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
  • FARM_REGISTRY
  • farmImplementation
  • farmId
  • Functions
  • constructor
  • updateFarmImplementation
  • _collectFee
  • _validateNonZeroAddr
  • Events
  • FarmCreated
  • FeeCollected
  • FarmImplementationUpdated
  • Errors
  • InvalidAddress
  • NewFarmImplementationSameAsOld

Was this helpful?

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

FarmDeployer

PreviousFarmRegistryNextFeatures

Was this helpful?

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

Name
Type
Description

_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

Name
Type
Description

_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();
Git Source