diff --git a/projects/trufin-trustake/index.js b/projects/trufin-trustake/index.js index b0707416140..c9a9b38a220 100644 --- a/projects/trufin-trustake/index.js +++ b/projects/trufin-trustake/index.js @@ -1,4 +1,15 @@ const ADDRESSES = require('../helper/coreAssets.json') +const { function_view } = require('../helper/chain/aptos') + +const TRUSTAKE_APT_CONTRACT_ADDR = "0x6f8ca77dd0a4c65362f475adb1c26ae921b1d75aa6b70e53d0e340efd7d8bc80" +const MODULE = "staker" +const FUNCTION = "total_staked" + +async function aptosTvl(api) { + const totalStaked = await function_view({ functionStr: `${TRUSTAKE_APT_CONTRACT_ADDR}::${MODULE}::${FUNCTION}` }) + api.add(ADDRESSES.aptos.APT, totalStaked[0]) +} + const abi = { "totalShares": "uint256:totalShares", "sharePrice": "function sharePrice() external view returns (uint256, uint256)", @@ -20,5 +31,8 @@ module.exports = { methodology: `Counts the TVL of MATIC tokens in TruFin's TruStake vault.`, ethereum: { tvl + }, + aptos: { + tvl: aptosTvl } }