Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 1.3 KB

File metadata and controls

39 lines (27 loc) · 1.3 KB

Proxy Repay Exercise

In this exercise, you'll learn how to repay DAI debt through a DSProxy using DssProxyActions.

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

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

Hint: notes/code/DssProxyActions.sol

Task 1 - Repay partial debt

function repay(uint256 amt) external auth {
    // Write your code here
}
  • Transfer DAI from the caller and approve the proxy.
  • Execute IDssProxyActions.wipe through the proxy.
  • Check for excess DAI in the urn. If any remains, move it out via IDssProxyActions.move and exit it to the caller.

Task 2 - Repay all debt

function repayAll() external auth {
    // Write your code here
}
  • Calculate the exact DAI needed using Math.calcDaiToRepayAll (using the urn address from manager.urns).
  • Transfer DAI from the caller and approve the proxy.
  • Execute IDssProxyActions.wipeAll through the proxy.

Test

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