IWithdrawController
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
Name | Type | Description |
---|---|---|
assets | uint256 | The 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
Name | Type | Description |
---|---|---|
shares | uint256 | The 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
Name | Type | Description |
---|---|---|
assets | uint256 | The amount of assets to withdraw. |
Returns
Name | Type | Description |
---|---|---|
shares | uint256 | The 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
Name | Type | Description |
---|---|---|
shares | uint256 | The amount of shares to burn. |
Returns
Name | Type | Description |
---|---|---|
assets | uint256 | The 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
Name | Type | Description |
---|---|---|
sender | address | |
assets | uint256 | The amount of assets to withdraw. |
receiver | address | The address that will receive the assets. |
owner | address | The address of the owner of the assets. |
Returns
Name | Type | Description |
---|---|---|
shares | uint256 | The amount of shares to burn. |
fees | uint256 | The 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;