feat: updated superloop tvl adapter (#16901)

This commit is contained in:
Priyam Anand
2025-10-31 17:11:58 +05:30
committed by GitHub
parent 138d6e4677
commit 311ee2f261
2 changed files with 33 additions and 7 deletions

View File

@@ -1,6 +1,8 @@
const ADDRESSES = require('../helper/coreAssets.json')
module.exports = {
'VAULTS' : ['0xe24e5deba01ab0b5d78a0093442de0864832803e','0xc557529dd252e5a02e6c653b0b88984afa3c8199'],
'V1_VAULTS' : ['0xe24e5deba01ab0b5d78a0093442de0864832803e','0xc557529dd252e5a02e6c653b0b88984afa3c8199'],
'VAULTS' : ['0xdd160351c9b75ac2984b5e11367e06ab25ee49eb','0xe6da0bb72a818ed519edb51717b86077464f0857'],
'MIGRATION_BLOCKS' : [29421087, 29426956],
"SUPERLEND_PROTOCOL_DATA_PROVIDER": "0x99e8269dDD5c7Af0F1B3973A591b47E8E001BCac",
'VAULT_TOKENS' : {
'0xe24e5deba01ab0b5d78a0093442de0864832803e' : {
@@ -10,6 +12,14 @@ module.exports = {
'0xc557529dd252e5a02e6c653b0b88984afa3c8199' : {
"lend" : ADDRESSES.etlk.LBTC,
"borrow" : ADDRESSES.etlk.WBTC,
},
'0xdd160351c9b75ac2984b5e11367e06ab25ee49eb' : {
"lend" : ADDRESSES.etlk.STXTZ,
"borrow" : ADDRESSES.etlk.WXTZ,
},
'0xe6da0bb72a818ed519edb51717b86077464f0857' : {
"lend" : ADDRESSES.etlk.LBTC,
"borrow" : ADDRESSES.etlk.WBTC,
}
}
}

View File

@@ -6,8 +6,16 @@ const userReserveDataAbi = "function getUserReserveData(address asset, address u
async function tvl(api) {
const balances = {};
for(const vault of config.VAULTS) {
for(let i = 0; i < config.VAULTS.length; i++) {
const vault = config.VAULTS[i];
const v1Vault = config.V1_VAULTS[i];
const migrationBlock = config.MIGRATION_BLOCKS[i];
if(!api.block || api.block > migrationBlock) {
await processVault(api, vault, balances);
} else {
await processVault(api, v1Vault, balances);
}
}
return balances;
@@ -37,8 +45,16 @@ async function processVault(api, vault, balances) {
async function borrowed(api) {
const balances = {}
for(const vault of config.VAULTS) {
for(let i = 0; i < config.VAULTS.length; i++) {
const vault = config.VAULTS[i];
const v1Vault = config.V1_VAULTS[i];
const migrationBlock = config.MIGRATION_BLOCKS[i];
if(!api.block || api.block > migrationBlock) {
await processVaultBorrow(api, vault, balances);
} else {
await processVaultBorrow(api, v1Vault, balances);
}
}
return balances;