Skip to content

Commit a54cf8e

Browse files
feat: replace debtOf with isControllerEnabled
1 parent 4eabe47 commit a54cf8e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/EulerSwap.sol

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,14 +200,12 @@ contract EulerSwap is IEulerSwap, EVCUtil {
200200
function depositAssets(address vault, uint256 amount) internal {
201201
IEVault(vault).deposit(amount, myAccount);
202202

203-
uint256 debt = myDebt(vault);
204-
205-
if (debt > 0) {
203+
if (IEVC(evc).isControllerEnabled(myAccount, vault)) {
206204
IEVC(evc).call(
207205
vault, myAccount, 0, abi.encodeCall(IBorrowing.repayWithShares, (type(uint256).max, myAccount))
208206
);
209207

210-
if (myDebt(vault) == 0) {
208+
if (IEVault(vault).debtOf(myAccount) == 0) {
211209
IEVC(evc).call(vault, myAccount, 0, abi.encodeCall(IRiskManager.disableController, ()));
212210
}
213211
}

0 commit comments

Comments
 (0)