Add New Farming Setups to a Contract
A host can add new setups to a contract in addition to those created during contract initialization.
To do this, they can use the setFarmingSetups
function:
The function uses as input the FarmingSetupConfiguration
struct:
add
->true
disable
->false
index
-> the index of the new Farming setup. This parameter is empty in case of adding a new setup.FarmingSetupInfo
-> struct containing the new setupdata
The setFarmingSetups
calls internally the _setOrAddFarmingSetupInfo
method to create the setup, which takes as input the information previously passed in the setFarmingSetups
:
info
->FarmingSetupInfo
structadd
->true
disable
->false
setupIndex
-> the index of the new Farming setup
The FarmingSetupInfo
struct is composed as follows:
free
-> a boolean value representing if the setup to create is free (true
) or locked (false
)blockDuration
-> duration of the setup in blocksstartBlock
-> start block of the setup*originalRewardPerBlock
-> thereward per block
set when the setup is created; will remain the same unless the host modifies thereward per block
laterminStakeable
-> minimum amount of the main token that can be staked by a position in the setupmaxStakeable
-> maximum amount stakeable in the setup (used for locked setups)renewtimes
-> if the setup is renewable or if it's one timeammPlugin
-> AMM plugin address used for this setup (eg. the Uniswap AMM pluginaddress
)liquidityPoolTokenAddress
->address
of the liquidity pool used for the setupmainTokenAddress
->address
of the chosen main token; used to perform some checks such as theminStakeable or maxStakeable
in case of a locked setupethereumAddress
-> for internal use onlyinvolvingETH
-> a boolean value representing if ETH is involved as token in the setup (true
) or not (false
). Please refer to the AMM Aggregator section for more detailspenaltyFee
-> penalty fee expressed as percentage used in theunlock
function in a locked setupsetupsCount
-> number of setups created by this info (for internal use only)lastSetupIndex
-> index of last setup created by this info (for internal use only)
*Optional. Represents the block from which activation of the setup can be attempted; activatesetup
cannot be called before that block
is reached. If startBlock
is set as zero, then the setup can be activated any time after it is created.
Last updated
Was this helpful?