mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-01-12 16:53:02 +08:00
* use tvl function v2 * refactor addFundsInMasterChef * replace usage of timestamp field * more refactoring * more refactoring
32 lines
915 B
JavaScript
32 lines
915 B
JavaScript
const { queryContract, } = require('./helper/chain/cosmos')
|
|
|
|
async function getMarkets() {
|
|
const res = await queryContract({ contract: 'terra1pcxwtrxppj9xj7pq3k95wm2zztfr9kwfkcgq0w', data: { market_lists: {} }, chain: 'terra' })
|
|
return res
|
|
}
|
|
async function tvl(api) {
|
|
const markets = await getMarkets()
|
|
markets.forEach(m => {
|
|
api.add(m.underlying, Math.floor(m.total_credit - m.total_insurance))
|
|
});
|
|
}
|
|
|
|
async function borrowed(api) {
|
|
const markets = await getMarkets()
|
|
markets.forEach(m => {
|
|
api.add(m.underlying, Math.floor(m.total_loan))
|
|
});
|
|
}
|
|
|
|
module.exports = {
|
|
timetravel: false,
|
|
methodology: `We query Edge's Genesis Pool smart contracts to get the amount of assets deposited and borrowed, we then use Coingecko to price the assets in USD.`,
|
|
terra: {
|
|
tvl,
|
|
borrowed
|
|
},
|
|
hallmarks: [
|
|
[1651881600, "UST depeg"],
|
|
]
|
|
};
|