Fix pool asset iteration and ensure all multi-asset pools are included in TAPP Exchange TVL calculation (#16837)

Co-authored-by: sehren <sehren.singh@youtap.id>
Co-authored-by: sehren <sehrenjit@undercurrent.tech>
Co-authored-by: Abdurrahman Ramadhan <abdmandhan@gmail.com>
This commit is contained in:
abdurrwansui
2025-10-27 20:13:32 +07:00
committed by GitHub
parent e9cc9228c7
commit 6d1fe44e09

View File

@@ -66,10 +66,14 @@ module.exports = {
);
for (const pool of filteredPools) {
const coinA = (await getPairedCoin(pool.assets[0])) || pool.assets[0];
const coinB = (await getPairedCoin(pool.assets[1])) || pool.assets[1];
api.add(coinA, pool.reserves[0]);
api.add(coinB, pool.reserves[1]);
// loop coins
for (let i = 0; i < pool.assets.length; i++) {
const coin = pool.assets[i];
const pairedCoin = await getPairedCoin(coin) || coin;
if (pairedCoin) {
api.add(pairedCoin, pool.reserves[i]);
}
}
}
},
},