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
  • Gauge Controller
  • Gauge SPA Reward Manager
  • Bribe Contract

Was this helpful?

Export as PDF
  1. FAQ
  2. Deprecated functions
  3. [Deprecated] Sperax Gauge

How does it work?

Last updated 2 years ago

Was this helpful?

Sperax Gauge functions with 3 main contracts, Gauge Controller which tracks the gauges and user votes, SPA Rewarder which allocates rewards based on votes and Bribe contracts which help is distributing bribe tokens for each gauge.

Gauge Controller

Gauge Controller contract tracks the list of all gauges. It tracks user votes, gauge weights, typeWeights and totalWeights. There can be multiple gauge types, and each gauge type can have multiple gauges.

Voting in gauge

  • Voting cycle is 1 Week, that is every week on THURSDAY 00:00 UTC, a snapshot of the vote is taken and SPA emission is done based on the relative votes of these gauges

  • Any user with a veSPA balance > 0, lock-expiry > start of next-cycle will be eligible to use their veSPA to vote on multiple gauges. Else the user needs to create a new stake position

  • veSPA holder with manual-cooldown and in residual period is not eligible to cast vote. Users in this case need to activate cooldown, withdraw and stake their SPA again.

  • In a scenario where a user increases his/her wallet’s veSPA balance by either increasing the SPA stake or increasing the expiry time, their existing vote weights for a gauge won’t change unless the user votes again for the gauge.

  • Users can define the weight they want to vote on a specific gauge out of 100.

  • Users can change their vote weights for a gauge in an interval of 6 days.

Formula used

Gauge SPA Reward Manager

Reward manager contract is responsible for emitting SPA rewards for all the registered gauges after voting is done for a week. It has a parameter to control global SPA Emission Rate per week (E) across all farms in Demeter (listed in GaugeController). Total SPA for emission will be funded to this contract. It will calculate the Relative weight of each gauge (wr) from the votes received by the gauge and total votes in the cycle. Based on Relative weight of a gauge and globalSPAEmissionRate, emission for each gauge will be determined.

  • Eligibility for reward - A farm should have a relative weight > T to be eligible for reward distribution for a cycle. (T is an updateable param, within 10000).

  • Reward distribution - Rewards are distributed to the farms using a public distributeReward() which can be called by anyone. distributeReward() is callable only once every reward cycle. If the distributeRewards function is not called for a gauge for a given cycle, there is no reward for the gauge for that week.

Formula used:

Bribe Contract

Protocols will use this contract to bribe the veSPA holders to vote for their gauges. Bribes will incentivize veSPA holders to vote for specific gauges increasing the SPA emission for that gauge, leading to higher APR for that farm. The bribe goes to veSPA holders who vote on emissions for the gauge. Voteshare is calculated at the time of closing of the vote cycle. Bribe token is distributed in proportion to user’s veSPA weights that they have used to vote in the farm. Whenever a user updates/ votes for a specific gauge, the user claims the pending bribe rewards.

While adding a new gauge contract in the Gauge controller, a bribe contract is deployed, and mapped to the gauge. Bribe tokens are registered to the contract on request. Anyone can add bribe rewards for the gauge for at max 10 voting cycles. Once a bribe contract is funded, it is not allowed to recover the funds. Funds are withdrawable only in case of emergencies.

Formula used:

UserVoteWeight = vvv (User’s vote weight for a gauge)

GaugeWeight = wg=wg0+∑vjwg = wg_0 + \sum{v_j}wg=wg0​+∑vj​ (where wg0wg_0wg0​ is the base weight for the gauge which remains constant and the other component is variable and decided by the user votes)

TypeWeight = ttt (TypeWeight acts like a multiplier for splitting rewards in between the different gauge types)

TypeSum = s=∑wgis = \sum{wg_i}s=∑wgi​ (where wgiwg_iwgi​ is gauge weight and sss captures the sum of all the gauges belonging to a particular type)

TotalWeight = W=∑sk∗tkW = \sum s_k * t_kW=∑sk​∗tk​ (Captures the total vote weight across all the gauge types)

globalSPAEmissionRate = EEE

Relative weight of a gauge = wr=wgWw_r = {\cfrac{wg}{W}}wr​=Wwg​ (wg0wg_0wg0​ is the weight of the gauge and W is the TotalWeight for the cycle)

Emission for a gauge = e=E∗wre = E * w_re=E∗wr​

Next reward time = tnt_ntn​ (Start of the next reward cycle)

Current time = t0t_0t0​ (Current block timestamp)

Reward rate = r=etn−t0r = \cfrac{e}{t_n - t_0}r=tn​−t0​e​

Bribe rewards for a week = bbb

User’s vote weight = vvv

Total vote weight for a gauge = wgwgwg

User’s bribe reward share for the week = b∗vwgb* \cfrac{v}{wg}b∗wgv​