FarmDeployer

Git Source

Inherits: Ownable, ReentrancyGuard

Author: Sperax Foundation.

Exposes base functionalities which will be useful in every deployer.

State Variables

FARM_REGISTRY

address public immutable FARM_REGISTRY;

farmImplementation

address public farmImplementation;

farmId

string public farmId;

Functions

constructor

Constructor.

constructor(address _farmRegistry, string memory _farmId) Ownable(msg.sender);

Parameters

NameTypeDescription

_farmRegistry

address

Address of the Demeter Farm Registry.

_farmId

string

Id of the farm.

updateFarmImplementation

Update farm implementation's address.

Only callable by the owner.

Ensure that _newFarmId is correct for the new farm implementation.

function updateFarmImplementation(address _newFarmImplementation, string calldata _newFarmId) external onlyOwner;

Parameters

NameTypeDescription

_newFarmImplementation

address

New farm implementation's address.

_newFarmId

string

ID of the new farm.

_collectFee

Collect fee and transfer it to feeReceiver.

Function fetches all the fee params from farmRegistry.

function _collectFee() internal virtual;

_validateNonZeroAddr

Validate address.

function _validateNonZeroAddr(address _addr) internal pure;

Events

FarmCreated

event FarmCreated(address indexed farm, address indexed creator, address indexed admin);

FeeCollected

event FeeCollected(address indexed creator, address indexed token, uint256 amount);

FarmImplementationUpdated

event FarmImplementationUpdated(address indexed newFarmImplementation, string newFarmId);

Errors

InvalidAddress

error InvalidAddress();

NewFarmImplementationSameAsOld

error NewFarmImplementationSameAsOld();