jediswap_v2_nft_position_manager

Wraps JediSwap V2 positions in the ERC721 non-fungible token interface

Functions

mint

fn mint(ref self: ContractState, params: MintParams) -> (u256, u128, u256, u256)

Creates a new position wrapped in a NFT

Call this when the pool does exist and is initialized

Emits IncreaseLiquidity.

Parameters:

Name
Type
Description

params

MintParams

The params necessary to mint a position

Return Values:

Type
Description

u256

The ID of the token that represents the minted position

u128

The amount of liquidity for this position

u256

The amount of token0

u256

The amount of token1

increase_liquidity

fn increase_liquidity(ref self: ContractState, params: IncreaseLiquidityParams) -> (u128, u256, u256)

Increases the amount of liquidity in a position, with tokens paid by the caller

Emits IncreaseLiquidity.

Parameters:

Name
Type
Description

params

IncreaseLiquidityParams

The params necessary to increase liquidity of a position

Return Values:

Type
Description

u128

The new liquidity amount as a result of the increase

u256

The amount of token0 to achieve resulting liquidity

u256

The amount of token1 to achieve resulting liquidity

decrease_liquidity

Decreases the amount of liquidity in a position and accounts it to the position

Emits DecreaseLiquidity.

Parameters:

Name
Type
Description

params

DecreaseLiquidityParams

The params necessary to decrease liquidity of a position

Return Values:

Type
Description

u256

The amount of token0 accounted to the position's tokens owed

u256

The amount of token1 accounted to the position's tokens owed

collect

Collects up to a maximum amount of fees owed to a specific position to the recipient

Emits Collect.

Parameters:

Name
Type
Description

params

CollectParams

The params necessary to collect fees of a position

Return Values:

Type
Description

u128

The amount of fees collected in token0

u128

The amount of fees collected in token1

burn

Burns a token ID, which deletes it from the NFT contract. The token must have 0 liquidity and all tokens must be collected first.

Parameters:

Name
Type
Description

token_id

u256

The ID of the token that is being burned

create_and_initialize_pool

Creates a new pool if it does not exist, then initializes if not initialized

This method can be bundled with others via multicall for the first action (e.g. mint) performed against a pool

Parameters:

Name
Type
Description

token0

ContractAddress

The contract address of token0 of the pool

token1

ContractAddress

The contract address of token1 of the pool

fee

u32

The fee amount of the v2 pool for the specified token pair

sqrt_price_X96

u256

The initial square root price of the pool as a Q64.96 value

Return Values:

Type
Description

ContractAddress

The pool address based on the pair of tokens and fee, will return the newly created pool address if necessary

jediswap_v2_mint_callback

Parameters:

Name
Type
Description

amount0_owed

u256

amount1_owed

u256

callback_data_span

Span<felt252>

Events

IncreaseLiquidity

Emitted when liquidity is increased for a position NFT. Also emitted when a token is minted.

Parameters:

Name
Type
Description

token_id

u256

The ID of the token for which liquidity was increased

liquidity

u128

The amount by which liquidity for the NFT position was increased

amount0

u256

The amount of token0 that was paid for the increase in liquidity

amount1

u256

The amount of token1 that was paid for the increase in liquidity

DecreaseLiquidity

Parameters:

Name
Type
Description

token_id

u256

The ID of the token for which liquidity was decreased

liquidity

u128

The amount by which liquidity for the NFT position was decreased

amount0

u256

The amount of token0 that was accounted for the decrease in liquidity

amount1

u256

The amount of token1 that was accounted for the decrease in liquidity

Collect

The amounts reported may not be exactly equivalent to the amounts transferred, due to rounding behavior

Parameters:

Name
Type
Description

token_id

u256

The ID of the token for which underlying tokens were collected

recipient

ContractAddress

The address of the account that received the collected tokens

amount0_collect

u128

The amount of token0 owed to the position that was collected

amount1_collect

u128

The amount of token1 owed to the position that was collected

ABI

Last updated