From 127b1e1e1bcabb762c1541c121bcb0808256aea7 Mon Sep 17 00:00:00 2001 From: 0xPeluche <0xpeluche@proton.me> Date: Thu, 25 Apr 2024 12:44:07 +0200 Subject: [PATCH] fix, morphoblue --- src/adapters/morpho-blue/ethereum/lend.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/adapters/morpho-blue/ethereum/lend.ts b/src/adapters/morpho-blue/ethereum/lend.ts index bb0176d69..68d5c3c2c 100644 --- a/src/adapters/morpho-blue/ethereum/lend.ts +++ b/src/adapters/morpho-blue/ethereum/lend.ts @@ -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, @@ -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] }