# Reward Logic

Tokemak's reward logic governs the rewards for LDs and LPs. Its main goals are:

- Balancing the demand of the Liquidity Directors (LDs) with what deployments would be most efficient for the system
- Optimizing rewards based on the performance of the Reactors
- Modulation of the impact that the difference in performance between reactors has in the overall rewards allocation

The overall quantity of TOKE rewards allocated to both LDs and LPs is determined using the rewards earned by Tokemak's deployment of LP tokens from a Token Reactor (using a 8-week rolling average, split between LDs and LPs) and a base allocation of rewards.

The LD reward allocation to specific reactors takes into account the votes allocated by LDs and the Optimal Allocation (the theoretical optimal allocation of votes desired by the protocol required to maximize performance), and gives them appropriate weighting. A set of additional parameters modulates the impact of the relative reactor performance on the rewards allocated to a specific reactor.

LDs will receive the maximum amount of rewards when allocating their votes according to the Optimal Allocation. The amount of liquidity provided by LPs has no impact on the rewards LDs earn by allocating votes to a Reactor.

**Definition of Variables and Parameters**

Variables:

- i is the i-th Reactor
- ld is the percentage of overall votes allocated by the LDs

Parameters:

**a**is the lower bound of**Rew**taken into account**b**is the upper bound of**Rew**taken into account**c**is the tightening factor**i**is the i-th Reactor**ld(i)**is the percentage of total votes voted to Token Reactor i**amin**is the minimum rate of return taken into account (lower bound)**amax**is the maximum rate of return taken into account (upper bound)**c**is the tightening factor**Rew**is the rewards rate of the Reactor. A reactor's expected rewards rate is calculated as the trailing 30-day average reward rate adjusted by the 1-year (or max available) reward rate volatility (standard deviation). For pairs that are deployed to more than one liquidity pool (e.g. Sushiswap and Uniswap) the rewards rates are weighted according to the size of the pool.**Rew_a**is constrained by the min/max parameters of a Reactor (amin / amax)**Rew_b**is the constrained rate of rewards of a Reactor adjusted by the tightening factor c

**Opt(i)**is the optimal allocation of votes to Token Reactor i**r_ld(i)**is the % share of rewards earned by the LDs in Token Reactor i this cycle**R_ld**is the maximum quantity of TOKE rewards budgeted to LDs each cycle

**Liquidity Director Equations**

In order to define the actual rewards paid out to LDs of i-th Reactor, we first constrain the parameter Rew of i-th Reactor in two steps by defining Rew_a and Rew_b as

$\begin{aligned}Rew\_ a_{(i)}=&min(max(Rew_{(i)},a),b)\\ M=&\{ x:x\ is\ Rew\_ a\} \end{aligned}$

$\begin{aligned}Rew\_ b_{(i)}=&Rew\_ a_{(i)}-minM+c\\ N=&\{ x:x\ is\ Rew\_ b\} \end{aligned}$

Then, the optimal % allocation of votes Opt(i) (optimal vote allocation) for the i-th Reactor is defined by

$Opt_{(i)}=\frac{Rew\_ b_{(i)}}{\sum N}$

The % share of rewards paid out to the i-th Reactor is calculated using the following equation:

$r\_ ld_{(i)}=ld^{\frac{2}{3} }_{(i)}\times Opt^{\frac{1}{3} }_{(i)}$

Finally, the reward amount for LDs the i-th Reactor are given by

$R\_ ld_{(i)}=R\_ ld\times r\_ ld_{(i)}$

- The overall amount of rewards allocated to LDs is determined by the performance of the Reactors and has a baseline of rewards.
- The share of rewards earned by the LDs is determined by the LD reward logic which balances:
- the optimal vote allocation (“How would the protocol distribute the LD votes based on the performance of the reactors?”)
- the votes allocated by the LDs (“What do the LDs want regardless of the performance of the reactors?”)

Schematic of the LD reward logic

In the new logic, whereas LD rewards are not impacted by the LP side of the Reactor, LP rewards are impacted by the factors responsible for the rewards given out in the LD side of the Reactor.

While this is very similar to the original “balance the reactors” logic, it now takes into account the optimal allocation Opt(i) as defined in the LD reward logic.

**Definition of Variables and Parameters**

**i**is the i-th Reactor**lp(i)**is the % of the overall LP Reactor assets in the i-th Reactor (normalized to $ terms)**ld(i)**is the percentage of total votes voted to Token Reactor i**Opt(i)**is the optimal allocation of votes to Token Reactor i**r_lp(i)**is the % share of rewards earned by the LPs in Token Reactor i this cycle**R_lp**is the maximum quantity of TOKE rewards budgeted to LPs each cycle**R_lp(i)**is the quantity of rewards earned by LPs of Token Reactor i this cycle

**Liquidity Provider Equations**

The % share of rewards paid out to the i-th Reactor is calculated using the following equation:

$r\_ lp_{(i)}=lp^{\frac{1}{3} }_{(i)}\times ld^{\frac{1}{3} }_{(i)}\times Opt^{\frac{1}{3} }_{(i)}$

Note that the share of rewards r_lp (i) makes use of the optimal allocation Opt (i).
Finally, the reward amount for LPs in the i-th Reactor are given by

$R\_ lp_{(i)}=r\_ lp_{(i)}\times R\_ lp$

The overall amount of rewards allocated to LPs is determined by the percentage of the overall Token Reactor TVL the Token Reactor represents, the percentage of votes allocated to the Reactor by the LDs and the optimal vote allocation.

Schematic of the LP reward logic