From 4f067c3d4e85ec34f3cc8021ed96df3d25ca94ea Mon Sep 17 00:00:00 2001 From: eukadish Date: Fri, 30 Aug 2024 09:43:28 -0400 Subject: [PATCH 1/2] add Reservoir TVL on Ethereum --- projects/reservoir-protocol/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/reservoir-protocol/index.js diff --git a/projects/reservoir-protocol/index.js b/projects/reservoir-protocol/index.js new file mode 100644 index 00000000000..bc3b6e44850 --- /dev/null +++ b/projects/reservoir-protocol/index.js @@ -0,0 +1,28 @@ +const rUSD = '0x09D4214C03D01F49544C0448DBE3A27f768F2b34'; +const srUSD = '0x738d1115B90efa71AE468F1287fc864775e23a31'; +const trUSD = '0x128D86A9e854a709Df06b884f81EeE7240F6cCf7'; + +const tvl = async (api) => { + + let tvl; + let target; + + target = trUSD; + tvl = await api.call({ target, abi: 'function totalDebt() external view returns (uint256)' }); + + api.add(target, tvl); + + target = rUSD; + tvl = await api.call({ target, abi: 'function totalSupply() external view returns (uint256)' }); + + api.add(target, tvl); + + target = srUSD; + tvl = await api.call({ target, abi: 'function totalSupply() external view returns (uint256)' }); + + api.add(target, tvl); +} + +module.exports = { + ethereum: { tvl } +}; From aaaa45a85a5e027bce668a36d0b0fa8a83a9ca25 Mon Sep 17 00:00:00 2001 From: eukadish Date: Tue, 17 Sep 2024 08:16:25 -0400 Subject: [PATCH 2/2] use Ethereum USDC for tvl price --- projects/reservoir-protocol/index.js | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/projects/reservoir-protocol/index.js b/projects/reservoir-protocol/index.js index bc3b6e44850..ef440a1e346 100644 --- a/projects/reservoir-protocol/index.js +++ b/projects/reservoir-protocol/index.js @@ -1,26 +1,22 @@ +const ADDRESSES = require('../helper/coreAssets.json'); + const rUSD = '0x09D4214C03D01F49544C0448DBE3A27f768F2b34'; const srUSD = '0x738d1115B90efa71AE468F1287fc864775e23a31'; -const trUSD = '0x128D86A9e854a709Df06b884f81EeE7240F6cCf7'; +const termIssuer = '0x128D86A9e854a709Df06b884f81EeE7240F6cCf7'; const tvl = async (api) => { - let tvl; - let target; - - target = trUSD; - tvl = await api.call({ target, abi: 'function totalDebt() external view returns (uint256)' }); + const trUSDTotalDebt = await api.call({ target: termIssuer, abi: 'function totalDebt() external view returns (uint256)' }); - api.add(target, tvl); + api.add(ADDRESSES['ethereum'].USDC, trUSDTotalDebt / 1e12); - target = rUSD; - tvl = await api.call({ target, abi: 'function totalSupply() external view returns (uint256)' }); + const rUSDTotalSupply = await api.call({ target: rUSD, abi: 'function totalSupply() external view returns (uint256)' }); - api.add(target, tvl); + api.add(ADDRESSES['ethereum'].USDC, rUSDTotalSupply / 1e12); - target = srUSD; - tvl = await api.call({ target, abi: 'function totalSupply() external view returns (uint256)' }); + const srUSDTotalSupply = await api.call({ target: srUSD, abi: 'function totalSupply() external view returns (uint256)' }); - api.add(target, tvl); + api.add(ADDRESSES['ethereum'].USDC, srUSDTotalSupply / 1e12); } module.exports = {