julien/lovepublic Fork 0
main
Commits
Clone
git clone https://git.rickub.com/julien/love.git
git clone ssh://git@rickub.com/julien/love.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Peg LOVE to wETH with deposit and withdraw #3

Closed@julien opened this issue 4h ago · 1 comment
  • @julien opened this issue · 4h ago

    Remove the unrestricted mint function and turn LOVE into a wrapper pegged 1:100000 to wETH.

    What

    • Drop mint(address,uint256) entirely.
    • deposit(uint256 wethAmount): pull wETH via transferFrom, mint wethAmount * 100_000 LOVE.
    • withdraw(uint256 loveAmount): burn LOVE, return loveAmount / 100_000 wETH; 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 deposit and withdraw.
    • 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.
  • @julien · 4h ago

    Closed via 3 — merged ce13509fab5b401d787ec19eb5198d7a4a4cbfc9 into main.

Sign in to comment.