Skip to content

Commit 44b5fb4

Browse files
committed
unwrap aSTETH
1 parent 5686d3c commit 44b5fb4

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

projects/alongside/index.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
const sdk = require("@defillama/sdk");
2-
const { sumTokensExport } = require("../helper/unwrapLPs");
1+
const { sumTokens2 } = require("../helper/unwrapLPs")
2+
const ADDRESSES = require('../helper/coreAssets.json')
33

4-
const INDEX = "0xF17A3fE536F8F7847F1385ec1bC967b2Ca9caE8D";
4+
async function tvl(_, block, _cb, { api }) {
5+
const aSTETH = "0x27C2B9fd547EAd2c05C305BeE2399A55811257c2"
6+
const vault = "0xf3bCeDaB2998933c6AAD1cB31430D8bAb329dD8C"
7+
const astBal = await api.call({ abi: 'erc20:balanceOf', target: aSTETH, params: vault })
8+
const stethBal = await api.call({ abi: 'erc20:balanceOf', target: ADDRESSES.ethereum.STETH, params: aSTETH })
9+
const astethSupply = await api.call({ abi: 'erc20:totalSupply', target: aSTETH })
10+
api.add(ADDRESSES.ethereum.STETH, stethBal * astBal / astethSupply)
511

6-
async function tvl(_, block, _cb) {
7-
const balances = {}
8-
const supply = await sdk.api2.abi.call({ abi: 'uint256:totalSupply', target: INDEX, block })
9-
sdk.util.sumSingleBalance(balances, INDEX, supply, 'ethereum')
10-
return balances
12+
return sumTokens2({ api, owner: vault, fetchCoValentTokens: true, blacklistedTokens: [aSTETH] })
1113
}
1214

1315
module.exports = {
1416
methodology:
1517
"Data is retrieved from calculation of market price and total supply",
1618
ethereum: {
17-
tvl: sumTokensExport({ owner: '0xf3bCeDaB2998933c6AAD1cB31430D8bAb329dD8C', fetchCoValentTokens: true }),
19+
tvl,
1820
},
1921
};

0 commit comments

Comments
 (0)