BulkerGateway

Git Source

Inherits: IBulkerGateway

Author: Morpho Labs.

Contract allowing to bundle multiple interactions with Morpho together.

State Variables

_WETH

The address of the WETH contract.

address internal constant _WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;

_ST_ETH

The address of the stETH contract.

address internal constant _ST_ETH = 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84;

_WST_ETH

The address of the wstETH contract.

address internal constant _WST_ETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;

_MORPHO

IMorpho internal immutable _MORPHO;

Functions

constructor

constructor(address morpho);

WETH

Returns the address of the WETH contract.

function WETH() external pure returns (address);

stETH

Returns the address of the stETH contract.

function stETH() external pure returns (address);

wstETH

Returns the address of the wstETH contract.

function wstETH() external pure returns (address);

MORPHO

Returns the address of the Morpho protocol.

function MORPHO() external view returns (address);

execute

Executes the given batch of actions, with the given input data. Those actions, if not performed in the correct order, with the proper action's configuration and with the proper inclusion of skim final calls, could leave funds in the Bulker contract.

function execute(ActionType[] calldata actions, bytes[] calldata data) external payable;

Parameters

NameTypeDescription
actionsActionType[]The batch of action to execute, one after the other.
databytes[]The array of data corresponding to each input action.

receive

Only the WETH contract is allowed to transfer ETH to this contract, without any calldata.

receive() external payable;

_performAction

Performs the given action, given its associated parameters.

function _performAction(ActionType action, bytes calldata data) internal;

Parameters

NameTypeDescription
actionActionTypeThe type of action to perform on behalf of the caller.
databytesThe data to decode, associated with the action.

_approve2

Approves the given amount of asset from sender to be spent by this contract via Permit2 with the given deadline & EIP712 signature.

function _approve2(bytes calldata data) internal;

_transferFrom2

Transfers the given amount of asset from sender to this contract via ERC20 transfer with Permit2 fallback.

function _transferFrom2(bytes calldata data) internal;

_approveManager

Approves this contract to manage the position of msg.sender via EIP712 signature.

function _approveManager(bytes calldata data) internal;

_supply

Supplies amount of asset of onBehalf using permit2 in a single tx. The supplied amount cannot be used as collateral but is eligible for the peer-to-peer matching.

function _supply(bytes calldata data) internal;

_supplyCollateral

Supplies amount of asset collateral to the pool on behalf of onBehalf.

function _supplyCollateral(bytes calldata data) internal;

_borrow

Borrows amount of asset on behalf of the sender. Sender must have previously approved the bulker as their manager on Morpho.

function _borrow(bytes calldata data) internal;

_repay

Repays amount of asset on behalf of onBehalf.

function _repay(bytes calldata data) internal;

_withdraw

Withdraws amount of asset on behalf of onBehalf. Sender must have previously approved the bulker as their manager on Morpho.

function _withdraw(bytes calldata data) internal;

_withdrawCollateral

Withdraws amount of asset on behalf of sender. Sender must have previously approved the bulker as their manager on Morpho.

function _withdrawCollateral(bytes calldata data) internal;

_wrapEth

Wraps the given input of ETH to WETH.

function _wrapEth(bytes calldata data) internal;

_unwrapEth

Unwraps the given input of WETH to ETH.

function _unwrapEth(bytes calldata data) internal;

_wrapStEth

Wraps the given input of stETH to wstETH.

function _wrapStEth(bytes calldata data) internal;

_unwrapStEth

Unwraps the given input of wstETH to stETH.

function _unwrapStEth(bytes calldata data) internal;

_skim

Sends any ERC20 in this contract to the receiver.

function _skim(bytes calldata data) internal;

_claimRewards

Claims rewards for the given assets, on behalf of an address, sending the funds to the given address.

function _claimRewards(bytes calldata data) internal;

_approveMaxToMorpho

Gives the max approval to the Morpho contract to spend the given asset if not already approved.

function _approveMaxToMorpho(address asset) internal;