Repository navigation
Add acceptance checks, a storage recovery contract, and the mainnet script - #22
Merged
Merged
Conversation
…cript A buyer can attach a check to a job (a page must contain text, a pull request must be merged, or the delivery must be an exact file). The desk runs it before relaying any delivery and refuses one that fails, with the reason. The payee sees it and can test it first; agents set it through MCP; npm run judge sends the wrong file first and expects the refusal. contracts/cleanup and scripts/recover-storage.ts free the NEAR a factory locks for storage. Rehearsed on testnet: 4.06 of 4.18 NEAR freed, and 5.9958 of 6 NEAR back after deleting the account. scripts/mainnet-proof.ts deploys the factory to clausehold.near and runs one 2 USDC clause end to end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Part 3 of the plan, plus the pieces mainnet needs.
Acceptance checks (
src/verify/checks.ts). The buyer can attach one test to a job:url_contains: a public https page must contain some text. Only public hosts are fetched (no IPs, localhost or internal names), redirects are not followed, there is an 8 s timeout and a 1 MB cap.github_pr_merged:owner/namepull request #n must be merged.sha256: the delivery must be an exact agreed file.How it works:
POST /invitesacceptscheck, stored with the invite.POST /invites/:id/checkruns it on demand (public)./relayruns it before relaying. A failing delivery gets 422 "The acceptance check failed: …. Nothing was sent.", and every run is logged asDELIVERY_CHECKED.openJoband the MCPclausehold_open_jobtool acceptcheck.npm run judge: the main job now carries asha256check. The wrong file must be refused, then the right one pays.Storage recovery (
contracts/cleanup,scripts/recover-storage.ts): a 12 KB contract that only the account's own key can call, which removes the storage keys it is given. Rehearsed on testnet with a real factory and the real code:Mainnet (
scripts/mainnet-proof.ts, not run yet): deploy the factory toclausehold.nearwith a USDC-only mandate where onlyclausehold.nearmay write clauses, then write and fund one 2 USDC clause, deliver it as a relayed meta-transaction, close it, and fetch a dry NEAR Intents quote.--dryprints the costs first.Checks: root typecheck; 234 tests (7 of them new, for the checks);
cargo test -p cleanup(2); web typecheck and build.🤖 Generated with Claude Code