MigratorZap

MigratorZap.sol

Migrates positions from NFTX V2 to V3.

Table of Contents

Constants
Public Write Functions

Constants

DEADLINE

uint256 private constant DEADLINE =
    0xf000000000000000000000000000000000000000000000000000000000000000

A sufficiently large value used for Uniswap V2's deadline.

DUST_THRESHOLD

uint256 private constant DUST_THRESHOLD = 0.005 ether

Threshold for what amount of V2 vTokens (left after redeeming) constitutes "dust." Used to determine whether to swap dust to WETH or not.

WETH

function WETH() external view returns (address)

Address of WETH contract.

v2NFTXFactory

function v2NFTXFactory() external view returns (address)

NFTX V2 vault factory address.

v2Inventory

function v2Inventory() external view returns (address)

NFTX V2 inventory staking address.

sushiRouter

function sushiRouter() external view returns (address)

Sushi router address.

positionManager

function positionManager() external view returns (address)

Address of NFTX V3's NonfungiblePositionManager contract.

v3NFTXFactory

function v3NFTXFactory() external view returns (address)

Address of NFTXVaultFactoryUpgradeableV3 contract.

v3Inventory

function v3Inventory() external view returns (address)

Address of NFTXInventoryStakingV3Upgradeable contract.

Write Functions

sushiToNFTXAMM

function sushiToNFTXAMM(
    SushiToNFTXAMMParams calldata params
) external returns (uint256 positionId)

Migrates Sushi vToken liquidity to NFTX v3 AMM.

SushiToNFTXAMMParams
Type
Description

sushiPair

address

SLP token address.

lpAmount

uint256

SLP amount.

vTokenV2

address

vToken amount.

idsToRedeem

uint256[]

NFT tokenIDs to redeem.

is1155

bool

Whether NFTs use ERC1155.

permitSig

bytes

Signed UniV2 Permit.

vaultIdV3

uint256

NFTX v3 vault ID.

tickLower

int24

Lower tick for v3 liquidity.

tickUpper

int24

Upper tick for v3 liquidity.

fee

uint24

Fee tier of V3 AMM pool to be used.

sqrtPriceX96

uint160

Starting price, if pool is not initialized.

amount0Min

uint256

Minimum token0 amount to succeed.

amount1Min

uint256

Minimum token1 amount to succeed.

deadline

uint256

Dealine for transaction to succeed. Unix timestamp, in seconds.

Return values
Type
Description

positionId

uint256

ID number of newly created position.

v2InventoryToXNFT

function v2InventoryToXNFT(
    uint256 vaultIdV2,
    uint256 shares,
    uint256[] calldata idsToRedeem,
    bool is1155,
    uint256 vaultIdV3,
    uint256 minWethToReceive
) external returns (uint256 xNFTId)

Migrates V2 inventory position to V3 xNFT inventory staking position.

Parameters
Type
Description

vaultIdV2

uint256

V2 vault ID.

shares

uint256

V2 xToken shares.

idsToRedeem

uint256[]

NFT tokenIDs to redeem.

is1155

bool

Whether NFT collection uses ERC1155.

vaultIdV3

uint256

V3 vault ID.

minWethToReceive

uint256

Minimum WETH to be received.

Return values
Type
Description

xNFTId

uint256

ID of newly created xNFT.

v2VaultToXNFT

function v2VaultToXNFT(
    address vTokenV2,
    uint256 vTokenV2Balance,
    uint256[] calldata idsToRedeem,
    bool is1155,
    uint256 vaultIdV3,
    uint256 minWethToReceive
) external returns (uint256 xNFTId)

Migrates V2 vault token to V3 xNFT inventory staking position.

Parameters
Type
Description

vaultIdV2

uint256

V2 vault ID.

vTokenV2

address

V2 vault address.

shares

uint256

The amount of v2 vToken shares to withdraw.

idsToRedeem

uint256[]

TokenIDs of NFTs to redeem.

is1155

bool

Whether the NFT collection uses ERC1155.

vaultIdV3

uint256

V3 vault ID.

minWethToReceive

uint256

Minimum required WETH to receive.

Return values
Type
Description

xNFTId

uint256

ID of newly created xNFT inventory position.

Last updated