| Merge 1-add-main-logic into main dded29a rickub 4h ago | 1 | # Love |
| document setup b1c9b0d julienbrg 5h ago | 2 | |
| Merge 1-add-main-logic into main dded29a rickub 4h ago | 3 | The official LOVE token. |
| document setup b1c9b0d julienbrg 5h ago | 4 | |
| Merge 1-add-main-logic into main dded29a rickub 4h ago | 5 | ## Install |
| document setup b1c9b0d julienbrg 5h ago | 6 | |
| 7 | ```shell |
| 8 | forge install |
| 9 | cp .env.example .env |
| 10 | ``` |
| 11 | |
| Merge 1-add-main-logic into main dded29a rickub 4h ago | 12 | ## Build & test |
| document setup b1c9b0d julienbrg 5h ago | 13 | |
| 14 | ```shell |
| 15 | forge build # compile |
| 16 | forge test # run tests |
| 17 | forge test -vvv # with traces |
| 18 | forge fmt # format |
| 19 | anvil # local node |
| 20 | ``` |
| 21 | |
| Merge 5-weth-bytecode-verification into main 2f6da5e rickub 1h ago | 22 | ## How wETH is chosen |
| 23 | |
| 24 | LOVE is pegged to wETH, and that wETH is not a constructor argument. It is read |
| 25 | at construction time from `WETHRegistry`, which accepts an address only if its |
| 26 | `EXTCODEHASH` is one of ten reviewed wETH implementations *and* it survives a |
| 27 | one-wei deposit/withdraw round trip. Registration is permissionless, ownerless |
| 28 | and write-once. |
| 29 | |
| 30 | Two things follow. A LOVE instance can never be bound to a typo, a lookalike |
| 31 | ERC-20 or an unreviewed wrapper. And because wETH is no longer in the creation |
| 32 | code, the creation code is byte-identical everywhere, so CREATE2 gives LOVE one |
| 33 | address on every chain instead of one per wETH deployment. |
| 34 | |
| 35 | The allowlist covers 14 chains across 5 implementations. Deployment is blocked |
| 36 | elsewhere, on purpose: the remaining chains either carry bridged ETH with no |
| 37 | `deposit()`/`withdraw()`, or put wETH behind an upgradeable proxy, where a |
| 38 | codehash commits to a forwarder rather than to behaviour. To re-derive the list |
| 39 | from chain state: |
| 40 | |
| 41 | ```shell |
| 42 | ./script/weth-codehashes.sh |
| 43 | ``` |
| 44 | |
| 45 | One caveat worth knowing before you trust an instance: the gate proves a |
| 46 | candidate *is* a reviewed wETH implementation, not that it is *the* wETH a |
| 47 | chain's ecosystem uses. Anyone can deploy a fresh WETH9 copy — same bytecode, |
| 48 | no liquidity — and register it first. Nothing is stealable, since it is real |
| 49 | WETH9 and fully redeemable, but check `WETH()` against the chain's canonical |
| 50 | address before treating a deployment as the real one. |
| 51 | |
| document setup b1c9b0d julienbrg 5h ago | 52 | ## Deploy |
| 53 | |
| Merge 1-add-main-logic into main dded29a rickub 4h ago | 54 | Deployment uses CREATE2, so the token has the same address on every EVM network. |
| Merge 5-weth-bytecode-verification into main 2f6da5e rickub 1h ago | 55 | Bringing up a chain is registry, then registration, then token — `run()` does |
| 56 | all three and skips whichever has already happened. |
| Merge 1-add-main-logic into main dded29a rickub 4h ago | 57 | |
| document setup b1c9b0d julienbrg 5h ago | 58 | ```shell |
| Merge 1-add-main-logic into main dded29a rickub 4h ago | 59 | forge script script/Love.s.sol:LoveScript --sig 'predict()' # print the address |
| 60 | |
| Merge 5-weth-bytecode-verification into main 2f6da5e rickub 1h ago | 61 | WETH=0x4200000000000000000000000000000000000006 \ |
| document setup b1c9b0d julienbrg 5h ago | 62 | forge script script/Love.s.sol:LoveScript \ |
| 63 | --rpc-url base_sepolia \ |
| 64 | --account "$DEPLOYER_ACCOUNT" \ |
| 65 | --broadcast \ |
| 66 | --verify |
| 67 | ``` |
| 68 | |
| Merge 5-weth-bytecode-verification into main 2f6da5e rickub 1h ago | 69 | `WETH` defaults to the OP Stack predeploy and is ignored once a wETH is |
| 70 | registered. Registration sends 1 wei, which stays in the registry. |
| 71 | |
| Merge 2-multichain-check into main 7c6b16b rickub 4h ago | 72 | To check determinism for real, deploy on two local chains and compare: |
| 73 | |
| 74 | ```shell |
| 75 | ./script/multichain-check.sh |
| 76 | ``` |
| 77 | |
| Merge 5-weth-bytecode-verification into main 2f6da5e rickub 1h ago | 78 | It starts two anvil nodes (chain IDs 31337 and 31338), gives them *different* |
| 79 | wETH implementations at *different* addresses, brings both up, and exits |
| 80 | non-zero if the two LOVE addresses differ. Override `PORT_A`, `PORT_B`, |
| Merge 2-multichain-check into main 7c6b16b rickub 4h ago | 81 | `CHAIN_ID_A`, `CHAIN_ID_B` or `SALT` as needed. |
| 82 | |
| Merge 1-add-main-logic into main dded29a rickub 4h ago | 83 | ## License |
| 84 | |
| 85 | GPL-3.0 |
| 86 | |
| 87 | ## Contact |
| 88 | |
| 89 | **Julien Béranger** ([GitHub](https://github.com/julienbrg)) |
| 90 | |
| 91 | - Element: [@julienbrg:matrix.org](https://matrix.to/#/@julienbrg:matrix.org) |
| 92 | - Farcaster: [julien-](https://warpcast.com/julien-) |
| 93 | - Telegram: [@julienbrg](https://t.me/julienbrg) |