Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Folks Finance yield #746

Merged
merged 18 commits into from
May 8, 2023
Prev Previous commit
Next Next commit
Refactor code
  • Loading branch information
pf55351 committed May 4, 2023
commit 74e0eee135f7336c13fa2a072ad1d6b1347f1b4e
18 changes: 0 additions & 18 deletions src/adaptors/folks-finance-lending/v2/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,12 @@ const pools = [
assetId: 386195940,
symbol: 'goETH',
},
// wBTC
/* {
appId: 971373361,
assetId: 386192725,
symbol: 'wBTC',
}, */
// wETH
/* {
appId: 971373611,
assetId: 386195940,
symbol: 'wETH',
}, */
// Opul
{
appId: 1044267181,
assetId: 287867876,
symbol: 'OPUL',
},
// Gard
/* {
appId: 1044267181,
assetId: 684649988,
symbol: 'GARD',
}, */
];

const oracleAppId = 1040271396;
Expand Down
26 changes: 5 additions & 21 deletions src/adaptors/folks-finance-lending/v2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,38 +51,22 @@ async function getPoolsInfo(pool) {
return poolInfo;
}

/* Get tvl */
async function tvl(pool) {
const { depositsUsd, borrowsUsd } = await getPoolsInfo(pool);
return depositsUsd - borrowsUsd;
}

/* Get borrows */
async function borrow(pool) {
const { borrowsUsd } = await getPoolsInfo(pool);
return borrowsUsd;
}

/* Get deposit */
async function deposit(pool) {
const { depositsUsd } = await getPoolsInfo(pool);
return depositsUsd;
}

const getApy = () => 1;

const poolsFunction = async () => {
let poolArr = [];
pools.forEach(async (pool) => {
const { depositsUsd, borrowsUsd } = await getPoolsInfo(pool);
const tvlUsd=depositsUsd -borrowsUsd
const data = {
pool: `${pool.appId}-algorand`,
chain: utils.formatChain('algorand'),
project: 'folks-finance-lending',
symbol: utils.formatSymbol(pool.symbol),
tvlUsd: await tvl(pool),
tvlUsd,
apy: getApy(pool.assetId),
totalSupplyUsd: await deposit(pool),
totalBorrowUsd: await borrow(pool),
totalSupplyUsd: depositsUsd,
totalBorrowUsd: borrowsUsd,
};
poolArr.push(data);
});
Expand Down