Redeem or Withdraw newUSD

Description

Users can redeem newUSD tokens for AUSD at any time.

Flow of Funds

  • User calls withdraw() or redeem()
    • withdraw(assets, receiver, owner) - Specify exact AUSD amount to receive. The vault calculates and burns the corresponding newUSD.
    • redeem(newUsd, receiver, owner) - Specify exact newUSD to burn. The vault calculates and sends the corresponding AUSD amount.
  • newUSD tokens are burned from user’s balance
  • Corresponding AUSD is withdrawn from vault
  • Remaining AUSD is transferred to receiver

Examples

Functions

1// Withdraw exact amount of AUSD, burn required newUSD
2function withdraw(uint256 assets, address receiver, address owner) returns (uint256 newUsd);
3
4// Redeem exact amount of newUSD, receive AUSD
5function redeem(uint256 newUsd, address receiver, address owner) returns (uint256 assets);
6
7// Check maximum AUSD you can withdraw
8function maxWithdraw(address owner) returns (uint256);
9
10// Calculate AUSD received for newUSD amount
11function previewRedeem(uint256 newUsd) returns (uint256);