Skip to content

Commit b2b93e5

Browse files
added new vault
Update index.js
1 parent ad7f568 commit b2b93e5

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

projects/thesauros/index.js

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
const config = {
22
arbitrum: [
3-
'0x57C10bd3fdB2849384dDe954f63d37DfAD9d7d70', // tUSDC
3+
'0x57C10bd3fdB2849384dDe954f63d37DfAD9d7d70', // tUSDC Vault
4+
'0xcd72118C0707D315fa13350a63596dCd9B294A30', // tUSDT Vault
5+
],
6+
base: [
7+
'0x6C7013b3596623d146781c90b4Ee182331Af6148', // tUSDC Vault
48
]
59
};
610

711
const abi = "function getDepositBalance(address user, address vault) view returns (uint256 balance)";
812

913
module.exports = {
10-
methodology: "TVL displays the total amount of assets stored in the Thesauros contracts.",
14+
methodology: "TVL displays the total amount of assets stored in the Thesauros vaults. The balance is calculated by querying the active provider for each vault's deposit balance.",
1115
start: '2025-09-19',
1216
hallmarks: [[1758283200, "Protocol launch"]],
1317
};
@@ -16,12 +20,29 @@ Object.keys(config).forEach((chain) => {
1620
module.exports[chain] = { tvl: (api) => tvl(api, config[chain]) };
1721
});
1822

23+
/**
24+
* Calculate TVL for Thesauros vaults
25+
* @param {Object} api - DefiLlama API helper
26+
* @param {Array<string>} vaults - Array of vault contract addresses
27+
*/
1928
const tvl = async (api, vaults) => {
29+
// Get active provider and asset address for each vault
2030
const [providers, assets] = await Promise.all([
2131
api.multiCall({ calls: vaults, abi: "address:activeProvider" }),
2232
api.multiCall({ calls: vaults, abi: "address:asset" }),
2333
]);
2434

25-
const balances = await api.multiCall({ calls: vaults.map((vault, i) => ({ target: providers[i], params: [vault, vault] })), abi })
26-
api.add(assets, balances)
35+
// Get deposit balance from each provider
36+
// Parameters: [vault address as user, vault address as vault]
37+
// The vault acts as both the user and the vault parameter
38+
const balances = await api.multiCall({
39+
calls: vaults.map((vault, i) => ({
40+
target: providers[i],
41+
params: [vault, vault]
42+
})),
43+
abi
44+
});
45+
46+
// Add assets with their balances to the TVL calculation
47+
api.add(assets, balances);
2748
};

0 commit comments

Comments
 (0)