Manage Farming Positions
A position is managed through two different structs.
The first one is the FarmingPositionRequest
, used to open a new position or to add liquidity to an existing position (with the latter only available for Free setups).
All other position management operations (transfer a position, withdraw the reward, withdraw the liquidity, etc.) interanlly use the struct FarmingPosition
.
FarmingPositionRequest Struct
The FarmingPositionRequest
is structured as follow:
setupIndex
-> Index of the chosen farming setup.amount
-> amount chosen to open the position or to add to an existing Free position in case ofAddLiquidity
.amountIsLiquidityPool
-> boolean value representing if the sent amount is of LP tokens (true
) or pair tokens (false
).positionOwner
-> position owneraddress
. Pass position owner either asaddress(0)
to represent themsg.sender
, or use another 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 data of the position of a farmer in a setup and is populated and modified automatically through the position management functions (openPosition
, addLiquidity
, withdrawLiquidity
and withdrawReward
). It is composed as follows:
uniqueOwner
-> address representing the position owner address.setupIndex
-> Index of the chosen farming setup.creationBlock
-> current block when position created.liquidityPoolTokenAmount
-> LP token amount.mainTokenAmount
-> represent the main token amount corresponding to the amount of liquidity added to a position.reward
-> the rewards for the position. It's updated when an addLiquidity on an already existing Farming position is executed.
Last updated