ITreasury

Git Source

Functions

asset

Returns the address of the single underlying asset token used by the treasury for accounting, depositing, and withdrawing.

function asset() external view returns (address);

Returns

NameTypeDescription
<none>addressThe address of the underlying asset token

totalAssets

Returns the total amount of the single underlying asset that is managed by the treasury.

function totalAssets() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The total amount of the underlying asset

previewWithdraw

Calculates the amount of the underlying asset that would be returned from burning the given amount of shares.

function previewWithdraw(uint256 shares) external view returns (uint256);

Parameters

NameTypeDescription
sharesuint256The amount of shares to calculate assets for

Returns

NameTypeDescription
<none>uint256The amount of underlying asset that would be returned

deposit

Deposits the underlying asset into the treasury and mints shares to the receiver. Only callable by the Valocracy contract.

function deposit(address receiver, uint256 shares) external;

Parameters

NameTypeDescription
receiveraddressThe address that will receive the shares
sharesuint256The amount of shares to mint

withdraw

Withdraws the underlying asset from the treasury by burning shares. Transfers the corresponding amount of the underlying asset to the receiver.

function withdraw(address receiver, uint256 shares) external;

Parameters

NameTypeDescription
receiveraddressThe address that will receive the underlying asset
sharesuint256The amount of shares to burn

Events

Deposit

Emitted when a new deposit of the underlying asset is made.

event Deposit(address indexed receiver, uint256 shares);

Parameters

NameTypeDescription
receiveraddressThe address that received the shares
sharesuint256The amount of shares minted

Withdraw

Emitted when a withdrawal of the underlying asset is made.

event Withdraw(address indexed owner, address indexed receiver, uint256 assets, uint256 shares);

Parameters

NameTypeDescription
owneraddressThe address that burned the shares
receiveraddressThe address that received the underlying asset
assetsuint256The amount of underlying asset withdrawn
sharesuint256The amount of shares burned

Errors

NotAuthorized

Emitted when a non-authorized account attempts to call a function.

error NotAuthorized(address caller);