You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// poolToken: '0xd5255Cc08EBAf6D54ac9448822a18d8A3da29A42' // AIDollarAlphaUSDC Pool
56
+
// }
57
+
// ]
58
+
};
59
+
60
+
consttotalAssetsABI={
61
+
"inputs": [],
62
+
"name": "totalAssets",
63
+
"outputs": [
64
+
{
65
+
"internalType": "uint256",
66
+
"name": "",
67
+
"type": "uint256"
68
+
}
69
+
],
70
+
"stateMutability": "view",
71
+
"type": "function"
72
+
};
73
+
74
+
asyncfunctiontvl(api){
75
+
constchain=api.chain;
76
+
77
+
constpoolsForChain=mainnetContracts[chain];
78
+
79
+
if(!poolsForChain||poolsForChain.length===0){
80
+
console.warn(`No configured contract data for chain: ${chain}. Skipping TVL calculation.`);
81
+
return{};
82
+
}
83
+
84
+
constcalls=poolsForChain.map(poolInfo=>({
85
+
target: poolInfo.poolToken,
86
+
}));
87
+
88
+
consttotalAssetsAmounts=awaitapi.multiCall({
89
+
abi: totalAssetsABI,
90
+
calls: calls,
91
+
});
92
+
93
+
totalAssetsAmounts.forEach((amount,index)=>{
94
+
constunderlyingToken=poolsForChain[index].token;
95
+
api.add(underlyingToken,amount);
96
+
});
97
+
98
+
returnapi.getBalances();
99
+
}
100
+
101
+
module.exports={
102
+
methodology: 'Counts the total underlying assets (e.g., USDC, USDT, USR, CUSDO, PUSD) reported by GAIB protocol pool contracts using their `totalAssets()` function across supported mainnet chains.',
0 commit comments