IWithdrawController

Git Source

This contract manages the withdrawal and redemption fees for users in the tranches.

The contract calculates fees, handles withdrawal, and allows setting of withdrawal fee rates.

Functions

withdrawFeeRate

function withdrawFeeRate() external view returns (uint256);

maxWithdraw

A user cannot withdraw in the live status.

function maxWithdraw(address owner) external view returns (uint256 assets);

Returns

NameTypeDescription
assetsuint256The max amount of assets that the user can withdraw.

maxRedeem

A user cannot redeem in the live status.

function maxRedeem(address owner) external view returns (uint256 shares);

Returns

NameTypeDescription
sharesuint256The max amount of shares that the user can burn to withdraw assets.

previewWithdraw

Preview the amount of shares to burn to withdraw the given amount of assets.

It always rounds up the result. e.g. 3/4 -> 1.

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

Parameters

NameTypeDescription
assetsuint256The amount of assets to withdraw.

Returns

NameTypeDescription
sharesuint256The amount of shares to burn.

previewRedeem

Preview the amount of assets to receive after burning the given amount of shares.

function previewRedeem(uint256 shares) external view returns (uint256 assets);

Parameters

NameTypeDescription
sharesuint256The amount of shares to burn.

Returns

NameTypeDescription
assetsuint256The amount of assets to receive.

onWithdraw

Executes the withdrawal process, returning the amount of shares to burn and fees.

The sender and owner parameters are not used in this implementation.

function onWithdraw(
    address sender,
    uint256 assets,
    address receiver,
    address owner
)
    external
    returns (uint256 shares, uint256 fees);

Parameters

NameTypeDescription
senderaddress
assetsuint256The amount of assets to withdraw.
receiveraddressThe address that will receive the assets.
owneraddressThe address of the owner of the assets.

Returns

NameTypeDescription
sharesuint256The amount of shares to burn.
feesuint256The amount of fees to be paid.

onRedeem

function onRedeem(
    address sender,
    uint256 shares,
    address receiver,
    address owner
)
    external
    returns (uint256 assets, uint256 fees);

setWithdrawFeeRate

function setWithdrawFeeRate(uint256 _withdrawFeeRate) external;