julien/lovepublic Fork
⑂ 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.

Download ZIP

Add LoveEnvelope secret/bearer-code contract #6

Closed@julien opened this issue Sep 18, 2026 · 1 comment
  • @julien opened this issue · Sep 18, 2026

    What

    Implement the on-chain mechanism assumed by docs/notes/add-privacy-to-love.md: a LoveEnvelope contract that lets a depositor lock LOVE behind a secret hash instead of a recipient address, and lets whoever later proves knowledge of the secret withdraw against it.

    • deposit(bytes32 secretHash, uint256 amount) returns (uint256 depositId) — locks amount LOVE under an auto-incrementing depositId, storing secretHash and a decrementing remaining balance.
    • withdraw(uint256 depositId, bytes32 secret, uint256 amount) — bearer-note semantics: no recipient check, whoever supplies the correct preimage first is paid. Reusable until remaining hits zero.
    • Events Deposited / Withdrawn, matching the naming used in the note.

    Why

    The note documents the off-chain processes (secret generation, encoding, distribution, timing discipline) around this mechanism, but the mechanism itself doesn't exist yet in this repo — only the unrelated wETH-peg deposit/withdraw in Love.sol does.

    Done looks like

    • src/LoveEnvelope.sol with the two functions above, custom errors, and NatSpec in the repo's existing style.
    • test/LoveEnvelope.t.sol covering full/partial withdrawal, remaining accounting, independent envelopes, and the wrong-secret / insufficient-remaining / unknown-deposit / zero-amount revert paths, plus fuzzing.
    • forge test and forge fmt --check pass.

    Deploy script, CREATE2 determinism and off-chain tooling are explicitly out of scope for this issue.

  • @julien · Sep 18, 2026

    Closed via 5 — merged 13964fbd8e7ff218c363dce3e0cfb9fd515c655f into main.

Sign in to comment.