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

Feature/integ 274 handle bad debt events #175

Merged
merged 10 commits into from
Dec 2, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,16 @@ export const check = async <
.map((_v, i) => seizableCollateral / 2n ** BigInt(i))
.filter(
(seizedAssets) =>
collateralToken.toUsd(seizedAssets)! > parseEther("1000"), // Do not try seizing less than $1000 collateral.
)
collateralToken.toUsd(seizedAssets)! > parseEther("1000") ||
(accrualPosition.collateral === seizableCollateral &&
loanToken.toUsd(accrualPosition.borrowAssets)! >
parseEther("1000")),
) // Do not try seizing less than $1000 collateral, except if there is significant bad debt.
Rubilmax marked this conversation as resolved.
Show resolved Hide resolved
.map(async (seizedAssets) => {
seizedAssets =
accrualPosition.collateral === seizableCollateral
? accrualPosition.collateral
: seizedAssets;
const repaidShares =
market.getLiquidationRepaidShares(seizedAssets)!;

Expand Down