From b8a2341d732f40120007d432cfeb2de70366ee69 Mon Sep 17 00:00:00 2001 From: adam Date: Thu, 8 Feb 2024 12:42:15 +0100 Subject: [PATCH 1/4] IPOR Protocol - add Arbitrum chain tvl --- projects/ipor/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/projects/ipor/index.js b/projects/ipor/index.js index 9b03ce067b8..727cc47b64b 100644 --- a/projects/ipor/index.js +++ b/projects/ipor/index.js @@ -3,13 +3,17 @@ const { abi } = require("./abi"); const V2DeploymentBlockNumber = 18333744 -async function tvl(_, block, _1, { api }) { +async function tvlEthereum(_, block, _1, { api }) { if (block >= V2DeploymentBlockNumber) { return await calculateTvlForV2(api); } else { return await calculateTvlForV1(api); } } +async function tvlArbitrum(_, block, _1, {api}) { + const ammTreasuryWstEthArbitrum = '0xBd013Ea2E01C2Ab3462dd67e9C83aa3834882A5D' + return api.sumTokens({owner: ammTreasuryWstEthArbitrum, tokens: [ADDRESSES.arbitrum.WSTETH]}) +} async function calculateTvlForV2(api) { const assets = [ @@ -55,6 +59,9 @@ async function calculateTvlForV1(api) { module.exports = { 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 + tvl: tvlEthereum + }, + arbitrum: { + tvl: tvlArbitrum } }; From 75fdec86340522e49770a97129e03602efff4f8c Mon Sep 17 00:00:00 2001 From: rav Date: Thu, 12 Sep 2024 22:08:06 +0200 Subject: [PATCH 2/4] Add IPOR Fusion --- projects/ipor-fusion/abi.js | 5 +++++ projects/ipor-fusion/index.js | 36 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 projects/ipor-fusion/abi.js create mode 100644 projects/ipor-fusion/index.js diff --git a/projects/ipor-fusion/abi.js b/projects/ipor-fusion/abi.js new file mode 100644 index 00000000000..de5ccfe8d74 --- /dev/null +++ b/projects/ipor-fusion/abi.js @@ -0,0 +1,5 @@ +module.exports = { + abi: { + totalAssets: "function totalAssets() view returns (uint256 totalAssets)" + } +}; diff --git a/projects/ipor-fusion/index.js b/projects/ipor-fusion/index.js new file mode 100644 index 00000000000..7c825bcb0e9 --- /dev/null +++ b/projects/ipor-fusion/index.js @@ -0,0 +1,36 @@ +const {abi} = require("./abi"); +const {getConfig} = require('../helper/cache') + +const IPOR_GITHUB_ADDRESSES_URL = "https://raw.githubusercontent.com/IPOR-Labs/ipor-abi/main/mainnet/addresses.json"; + +async function tvlEthereum(_, block, _1, {api}) { + const config = await getConfig('ipor/assets', IPOR_GITHUB_ADDRESSES_URL); + return vaultsTvl(api, config.ethereum.vaults); +} + +async function tvlArbitrum(_, block, _1, {api}) { + const config = await getConfig('ipor/assets', IPOR_GITHUB_ADDRESSES_URL); + return vaultsTvl(api, config.arbitrum.vaults); +} + +async function vaultsTvl(api, vaults) { + if (vaults.length > 0) { + const vaultAddresses = vaults.map(vault => vault.PlasmaVault); + const output = await api.multiCall({abi: abi.totalAssets, calls: vaultAddresses}) + output.forEach((totalAssets, i) => { + api.add(vaults[i].asset, totalAssets) + }); + } + + return api.getBalances(); +} + +module.exports = { + methodology: `Counts the tokens deposited into IPOR Fusion Vaults.`, + ethereum: { + tvl: tvlEthereum + }, + arbitrum: { + tvl: tvlArbitrum + }, +}; From 5cd01a776e3d14fa55c7260348184a30f3f47a93 Mon Sep 17 00:00:00 2001 From: rav Date: Fri, 13 Sep 2024 20:33:32 +0200 Subject: [PATCH 3/4] Remove not needed ABI file in IPOR Fusion --- projects/ipor-fusion/abi.js | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 projects/ipor-fusion/abi.js diff --git a/projects/ipor-fusion/abi.js b/projects/ipor-fusion/abi.js deleted file mode 100644 index de5ccfe8d74..00000000000 --- a/projects/ipor-fusion/abi.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - abi: { - totalAssets: "function totalAssets() view returns (uint256 totalAssets)" - } -}; From 0953fe334ae5c4cdc831634c89f5b0251336c303 Mon Sep 17 00:00:00 2001 From: rav Date: Fri, 13 Sep 2024 20:58:19 +0200 Subject: [PATCH 4/4] IL-4797 Add Liquidity Mining Start hallmark in IPOR project --- projects/ipor/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/ipor/index.js b/projects/ipor/index.js index f4e7758c56f..40b79070e39 100644 --- a/projects/ipor/index.js +++ b/projects/ipor/index.js @@ -93,5 +93,8 @@ module.exports = { }, arbitrum: { tvl: tvlArbitrum - } + }, + hallmarks:[ + [1674648000, "Liquidity Mining Start"] + ], };