MaverickV2RewardRouter
Inherits: IMaverickV2RewardRouter, MaverickV2LiquidityManager
Liquidity and Reward contract to facilitate multi-step interactions with adding and staking liquidity in Maverick V2. This contracts inherits all of the functionality of MaverickV2LiquidityManager
that allows the creation of pools and BPs and adds mechanisms to interact with the various reward and ve functionality that are present in v2-rewards. All of the functions are specified as payable
to enable multicall transactions that involve functions that require ETH and those that do not.
State Variables
rewardFactory
This function retrieves the address of the MaverickV2RewardFactory contract associated with this contract.
Functions
constructor
stake
This function stakes any new staking token balance that are in the reward.vault()
for a specified recipient tokenId. Passing input tokenId=0
will cause the stake to mint to either the first tokenId for the caller, or a new NFT tokenId if the sender does not yet have one.
Parameters
Name | Type | Description |
---|---|---|
|
| The IMaverickV2Reward contract for which to stake. |
|
| Nft tokenId to stake for the staked tokens. |
Returns
Name | Type | Description |
---|---|---|
|
| The amount of staking tokens staked. May differ from input if there were unstaked tokens in the vault prior to this call. |
|
| TokenId where liquidity was staked to. This may differ from the input tokenId if the input |
notifyRewardAmount
This function transfers a specified amount of reward tokens from the caller to a reward contract and notifies it to distribute them over a defined duration.
Parameters
Name | Type | Description |
---|---|---|
|
| The IMaverickV2Reward contract to notify. |
|
| The address of the reward token to transfer. |
|
| The duration (in seconds) over which to distribute the rewards. |
Returns
Name | Type | Description |
---|---|---|
|
| The duration in seconds that the incentives will be distributed over. |
transferAndStake
This function transfers a specified amount of staking tokens from the caller, stakes them on the recipient's behalf, and associates them with a specified reward contract.
Parameters
Name | Type | Description |
---|---|---|
|
| The IMaverickV2Reward contract for which to stake. |
|
| Nft tokenId to stake for the staked tokens. |
|
| The amount of staking tokens to transfer and stake. |
Returns
Name | Type | Description |
---|---|---|
|
| The amount of staking tokens staked. May differ from input if there were unstaked tokens in the vault prior to this call. |
|
| TokenId where liquidity was staked to. This may differ from the input tokenIf if the input |
transferAndNotifyRewardAmount
This function transfers a specified amount of reward tokens from the caller and adds them to the reward contract as incentives.
Parameters
Name | Type | Description |
---|---|---|
|
| The IMaverickV2Reward contract to notify. |
|
| The address of the reward token to transfer. |
|
| The duration (in seconds) over which to distribute the rewards. |
|
| The amount of staking tokens to stake (uint256). |
Returns
Name | Type | Description |
---|---|---|
|
| The duration in seconds that the incentives will be distributed over. |
createBoostedPositionAndAddLiquidityAndStake
This function creates a new BoostedPosition contract, adds liquidity to a pool using the provided parameters, stakes the received LP tokens, and associates them with a specified reward contract.
Parameters
Name | Type | Description |
---|---|---|
|
| The address to which the minted LP tokens will be credited. |
|
| A struct containing parameters for creating the BoostedPosition (see IMaverickV2PoolLens.CreateBoostedPositionInputs). |
|
| An array of IERC20 token addresses representing the available reward tokens for the staked LP position. |
|
| An array of IMaverickV2VotingEscrow contract addresses representing the veTokens used for boosting. |
Returns
Name | Type | Description |
---|---|---|
|
| The created IMaverickV2BoostedPosition contract. |
|
| The amount of LP tokens minted from the added liquidity. |
|
| The amount of token A deposited for liquidity. |
|
| The amount of token B deposited for liquidity. |
|
| The amount of LP tokens staked in the reward contract. |
|
| The IMaverickV2Reward contract. |
|
| Token on reward contract where user liquidity was staked. |
createBoostedPositionAndAddLiquidityAndStakeToSender
This function is similar to createBoostedPositionAndAddLiquidityAndStake
but stakes the minted LP tokens for the caller (msg.sender) instead of a specified recipient.
Parameters
Name | Type | Description |
---|---|---|
|
| A struct containing parameters for creating the BoostedPosition (see IMaverickV2PoolLens.CreateBoostedPositionInputs). |
|
| An array of IERC20 token addresses representing the available reward tokens for the staked LP position. |
|
| An array of IMaverickV2VotingEscrow contract addresses representing the veTokens used for boosting. |
Returns
Name | Type | Description |
---|---|---|
|
| The created IMaverickV2BoostedPosition contract. |
|
| The amount of LP tokens minted from the added liquidity. |
|
| The amount of token A deposited for liquidity. |
|
| The amount of token B deposited for liquidity. |
|
| The amount of LP tokens staked in the reward contract. |
|
| The IMaverickV2Reward contract associated with the staked LP position. |
|
| Token on reward contract where user liquidity was staked. |
addLiquidityAndMintBoostedPositionAndStake
This function adds liquidity to a pool using a pre-created BoostedPosition contract, stakes the received LP tokens, and associates them with a specified reward contract.
Parameters
Name | Type | Description |
---|---|---|
|
| Token on reward contract where liquidity is to be staked. |
|
| The IMaverickV2BoostedPosition contract representing the existing boosted position. |
|
| A packed representation of sqrt price breaks for the liquidity range (see IMaverickV2Pool.IAddLiquidityParams). |
|
| Additional packed arguments for adding liquidity (see IMaverickV2Pool.IAddLiquidityParams). |
|
| The IMaverickV2Reward contract for which to stake the LP tokens. |
Returns
Name | Type | Description |
---|---|---|
|
| The amount of LP tokens minted from the added liquidity. |
|
| The amount of token A deposited for liquidity. |
|
| The amount of token B deposited for liquidity. |
|
| The amount of LP tokens staked in the reward contract. |
addLiquidityAndMintBoostedPositionAndStakeToSender
This function is similar to addLiquidityAndMintBoostedPositionAndStake
but uses the caller (msg.sender) as the recipient for the minted reward stake.
Parameters
Name | Type | Description |
---|---|---|
|
| Token index of sender on the reward contract to mint to. If sender does not have a token already, then this call will mint one for the user. |
|
| The IMaverickV2BoostedPosition contract representing the existing boosted position. |
|
| A packed representation of sqrt price breaks for the liquidity range (see IMaverickV2Pool.IAddLiquidityParams). |
|
| Additional packed arguments for adding liquidity (see IMaverickV2Pool.IAddLiquidityParams). |
|
| The IMaverickV2Reward contract for which to stake the LP tokens. |
Returns
Name | Type | Description |
---|---|---|
|
| The amount of LP tokens minted from the added liquidity. |
|
| The amount of token A deposited for liquidity. |
|
| The amount of token B deposited for liquidity. |
|
| The amount of LP tokens staked in the reward contract. |
|
| Token on reward contract where user liquidity was staked. |
mintTokenInRewardToSender
mintTokenInReward
sync
This function syncs the balance of a staker's votes on the legacy ve mav contract with the new V2 ve mav contract.
Parameters
Name | Type | Description |
---|---|---|
|
| The IMaverickV2VotingEscrowWSync contract to interact with. |
|
| The address of the user whose veToken lock may need syncing. |
|
| A list of indexes to synchronize from the legacy veMav to the V2 ve contract. |
Last updated