Creation and Initialization
Creation & Initialization
To create and initialize a contract, first use the deploy
function to have the Factory clone the model farming contract.
By doing so, the Factory also calls the initialize function (init
) for the clone contract.
The init
function works as follows:
address extension
-> the address of the extension to link with the contract*.extensionInitData
-> the extension's initialization data**.uniswapV3NonfungiblePositionManager
-> theaddress
of the Uniswap V3 Nonfungible Position Manager.rewardTokenAddress
-> theaddress
of the reward token (one per contract).farmingSetupInfoBytes
-> ABI-encoded data of the contract's setups, which can be created directly during this initialization phase or afterwards***
*The extension (whether default or custom) must have already been deployed if the extension has an init method (in the case of a custom extension).
**Available only if the extension has not yet been initialized.
If the extension has not already been initialized and has an init
function, it will be called:
***If the farmingSetupInfoBytes
parameter is passed in this initialization phase, then the _setOrAddFarmingSetupInfo
function is called internally to create the setups:
If it will be passed afterward, setups can be created directly using the setFarmingSetups
function (see the Add New Setups to a Contract section for how to customize and create new setups for a contract).
After creating the setups, remember to send the correct amount of reward tokens to the extension in order to correctly activate the setup/s. For more info, see here.
Last updated