Skip to content

Commit

Permalink
account for locked collateral from borrows
Browse files Browse the repository at this point in the history
  • Loading branch information
brightiron committed Jun 30, 2024
1 parent e64ce5b commit 121be5a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions projects/baseline/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ async function tvl(api) {
const position = await api.multiCall({ target: BASELINE_CONTRACT, calls: positions, abi: abi.getPosition, });
//return managed positions from baseline contract
const baselinePositionBalances = await api.multiCall({ target: BASELINE_CONTRACT, calls: position.map(i => ({ params: [i], })), abi: abi.getBalancesForPosition, });
const collateralLocked = await
//sum the reserve balances
api.addGasToken(baselinePositionBalances.map(i => i.reserves));

//baseline V2 Positions
const v2Positions = await api.multiCall({ target: BASELINE_CONTRACT_V2, calls: positions, abi: v2Abi.getPosition });
//account for collateral now locked in protocol from borrowing activity
const v2CollateralLocked = await api.call({ target: CREDT_CONTRACT, abi: credtAbi.totalCollateralized });
api.add(BASELINE_CONTRACT_V2, v2CollateralLocked);
api.addGasToken(v2Positions.map(i => i.reserves));
}

Expand Down Expand Up @@ -50,4 +54,5 @@ const v2Abi = {

const credtAbi = {
totalCreditIssues: "function totalCreditIssued() view returns (uint256)",
totalCollateralized: "function totalCollateralized() view returns (uint256)",
}

0 comments on commit 121be5a

Please sign in to comment.