Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

RampAController

Git Source

Inherits: IRampAController, Initializable, OwnableUpgradeable

Contract for managing gradual changes to A coeff (A) parameter Allows for smooth transitions between different A values.

State Variables

MAX_A

uint256 private constant MAX_A = 10 ** 6;

DEFAULT_RAMP_TIME

uint256 private constant DEFAULT_RAMP_TIME = 30 minutes;

initialA

uint256 public override initialA;

futureA

uint256 public override futureA;

initialATime

uint256 public override initialATime;

futureATime

uint256 public override futureATime;

minRampTime

uint256 public minRampTime;

Functions

constructor

constructor();

initialize

Initializer for RampAController

function initialize(uint256 _initialA, uint256 _minRampTime, address _owner) external initializer;

Parameters

NameTypeDescription
_initialAuint256is the initial value of A
_minRampTimeuint256is min ramp time
_owneraddressis the address of the owner

setMinRampTime

Set the minimum ramp time (default is 30 minutes)

function setMinRampTime(uint256 _minRampTime) external onlyOwner;

Parameters

NameTypeDescription
_minRampTimeuint256is the new minimum ramp time

rampA

Initiate a ramp to a new A value

function rampA(uint256 _futureA, uint256 _futureTime) external override onlyOwner;

Parameters

NameTypeDescription
_futureAuint256is the target value of A
_futureTimeuint256is UNIX timestamp when the ramp should complete

stopRamp

Force-stop ramping A coeff

function stopRamp() external override onlyOwner;

isRamping

Check if ramping in progress

function isRamping() external view override returns (bool);

Returns

NameTypeDescription
<none>booltrue if it is, false otherwise

getA

Public getter which is used in SPA

function getA() public view override returns (uint256);

Returns

NameTypeDescription
<none>uint256the current value of A coeff

Events

RampInitiated

event RampInitiated(uint256 initialA, uint256 futureA, uint256 initialATime, uint256 futureATime);

RampStopped

event RampStopped(uint256 currentA);

MinRampTimeUpdated

event MinRampTimeUpdated(uint256 oldValue, uint256 newValue);

Errors

InvalidFutureTime

error InvalidFutureTime();

RampAlreadyInProgress

error RampAlreadyInProgress();

NoOngoingRamp

error NoOngoingRamp();

AOutOfBounds

error AOutOfBounds();

InsufficientRampTime

error InsufficientRampTime();

Unauthorized

error Unauthorized();