Overview of RAI Rewards for Pinger Bots

RAI Rewards Module

The RAI protocol has a number of components that need to be called periodically to maintain the system’s health. In order to be fully autonomous, the aforementioned components reward addresses that call them using the rewards module. Rewards are paid in RAI offered by the Stability Fee Treasury.

Calls to these components need to be profitable (pay for the cost of gas and reward the caller) or else the system can be at risk of not having crucial updates performed. RAI rewards for each component are updated periodically using “reward adjuster” contracts. The reward adjuster contracts take into consideration the latest ETH price, the gas cost of calling each function and a gas price.

Currently, a fixed gas price is used for all reward recalculations due to the absence of a proper gas TWAP feed. This method could/should be replaced in the future once a reliable and inexpensive gas price oracle becomes available on Ethereum L1.

Functions that Pay Callers with RAI

  • DEBT_POPPER_REWARDS - getRewardForPop(uint256,address)

    Bad debt (confiscated by liquidations) is pushed into a debt queue and sits there for a predetermined delay to allow for collateral auctions to settle. Debt can be popped from the queue after the delay for each debt block passes.

  • GEB_RRFM_SETTER_RELAYER - relayRate(uint256,address)

    This function can only be called from GEB_RRFM_SETTER. This function is critical to the system, as it updates the redemption rate.

  • MEDIANIZER_RAI_REWARDS_RELAYER - reimburseCaller(address)

    This function is called by MEDIANIZER_RAI whenever an external call to updateResult() is made.

  • MEDIANIZER_ETH_REWARDS_RELAYER - reimburseCaller(address)

    This function is called by MEDIANIZER_ETH whenever an external call to updateResult() is made. It updates the ETH price.

  • FSM_WRAPPER_ETH - renumerateCaller(address)

    This is a rewards relayer for calls made to FEED_SECURITY_MODULE_ETH, function updateResult().

  • GEB_SINGLE_CEILING_SETTER - autoUpdateCeiling(address)

    Updates the collateral debt ceiling for ETH-A.

  • COLLATERAL_AUCTION_THROTTLER - recomputeOnAuctionSystemCoinLimit(address)

    Updates onAuctionSystemCoinLimit, based on current global debt amount.

  • GEB_DEBT_FLOOR_ADJUSTER - recomputeCollateralDebtFloor(address)

    Updates every Safe’s debt floor to ensure liquidations are profitable.

  • GEB_AUTO_SURPLUS_BUFFER - adjustSurplusBuffer(address)

    Updates the surplus buffer based on latest global debt.

  • GEB_DEBT_AUCTION_INITIAL_PARAM_SETTER - setDebtAuctionInitialParameters(address)

    Recomputes both debtAuctionBidSize and initialDebtAuctionMintedTokens. The contract adjusts both parameters according to changes in price on both RAI and FLX.

  • GEB_AUTO_SURPLUS_AUCTIONED - recomputeSurplusAmountAuctioned(address)

    Adjusts surplusAuctionAmountToSell in the Accounting Engine.

Reward Distribution Implementations

Rewards paying contracts inherit one of several implementations outlined below, or rely on an external contract that pays function callers rewards relayer. All implementations live in this repository. Several different flavors of reimbursement contracts exist, including different setups, that can be inherited or can be deployed separately. Reward contracts can be put in two buckets:

  • Fixed Rewards: pay a fixed RAI reward to function callers (pre computed cost of call + a margin on top, currently set to +30%). Only used on DEBT_POPPER_REWARDS.
  • Increasing Rewards: pay an increasing RAI reward to function callers, all are currently set to start at the gas cost of the call, and increase to 200% of the cost.

Reward Adjustment Contracts

In order to ensure RAI rewards for calling different functions are adjusted periodically and do not become unprofitable due to ETH price movements or high gas prices, there’s a set of contracts called “reward adjusters” which are meant to adjust those rewards. Adjusters can be called by anyone although they do not give out RAI rewards by themselves.

When a reward adjuster is called, it will also call the Treasury Param Adjuster contract (detailed in a section below).

When adding a reward paying contract in the reward bundlers, it is important to set it up in the Treasury Core Parameter Adjuster as well. Templates for adding new reward paying contracts in a reward bundler and the treasury param adjuster are available in the Dao Governance Actions repository.

Rewards Adjusters

There are two rewards adjusters currently in production:


    Adjusts rewards for fixed rewards contracts (currently only the Debt Popper Rewards). When called, it will adjust the RAI reward offered by each contract it has whitelisted. It will then adjust each whitelisted contract’s allowance in the Stability Fee Treasury and then call the Treasury Core Param Adjuster.


    Has similar logic to the Fixed version but it is used for contracts that offer an increasing RAI reward. It will set a minimum and maximum reward in each of its whitelisted contracts, an allowance to pull RAI from the SF Treasury and it will then call the Treasury Param Adjuster (passing the max reward in the case of each contract as a parameter).

Treasury Param Adjuster


    This contract is called by rewards adjusters on every adjustment. It is meant to keep track of the maximum reward offered to each contract.

    The function setNewTreasuryParameters() is public and it can be called by anyone. It sets treasuryCapacity, minimumFundsRequired and pullFundsMinThreshold on the Stability Fee Treasury, ensuring funds are available to pay for all calls that grant a reward to the caller.

  • treasuryCapacity: maximum amount of RAI that can be kept in the treasury at any time; ensures the treasury doesn’t keep too many funds which can instead be used in the surplus buffer

  • minimumFundsRequired: minimum amount of RAI that should be kept in the treasury

  • pullFundsMinThreshold: minimum amount of RAI that must be in the treasury so that someone can call pullFunds

Treasury Resetter


    This is an auxiliary contract that sets a RAI reward receiver’s totalAllowance in the Stability Fee Treasury to type(uint).max. The only requirement for an address to have its totalAllowance reset is that it has a non nullperBlockAllowance.
1 Like