Skip to content

Latest commit

 

History

History
35 lines (24 loc) · 1.07 KB

File metadata and controls

35 lines (24 loc) · 1.07 KB

USDS Savings Rate Exercise

In this exercise, you'll learn how to deposit and redeem USDS using the sUSDS ERC4626 vault contract.

The starter code for this exercise is provided in foundry/src/exercises/UsdsSavingsRate.sol

Solution is in foundry/src/solutions/UsdsSavingsRate.sol

Task 1 - Deposit USDS

function deposit(uint256 amt) external returns (uint256 shares) {
    // Write your code here
}
  • Transfer USDS from the caller and approve sUSDS.
  • Call susds.deposit with the caller as receiver. Return the shares minted.

Task 2 - Redeem sUSDS

function redeem(uint256 shares) external {
    // Write your code here
}
  • Transfer sUSDS shares from the caller into this contract.
  • Call susds.redeem with the caller as receiver and this contract as owner.

Test

forge test --fork-url $FORK_URL --match-path test/UsdsSavingsRate.t.sol -vvv