Peg LOVE to wETH with deposit and withdraw #3
Closed@julien opened this issue 4h ago · 1 comment
- @julien opened this issue · 4h agoedited
Remove the unrestricted
mintfunction and turn LOVE into a wrapper pegged 1:100000 to wETH.What
- Drop
mint(address,uint256)entirely. deposit(uint256 wethAmount): pull wETH viatransferFrom, mintwethAmount * 100_000LOVE.withdraw(uint256 loveAmount): burn LOVE, returnloveAmount / 100_000wETH; revert if the amount is not a multiple of the rate so the peg can't leak dust.- wETH address is an immutable constructor argument, which means the deployment address is no longer identical across chains — the CREATE2 tests and docs are updated accordingly.
- NatSpec on every contract, function, event, error and state variable.
Why
An unrestricted mint makes the supply meaningless. Backing every LOVE with wETH at a fixed rate makes the supply fully collateralised and redeemable at all times.
Done looks like
- No mint path remains; the only ways to change supply are
depositandwithdraw. - Total supply always equals the contract's wETH balance times 100000.
- Tests cover deposit, withdraw, the divisibility revert, allowance/balance reverts, round-trips and fuzzing.
- README and CHANGELOG describe the peg instead of the faucet mint.
- Drop
- @julien · 4h agoedited
Closed via 3 — merged ce13509fab5b401d787ec19eb5198d7a4a4cbfc9 into main.
Sign in to comment.