Move yield from L1 to L2
This guide explains the precise steps required to transfer the protocol yield from Ethereum (L1) to Arbitrum (L2) using the core contracts of the protocol.
Move yield to the L1SenderV2 (optional)
Morpheus yield is automatically transferred to the L1SenderV2 contract from each DepositPool whenever any user calls the staking, claiming, or withdrawal functions. Thus, USDC, USDC, stETH, etc., are accumulated on L1SenderV2.
If it is necessary to transfer to L2 the maximum yield amount (for example, if there has been no activity on one or several deposit pools for a long time), the contract owner can call the withdrawYield function on the Distributor contract. It will calculate the current yield of the asset and transfer it to the L1SenderV2 address.
At this step, it is possible to collect the maximum yield from all deposit pools, if necessary.
function withdrawYield(uint256 rewardPoolIndex_, address depositPoolAddress_) external;Convert USDC, USDT, wBTC... to wstETH (optional)
All yield from the Morpheus protocol must be converted to wstETH before being sent to Arbitrum.
Yield from different deposit pools is accrued in different tokens (USDC, USDC, wBTC...). The purpose of this step is to convert this yield to wstETH. To do this, the contract owner need to call the swapExactInputMultihop function on the L1SenderV2 contract.
The exception is the stETH token, which will be automatically converted to wstETH at the next step and does not require this conversion.
If this step is skipped, the yield from deposit tokens that has not been converted to wstETH (except stETH) will not be transferred to L2.
function swapExactInputMultihop(
address[] calldata tokens_,
uint24[] calldata poolsFee_,
uint256 amountIn_,
uint256 amountOutMinimum_,
uint256 deadline_
) external onlyOwner returns (uint256) Transfer wstETH to Arbitrum
At this step, the protocol yield is transferred to Arbitrum via the Arbitrum bridge. The function converts stETH to wstETH, calculates the wstETH balance (including the previous step where yield from other tokens was swapped to wstETH), and transfers all wstETH to L2. To do this, the contract owner need to call the sendWstETH function on the L1SenderV2 contract.
function sendWstETH(
uint256 gasLimit_,
uint256 maxFeePerGas_,
uint256 maxSubmissionCost_
) external payable onlyOwner returns (bytes memory)Last updated
Was this helpful?