Skip to main content

Range Converter

FullRangeConvertorV2

FullRangeConvertorV2 converts a V3 narrow-range position into a full-range position and locks the new position in BDexV3LiquidityLocker within the same transaction.

convertToFullRangeAndLock

function convertToFullRangeAndLock(
LockParams lockParams,
SlippageChecks slippageParams
) external payable returns (
uint256 newLockId,
uint256 amountLiquidity0,
uint256 amountLiquidity1,
uint256 refund0,
uint256 refund1
);

Before calling, the NFT owner must approve lockParams.nft_id to FullRangeConvertorV2.

lockParams

struct LockParams {
INonfungiblePositionManager nftPositionManager;
uint256 nft_id;
address dustRecipient;
address owner;
address additionalCollector;
address collectAddress;
uint256 unlockDate;
uint16 countryCode;
string feeName;
bytes[] r;
}
ParameterDescription
nftPositionManagerPosition Manager for the source position NFT (BDEX); it must be allowlisted by the Locker.
nft_idID of the NFT to convert and lock.
dustRecipientReceives unused token0/token1 and the initial collection made during locking.
ownerOwner of the new lock.
additionalCollectorOptional address allowed to collect fees.
collectAddressRecipient used by automatic fee collection; it cannot be the zero address.
unlockDateUnlock time in seconds and in the future; use ETERNAL_LOCK for a permanent lock.
countryCodeCountry or region code supported by the Locker.
feeNameLocker fee option name; use DEFAULT by default.
rDynamic-fee signature parameters; pass an empty array [] when dynamic fees are unused.

slippageParams

struct SlippageChecks {
uint256 amount0LiquidityMin;
uint256 amount1LiquidityMin;
uint256 amount0RefundMin;
uint256 amount1RefundMin;
}
ParameterDescription
amount0LiquidityMinMinimum token0 used to mint the full-range NFT. It must be greater than 0 for a narrow-range conversion.
amount1LiquidityMinMinimum token1 used to mint the full-range NFT. It must be greater than 0 for a narrow-range conversion.
amount0RefundMinMinimum token0 refunded to dustRecipient after conversion; usually 0.
amount1RefundMinMinimum token1 refunded to dustRecipient after conversion; usually 0.

amount0RefundMin and amount1RefundMin are minimum refund amounts. They do not represent maximum slippage or maximum loss.

msg.value

When the fixed fee selected by feeName uses the native token, msg.value must exactly equal that option's flatFee.

The current Converter cannot pay an ERC20 fixed fee. Do not use an option where flatFeeToken != address(0) and flatFee > 0.

Return Values

Return valueDescription
newLockIdID of the newly created Locker lock.
amountLiquidity0Actual token0 amount used for the new full-range liquidity.
amountLiquidity1Actual token1 amount used for the new full-range liquidity.
refund0Token0 amount refunded to dustRecipient.
refund1Token1 amount refunded to dustRecipient.

If the source NFT is already full range, the contract skips reminting and locks it directly. In this case, both liquidity amounts and both refund amounts return 0.

getRangeAndMaxTick

function getRangeAndMaxTick(
INonfungiblePositionManager nftPositionManager,
uint256 nftId
) external view returns (
bool isFullRange,
int24 maxTick
);
Parameter or return valueDescription
nftPositionManagerPosition Manager that owns the NFT.
nftIdNFT ID to inspect.
isFullRangeWhether the NFT already represents a full-range position.
maxTickMaximum usable tick for the current fee tier. A full range is [-maxTick, maxTick].

tickSpacingToMaxTick

function tickSpacingToMaxTick(
int24 tickSpacing
) external pure returns (int24 maxTick);
Parameter or return valueDescription
tickSpacingTick spacing for the pool fee tier.
maxTickMaximum usable tick for the spacing.