← Index
Source: docs/zsub/hacking-instructions-2/unchecked-returns-3.md (auto-generated by scripts/generate-docs-html.mjs — edit the .md, not this file)

Unchecked Returns Exercise 3

Intro

StableSwap is a decentralized exchange that allows users to swap stable coins with 0 fees.

Currently it supports 3 tokens: DAI, USDC, and UST.

The exchange already has $3M of TVL in liquidty.

What could go wrong?

Accounts

Tasks

Task 1

Find a vulnerability in StableSwap.sol and use it to drain ALL the stablecoins from the contract (All the USDC, DAI, and UST). Your attacker EOA account should own all the funds.

Task 2

Fix StableSwap.sol and create a secured version without the bug under the /contracts/unchecked-returns-2/solution/StableSwapSecured.sol.

Modify the test file so the secured contract will be used, and make sure that your attack fails.