update bastion

This commit is contained in:
g1nt0ki
2022-05-16 19:01:56 +05:30
parent 2dd15391e4
commit 90bc7969dc

View File

@@ -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;
},
},