Skip to content

Commit

Permalink
fix: move safeApprove out of _doDivest
Browse files Browse the repository at this point in the history
  • Loading branch information
xenide committed Dec 29, 2024
1 parent 39d094b commit 707e270
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/asset-management/EulerV2Manager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ contract EulerV2Manager is IAssetManager, Owned(msg.sender), RGT {
_doDivest(aPair, lToken1, lToken1Vault, lAmount1Change);
}

// transfer tokens to/from the pair
if (aAmount0Change < 0) SafeTransferLib.safeApprove(address(lToken0), address(aPair), uint256(-aAmount0Change));
if (aAmount1Change < 0) SafeTransferLib.safeApprove(address(lToken1), address(aPair), uint256(-aAmount1Change));
// transfer tokens to/from pair
aPair.adjustManagement(aAmount0Change, aAmount1Change);

// transfer the managed tokens to the destination
Expand All @@ -202,7 +204,6 @@ contract EulerV2Manager is IAssetManager, Owned(msg.sender), RGT {
_decreaseShares(aPair, aToken, aVault, lSharesBurned);

emit Divestment(aPair, aToken, lSharesBurned);
SafeTransferLib.safeApprove(address(aToken), address(aPair), aAmount);
}

function _doInvest(IAssetManagedPair aPair, IERC20 aToken, IERC4626 aVault, uint256 aAmount) private {
Expand Down

0 comments on commit 707e270

Please sign in to comment.