​Gem Farm lets you offer a yield-bearing facility to loyal NFT ("gem" πŸ’Ž) stakers.
IMPORTANT: as it currently stands, Gem Farm is unaudited software. We're looking for community members to help review the protocol, or projects to help fund a professional audit.


  • Anyone with a wallet can start a farm
  • Each new farm automatically starts an instance of Gem Bank, used for storing the staked NFTs
  • Each farm comes with a bunch of config knobs you can turn, such as minimum staking period, and cooldown period
  • When starting a farm you can decide on up to 2 rewards. For each one you choose:
    • Reward mint
    • Reward type - fixed or variable
  • As of right now, after the farm has been started, the above can't be changed. This is done for security reasons
    • Although the reward mint / type can't be changed - the actual schedules / amounts absolutely can!
    • Worst case you start a new farm with new mints / types
  • After the farm is ready, you as the farm manager authorize one or multiple funders (could be just you), who fund the rewards pots with $$ and configure the reward schedule
  • Users show up and register as farmers. Once registered they can stake / unstake & claim rewards
    • Claiming can be done at any point without them having to unstake
  • Any unused rewards can be cancelled
  • There is also an option to lock rewards in place, to effectively "guarantee" them to users
  • Reward distribution depends on both gems staked, and gem rarity​

Farm Config

  • As the farm manager it is possible to configure the following variables for the farm:
    • Min staking period - after staked, gems can't be unstaked until this number of seconds passes
    • Min cooldown period - after unstaked, gems can't be withdrawn until they complete a "cooldown" period of this many seconds
    • Unstaking fee - an additional fee, in lamports, charged on unstaking
  • These are set at farm initialization, but can also be tweaked later (which would affect future stakers, but not past)
  • Note: this is in addition to configuring reward schedules by funders, described below

Max Counts

  • This is a new feature since Feb-22
  • You can now set any of:
    • max farmer count per farm
    • max gem count per farm
    • max rarity point per farm
  • All of the above are optional, but if you configure any of them they will be checked
    • Eg you could say you only want to allow 200 farmers to stake on your farm. Once that count is reached, further staking instructions will fail
  • Max counts can be configured both during initialization of the farm - and during farm update
    • Both require farm manager to sign off
  • To see how it works see this test file​

Funder lifecycle

  • A funder account needs to be authorized by the farm manager before they can deposit reward funds into one of the reward pots
  • When depositing, the funder also specifies a funding schedule - which can be fixed or variable
    • Each comes with its own config knobs explained in detail below
  • Regardless of the schedule, the Funder specifies 2 things:
    • Total reward amount
    • Total reward duration
  • Amount -
    • Is added to any previously unused rewards (eg if 1000 was deposited, but only 200 accrued to stakers, 800 is available for next funding cycle)
    • Can limit the number of total stakers (fixed rewards)
  • Duration -
    • Dictates for how long the current funding schedule will be active
    • Anyone who stakes before the end of the schedule, will get a proportional amount of rewards attributed to them - anyone who stakes after gets nothing
  • After the initial funding, the farm manager / funder have a number of options:
    • Do nothing - farmers will be able to stake / unstake / claim current rewards
    • Cancel the reward - any rewards not yet accrued / promised (fixed rate concept) will be returned, and reward end will be set to current timestamp
    • Fund another reward - new duration can be specified, which can be shorter or longer than the current one, and new funding added to existing
    • Lock reward - this sets lock timestamp = reward end timestamp. After set, there is no way for the farm manager to withdraw the funding until after reward end passes

Farmer lifecycle

  • The user (farmer) starts by initializing a new farmer acount. This is used to store all the data associated with them, such as how long they've been staking for
  • Next they deposit their gems into the vault
    • You as the farm manager can restrict what NFTs can / can't go into the vault
    • That's because under the hood Gem Farm uses Gem Bank, with all of its wonderful features​
  • Finally they click "stake". This locks up the vault and starts accruing any rewards that are currently funded
  • Farmers can claim their rewards anytime, without unstaking
    • There is no minimum claim amount, as long as it's >0, Farmer gets a payout
    • Both rewards are claimed at the same time, it's not possible to only do one
  • When the farmer is done staking, they hit "unstake". This unlocks the vault and let's them withdraw their gems
  • Note: the above steps map to how the code works, but as the front end dev you can hide many of these steps from the user. Eg you can init a new Farmer account, deposit their gems, and lock their vault all in a single click

Farm Treasury

  • The only type of fee currently collected by the farm treasury is the unstaking fee
  • Payouts can be made from the treasury to any address, for any amount (within what's accumulated ofc) by the farm manager
Copy link
On this page
Farm Config
Max Counts
Funder lifecycle
Farmer lifecycle
Farm Treasury