OlympusTreasury
Inherits: TRSRYv1, ReentrancyGuard
Treasury holds all other assets under the control of the protocol.
Functions
constructor
constructor(Kernel kernel_) Module(kernel_);
Parameters
| Name | Type | Description |
|---|---|---|
| kernel_ | Kernel |
KEYCODE
5 byte identifier for a module.
function KEYCODE() public pure override returns (Keycode);
Returns
| Name | Type | Description |
|---|---|---|
| <none> | Keycode |
VERSION
Returns which semantic version of a module is being implemented.
function VERSION() external pure override returns (uint8 major, uint8 minor);
Returns
| Name | Type | Description |
|---|---|---|
| major | uint8 | - Major version upgrade indicates breaking change to the interface. |
| minor | uint8 | - Minor version change retains backward-compatible interface. |
increaseWithdrawApproval
Increase approval for specific withdrawer addresses
function increaseWithdrawApproval(
address withdrawer_,
ERC20 token_,
uint256 amount_
) external override permissioned;
Parameters
| Name | Type | Description |
|---|---|---|
| withdrawer_ | address | |
| token_ | ERC20 | |
| amount_ | uint256 |
decreaseWithdrawApproval
Decrease approval for specific withdrawer addresses
function decreaseWithdrawApproval(
address withdrawer_,
ERC20 token_,
uint256 amount_
) external override permissioned;
Parameters
| Name | Type | Description |
|---|---|---|
| withdrawer_ | address | |
| token_ | ERC20 | |
| amount_ | uint256 |
withdrawReserves
Allow withdrawal of reserve funds from pre-approved addresses.
function withdrawReserves(
address to_,
ERC20 token_,
uint256 amount_
) public override permissioned onlyWhileActive;
Parameters
| Name | Type | Description |
|---|---|---|
| to_ | address | |
| token_ | ERC20 | |
| amount_ | uint256 |
increaseDebtorApproval
Increase approval for someone to accrue debt in order to withdraw reserves.
Debt will generally be taken by contracts to allocate treasury funds in yield sources.
function increaseDebtorApproval(
address debtor_,
ERC20 token_,
uint256 amount_
) external override permissioned;
Parameters
| Name | Type | Description |
|---|---|---|
| debtor_ | address | |
| token_ | ERC20 | |
| amount_ | uint256 |
decreaseDebtorApproval
Decrease approval for someone to withdraw reserves as debt.
function decreaseDebtorApproval(
address debtor_,
ERC20 token_,
uint256 amount_
) external override permissioned;
Parameters
| Name | Type | Description |
|---|---|---|
| debtor_ | address | |
| token_ | ERC20 | |
| amount_ | uint256 |
incurDebt
Pre-approved policies can get a loan to perform operations with treasury assets.
function incurDebt(
ERC20 token_,
uint256 amount_
) external override permissioned onlyWhileActive;
Parameters
| Name | Type | Description |
|---|---|---|
| token_ | ERC20 | |
| amount_ | uint256 |
repayDebt
Repay a debtor debt.
Only confirmed to safely handle standard and non-standard ERC20s.
Can have unforeseen consequences with ERC777. Be careful with ERC777 as reserve.
function repayDebt(
address debtor_,
ERC20 token_,
uint256 amount_
) external override permissioned nonReentrant;
Parameters
| Name | Type | Description |
|---|---|---|
| debtor_ | address | |
| token_ | ERC20 | |
| amount_ | uint256 |
setDebt
An escape hatch for setting debt in special cases, like swapping reserves to another token.
function setDebt(
address debtor_,
ERC20 token_,
uint256 amount_
) external override permissioned;
Parameters
| Name | Type | Description |
|---|---|---|
| debtor_ | address | |
| token_ | ERC20 | |
| amount_ | uint256 |
deactivate
Emergency shutdown of withdrawals.
function deactivate() external override permissioned;
activate
Re-activate withdrawals after shutdown.
function activate() external override permissioned;
getReserveBalance
Get total balance of assets inside the treasury + any debt taken out against those assets.
function getReserveBalance(ERC20 token_) external view override returns (uint256);
Parameters
| Name | Type | Description |
|---|---|---|
| token_ | ERC20 |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | uint256 |