Standard Farming Manager

Contract NameGithubDeployed Contract AddressContract ImplementedInitialization Data

FarmingManager

Coming soon

Coming soon

IFarmingManager, LazyInitCapableElement

LazyInitCapableElement init data

Farming Manager Initialization

The FarmingManager must be initialized by the farming contract itself; specifically, via the init function of the farming contract:

function init(address extension, bytes memory extensionInitData, address uniswapV3NonfungiblePositionManager, address rewardTokenAddress, bytes memory farmingSetupInfosBytes) public returns(bytes memory extensionReturnCall)
  • address extension -> The address of the Farming Manager contract must be passed as address extension.

  • bytes extensionInitData -> The initialization data of the Farming Manager must be passed as bytes extensionInitData. FarmingManager is a LazyInitCapableElement, and so the initialization data must follow this pattern. In particular, the host of the FarmingManager must be the address of the Organization to which it will be linked as an active component. The host parameter is the only one to initialize.

  • address rewardTokenAddress -> address of the Farming contract reward token. There can be only one reward token per Farming contract.

  • bytes farmingSetupInfosBytes -> ABI-encoded data of the contract's farmingSetupInfos structs used to create Farming setups. Look here for more info.

Following the creation of the farming contract and initialization of the Farming Manager, the organization must, through a proposal, link the Farming Manager to itself as an active component (to learn more, see here).

Farming Contract Interaction

The Farming Manager provides the following interaction functions with the farming contract.

transferTo

function transferTo(uint256 amount) external;l

This function, which can be called only by the farming contract itself, is used to send the required amount of reward tokens from the Organization's Treasury Manager to the farming contract; this must be done before the contract's setups can be or at the moment they are activated (see here to learn more).

backToYou

function backToYou(uint256 amount) external payable;

This function, which can be called only by the farming contract itself, is used to send back any unissued reward tokens from a farming contract after all its setups have ended back to the Organization's main Treasury Manager (see here to learn more).

setFarmingSetups

function setFarmingSetups(FarmingSetupConfiguration[] memory farmingSetups) external;l

This function, which can be called by all authorized subjects and Components linked to the Organization, is used to add new Farming setups to, and modify existing setups of, a farming contract. See here to learn more.

setTreasury

function setTreasury(address) external override authorizedOnly {
    revert("Impossibru!");
}

The Farming Manager address is automatically set as the Farming contract treasury, and cannot be changed. See here to learn more.

Last updated