Manage Farming Positions
A position is managed through just 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, unlock locked position, etc.) use the struct FarmingPosition
.
The FarmingPositionRequest
is structured as follow:
setupIndex
-> Index of the chosen farming setupamount
-> 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 as0x0000000000000000000000000000000000000000
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
.
The FarmingPosition
struct contains all 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 setupcreationBlock -> current block when position created
liquidityPoolTokenAmount
-> LP token amount added via_addLiquidity
using the AMM AggregatormainTokenAmount
-> used only in Locked setup to represent the main token amount corresponding to the amount of liquidity added to a position. It's an unpopulated parameter in a free setup positionreward
-> the rewards for the position. For Locked setup positions, it is a precise, fixed figure calculated even before the position was staked. For Free setup positions, it is initially unpopulated , and subsequently repopulated block-to-block as rewards are calculated on a pro rata basis.lockedRewardPerBlock
-> the calculated reward per block for a Locked position. It is populated when the position is opened, and represents the fixedreward per block
for that position. It is calculated based on the amount of liquidity (in the main token) staked by the farmer relative to the setups'maxStakeable
amount. It is an unpopulated parameter in a free setup position
Last updated