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.) use the FarmingPosition
struct.
FarmingPositionRequest Struct
The FarmingPositionRequest
struct is structured as follow:
setupIndex
-> Index of the chosen farming setupamount0
-> amount of the first token (token0)amount1
-> amount of the second token (token1)positionOwner
-> the position owneraddress
.0x0000000000000000000000000000000000000000
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 addresssetupIndex
-> Index of the chosen farming setup for the positioncreationBlock
-> the block at which the position is createdtokenId
-> 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