Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added Neemo finance on Soneium #13120

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions projects/neemo-finance/index.js
Original file line number Diff line number Diff line change
@@ -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.`
};
Loading