Skip to content

Commit

Permalink
Merge branch 'main' of github.com:morpho-labs/morpho-stack into test/…
Browse files Browse the repository at this point in the history
…hardhat-gas
  • Loading branch information
Rubilmax committed Oct 23, 2023
2 parents 0b568bc + 9c73205 commit 07adf66
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/morpho-blue
12 changes: 6 additions & 6 deletions src/ERC4626Bundler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ abstract contract ERC4626Bundler is BaseBundler {
require(receiver != address(0), ErrorsLib.ZERO_ADDRESS);
/// Do not check `receiver != address(this)` to allow the bundler to receive the underlying asset.

address _initiator = initiator();
address initiator = initiator();

assets = Math.min(assets, IERC4626(vault).maxWithdraw(_initiator));
assets = Math.min(assets, IERC4626(vault).maxWithdraw(initiator));

require(assets != 0, ErrorsLib.ZERO_AMOUNT);

IERC4626(vault).withdraw(assets, receiver, _initiator);
IERC4626(vault).withdraw(assets, receiver, initiator);
}

/// @notice Redeems the given amount of `shares` from the given ERC4626 `vault`, transferring assets to `receiver`.
Expand All @@ -84,12 +84,12 @@ abstract contract ERC4626Bundler is BaseBundler {
require(receiver != address(0), ErrorsLib.ZERO_ADDRESS);
/// Do not check `receiver != address(this)` to allow the bundler to receive the underlying asset.

address _initiator = initiator();
address initiator = initiator();

shares = Math.min(shares, IERC4626(vault).maxRedeem(_initiator));
shares = Math.min(shares, IERC4626(vault).maxRedeem(initiator));

require(shares != 0, ErrorsLib.ZERO_SHARES);

IERC4626(vault).redeem(shares, receiver, _initiator);
IERC4626(vault).redeem(shares, receiver, initiator);
}
}
6 changes: 3 additions & 3 deletions src/Permit2Bundler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ abstract contract Permit2Bundler is BaseBundler {
external
payable
{
address _initiator = initiator();
uint256 amount = Math.min(permit.permitted.amount, ERC20(permit.permitted.token).balanceOf(_initiator));
address initiator = initiator();
uint256 amount = Math.min(permit.permitted.amount, ERC20(permit.permitted.token).balanceOf(initiator));

require(amount != 0, ErrorsLib.ZERO_AMOUNT);

ISignatureTransfer.SignatureTransferDetails memory transferDetails =
ISignatureTransfer.SignatureTransferDetails({to: address(this), requestedAmount: amount});

ISignatureTransfer(PERMIT2).permitTransferFrom(permit, transferDetails, _initiator, signature);
ISignatureTransfer(PERMIT2).permitTransferFrom(permit, transferDetails, initiator, signature);
}
}
6 changes: 3 additions & 3 deletions src/TransferBundler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ abstract contract TransferBundler is BaseBundler {
/// @notice Warning: should only be called via the bundler's `multicall` function.
/// @dev Pass `amount = type(uint256).max` to transfer all.
function erc20TransferFrom(address asset, uint256 amount) external payable {
address _initiator = initiator();
amount = Math.min(amount, ERC20(asset).balanceOf(_initiator));
address initiator = initiator();
amount = Math.min(amount, ERC20(asset).balanceOf(initiator));

require(amount != 0, ErrorsLib.ZERO_AMOUNT);

ERC20(asset).safeTransferFrom(_initiator, address(this), amount);
ERC20(asset).safeTransferFrom(initiator, address(this), amount);
}
}

0 comments on commit 07adf66

Please sign in to comment.