RebaseManager

Git Source

Inherits: IRebaseManager, Ownable

Author: Sperax Foundation

This contract handles the configuration and execution of the rebasing mechanism for the USDs stablecoin. It ensures that rebases occur only when certain prerequisites are fulfilled, such as the time gap between rebases and acceptable APR (Annual Percentage Rate) ranges.

The Rebase Manager coordinates with the Vault and Dripper contracts to manage the rebase process.

State Variables

ONE_YEAR

uint256 private constant ONE_YEAR = 365 days;

vault

address public vault;

dripper

address public dripper;

gap

uint256 public gap;

aprCap

uint256 public aprCap;

aprBottom

uint256 public aprBottom;

lastRebaseTS

uint256 public lastRebaseTS;

Functions

onlyVault

modifier onlyVault();

constructor

Constructor to initialize the Rebase Manager

constructor(address _vault, address _dripper, uint256 _gap, uint256 _aprCap, uint256 _aprBottom);

Parameters

NameTypeDescription

_vault

address

Address of the vault contract

_dripper

address

Address of the dripper contract for collecting USDs

_gap

uint256

Minimum time gap required between two consecutive rebases

_aprCap

uint256

Maximum allowed APR for a rebase

_aprBottom

uint256

Minimum allowed APR for a rebase

fetchRebaseAmt

Get the current amount valid for rebase

Function is called by the vault while rebasing

function fetchRebaseAmt() external onlyVault returns (uint256);

Returns

NameTypeDescription

uint256

The available amount for rebasing USDs

updateVault

Updates the vault address

function updateVault(address _newVault) public onlyOwner;

Parameters

NameTypeDescription

_newVault

address

Address of the new vault contract

updateDripper

Updates the dripper contract for USDs vault

function updateDripper(address _dripper) public onlyOwner;

Parameters

NameTypeDescription

_dripper

address

Address of the new dripper contract

updateGap

Update the minimum time gap required between two rebases

function updateGap(uint256 _gap) public onlyOwner;

Parameters

NameTypeDescription

_gap

uint256

Updated gap time

updateAPR

Update the APR requirements for each rebase

function updateAPR(uint256 _aprBottom, uint256 _aprCap) public onlyOwner;

Parameters

NameTypeDescription

_aprBottom

uint256

New minimum APR for a rebase

_aprCap

uint256

New maximum APR for a rebase

getAvailableRebaseAmt

Gets the current available rebase fund

function getAvailableRebaseAmt() public view returns (uint256);

Returns

NameTypeDescription

uint256

Current balance in the vault plus collectable dripped USDs amount

getMinAndMaxRebaseAmt

Gets the minimum and maximum rebase USDs amount based on the APR config

function getMinAndMaxRebaseAmt() public view returns (uint256, uint256);

Returns

NameTypeDescription

uint256

Minimum and maximum rebase amounts

uint256

Events

VaultUpdated

event VaultUpdated(address vault);

DripperUpdated

event DripperUpdated(address dripper);

GapUpdated

event GapUpdated(uint256 gap);

APRUpdated

event APRUpdated(uint256 aprBottom, uint256 aprCap);

Errors

CallerNotVault

error CallerNotVault(address caller);

InvalidAPRConfig

error InvalidAPRConfig(uint256 aprBottom, uint256 aprCap);

Last updated