From a2ba5e7a714156c24534f4f15aa2f07f93da3daf Mon Sep 17 00:00:00 2001 From: fextr Date: Wed, 19 Jun 2024 16:41:06 +0400 Subject: [PATCH 1/3] add Resolv TVL adapter --- projects/resolv/index.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 projects/resolv/index.js diff --git a/projects/resolv/index.js b/projects/resolv/index.js new file mode 100644 index 0000000000..8981ca61a1 --- /dev/null +++ b/projects/resolv/index.js @@ -0,0 +1,34 @@ +const USR = "0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110"; +const RLP = "0x4956b52aE2fF65D74CA2d61207523288e4528f96"; +const RLPPriceStorage = "0x31319866778a5223633bd745780BB6d59406371E"; +const stUSR = "0x6c8984bc7DBBeDAf4F6b2FD766f16eBB7d10AAb4"; + +const erc20 = { + "totalSupply": "uint256:totalSupply" +}; +const rlpPriceStorage = { + "lastPrice": "uint256:lastPrice" +}; + +async function ethTvl(api) { + api.add(USR, await api.call({ abi: erc20.totalSupply, target: USR })); + + const rlpSupply = await api.call({ abi: erc20.totalSupply, target: RLP }); + const rlpPrice = await api.call({ + abi: rlpPriceStorage.lastPrice, + target: RLPPriceStorage + } + ) / 1e18; + api.add(RLP, rlpSupply * rlpPrice); +} + +async function staking(api) { + api.add(USR, await api.call({ abi: erc20.totalSupply, target: stUSR })); +} + +module.exports = { + ethereum: { + tvl: ethTvl, + staking + } +}; \ No newline at end of file From 9ffbc3797239a182f8b6ce6791985c0b53221dc9 Mon Sep 17 00:00:00 2001 From: fextr Date: Thu, 27 Jun 2024 08:55:31 +0400 Subject: [PATCH 2/3] remove staking export --- projects/resolv/index.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/projects/resolv/index.js b/projects/resolv/index.js index 8981ca61a1..0a8c9710cb 100644 --- a/projects/resolv/index.js +++ b/projects/resolv/index.js @@ -1,7 +1,6 @@ const USR = "0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110"; const RLP = "0x4956b52aE2fF65D74CA2d61207523288e4528f96"; const RLPPriceStorage = "0x31319866778a5223633bd745780BB6d59406371E"; -const stUSR = "0x6c8984bc7DBBeDAf4F6b2FD766f16eBB7d10AAb4"; const erc20 = { "totalSupply": "uint256:totalSupply" @@ -22,13 +21,8 @@ async function ethTvl(api) { api.add(RLP, rlpSupply * rlpPrice); } -async function staking(api) { - api.add(USR, await api.call({ abi: erc20.totalSupply, target: stUSR })); -} - module.exports = { ethereum: { - tvl: ethTvl, - staking + tvl: ethTvl } }; \ No newline at end of file From 8977cd5948e9a1600994fec98e6aa6da7477c5ec Mon Sep 17 00:00:00 2001 From: fextr Date: Thu, 27 Jun 2024 12:32:03 +0400 Subject: [PATCH 3/3] use curve oracle for the rlp price --- projects/resolv/index.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/projects/resolv/index.js b/projects/resolv/index.js index 0a8c9710cb..95ba4c2387 100644 --- a/projects/resolv/index.js +++ b/projects/resolv/index.js @@ -1,24 +1,13 @@ const USR = "0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110"; const RLP = "0x4956b52aE2fF65D74CA2d61207523288e4528f96"; -const RLPPriceStorage = "0x31319866778a5223633bd745780BB6d59406371E"; const erc20 = { "totalSupply": "uint256:totalSupply" }; -const rlpPriceStorage = { - "lastPrice": "uint256:lastPrice" -}; async function ethTvl(api) { api.add(USR, await api.call({ abi: erc20.totalSupply, target: USR })); - - const rlpSupply = await api.call({ abi: erc20.totalSupply, target: RLP }); - const rlpPrice = await api.call({ - abi: rlpPriceStorage.lastPrice, - target: RLPPriceStorage - } - ) / 1e18; - api.add(RLP, rlpSupply * rlpPrice); + api.add(RLP, await api.call({ abi: erc20.totalSupply, target: RLP })); } module.exports = {