This section outlines the operational steps for initiating and completing a withdrawal from an ERC20-based Byzantine Vault.
0. Preview the Withdrawal
Estimate how many shares are needed or what amount you’ll receive using:
function previewWithdraw(uint256 assets) external view returns (uint256 shares);
function previewRedeem(uint256 shares) external view returns (uint256 assets);
This step helps avoid errors and ensures correct share approvals.
1. Call withdraw() or redeem()
This function initiates the withdrawal and locks the shares in the vault while the protocol processes the request.
You can call 2 functions :
withdraw() is used when the user specifies the amount of assets they want to withdraw, and the contract calculates the corresponding number of shares to redeem.
redeem() is used when the user specifies the number of shares they want to redeem, and the contract calculates the amount of assets they will receive. In both cases, the function locks the shares in the vault while the protocol processes the request.