Skip to main content

OlympusTreasury

Git Source

Inherits: TRSRYv1, ReentrancyGuard

Treasury holds all other assets under the control of the protocol.

Functions​

constructor​

constructor(Kernel kernel_) Module(kernel_);

Parameters

NameTypeDescription
kernel_Kernel

KEYCODE​

5 byte identifier for a module.

function KEYCODE() public pure override returns (Keycode);

Returns

NameTypeDescription
<none>Keycode

VERSION​

Returns which semantic version of a module is being implemented.

function VERSION() external pure override returns (uint8 major, uint8 minor);

Returns

NameTypeDescription
majoruint8- Major version upgrade indicates breaking change to the interface.
minoruint8- 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

NameTypeDescription
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

NameTypeDescription
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

NameTypeDescription
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

NameTypeDescription
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

NameTypeDescription
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

NameTypeDescription
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

NameTypeDescription
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

NameTypeDescription
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

NameTypeDescription
token_ERC20

Returns

NameTypeDescription
<none>uint256