Skip to content

Commit

Permalink
fix, morphoblue
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpeluche committed Apr 25, 2024
1 parent 832f34f commit 127b1e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/adapters/morpho-blue/ethereum/lend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export async function getMorphoLendBalances(ctx: BalancesContext, router?: Contr
const [_supplyShares, borrowShares, collateral] = positions.output

const [_, __, totalBorrowAssets, totalBorrowShares] = params
const nonZeroTotalBorrowShares = totalBorrowShares === 0n ? 1n : totalBorrowShares

const lender: Contract = {
...coll,
Expand All @@ -75,7 +76,7 @@ export async function getMorphoLendBalances(ctx: BalancesContext, router?: Contr

const borrower: Contract = {
...debt,
amount: (borrowShares * totalBorrowAssets) / totalBorrowShares,
amount: (borrowShares * totalBorrowAssets) / nonZeroTotalBorrowShares,
}

return { balances: [lender, borrower] }
Expand Down

0 comments on commit 127b1e1

Please sign in to comment.