Files
proxmox/scripts/weth9-zero-supply.md

58 lines
2.3 KiB
Markdown
Raw Permalink Normal View History

# How to Zero WETH9 Total Supply on Chain 138
WETH9 has **no admin or mint/burn** — total supply is the sum of all balances. The only way to reduce it is for **each holder** to call `withdraw(amount)`, which burns that WETH9 and returns ETH to them.
## 1. You control all holders (e.g. only deployer)
- Burn from the **deployer** wallet:
```bash
./scripts/burn-weth9-deployer.sh
```
- If you have other wallets that hold WETH9 and you have their **private keys**, burn from each. Use the same pattern: call `WETH9.withdraw(balance)` from that address. The script `scripts/burn-weth9-from-keys.sh` can burn from multiple keys (see below).
## 2. Multiple accounts you control (multiple keys)
Use:
```bash
./scripts/burn-weth9-from-keys.sh
```
Requires a file (e.g. `smom-dbis-138/.env.burn-keys`) with one `PRIVATE_KEY=0x...` per line (or `BURN_KEY_1`, `BURN_KEY_2`, …). The script will:
- Derive address from each key
- Get WETH9 balance for that address
- If balance > 0, send `withdraw(balance)` from that address
After running it for every key you control, total supply will be zero **only if** those addresses were the only holders.
## 3. Finding who holds WETH9
To see all current holders and balances:
```bash
./scripts/weth9-list-holders.sh
```
This uses the Blockscout API (`/api/v2/tokens/{WETH9}/holders`) and prints address + balance for each holder. Use this to:
- Confirm only deployer (or your keys) hold WETH9, then run the burn scripts above, or
- See third-party holders; you cannot burn from their addresses without their keys.
## 4. Third-party holders (you dont have their keys)
You **cannot** zero supply unilaterally. Each holder must unwrap their own WETH9:
- They call `WETH9.withdraw(balance)` from their wallet (e.g. MetaMask, or your frontend “Unwrap WETH9 → ETH”).
- Or you send them the exact `cast send` command for their balance (from `weth9-list-holders.sh` output).
There is no contract or admin function that can burn or zero WETH9 from other addresses.
## Summary
| Situation | Action |
|-----------|--------|
| Only deployer holds WETH9 | `./scripts/burn-weth9-deployer.sh` |
| You have private keys for all holders | `./scripts/burn-weth9-from-keys.sh` (after configuring keys) |
| Unknown / third-party holders | Use `./scripts/weth9-list-holders.sh` to list them; each must call `withdraw(balance)` themselves |