From 0ea1fe7b171b12a20be17f6e75c2a084f645a892 Mon Sep 17 00:00:00 2001 From: Sagar Chaurasia Date: Fri, 17 Jan 2025 08:20:19 +0530 Subject: [PATCH] added Neemo finance on Soneium (#13120) --- projects/neemo-finance/index.js | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 projects/neemo-finance/index.js diff --git a/projects/neemo-finance/index.js b/projects/neemo-finance/index.js new file mode 100644 index 000000000000..899ed37a2802 --- /dev/null +++ b/projects/neemo-finance/index.js @@ -0,0 +1,36 @@ +const ADDRESSES = require('../helper/coreAssets.json'); + +// ABI for fetching the conversion rate +const abis = { + getRate: "function getRate() view returns (uint256)" +}; + +// Contract configurations +const configs = { + nsASTRToken: '0xc67476893C166c537afd9bc6bc87b3f228b44337', + nsASTRManager: '0x85031E58C66BA47A16Eef7A69514cd33EC16559c', + nrETHToken: '0x2fc9a87b1ef46dCDdF4801C36d752E0d5F243E4b', + nrETHManager: '0xf5AeA1089D075C8f16095aa11be4114350383a9B' +}; + +// Fetches TVL for nsASTR and nrETH and adds their value to the API. +async function getNeemoTvl(api) { + // Fetch and calculate TVL for nsASTR + const nsASTRSupply = await api.call({ target: configs.nsASTRToken, abi: 'erc20:totalSupply' }); + const nsASTRRate = await api.call({ target: configs.nsASTRManager, abi: abis.getRate }); + const stakedAmountInASTR = (nsASTRSupply * nsASTRRate) / 1e18; + api.add(ADDRESSES.soneium.ASTAR, stakedAmountInASTR); + + // Fetch and calculate TVL for nrETH + const nrETHSupply = await api.call({ target: configs.nrETHToken, abi: 'erc20:totalSupply' }); + const nrETHRate = await api.call({ target: configs.nrETHManager, abi: abis.getRate }); + const stakedAmountInETH = (nrETHSupply * nrETHRate) / 1e18; + api.add(ADDRESSES.soneium.WETH, stakedAmountInETH); +} + +module.exports = { + soneium: { + tvl: getNeemoTvl + }, + methodology: `TVL is calculated by fetching the total supply of nsASTR and nrETH tokens and converting their values into the underlying tokens (ASTR and WETH) using the current conversion rate provided by the respective managers.` +}; \ No newline at end of file