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.

IMaverickV2RewardFactory public immutable rewardFactory;

Functions

constructor

constructor(
    IMaverickV2Factory _factory,
    IWETH9 _weth,
    IMaverickV2Position _position,
    IMaverickV2BoostedPositionFactory _boostedPositionFactory,
    IMaverickV2RewardFactory _rewardFactory
) MaverickV2LiquidityManager(_factory, _weth, _position, _boostedPositionFactory);

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.

function stake(IMaverickV2Reward reward, uint256 tokenId)
    public
    payable
    returns (uint256 amount, uint256 stakedTokenId);

Parameters

Returns

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.

function notifyRewardAmount(IMaverickV2Reward reward, IERC20 rewardToken, uint256 duration)
    public
    payable
    returns (uint256 _duration);

Parameters

Returns

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.

function transferAndStake(IMaverickV2Reward reward, uint256 tokenId, uint256 _amount)
    public
    payable
    returns (uint256 amount, uint256 stakedTokenId);

Parameters

Returns

transferAndNotifyRewardAmount

This function transfers a specified amount of reward tokens from the caller and adds them to the reward contract as incentives.

function transferAndNotifyRewardAmount(IMaverickV2Reward reward, IERC20 rewardToken, uint256 duration, uint256 amount)
    public
    payable
    returns (uint256 _duration);

Parameters

Returns

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.

function createBoostedPositionAndAddLiquidityAndStake(
    address recipient,
    IMaverickV2PoolLens.CreateBoostedPositionInputs memory params,
    IERC20[] memory rewardTokens,
    IMaverickV2VotingEscrow[] memory veTokens
)
    public
    payable
    returns (
        IMaverickV2BoostedPosition boostedPosition,
        uint256 mintedLpAmount,
        uint256 tokenAAmount,
        uint256 tokenBAmount,
        uint256 stakeAmount,
        IMaverickV2Reward reward,
        uint256 tokenId
    );

Parameters

Returns

createBoostedPositionAndAddLiquidityAndStakeToSender

This function is similar to createBoostedPositionAndAddLiquidityAndStake but stakes the minted LP tokens for the caller (msg.sender) instead of a specified recipient.

function createBoostedPositionAndAddLiquidityAndStakeToSender(
    IMaverickV2PoolLens.CreateBoostedPositionInputs memory params,
    IERC20[] memory rewardTokens,
    IMaverickV2VotingEscrow[] memory veTokens
)
    public
    payable
    returns (
        IMaverickV2BoostedPosition boostedPosition,
        uint256 mintedLpAmount,
        uint256 tokenAAmount,
        uint256 tokenBAmount,
        uint256 stakeAmount,
        IMaverickV2Reward reward,
        uint256 tokenId
    );

Parameters

Returns

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.

function addLiquidityAndMintBoostedPositionAndStake(
    uint256 tokenId,
    IMaverickV2BoostedPosition boostedPosition,
    bytes memory packedSqrtPriceBreaks,
    bytes[] memory packedArgs,
    IMaverickV2Reward reward
) public payable returns (uint256 mintedLpAmount, uint256 tokenAAmount, uint256 tokenBAmount, uint256 stakeAmount);

Parameters

Returns

addLiquidityAndMintBoostedPositionAndStakeToSender

This function is similar to addLiquidityAndMintBoostedPositionAndStake but uses the caller (msg.sender) as the recipient for the minted reward stake.

function addLiquidityAndMintBoostedPositionAndStakeToSender(
    uint256 sendersTokenIndex,
    IMaverickV2BoostedPosition boostedPosition,
    bytes memory packedSqrtPriceBreaks,
    bytes[] memory packedArgs,
    IMaverickV2Reward reward
)
    public
    payable
    returns (uint256 mintedLpAmount, uint256 tokenAAmount, uint256 tokenBAmount, uint256 stakeAmount, uint256 tokenId);

Parameters

Returns

mintTokenInRewardToSender

function mintTokenInRewardToSender(IMaverickV2Reward reward) public payable returns (uint256 tokenId);

mintTokenInReward

function mintTokenInReward(IMaverickV2Reward reward, address recipient) public payable returns (uint256 tokenId);

sync

This function syncs the balance of a staker's votes on the legacy ve mav contract with the new V2 ve mav contract.

function sync(IMaverickV2VotingEscrowWSync ve, address staker, uint256[] memory legacyLockupIndexes)
    public
    returns (uint256[] memory newBalance);

Parameters

Last updated