Skip to content

Commit

Permalink
Fix flashloanOsTokenShares zero check
Browse files Browse the repository at this point in the history
  • Loading branch information
tsudmi committed Sep 29, 2024
1 parent 10b7b1b commit 3a8325e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
844627
844583
Original file line number Diff line number Diff line change
@@ -1 +1 @@
954568
954552
Original file line number Diff line number Diff line change
@@ -1 +1 @@
379514
379495
Original file line number Diff line number Diff line change
@@ -1 +1 @@
533356
533343
10 changes: 5 additions & 5 deletions src/leverage/LeverageStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ abstract contract LeverageStrategy is Multicall, ILeverageStrategy {

// mint max possible osToken shares
leverageOsTokenShares = _mintOsTokenShares(vault, proxy, assetsToBorrow, type(uint256).max);
if (leverageOsTokenShares == 0) {
// no osToken shares to leverage
emit Deposited(vault, msg.sender, osTokenShares, 0);
return;
}
}

// calculate flash loaned osToken shares
uint256 flashloanOsTokenShares = _getFlashloanOsTokenShares(vault, leverageOsTokenShares);
if (flashloanOsTokenShares == 0) {
// no osToken shares to leverage
emit Deposited(vault, msg.sender, osTokenShares, 0);
return;
}

// execute flashloan
_osTokenFlashLoans.flashLoan(flashloanOsTokenShares, abi.encode(FlashloanAction.Deposit, vault, proxy));
Expand Down

0 comments on commit 3a8325e

Please sign in to comment.