From 757af4bf716eb8497dcc406a30c44f086f91c26a Mon Sep 17 00:00:00 2001 From: Haythem Sellami <17862704+haythemsellami@users.noreply.github.com> Date: Thu, 2 Jan 2025 17:34:42 +0700 Subject: [PATCH 1/2] Use myDebt() to check debt amount before disabling controller --- src/MaglevBase.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MaglevBase.sol b/src/MaglevBase.sol index 2357348..af70b10 100644 --- a/src/MaglevBase.sol +++ b/src/MaglevBase.sol @@ -178,7 +178,7 @@ abstract contract MaglevBase is IMaglevBase, EVCUtil { vault, myAccount, 0, abi.encodeCall(IBorrowing.repayWithShares, (type(uint256).max, myAccount)) ); - if (debt <= amount) { + if (myDebt(vault) == 0) { IEVC(evc).call(vault, myAccount, 0, abi.encodeCall(IRiskManager.disableController, ())); } } From 1ddc9a68b7c826688afcb6b59e3d6e592a699059 Mon Sep 17 00:00:00 2001 From: Haythem Sellami <17862704+haythemsellami@users.noreply.github.com> Date: Thu, 2 Jan 2025 17:35:23 +0700 Subject: [PATCH 2/2] clean ToDo list --- TODO | 1 - 1 file changed, 1 deletion(-) diff --git a/TODO b/TODO index bdd7da9..3203a03 100644 --- a/TODO +++ b/TODO @@ -3,7 +3,6 @@ ! Better revert messages when a swap cannot be satisifed due to debt-limit/utilisation/etc * currently it's an arithmetic underflow ! Don't make quotes that would cause a swap to fail due to supply or borrow caps -! Use `myDebt() == 0` condition for disabling controller: more accurate ! In _computeQuote() use vault.cash() method instead of token.balanceOf() otherwise donations could cause quoted swaps to fail ! In _computeQuote(), exactOut swaps should verify the *amount* (not quote) is withdrawable * ConstantSum: incorporate price multipliers in quote methods