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

fetchRebaseAmt

Get the current amount valid for rebase

Function is called by the vault while rebasing

function fetchRebaseAmt() external onlyVault returns (uint256);

Returns

updateVault

Updates the vault address

function updateVault(address _newVault) public onlyOwner;

Parameters

updateDripper

Updates the dripper contract for USDs vault

function updateDripper(address _dripper) public onlyOwner;

Parameters

updateGap

Update the minimum time gap required between two rebases

function updateGap(uint256 _gap) public onlyOwner;

Parameters

updateAPR

Update the APR requirements for each rebase

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

Parameters

getAvailableRebaseAmt

Gets the current available rebase fund

function getAvailableRebaseAmt() public view returns (uint256);

Returns

getMinAndMaxRebaseAmt

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

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

Returns

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