Add new Setups to a Contract
A host can add new setups to a contract in addition to those created during contract initialization.
To do this, use the setFarmingSetups
function:
This function uses, as input, the FarmingSetupConfiguration
struct:
The parameters to create new Seups are as follows:
add
->true
.disable
->false
.index
-> the index of the new Farming setup. This parameter is empty if adding a new setup.FarmingSetupInfo
-> struct containing the new setupdata
.
The FarmingSetupInfo
struct for a Covenants Farming 1.5 Regular setup, supporting Uniswap v3, is composed as follows:
blockDuration
-> duration of the setup in blocks.startBlock
-> start block of the setup*.originalRewardPerBlock
-> thereward per block
chosen, it will remain the same unless the host modifies thereward per block
later.minStakeable
-> minimum amount of the main token that can be staked by a position in the setup.renewtimes
-> amount of times the setup can be renewed.liquidityPoolTokenAddress
->address
of the Uniswap v3 liquidity pool for the setup.mainTokenAddress
->address
of the chosen main token (one of the two token componing the pair); used to perform some checks such as theminStakeable
.involvingETH
-> boolean value representing if ETH is a token in the setup (true
) or not (false
).setupsCount
-> number of setups created by the passing of this info; populated automatically by the contract and for internal use only.lastSetupIndex
-> index of last setup created by this info; populated automatically by the contract and for internal use only.tickLower
-> parameter representing the value oftickLower
used to create the Uniswap v3 NFT for the setup.tickUpper
-> parameter representing the value oftickUpper
used to create the Uniswap v3 NFT for the setup.
*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.
When creating a setup via the FarmingSetupInfo
struct, the information for the NFT to be created for the Uniswap v3 price curve and liquidity position is passed from the host. The info regarding the addresses
of the pair tokens (token0
and token1
) and the pool fee
is retrieved from the passed liquidityPoolTokenAddress
; to correctly create a setup, the Uniswap v3 pool you want to use must already exist. The tickLower
and tickUpper
parameters provide the remaining data.
Once a setup is created, it is represented by the FarmingSetup
struct:
infoIndex
-> setup info index.active
-> a boolean value representing if the setup is active (true
) or inactive (false
).startBlock
-> farming setup start block corresponding to setup activation block.endBlock
-> farming setup end block calculated assetup start Block + setup duration
.lastUpdateBlock
-> number of the block where an update was triggered in the setup (for internal use only such as reward position calculation).deprecatedObjectId
-> this parameter is only used in the Farming 1.5 shared version.rewardPerBlock
-> farming setup reward per block set.totalSupply
-> it represents theliquidity
parameter of the NFT (Uniswap v3) that is the total liquidity amount inserted all users of that setup.
Last updated