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

feat: Dinero Branded LSTs #12864

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
15 changes: 15 additions & 0 deletions projects/branded-lst/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const { nullAddress } = require("../helper/unwrapLPs");

const getTvl = (target) => async (api) => {
const totalSupply = await api.call({ target, abi: 'uint256:totalSupply' });
return { [nullAddress]: totalSupply };
};

module.exports = {
methodology: `Calculated based on the total supply of the rebasing token for each chain. The value represents the total underlying assets locked in the lockbox contract, which are withdrawable as pxETH on the Ethereum mainnet. `,
sei: { tvl: getTvl('0x9faaea2cdd810b21594e54309dc847842ae301ce') },
era: { tvl: getTvl('0x8b73bB0557C151Daa39b6ff556e281e445b296D5') },
ink: { tvl: getTvl('0xcab283e4bb527Aa9b157Bae7180FeF19E2aaa71a') },
flare: { tvl: getTvl('0x61Ef2d1d8637Dc24e19c2C9dA8f58f6F06C3D31E') },
// plume: { tvl: getTvl('0xcab283e4bb527Aa9b157Bae7180FeF19E2aaa71a') },
};
43 changes: 37 additions & 6 deletions projects/dinero/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,46 @@
const { nullAddress } = require("../helper/unwrapLPs");
const { sumERC4626VaultsExport } = require("../helper/erc4626");
const sdk = require("@defillama/sdk");

const PXETH = '0x04C154b66CB340F3Ae24111CC767e0184Ed00Cc6';
const APXETH = '0x9Ba021B0a9b958B5E75cE9f6dff97C7eE52cb3E6';
const LOCKBOXES = [
'0x96B6AAE5Cdc5B6d2e1aC2EFc46162402F5a868B1', // ERA
'0xf2B2BBdC9975cF680324De62A30a31BC3AB8A4d5', // INK
'0xaAA55490721b72A3112323FC274e9798796CcE85', // FLR
'0xA8A3A5013104e093245164eA56588DBE10a3Eb48', // SEI
'0x043eF1DC118b5039203AECfAc680CEA4E58b0eBb' // PLUME
];

const convertToAssetsAbi = 'function convertToAssets(uint256) view returns (uint256)';

async function getBalances(api, token, convertToAssets = false) {
const balances = await Promise.all(
LOCKBOXES.map((lockbox) =>
api.call({ abi: 'erc20:balanceOf', target: token, params: lockbox })
)
);

const total = balances.reduce((sum, balance) => sum + sdk.util.convertToBigInt(balance), BigInt(0));

if (convertToAssets) {
return sdk.util.convertToBigInt(await api.call({ target: token, abi: convertToAssetsAbi, params: [total] }));
}

return total;
}

module.exports = {
ethereum: {
tvl: async (api) => {
const totalSupply = await api.call({ target: '0x04C154b66CB340F3Ae24111CC767e0184Ed00Cc6', abi: 'uint256:totalSupply' });
const totalSupply = sdk.util.convertToBigInt(await api.call({ target: PXETH, abi: 'uint256:totalSupply' }));

return {
[nullAddress]: totalSupply
};
const pxEthBalances = await getBalances(api, PXETH);
const apxEthBalances = await getBalances(api, APXETH, true);
const adjustedSupply = totalSupply - pxEthBalances - apxEthBalances;

return {[nullAddress]: adjustedSupply.toString(),};
},
staking: sumERC4626VaultsExport({ vaults: ['0x55769490c825CCb09b2A6Ae955203FaBF04857fd'], isOG4626: true, })
}
staking: sumERC4626VaultsExport({vaults: ['0x55769490c825CCb09b2A6Ae955203FaBF04857fd'], isOG4626: true,}),
},
};
Loading