Skip to content

Commit

Permalink
add bifi
Browse files Browse the repository at this point in the history
  • Loading branch information
slasher125 committed Jan 5, 2024
1 parent d1719b4 commit 549f449
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/adaptors/bifi/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const axios = require('axios');

const url = 'https://biholder-view.thebifrost.io/chains/bfc/bifi';

const apy = async () => {
const [markets, handlers] = await Promise.all(
['bifi-market', 'handlers'].map((i) => axios.get(`${url}/${i}`))
);

return markets.data.map((p) => {
const handler = handlers.data.find(
(i) => i.tokenHandlerId === p.token_handler_id
);

const totalSupplyUsd = Number(p.deposit_value);
const totalBorrowUsd = Number(p.borrow_value);
const tvlUsd = totalSupplyUsd - totalBorrowUsd;

return {
pool: handler.handlerAddress,
symbol: handler.tokenSymbol,
chain: 'Bifrost Network',
project: 'bifi',
tvlUsd,
apyBase: Number(p.deposit_apy),
apyBaseBorrow: Number(p.borrow_apy),
totalSupplyUsd,
totalBorrowUsd,
underlyingTokens: [handler.tokenAddress],
};
});
};

module.exports = {
apy,
url: 'https://crosschain.bifi.finance/',
};

0 comments on commit 549f449

Please sign in to comment.