FarmRegistry

Git Source

Inherits: IFarmRegistry, OwnableUpgradeable

Author: Sperax Foundation.

This contract tracks fee details, privileged users, deployed farms and farm deployers.

State Variables

farms

address[] internal farms;

deployerList

address[] internal deployerList;

feeReceiver

address public feeReceiver;

feeToken

address public feeToken;

feeAmount

extensionFeePerDay

farmRegistered

deployerRegistered

isPrivilegedUser

Functions

constructor

initialize

constructor

Parameters

Name
Type
Description

_feeReceiver

address

Receiver of the fees.

_feeToken

address

The fee token for farm creation.

_feeAmount

uint256

The fee amount to be paid by the creator.

_extensionFeePerDay

uint256

Extension fee per day.

registerFarm

Register a farm created by registered Deployer.

Only registered deployer can register a farm.

Parameters

Name
Type
Description

_farm

address

Address of the created farm contract

_creator

address

Address of the farm creator.

registerFarmDeployer

Register a new farm deployer.

Only owner can call this function.

Parameters

Name
Type
Description

_deployer

address

Address of deployer to be registered.

removeDeployer

Remove an existing deployer from registry.

Only owner can call this function.

Parameters

Name
Type
Description

_id

uint16

ID of the deployer to be removed (0 index based).

updatePrivilege

Function to add/remove privileged User.

Only callable by the owner.

Parameters

Name
Type
Description

_user

address

User Address for which privilege is to be updated.

_privilege

bool

Privilege(bool) whether true or false.

getFarmDeployerList

Get list of registered deployer.

Returns

Name
Type
Description

<none>

address[]

Returns array of registered deployer addresses.

getFarmList

Get list of farms created via registered deployer.

Returns

Name
Type
Description

<none>

address[]

Returns array of farm addresses.

getFeeParams

Get all the fee parameters for creating farm.

It returns fee amount and extension fee as 0 if _user is privileged.

Parameters

Name
Type
Description

_user

address

The account creating the farm.

Returns

Name
Type
Description

<none>

address

Receiver of the fees.

<none>

address

Token in which fee is to be paid.

<none>

uint256

Amount of fees to be paid for creation of farm.

<none>

uint256

Extension fee per day in case of extending a farm.

updateFeeParams

Update the fee params for registry.

Parameters

Name
Type
Description

_receiver

address

FeeReceiver address.

_feeToken

address

Token address for fee.

_amount

uint256

Amount of token to be collected.

_extensionFeePerDay

uint256

Extension fee per day.

_validateNonZeroAddr

Validate address.