Sperax
  • USDs (Sperax USD)
    • Minting and Redeeming
    • Auto Yield
      • Smart Contracts can opt in for the rebase feature (Auto-yield).
    • Stability Mechanism
    • Key parameters and functions
    • Technical documents
      • Sequence diagrams
      • Smart contracts
        • Vault
        • USDs
        • CollateralManager
        • SPA Buyback
        • MasterPriceOracle
        • Yield Reserve
        • Fee Calculator
        • RebaseManager
        • Dripper
        • BaseStrategy
      • Deployed contracts
  • Buyback Contract
  • Staking Protocol
    • Locking SPA
    • Withdrawing SPA
    • Staking Rewards
  • Demeter Protocol
    • How does Demeter Work?
    • Technical documents
      • Smart contracts
        • E721 Farms
          • E721Farm
          • Camelot V3
            • CamelotV3FarmDeployer
            • CamelotV3Farm
        • Base contracts
          • Farm
          • FarmStorage
          • FarmRegistry
          • FarmDeployer
        • Features
          • ClaimableFee
          • ExpirableFarm
          • OperableDeposit
        • Rewarder
          • Rewarder
          • RewarderFactory
      • Deployed contracts
  • Getting Started on Our DApp
    • Minting & Redeeming USDs
    • Stake SPA
  • Governance
  • Bug Bounty Program
  • FAQ
    • SPA Tokenomics
    • xSPA token
    • Smart Contract Addresses
    • How to Transfer SPA from Ethereum to Arbitrum
  • Quick Links
    • Audit Reports
    • Sperax Dapp
    • Demeter Dapp
    • Discord
    • Forum
    • Snapshot
Powered by GitBook
On this page
  • State Variables
  • farms
  • deployerList
  • feeReceiver
  • feeToken
  • feeAmount
  • extensionFeePerDay
  • farmRegistered
  • deployerRegistered
  • isPrivilegedUser
  • Functions
  • constructor
  • initialize
  • registerFarm
  • registerFarmDeployer
  • removeDeployer
  • updatePrivilege
  • getFarmDeployerList
  • getFarmList
  • getFeeParams
  • updateFeeParams
  • _validateNonZeroAddr

Was this helpful?

Export as PDF
  1. Demeter Protocol
  2. Technical documents
  3. Smart contracts
  4. Base contracts

FarmRegistry

PreviousFarmStorageNextFarmDeployer

Was this helpful?

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

uint256 public feeAmount;

extensionFeePerDay

uint256 public extensionFeePerDay;

farmRegistered

mapping(address => bool) public farmRegistered;

deployerRegistered

mapping(address => bool) public deployerRegistered;

isPrivilegedUser

mapping(address => bool) public isPrivilegedUser;

Functions

constructor

constructor();

initialize

constructor

function initialize(address _feeReceiver, address _feeToken, uint256 _feeAmount, uint256 _extensionFeePerDay)
    external
    initializer;

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.

function registerFarm(address _farm, address _creator) external;

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.

function registerFarmDeployer(address _deployer) external onlyOwner;

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.

function removeDeployer(uint16 _id) external onlyOwner;

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.

function updatePrivilege(address _user, bool _privilege) external onlyOwner;

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.

function getFarmDeployerList() external view returns (address[] memory);

Returns

Name
Type
Description

<none>

address[]

Returns array of registered deployer addresses.

getFarmList

Get list of farms created via registered deployer.

function getFarmList() external view returns (address[] memory);

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.

function getFeeParams(address _user) external view returns (address, address, uint256, uint256);

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.

function updateFeeParams(address _receiver, address _feeToken, uint256 _amount, uint256 _extensionFeePerDay)
    public
    onlyOwner;

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.

function _validateNonZeroAddr(address _addr) private pure;
Git Source