Managing Positions
A position is managed through two different structs.
The first is the FarmingPositionRequest
struct, which is used to open a new position or to add liquidity to an existing position.
All other position management operations (position transfer, reward withdrawal, liquidity withdrawal, etc.) internally use the FarmingPosition
struct.
FarmingPositionRequest Struct
The FarmingPositionRequest
struct is structured as follow:
setupIndex
-> Index of the chosen farming setup.amount0
-> amount of the first token (token0
).amount1
-> amount of the second token (token1
).positionOwner
-> the position owneraddress
.address(0)
is used to represent themsg.sender
; otherwise, input the address of your choice. This means that by using theOpenPosition
function, you can also open a position for anotheraddress
.
FarmingPosition Struct
The FarmingPosition
struct contains all of the data of the position of a farmer in a setup and is populated and modified through the position management functions. It is composed as follows:
uniqueOwner
-> address representing the position owner address.setupIndex
-> Index of the chosen farming setup for the position.creationBlock
-> the block at which the position is created.tokenId
-> the id of the NFT of a specific position. This parameter is used by the farming contract to retrieve information about the NFT, such as the amount of liquidity or trading fees collected.reward
-> rewards for the position. initially unpopulated, and subsequently repopulated as rewards are recalculated on a block-to-block basis.
Last updated