Repository navigation
Conversation
The factory reserves a clause's amount against the day's caps when the clause is written. With creators open (testnet), anyone could write unfunded clauses and fill the day. Now every new clause gets funding_deadline = creation + 10 minutes. After it, an unfunded clause refuses deposits (ft_on_transfer refunds, sync_funding no longer marks it funded) and anyone may call cancel_unfunded. That returns any partial deposit to the buyer and reports a new Cancelled outcome: the factory gives the reservation back, decrements open counts, and writes no receipt and no returned count, so nobody's standing changes. The clause then closes like any other. No factory state migration: new enum variants are appended and the window is a constant. Clauses created by the current code have no window and behave as before. Not deployed. Tests: 8 new clause tests, 2 new factory tests; 48 + 28 pass. Both contracts build for wasm32. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Do not merge or deploy until hackathon judging is over. The live testnet and mainnet contracts are unchanged.
Why
The threat model's first weakness: the factory reserves a clause's amount against the day's caps when the clause is written, before it is funded. With
creatorsopen (testnet), anyone could write unfunded clauses and fill the day's caps. Mainnet is already closed by itscreatorsallowlist.What changes
FUNDING_WINDOW_SECS).ft_on_transferrefunds them, andsync_fundingno longer marks it funded.cancel_unfunded. Any partial deposit goes back to the buyer, and the clause reports a newcancelledoutcome.cancelled, the factory gives the reservation back and decrements the open counts. It writes no receipt and no returned count, so neither side's standing changes. The clause then closes and refunds its storage like any other.docs/THREAT_MODEL.mdandcontracts/ABI.mddescribe the change.docs/x-post-next.mdis a follow-up post.Tests
cancelled, and an ordinary return still reportsreturned.cargo test -p clause -p factory --lib: 48 + 28 passed. Both contracts build for wasm32.To ship later
DAO proposal to upload the new clause code, then redeploy the factory wasm (state compatible), then
npm run judgeagainst testnet.🤖 Generated with Claude Code