Sperax
Search
K

# How does it work?

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

• UserVoteWeight =
$v$
(User’s vote weight for a gauge)
• GaugeWeight =
$wg = wg_0 + \sum{v_j}$
(where
$wg_0$
is the base weight for the gauge which remains constant and the other component is variable and decided by the user votes)
• TypeWeight =
$t$
(TypeWeight acts like a multiplier for splitting rewards in between the different gauge types)
• TypeSum =
$s = \sum{wg_i}$
(where
$wg_i$
is gauge weight and
$s$
captures the sum of all the gauges belonging to a particular type)
• TotalWeight =
$W = \sum s_k * t_k$
(Captures the total vote weight across all the gauge types)

## 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:

• globalSPAEmissionRate =
$E$
• Relative weight of a gauge =
$w_r = {\cfrac{wg}{W}}$
(
$wg_0$
is the weight of the gauge and W is the TotalWeight for the cycle)
• Emission for a gauge =
$e = E * w_r$
• Next reward time =
$t_n$
(Start of the next reward cycle)
• Current time =
$t_0$
(Current block timestamp)
• Reward rate =
$r = \cfrac{e}{t_n - t_0}$

## 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:

• Bribe rewards for a week =
$b$
• User’s vote weight =
$v$
• Total vote weight for a gauge =
$wg$
• User’s bribe reward share for the week =
$b* \cfrac{v}{wg}$