Skip to content

Commit be22df4

Browse files
committed
SiAL: explicitly check balance before paying flash loan
1 parent 644965e commit be22df4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/strategies/libs/SiloAdvancedLib.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ library SiloAdvancedLib {
140140
swapPriceImpactTolerance0
141141
);
142142

143+
// explicit error for the case when _estimateSwapAmount gives incorrect amount
144+
require(IERC20(token).balanceOf(address(this)) >= amount + feeAmount, IControllable.InsufficientBalance());
145+
143146
// pay flash loan
144147
IERC20(token).safeTransfer(flashLoanVault, amount + feeAmount);
145148

0 commit comments

Comments
 (0)