L2 Token Receiver V2
L2TokenReceiverV2.sol
is a component of the Techno Capital Machine. It is responsible for receiving wstETH yield from L1Sender
via the native Arbitrum bridge and managing Protocol-Owned Liquidity.
The contract supports swapping tokens with the swap
method through Uniswap V3 for either of two token pairs specified in firstSwapParams
and secondSwapParams
. The former is used to swap bridged wstETH yield for WETH. The latter is used to swap half of the resulting WETH for MOR. In turn, additional liquidity for the MOR/WETH pair is provisioned using the increaseLiquidityCurrentRange
method.
All functions on L2TokenReceiverV2
can only be called by the contract owner – the Morpheus multisig.
Variables
Name | Type | Description |
---|---|---|
| address | Address of the Uniswap V3 router. |
| address | Address of the Uniswap V3 Nonfungible Position Manager. |
|
| Uniswap V3 parameters for the MOR/WETH pair, including token addresses, pair fee, and slippage tolerance. |
|
| Uniswap V3 parameters for the wstETH/WETH pair, including token addresses, pair fee, and slippage tolerance. |
Functions
swap
Executes a token swap on Uniswap V3 using specified parameters. Used to swap wstETH for WETH or WETH for MOR.
Parameters:
Name | Type | Description |
---|---|---|
| uint256 | The amount of input token to swap. |
| uint256 | The minimum amount of output token to accept. |
| uint256 | Timestamp after which the transaction reverts. |
| bool | Determines if the swap uses |
Return Values:
Type | Description |
---|---|
uint256 | The amount of output tokens received from the swap. |
increaseLiquidityCurrentRange
Increases liquidity in the current range for a Uniswap V3 liquidity position. Used to add liquidity on the MOR/WETH pair.
Parameters:
Name | Type | Description |
---|---|---|
| uint256 | The ID of the NFT position to increase liquidity for. |
| uint256 | Amount of WETH to add to the position. |
| uint256 | Amount of MOR to add to the position. |
| uint256 | Minimum amount of WETH that must be added. |
| uint256 | Minimum amount of MOR that must be added. |
Return Values:
Type | Description |
---|---|
uint128 | The liquidity added to the position. |
uint256 | The amount of the first token added to the position. |
uint256 | The amount of the second token added to the position. |
collectFees
Collects fees for a Uniswap V3 liquidity position. Used to collect fees from the MOR/WETH pair.
Parameters:
Name | Type | Description |
---|---|---|
| uint256 | The ID of the NFT position from which to collect fees. |
Return Values:
Type | Description |
---|---|
uint256 | The amount of the first token collected as fees. |
uint256 | The amount of the second token collected as fees. |
L2TokenReceiver__init
Initializes the contract.
Parameters:
Name | Type | Description |
---|---|---|
| address | Address of the Uniswap V3 router. |
| address | Address of the Uniswap V3 Nonfungible Position Manager. |
|
| Initial parameters for swaps. |
editParams
Updates the swap parameters for firstSwapParams
or secondSwapParams
.
Parameters:
Name | Type | Description |
---|---|---|
|
| The new swap parameters to be applied. |
| bool | Determines if |
Events
TokensSwapped
Emitted when a swap operation is successfully executed.
Parameters:
Name | Type | Description |
---|---|---|
| address | The address of the input token. |
| address | The address of the output token. |
| uint256 | The amount of the input token swapped. |
| uint256 | The amount of the output token received. |
| uint256 | The minimum amount of output token specified for the swap. |
LiquidityIncreased
Emitted when liquidity is successfully added to a Uniswap V3 position.
Parameters:
Name | Type | Description |
---|---|---|
| uint256 | The ID of the NFT position to which liquidity was added. |
| uint256 | The amount of the first token added. |
| uint256 | The amount of the second token added. |
| uint128 | The amount of liquidity added to the position. |
| uint256 | The minimum amount of the first token that was required. |
| uint256 | The minimum amount of the second token that was required. |
FeesCollected
Emitted when fees are collected from a Uniswap V3 position.
Parameters:
Name | Type | Description |
---|---|---|
| uint256 | The ID of the NFT position from which fees are collected |
Structs
SwapParams
Stores parameters used for swapping between tokens on Uniswap V3.
Fields
Name | Type | Description |
---|---|---|
| address | The address of the token to swap from. |
| address | The address of the token to swap to. |
| uint24 | The fee percentage for the swap in hundredths of a basis point. |
| uint160 | The square root of the price limit. Used to specify slippage tolerance. |
Last updated
Was this helpful?