Position NFT

position_nft

Description

This is a modified NFT contract to store user position. To minimize data, actual content is not stored inside the contract so far kept empty by the pool. It is appended on the fly with nft values. Pool then adds all the other fields to form valid metadata.

Data Storage

IndexTypeSize (b/r)CellNameDescription

1

uint64

64 / 0

1

positionv3::index

The position number. Also the nft index

2

addr

267 / 0

1

positionv3::pool_address

Address of the pool that created this NFT

3

addr

267 / 0

1

positionv3::user_address

Address of the user ton wallet that currently owns the position

4

cell

0 / 1

1

positionv3::content

NFT metadata that contains image url, name and description packed in standard format

5

uint128

128 / 0

1

positionv3::liquidity

Position liquidity

6

int24

24 / 0

1

positionv3::tickLower

Position lower tick number

7

int24

24 / 0

1

positionv3::tickUpper

Position upper tick number

8

uint256

256 / 0

11

positionv3::feeGrowthInside0LastX128

Fees collected before the position was opened or updated for jetton0 (in pool terms)

9

uint256

256 / 0

11

positionv3::feeGrowthInside1LastX128

Fees collected before the position was opened or updated for jetton1 (in pool terms)

Cells

NameSizeFree

1

774

249

11

512

511

Interface

getPoolAddress

(slice) getPoolAddress ()

This function returns pool address that created this Position NFT

  • @return0 address in question

getUserAddress

(slice) getUserAddress ()

This function returns user address that owned created this Position NFT

  • @return0 address in question

getPositionInfo

(int, int, int, int, int) getPositionInfo ()

This function returns data stored in Position NFT and is related to the position

  • @return0 liquidity that this position owns

  • @return1 lower tick of the position

  • @return2 upper tick of the position

  • @return3 fee growth of jetton0 in the given range at moment of the creation or latest collect of the NFT position

  • @return4 fee growth of jetton1 in the given range at moment of the creation or latest collect of the NFT position

get_nft_data

(int, int, slice, slice, cell) get_nft_data ()

This function returns data of this Position NFT that is related to NFT as TEP-62 It also attaches some values to transfer them to pool

Messages

POSITIONNFTV3_POSITION_INIT

Opcode : 0xd5ecca2a

MnemonicTypeDescription

op

Uint(32) op

query_id

Uint(64)

queryid as of the TON documentation

user_address

Address()

liquidity

Uint(128)

tickLower

Int(24)

tickUpper

Int(24)

feeGrowthInside0LastX128

Uint(256)

feeGrowthInside1LastX128

Uint(256)

nftIndex

Uint(64),Indexer

jetton0Amount

Coins(),Indexer

jetton1Amount

Coins(),Indexer

tick

Int(24),Indexer

POSITIONNFTV3_POSITION_BURN

Opcode : 0x46ca335a

Message from the pool that is part of burn process. This message carries new feeGrowthInside?Last values form the pool

MnemonicTypeDescription

op

Uint(32) op

query_id

Uint(64)

queryid as of the TON documentation

nft_owner

Address()

liquidity2Burn

Uint(128)

tickLower

Int(24)

tickUpper

Int(24)

feeGrowthInside0LastX128

Uint(256)

feeGrowthInside1LastX128

Uint(256)

NFT_TRANSFER,POSITIONNFTV3_NFT_TRANSFER

Opcode : 0x5fcc3d14

Last updated