Add LoveEnvelope secret/bearer-code contract #5
Merged@julien wants to merge
6-add-love-envelope into mainMerged as
13964fbd8e7f.- @julien opened this merge request · Sep 18, 2026edited
closes #6
Adds the on-chain mechanism assumed by docs/notes/add-privacy-to-love.md, folded into
Love.sol:deposit(bytes32 secretHash, uint256 wethAmount)— overload of the existingdeposit, pulls wETH and mints LOVE the same way, but locks it into a secret-locked envelope (auto-incrementingdepositId, decrementingremaining) instead of crediting the caller. Keeps the peg invariant (totalSupply() == WETH.balanceOf(this) * RATE) exactly.claim(uint256 depositId, bytes32 secret, uint256 loveAmount)— new function, bearer-note semantics: whoever proves the secret is paid, reusable across partial claims.withdrawis untouched — a claimed balance redeems for wETH the normal way.
Tests in
test/LoveEnvelope.t.solcover deposit/claim accounting, independent envelopes, wrong-secret/unknown-deposit/insufficient-remaining reverts, and fuzzing.
Sign in to comment.