mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-01-12 16:53:02 +08:00
update bastion
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const { compoundExports } = require("../helper/compound");
|
||||
const { bigNumberify } = require("../mobiusfinance/utilities/utilities");
|
||||
const sdk = require('@defillama/sdk')
|
||||
|
||||
const mainHubExport = compoundExports(
|
||||
"0x6De54724e128274520606f038591A00C5E94a1F6",
|
||||
@@ -35,38 +35,18 @@ module.exports = {
|
||||
aurora: {
|
||||
tvl: async (...args) => {
|
||||
let balances = {};
|
||||
for (const realm of bastion) {
|
||||
const realmBalances = await realm.tvl(...args);
|
||||
for (const underlyingAddress of Object.keys(realmBalances)) {
|
||||
if (underlyingAddress in balances) {
|
||||
balances[underlyingAddress] = bigNumberify(
|
||||
balances[underlyingAddress]
|
||||
)
|
||||
.add(bigNumberify(realmBalances[underlyingAddress]))
|
||||
.toString();
|
||||
} else {
|
||||
balances[underlyingAddress] = realmBalances[underlyingAddress];
|
||||
}
|
||||
}
|
||||
}
|
||||
const tvls = await Promise.all(bastion.map(realm => realm.tvl(...args)))
|
||||
tvls.forEach(tvl => {
|
||||
Object.keys(tvl).forEach(key => sdk.util.sumSingleBalance(balances, key, tvl[key]))
|
||||
})
|
||||
return balances;
|
||||
},
|
||||
borrowed: async (...args) => {
|
||||
let balances = {};
|
||||
for (const realm of bastion) {
|
||||
const realmBalances = await realm.borrowed(...args);
|
||||
for (const underlyingAddress of Object.keys(realmBalances)) {
|
||||
if (underlyingAddress in balances) {
|
||||
balances[underlyingAddress] = bigNumberify(
|
||||
balances[underlyingAddress]
|
||||
)
|
||||
.add(bigNumberify(realmBalances[underlyingAddress]))
|
||||
.toString();
|
||||
} else {
|
||||
balances[underlyingAddress] = realmBalances[underlyingAddress];
|
||||
}
|
||||
}
|
||||
}
|
||||
const tvls = await Promise.all(bastion.map(realm => realm.borrowed(...args)))
|
||||
tvls.forEach(tvl => {
|
||||
Object.keys(tvl).forEach(key => sdk.util.sumSingleBalance(balances, key, tvl[key]))
|
||||
})
|
||||
return balances;
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user