Skip to content

Commit

Permalink
Add Joltify RWA Adapter (DefiLlama#10606)
Browse files Browse the repository at this point in the history
* add Joltify RWA adapter

* update rwa adapter
  • Loading branch information
briangarden authored Jun 12, 2024
1 parent a07f606 commit bf4d857
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions projects/joltify-rwa/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const { queryV1Beta1 } = require('../helper/chain/cosmos');
const chain = 'joltify'

const tvl = async (api) => {
const [pools] = await Promise.all([
queryV1Beta1({ chain, url: `spv/list_pools` }),
]);

pools.pools_info.forEach(async pool => {
api.add(pool.usable_amount.denom, pool.usable_amount.amount);
});
}

const borrowed = async (api) => {
const [pools] = await Promise.all([
queryV1Beta1({ chain, url: `spv/list_pools` }),
]);

const [price_info] = await Promise.all([
queryV1Beta1({ chain, url: `third_party/pricefeed/v1beta1/prices` }),
]);

pools.pools_info.forEach(async pool => {
const [market, borrowed_denom] = pool.borrowed_amount.denom.split('-');
const market_id = `${market}:usd`;
const price = price_info.prices.find(price => price.market_id === market_id)?.price;
api.add(borrowed_denom, pool.borrowed_amount.amount * price);
});
}

module.exports = {
timetravel: false,
joltify: {
tvl,
borrowed
}
}

0 comments on commit bf4d857

Please sign in to comment.