Opus
  • Meet Opus and CASH
  • Rewards
  • Borrowing
  • Liquidations
  • Peg Stability
  • Recovery Mode
  • Global Settlement
  • Risks
  • Resources
  • Glossary
  • Technical Documentation
    • Overview
    • Smart Contracts
      • Shrine Module
      • Abbot Module
      • Gate Module
      • Sentinel Module
      • Purger Module
      • Absorber Module
      • Controller Module
      • Equalizer Module
      • Stabilizer Module
      • Seer Module
      • Receptor Module
      • Flash Mint Module
      • Caretaker Module
      • Transmuter Module
    • Security
      • Internal
      • External
      • Emergency Procedures
    • Governance
      • Onboarding collateral
      • Monitoring collateral
      • Onboarding a reward to the Absorber
    • Deployed Contracts
Powered by GitBook
On this page
  1. Technical Documentation
  2. Smart Contracts

Controller Module

Autonomous interest rate governor

PreviousAbsorber ModuleNextEqualizer Module

Last updated 1 year ago

The Controller module autonomously adjusts the value of a global interest rate multiplier for troves based on the deviation of the spot market price from the peg price. Its goal is to minimize the peg error by adjusting the interest rate multiplier to influence the behaviour of trove owners.

The core idea of the controller is:

  • If the market price of yin goes above peg, then the multiplier should drop below 1 to encourage users to forge new yin. By decreasing interest rates across the board, it makes it cheaper for users to take on debt, thereby applying downward pressure on the market price of yin by increasing the supply of yin.

  • If the market price of yin goes below peg, then the multiplier should increase above 1 to discourage users from forging new yin and encourage trove owners to repay their existing debt. By increasing interest rates across the board, it makes it more expensive for users to take on debt, thereby applying upward pressure on the market price of yin by decreasing the supply of yin.

Specification

The controller is mostly a standard PI (Proportional-Integral) controller, except the error is first fed through a nonlinear function. This is done to better control how the controller reacts to errors of various magnitudes.

In concrete terms, thanks to this nonlinearity, the controller may not react very aggressively to an error of 0.01, but react 'disproportionately' more aggressively to an error of 0.015.

This is desirable because small deviations in the synthetic's price can happen for a number of benign reasons and should not necessarily be 'punished' by the controller, but larger deviations can be a sign of a true mismatch between supply and demand and must therefore be harshly corrected by the controller before they spiral out of control.

The Controller acts according to this formula:

y[k]=1+kpu[k]αkp1+u[k]βkp+yi[k−1]+kiu[k−1]αki1+u[k−1]βki⋅Δty[k] = 1 + k_p \frac{ u[k]^{\alpha_{kp}}}{\sqrt{1 + u[k]^{\beta_{kp}}}} + y_i[k-1] + k_i \frac{u[k-1]^{\alpha_{ki}}}{\sqrt{1 + u[k-1]^{\beta_{ki}}}} \cdot \Delta t y[k]=1+kp​1+u[k]βkp​​u[k]αkp​​+yi​[k−1]+ki​1+u[k−1]βki​​u[k−1]αki​​⋅Δt

Where:

  • u[k]u[k]u[k] is the error at time step kkk

  • y[k]y[k]y[k] is the multiplier at time step kkk

  • the term multiplied by kpk_pkp​ is the proportional term

  • yi[k−1]y_i[k-1]yi​[k−1] is the integral term at time step k−1k-1k−1

  • the term multiplied by ki k_iki​ is the integral term

  • Δt\Delta tΔt is the number of time steps that have passed since the last update to the controller

There are four parameters that can be tuned:

kpk_pkp​: the gain (i.e., multiplier/scalar) that is applied to the proportional term

kik_iki​: the gain that is applied to the integral term

αk\alpha_{k}αk​ & βk\beta_{k}βk​: control the 'severity' of the controller's reaction to price deviations from the peg in a nonlinear way