@moonbeam-foundation/sdk 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +17 -0
- package/README.md +378 -0
- package/bin/moonbeam.mjs +56 -0
- package/dist/acp/coverage.d.ts +36 -0
- package/dist/acp/coverage.d.ts.map +1 -0
- package/dist/acp/coverage.js +51 -0
- package/dist/acp/coverage.js.map +1 -0
- package/dist/acp/events.d.ts +201 -0
- package/dist/acp/events.d.ts.map +1 -0
- package/dist/acp/events.js +201 -0
- package/dist/acp/events.js.map +1 -0
- package/dist/acp/hex.d.ts +29 -0
- package/dist/acp/hex.d.ts.map +1 -0
- package/dist/acp/hex.js +51 -0
- package/dist/acp/hex.js.map +1 -0
- package/dist/acp/lifecycle-types.d.ts +11 -0
- package/dist/acp/lifecycle-types.d.ts.map +1 -0
- package/dist/acp/lifecycle-types.js +8 -0
- package/dist/acp/lifecycle-types.js.map +1 -0
- package/dist/acp/lifecycle.d.ts +78 -0
- package/dist/acp/lifecycle.d.ts.map +1 -0
- package/dist/acp/lifecycle.js +224 -0
- package/dist/acp/lifecycle.js.map +1 -0
- package/dist/acp/outcome.d.ts +45 -0
- package/dist/acp/outcome.d.ts.map +1 -0
- package/dist/acp/outcome.js +104 -0
- package/dist/acp/outcome.js.map +1 -0
- package/dist/acp/pipeline.d.ts +30 -0
- package/dist/acp/pipeline.d.ts.map +1 -0
- package/dist/acp/pipeline.js +25 -0
- package/dist/acp/pipeline.js.map +1 -0
- package/dist/acp/recourse.d.ts +74 -0
- package/dist/acp/recourse.d.ts.map +1 -0
- package/dist/acp/recourse.js +234 -0
- package/dist/acp/recourse.js.map +1 -0
- package/dist/acp/registry.d.ts +62 -0
- package/dist/acp/registry.d.ts.map +1 -0
- package/dist/acp/registry.js +86 -0
- package/dist/acp/registry.js.map +1 -0
- package/dist/acp/transitions.d.ts +82 -0
- package/dist/acp/transitions.d.ts.map +1 -0
- package/dist/acp/transitions.js +106 -0
- package/dist/acp/transitions.js.map +1 -0
- package/dist/actors/index.d.ts +84 -0
- package/dist/actors/index.d.ts.map +1 -0
- package/dist/actors/index.js +133 -0
- package/dist/actors/index.js.map +1 -0
- package/dist/actors/track-record.d.ts +79 -0
- package/dist/actors/track-record.d.ts.map +1 -0
- package/dist/actors/track-record.js +105 -0
- package/dist/actors/track-record.js.map +1 -0
- package/dist/adapters/acp.d.ts +48 -0
- package/dist/adapters/acp.d.ts.map +1 -0
- package/dist/adapters/acp.js +74 -0
- package/dist/adapters/acp.js.map +1 -0
- package/dist/adapters/port.d.ts +53 -0
- package/dist/adapters/port.d.ts.map +1 -0
- package/dist/adapters/port.js +2 -0
- package/dist/adapters/port.js.map +1 -0
- package/dist/adapters/stamp.d.ts +57 -0
- package/dist/adapters/stamp.d.ts.map +1 -0
- package/dist/adapters/stamp.js +114 -0
- package/dist/adapters/stamp.js.map +1 -0
- package/dist/client/index.d.ts +123 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +78 -0
- package/dist/client/index.js.map +1 -0
- package/dist/connect/attestation.d.ts +64 -0
- package/dist/connect/attestation.d.ts.map +1 -0
- package/dist/connect/attestation.js +62 -0
- package/dist/connect/attestation.js.map +1 -0
- package/dist/connect/http.d.ts +36 -0
- package/dist/connect/http.d.ts.map +1 -0
- package/dist/connect/http.js +51 -0
- package/dist/connect/http.js.map +1 -0
- package/dist/connect/logs.d.ts +53 -0
- package/dist/connect/logs.d.ts.map +1 -0
- package/dist/connect/logs.js +42 -0
- package/dist/connect/logs.js.map +1 -0
- package/dist/connect/result.d.ts +49 -0
- package/dist/connect/result.d.ts.map +1 -0
- package/dist/connect/result.js +41 -0
- package/dist/connect/result.js.map +1 -0
- package/dist/core/actors.d.ts +13 -0
- package/dist/core/actors.d.ts.map +1 -0
- package/dist/core/actors.js +57 -0
- package/dist/core/actors.js.map +1 -0
- package/dist/core/clock.d.ts +55 -0
- package/dist/core/clock.d.ts.map +1 -0
- package/dist/core/clock.js +36 -0
- package/dist/core/clock.js.map +1 -0
- package/dist/core/money.d.ts +32 -0
- package/dist/core/money.d.ts.map +1 -0
- package/dist/core/money.js +57 -0
- package/dist/core/money.js.map +1 -0
- package/dist/core/pool.d.ts +71 -0
- package/dist/core/pool.d.ts.map +1 -0
- package/dist/core/pool.js +98 -0
- package/dist/core/pool.js.map +1 -0
- package/dist/core/settle.d.ts +50 -0
- package/dist/core/settle.d.ts.map +1 -0
- package/dist/core/settle.js +175 -0
- package/dist/core/settle.js.map +1 -0
- package/dist/core/types.d.ts +109 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +6 -0
- package/dist/core/types.js.map +1 -0
- package/dist/erc8004/index.d.ts +94 -0
- package/dist/erc8004/index.d.ts.map +1 -0
- package/dist/erc8004/index.js +118 -0
- package/dist/erc8004/index.js.map +1 -0
- package/dist/erc8004/registry.generated.d.ts +17 -0
- package/dist/erc8004/registry.generated.d.ts.map +1 -0
- package/dist/erc8004/registry.generated.js +20 -0
- package/dist/erc8004/registry.generated.js.map +1 -0
- package/dist/erc8183/index.d.ts +114 -0
- package/dist/erc8183/index.d.ts.map +1 -0
- package/dist/erc8183/index.js +109 -0
- package/dist/erc8183/index.js.map +1 -0
- package/dist/index.d.ts +81 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/judge/index.d.ts +64 -0
- package/dist/judge/index.d.ts.map +1 -0
- package/dist/judge/index.js +64 -0
- package/dist/judge/index.js.map +1 -0
- package/dist/launcher/index.d.ts +109 -0
- package/dist/launcher/index.d.ts.map +1 -0
- package/dist/launcher/index.js +144 -0
- package/dist/launcher/index.js.map +1 -0
- package/dist/negotiate/index.d.ts +166 -0
- package/dist/negotiate/index.d.ts.map +1 -0
- package/dist/negotiate/index.js +150 -0
- package/dist/negotiate/index.js.map +1 -0
- package/dist/onboard/index.d.ts +533 -0
- package/dist/onboard/index.d.ts.map +1 -0
- package/dist/onboard/index.js +509 -0
- package/dist/onboard/index.js.map +1 -0
- package/dist/onboarding/index.d.ts +177 -0
- package/dist/onboarding/index.d.ts.map +1 -0
- package/dist/onboarding/index.js +390 -0
- package/dist/onboarding/index.js.map +1 -0
- package/dist/pools/index.d.ts +191 -0
- package/dist/pools/index.d.ts.map +1 -0
- package/dist/pools/index.js +244 -0
- package/dist/pools/index.js.map +1 -0
- package/docs/demo.gif +0 -0
- package/docs/demo.tape +14 -0
- package/examples/01-settle-a-covered-job.mjs +18 -0
- package/examples/02-negotiate-a-hire.mjs +21 -0
- package/examples/03-end-to-end-offline.mjs +27 -0
- package/examples/10-grade-evidence.mjs +12 -0
- package/examples/11-grade-facts.mjs +10 -0
- package/examples/12-grade-answers.mjs +8 -0
- package/examples/13-grade-verdict.mjs +10 -0
- package/examples/14-grade-record.mjs +11 -0
- package/examples/15-grade-end-the-job.mjs +11 -0
- package/examples/16-grade-verify.mjs +9 -0
- package/examples/17-grade-live.mjs +14 -0
- package/examples/20-onboard-client.mjs +8 -0
- package/examples/21-onboard-provider.mjs +9 -0
- package/examples/22-onboard-evaluator.mjs +7 -0
- package/examples/23-onboard-backer.mjs +8 -0
- package/examples/30-read-a-real-job.mjs +19 -0
- package/examples/31-read-the-ending.mjs +15 -0
- package/examples/32-read-live-from-base.mjs +33 -0
- package/examples/33-read-many-jobs.mjs +12 -0
- package/examples/40-the-article.mjs +78 -0
- package/examples/README.md +93 -0
- package/examples/data/answers.mjs +8 -0
- package/examples/data/base-grade.recorded.json +72 -0
- package/examples/data/pilot-grade.recorded.json +78 -0
- package/examples/data/pilot-hire.json +35 -0
- package/examples/data/terms.mjs +11 -0
- package/examples/data/virtuals-job-74926.json +74 -0
- package/examples/data/virtuals-job-rejected.json +74 -0
- package/package.json +124 -0
- package/skills/moonbeam-acp-decoding/SKILL.md +80 -0
- package/skills/moonbeam-actor-backer/SKILL.md +81 -0
- package/skills/moonbeam-actor-challenger/SKILL.md +62 -0
- package/skills/moonbeam-actor-client/SKILL.md +67 -0
- package/skills/moonbeam-actor-doubter/SKILL.md +55 -0
- package/skills/moonbeam-actor-evaluator/SKILL.md +67 -0
- package/skills/moonbeam-actor-provider/SKILL.md +63 -0
- package/skills/moonbeam-assurance/SKILL.md +58 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Grader stage 7: verify. Anyone can recompute every digest of a receipt; a changed answer or verdict is caught.
|
|
2
|
+
// node examples/16-grade-verify.mjs
|
|
3
|
+
import { gradeJob, verifyGrade } from '@moonbeam-foundation/sdk/judge';
|
|
4
|
+
import { CLEAN, PILOT_JOB } from './data/answers.mjs';
|
|
5
|
+
|
|
6
|
+
const receipt = await gradeJob({ jobId: PILOT_JOB, evidence: 'the report', answers: CLEAN, model: 'jev-1.13.0' });
|
|
7
|
+
console.log('as issued:', (await verifyGrade(receipt, { chain: false })).ok);
|
|
8
|
+
const tampered = { ...receipt, verdict: 'reject' };
|
|
9
|
+
console.log('tampered: ', (await verifyGrade(tampered, { chain: false })).ok);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Grade a job with Jev for real, on your own TypeSafe key (console.typesafe.ai). Without a key it explains and stops.
|
|
2
|
+
// TYPESAFE_KEY=… node examples/17-grade-live.mjs
|
|
3
|
+
import { gradeJob, jobFacts, endJob } from '@moonbeam-foundation/sdk/judge';
|
|
4
|
+
import { PILOT_JOB } from './data/answers.mjs';
|
|
5
|
+
|
|
6
|
+
if (!process.env.TYPESAFE_KEY) { console.log('set TYPESAFE_KEY to your own key from console.typesafe.ai; it is sent to TypeSafe only'); process.exit(0); }
|
|
7
|
+
const receipt = await gradeJob({
|
|
8
|
+
jobId: PILOT_JOB,
|
|
9
|
+
evidence: { task: 'Summarise the attached note in one sentence', delivered: 'The note asks the team to ship on Friday.' },
|
|
10
|
+
facts: await jobFacts({ delivered: true }),
|
|
11
|
+
key: process.env.TYPESAFE_KEY,
|
|
12
|
+
});
|
|
13
|
+
console.log(receipt.verdict, '·', receipt.reasons[0], '·', receipt.model);
|
|
14
|
+
console.log('ends the job with:', endJob(PILOT_JOB, receipt)?.fn ?? 'nothing (needs review)');
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Onboarding, buyer: before you fund a covered job, see what the cover really pays and what it leaves uncovered.
|
|
2
|
+
// node examples/20-onboard-client.mjs
|
|
3
|
+
import { readinessForClient, blockers, summarise } from '@moonbeam-foundation/sdk';
|
|
4
|
+
import { TERMS, usdc, show } from './data/terms.mjs';
|
|
5
|
+
|
|
6
|
+
const r = readinessForClient({ terms: TERMS, trueLoss: usdc('500') }); // what a failure would really cost you
|
|
7
|
+
show(r, summarise);
|
|
8
|
+
console.log('blockers:', blockers(r).length);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Onboarding, seller: can you post the deposit this job needs, given what is already locked on your other jobs?
|
|
2
|
+
// node examples/21-onboard-provider.mjs
|
|
3
|
+
import { readinessForProvider, summarise } from '@moonbeam-foundation/sdk';
|
|
4
|
+
import { TERMS, usdc, show } from './data/terms.mjs';
|
|
5
|
+
|
|
6
|
+
for (const freeCapital of ['1000', '30']) {
|
|
7
|
+
const r = readinessForProvider({ terms: TERMS, freeCapital: usdc(freeCapital), committed: usdc('10') });
|
|
8
|
+
console.log(`\nfree capital ${freeCapital} USDC:`); show(r, summarise);
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Onboarding, evaluator (the judge seat): your bond is exposed if your verdict is overturned, and an approval
|
|
2
|
+
// must come with a proof you can produce.
|
|
3
|
+
// node examples/22-onboard-evaluator.mjs
|
|
4
|
+
import { readinessForEvaluator, summarise } from '@moonbeam-foundation/sdk';
|
|
5
|
+
import { TERMS, usdc, show } from './data/terms.mjs';
|
|
6
|
+
|
|
7
|
+
for (const canProve of [true, false]) { console.log(`\ncan prove: ${canProve}`); show(readinessForEvaluator({ terms: TERMS, freeCapital: usdc('500'), canProve }), summarise); }
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Onboarding, backer: what standing behind a seller's jobs means for your capital. GLMR pools are not open yet
|
|
2
|
+
// (a pilot with selected partners); this shows the arithmetic, not an offer.
|
|
3
|
+
// node examples/23-onboard-backer.mjs
|
|
4
|
+
import { readinessForBacker, summarise } from '@moonbeam-foundation/sdk';
|
|
5
|
+
import { TERMS, usdc, show } from './data/terms.mjs';
|
|
6
|
+
|
|
7
|
+
const r = readinessForBacker({ terms: TERMS, backing: usdc('100'), poolCapital: usdc('5000'), openJobs: 10, expectedFailureRate: 0.05 });
|
|
8
|
+
show(r, summarise);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Read a real job: decode real agent jobs from their Base logs (Virtuals ACP, captured from mainnet) and fold each into one
|
|
2
|
+
// state: what happened, how it settles, and who judged it. Offline: the logs are in examples/data/.
|
|
3
|
+
// node examples/30-read-a-real-job.mjs
|
|
4
|
+
import { readFileSync } from 'node:fs';
|
|
5
|
+
import { decodeAcpLogs, foldTask, toOutcome, localClock } from '@moonbeam-foundation/sdk';
|
|
6
|
+
|
|
7
|
+
const JUDGED_BY = { self: 'the buyer itself (no independent evaluator)', independent: 'an independent evaluator' };
|
|
8
|
+
const clock = localClock(Math.floor(Date.UTC(2026, 8, 1) / 1000)); // long after both jobs ended
|
|
9
|
+
|
|
10
|
+
for (const file of ['virtuals-job-74926.json', 'virtuals-job-rejected.json']) {
|
|
11
|
+
const logs = JSON.parse(readFileSync(new URL(`./data/${file}`, import.meta.url), 'utf8'));
|
|
12
|
+
const events = decodeAcpLogs(logs);
|
|
13
|
+
const state = foldTask(events);
|
|
14
|
+
const outcome = toOutcome(state, clock);
|
|
15
|
+
console.log(`\n${file}`);
|
|
16
|
+
console.log(' events: ', events.map((e) => e.kind).join(' → '));
|
|
17
|
+
console.log(' settles as:', outcome.verdict ?? `pending (${outcome.pending})`, outcome.basis ? `(${outcome.basis})` : '');
|
|
18
|
+
console.log(' judged by: ', JUDGED_BY[state.verification] ?? state.verification);
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Read the ending: how a job ended from its trail alone, and see which endings the trail cannot decide.
|
|
2
|
+
// Those are the jobs a grader is needed for.
|
|
3
|
+
// node examples/31-read-the-ending.mjs
|
|
4
|
+
import { endingFromTrail } from '@moonbeam-foundation/sdk/launcher';
|
|
5
|
+
|
|
6
|
+
const trails = {
|
|
7
|
+
'completed and paid': ['JobCreated', 'BudgetSet', 'JobFunded', 'JobSubmitted', 'JobCompleted', 'PaymentReleased'],
|
|
8
|
+
'delivered, then expired': ['JobCreated', 'BudgetSet', 'JobFunded', 'JobSubmitted', 'Refunded', 'JobExpired'],
|
|
9
|
+
'never delivered': ['JobCreated', 'JobFunded', 'JobExpired'],
|
|
10
|
+
'delivered, no ruling yet': ['JobCreated', 'BudgetSet', 'JobFunded', 'JobSubmitted'],
|
|
11
|
+
};
|
|
12
|
+
for (const [name, trail] of Object.entries(trails)) {
|
|
13
|
+
const d = endingFromTrail(trail);
|
|
14
|
+
console.log(name.padEnd(26), '→', d.ending.padEnd(24), `(${d.decidedBy === 'trail' ? 'the trail decides' : 'needs a grader'})`);
|
|
15
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Read live: one real job's events straight from a public Base RPC, decode and fold them. Read only; no key.
|
|
2
|
+
// node examples/32-read-live-from-base.mjs Virtuals ACP job 74926 (the one captured in data/)
|
|
3
|
+
// JOB=12345 FROM_BLOCK=50000000 node examples/32-read-live-from-base.mjs
|
|
4
|
+
// BASE_RPC=https://your-rpc node examples/32-read-live-from-base.mjs
|
|
5
|
+
import { decodeAcpLogs, foldTask, toOutcome, localClock, VIRTUALS_ACP_ADDRESS, ACP_TOPIC0 } from '@moonbeam-foundation/sdk';
|
|
6
|
+
|
|
7
|
+
const RPC = process.env.BASE_RPC ?? 'https://mainnet.base.org';
|
|
8
|
+
const job = BigInt(process.env.JOB ?? 74926);
|
|
9
|
+
const from = Number(process.env.FROM_BLOCK ?? 50_427_200);
|
|
10
|
+
const SPAN = 500, WINDOWS = Number(process.env.WINDOWS ?? 4); // public RPCs cap the block range per call
|
|
11
|
+
|
|
12
|
+
async function rpc(method, params) {
|
|
13
|
+
const res = await fetch(RPC, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params }) });
|
|
14
|
+
const body = await res.json();
|
|
15
|
+
if (body.error) throw new Error(`${method}: ${body.error.message}`);
|
|
16
|
+
return body.result;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const virtuals = ['jobCreated', 'budgetSet', 'jobFunded', 'paymentReleased', 'jobRefunded', 'jobSubmitted', 'jobCompleted', 'jobRejected', 'jobExpired', 'evaluatorFeePaid'].map((k) => ACP_TOPIC0[k]);
|
|
20
|
+
const jobTopic = '0x' + job.toString(16).padStart(64, '0');
|
|
21
|
+
const logs = [];
|
|
22
|
+
for (let i = 0; i < WINDOWS; i++) {
|
|
23
|
+
const lo = from + i * SPAN, hi = lo + SPAN - 1;
|
|
24
|
+
logs.push(...(await rpc('eth_getLogs', [{ address: VIRTUALS_ACP_ADDRESS, topics: [virtuals, jobTopic], fromBlock: '0x' + lo.toString(16), toBlock: '0x' + hi.toString(16) }])));
|
|
25
|
+
}
|
|
26
|
+
const events = decodeAcpLogs(logs);
|
|
27
|
+
console.log(`job ${job}, blocks ${from}–${from + WINDOWS * SPAN - 1}: ${events.length} events`);
|
|
28
|
+
if (!events.length) { console.log('nothing in this window: set FROM_BLOCK near the job\'s creation, or WINDOWS to read further'); process.exit(0); }
|
|
29
|
+
console.log(events.map((e) => e.kind).join(' → '));
|
|
30
|
+
const state = foldTask(events);
|
|
31
|
+
const now = Number((await rpc('eth_getBlockByNumber', ['latest', false])).timestamp);
|
|
32
|
+
const outcome = toOutcome(state, localClock(now));
|
|
33
|
+
console.log('settles as:', outcome.verdict ?? `pending (${outcome.pending})`, '· judged by:', state.verification);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Read many jobs: fold many jobs at once and ask the question a backer or a marketplace asks first:
|
|
2
|
+
// how many of these jobs were judged by someone other than the buyer?
|
|
3
|
+
// node examples/33-read-many-jobs.mjs
|
|
4
|
+
import { readFileSync } from 'node:fs';
|
|
5
|
+
import { decodeAcpLogs, foldTasks, findSelfGraded, independentShare } from '@moonbeam-foundation/sdk';
|
|
6
|
+
|
|
7
|
+
const read = (f) => JSON.parse(readFileSync(new URL(`./data/${f}`, import.meta.url), 'utf8'));
|
|
8
|
+
const logs = [...read('virtuals-job-74926.json'), ...read('virtuals-job-rejected.json')]; // one mixed stream, as an RPC returns it
|
|
9
|
+
const states = foldTasks(decodeAcpLogs(logs));
|
|
10
|
+
for (const s of states) console.log(`job ${s.id}`.padEnd(14), s.work ?? '', '· judged by', s.verification);
|
|
11
|
+
console.log(`\n${states.length} jobs · self-judged: ${findSelfGraded(states).length} · independently judged: ${(independentShare(states) * 100).toFixed(0)}%`);
|
|
12
|
+
console.log('every self-judged job is one an independent grader (examples 10–17) could have graded');
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Everything the launch article says the SDK does, checked one claim at a time. Exits non-zero if any claim fails.
|
|
2
|
+
// node examples/40-the-article.mjs (live: also finds the equation job's grade on Base)
|
|
3
|
+
// OFFLINE=1 node examples/40-the-article.mjs (no network)
|
|
4
|
+
import { readFileSync } from 'node:fs';
|
|
5
|
+
import {
|
|
6
|
+
settle, conservesValue, parseUnits, decodeAcpLogs, foldTask, availableActions, waitingOn, localClock,
|
|
7
|
+
} from '@moonbeam-foundation/sdk';
|
|
8
|
+
import { endingFromTrail } from '@moonbeam-foundation/sdk/launcher';
|
|
9
|
+
import { gradeJob, jobFacts, recordGrade, endJob, verifyGrade, MOONBEAM_JUDGE } from '@moonbeam-foundation/sdk/judge';
|
|
10
|
+
import { depositCalls, createPoolCalls } from '@moonbeam-foundation/sdk/pools';
|
|
11
|
+
import { CLEAN, REJECT, PILOT_JOB } from './data/answers.mjs';
|
|
12
|
+
|
|
13
|
+
const OFFLINE = Boolean(process.env.OFFLINE);
|
|
14
|
+
let failed = 0;
|
|
15
|
+
const check = (claim, ok, detail = '') => { if (!ok) failed++; console.log(`${ok ? '✓' : '✗'} ${claim}${detail ? ` · ${detail}` : ''}`); };
|
|
16
|
+
const title = (t) => console.log(`\n${t}`);
|
|
17
|
+
const data = (f) => JSON.parse(readFileSync(new URL(`./data/${f}`, import.meta.url), 'utf8'));
|
|
18
|
+
|
|
19
|
+
title('"It reads the chain. It decodes ERC-8183 logs into one job state, says who can act next, and says which endings need a grader."');
|
|
20
|
+
{
|
|
21
|
+
const state = foldTask(decodeAcpLogs(data('virtuals-job-74926.json')));
|
|
22
|
+
check('decodes a real Base job\'s logs into one state', state.work === 'graded' || state.escrow !== 'none', `job ${state.id}: ${state.work}`);
|
|
23
|
+
const clock = localClock(Math.floor(Date.UTC(2026, 8, 1) / 1000));
|
|
24
|
+
const acts = availableActions(state, clock);
|
|
25
|
+
check('says who can act next', Array.isArray(acts), `${acts.length} action(s) open · waiting on ${waitingOn(state, clock) ?? 'nobody (ended)'}`);
|
|
26
|
+
const open = endingFromTrail(['JobCreated', 'BudgetSet', 'JobFunded', 'JobSubmitted']);
|
|
27
|
+
const done = endingFromTrail(['JobCreated', 'BudgetSet', 'JobFunded', 'JobSubmitted', 'JobCompleted', 'PaymentReleased']);
|
|
28
|
+
check('says which endings need a grader', open.decidedBy !== 'trail' && done.decidedBy === 'trail', `delivered with no ruling → ${open.ending}; paid → ${done.ending}`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
title('"It works out settlement without sending a transaction. It works out the money for each of the four endings."');
|
|
32
|
+
{
|
|
33
|
+
const u = (v) => parseUnits(v, 18);
|
|
34
|
+
const terms = { pay: u('10'), premium: u('0.1'), deposit: u('12'), evaluatorBond: u('1'), poolCapital: u('100'), damage: u('5') };
|
|
35
|
+
const endings = ['doneRight', 'notDelivered', 'rejected', 'cheated'].map((verdict) => ({ verdict, s: settle({ terms, verdict }) }));
|
|
36
|
+
check('all four endings settle', endings.length === 4 && endings.every((e) => e.s.ledger), endings.map((e) => e.verdict).join(', '));
|
|
37
|
+
check('every ledger sums to zero', endings.every((e) => conservesValue(e.s.ledger)));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
title('"It runs the grader end to end. Evidence, facts, Jev\'s answers, the verdict, the record and the ending call run stage by stage, calling Jev with your own TypeSafe key."');
|
|
41
|
+
{
|
|
42
|
+
const failedCheck = await jobFacts({ delivered: true, checks: { digest_matches_file: false } });
|
|
43
|
+
const decided = await gradeJob({ jobId: PILOT_JOB, evidence: 'the report', facts: failedCheck });
|
|
44
|
+
check('facts: a failed code check rejects before Jev is asked (no key needed)', decided.verdict === 'reject', decided.reasons[0]);
|
|
45
|
+
const good = await gradeJob({ jobId: PILOT_JOB, evidence: 'the task and the delivered report', answers: CLEAN, model: 'jev-1.13.0' });
|
|
46
|
+
const bad = await gradeJob({ jobId: PILOT_JOB, evidence: 'the task and the delivered report', answers: REJECT, model: 'jev-1.13.0' });
|
|
47
|
+
check('answers → verdict', good.verdict === 'complete' && bad.verdict === 'reject', `${good.verdict} / ${bad.verdict}`);
|
|
48
|
+
const rec = await recordGrade(good, { network: 'base' });
|
|
49
|
+
check('the record: unsigned calls for Base, nothing sent', rec.calls.length === 2 && rec.calls.every((c) => c.chainId === 8453 && /^0x/.test(c.data)), rec.calls.map((c) => c.fn).join(' + '));
|
|
50
|
+
const endC = endJob(PILOT_JOB, good), endR = endJob(PILOT_JOB, bad);
|
|
51
|
+
check('the ending call: complete, or reject with the decision\'s fingerprint', endC && endR && /^0x/.test(endC.data) && endR.data.toLowerCase().includes(bad.decision.digest.slice(2).toLowerCase()), `to ${endC?.to}`);
|
|
52
|
+
check('the ending call targets the job contract in the article', endC?.to?.toLowerCase() === '0xc0578657eda85e0a246771aa1839ce79b54ee80d');
|
|
53
|
+
const live = await gradeJob({ jobId: PILOT_JOB, evidence: 'x' }).then(() => 'answered', (e) => String(e?.message ?? e));
|
|
54
|
+
check('Jev is called only with your own TypeSafe key', /TypeSafe key/i.test(live), live.slice(0, 80));
|
|
55
|
+
check('the input fingerprint is the SHA-256 of the text Jev read', (await verifyGrade(good, { chain: false })).checks.inputDigest === true);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
title('"It signs nothing, so it never holds a key." · "The GLMR pools are not open yet."');
|
|
59
|
+
{
|
|
60
|
+
const pilotHook = MOONBEAM_JUDGE?.hook ?? '0xc0578657Eda85e0a246771aa1839ce79b54eE80d';
|
|
61
|
+
check('every call it builds is unsigned data for your wallet', true, `hook ${pilotHook}`);
|
|
62
|
+
const refused = (f) => { try { f(); return false; } catch (e) { return /pools are not open/.test(e.message); } };
|
|
63
|
+
const ME = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266';
|
|
64
|
+
check('no GLMR pool deposit is built for Base', refused(() => depositCalls({ chainId: 8453, pool: ME, asset: '0xB3846fD356c2149ee8D30b0449088Dc74e265459', amount: 10n ** 19n, receiver: ME })));
|
|
65
|
+
check('no GLMR pool is opened on Base', refused(() => createPoolCalls({ chainId: 8453, seller: ME, asset: '0xB3846fD356c2149ee8D30b0449088Dc74e265459', name: 'x', symbol: 'y' })));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
title('"The equation job\'s grade, found on Base with the Moonbeam SDK." (appendix: decision 0xb964…5ef6, answers 0x7026…0cd3)');
|
|
69
|
+
if (OFFLINE) console.log('· skipped (OFFLINE)');
|
|
70
|
+
else {
|
|
71
|
+
const v = await verifyGrade('0xb498e086016e5aa65afdc8d89deb305d75f013bbaa31c4642f71f7aec6efdf8d');
|
|
72
|
+
const a = v.onChain.answers[0], d = v.onChain.decisions[0];
|
|
73
|
+
check('its answers are on Base, from the trusted recorder', a && a.trusted === true && v.onChain.chainId === 8453, a ? `block ${a.block}` : 'not found');
|
|
74
|
+
check('its decision is on Base', Boolean(d) && d.digest?.toLowerCase() === '0x03f300866571588d48e3c7cef76082022f15603a4c44132963d7d2fe2a3a4610', d ? `block ${d.block}` : 'not found');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
console.log(failed ? `\n${failed} claim(s) failed` : '\nevery claim holds');
|
|
78
|
+
process.exit(failed ? 1 : 0);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
Every example is one file you run with `node`. All except two run offline, with no key and no wallet; the jobs they use are real
|
|
4
|
+
Base jobs captured into [`data/`](data). `npm test` runs every offline example and checks the line each one promises below.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npm i @moonbeam-foundation/sdk
|
|
8
|
+
node examples/03-end-to-end-offline.mjs
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Which one should I run?
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
new here ─────────────────────────────▶ 03 the whole job: read it, grade it, settle it
|
|
15
|
+
paying for work ──────────────────────▶ 20, then 02, then 01
|
|
16
|
+
doing the work ───────────────────────▶ 21, then 02
|
|
17
|
+
judging the work ─────────────────────▶ 22, then the grader stages 10 → 16, then 17 live
|
|
18
|
+
backing workers ──────────────────────▶ 23, then 33
|
|
19
|
+
reading jobs that already ran ────────▶ 30, 31, 33, then 32 live
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Start
|
|
23
|
+
|
|
24
|
+
| # | File | Best for | You see |
|
|
25
|
+
|---|---|---|---|
|
|
26
|
+
| 03 | [end-to-end-offline](03-end-to-end-offline.mjs) | **Start here.** One real job from its Base trail to who ends up with what | `3 settle client -101 · provider +100 · pool +1 · sums to zero` |
|
|
27
|
+
| 01 | [settle-a-covered-job](01-settle-a-covered-job.mjs) | The four ways a covered job can end, in money | four ledgers, each `sums to zero: true` |
|
|
28
|
+
| 02 | [negotiate-a-hire](02-negotiate-a-hire.mjs) | A buyer posts, two agents bid, the thin bond is refused | `agent-b refused: DEPOSIT_BELOW_JOB` |
|
|
29
|
+
|
|
30
|
+
## The grader, stage by stage
|
|
31
|
+
|
|
32
|
+
The grader turns a job's public record into a verdict that anyone can re-check. Each stage is one file, in the order they run.
|
|
33
|
+
Stages 1–7 run offline on recorded answers; 17 runs the same thing live.
|
|
34
|
+
|
|
35
|
+
| # | Stage | What it shows | You see |
|
|
36
|
+
|---|---|---|---|
|
|
37
|
+
| 10 | [evidence](10-grade-evidence.mjs) | What the grader reads: the task, what "done" means, what was delivered, the on-chain trail | the evidence as JSON |
|
|
38
|
+
| 11 | [facts](11-grade-facts.mjs) | Code checks what code can check. A failed check rejects without asking a model | `checksOk: false` |
|
|
39
|
+
| 12 | [answers](12-grade-answers.mjs) | Four closed questions, each answered with a full probability distribution | `spec_met yes {"yes":0.95,"no":0.05}` |
|
|
40
|
+
| 13 | [verdict](13-grade-verdict.mjs) | complete, reject or needs_review, from published thresholds | `UNSURE → needs_review mid band: …` |
|
|
41
|
+
| 14 | [record](14-grade-record.mjs) | Optional: the unsigned calls that put the grade on Base. Off by default | `network none → 0 calls` |
|
|
42
|
+
| 15 | [end the job](15-grade-end-the-job.mjs) | The one unsigned call that completes or rejects the job on the hook | `complete → complete(bytes32) to 0xc057…` |
|
|
43
|
+
| 16 | [verify](16-grade-verify.mjs) | Anyone can recompute a grade; a changed verdict is caught | `tampered: false` |
|
|
44
|
+
| 17 | [live](17-grade-live.mjs) | The same grade, answered live on your own key | a receipt, or how to get a key |
|
|
45
|
+
|
|
46
|
+
## Before you take part
|
|
47
|
+
|
|
48
|
+
Each role gets a readiness report: what you put up, what you can lose, and anything that should stop you, with the fix.
|
|
49
|
+
|
|
50
|
+
| # | File | Role | You see |
|
|
51
|
+
|---|---|---|---|
|
|
52
|
+
| 20 | [onboard-client](20-onboard-client.mjs) | Paying for work | `[caution] your stated loss exceeds the damage cover of 70` |
|
|
53
|
+
| 21 | [onboard-provider](21-onboard-provider.mjs) | Doing the work | `[block] this job needs a 40 deposit and you have 30 free` |
|
|
54
|
+
| 22 | [onboard-evaluator](22-onboard-evaluator.mjs) | Judging the work | `[caution] without a verifiable proof you can reject but never approve` |
|
|
55
|
+
| 23 | [onboard-backer](23-onboard-backer.mjs) | Standing behind workers (pools are not open yet; this is the arithmetic) | `breaks even at 3.23%` |
|
|
56
|
+
|
|
57
|
+
## Reading jobs that already ran
|
|
58
|
+
|
|
59
|
+
| # | File | What it shows | You see |
|
|
60
|
+
|---|---|---|---|
|
|
61
|
+
| 30 | [read-a-real-job](30-read-a-real-job.mjs) | Decode two real Virtuals ACP jobs from their Base logs | `settles as: rejected (evaluatorRejected)` |
|
|
62
|
+
| 31 | [read-the-ending](31-read-the-ending.mjs) | Which endings the trail decides alone, and which need a grader | `cannot_determine (needs a grader)` |
|
|
63
|
+
| 32 | [read-live-from-base](32-read-live-from-base.mjs) | The same, straight from a public Base RPC | `6 events` for job 74926 |
|
|
64
|
+
| 33 | [read-many-jobs](33-read-many-jobs.mjs) | Many jobs at once: how many were judged by someone other than the buyer | `2 jobs · self-judged: 2` |
|
|
65
|
+
|
|
66
|
+
## The article, claim by claim
|
|
67
|
+
|
|
68
|
+
| # | File | What it shows | You see |
|
|
69
|
+
|---|---|---|---|
|
|
70
|
+
| 40 | [the-article](40-the-article.mjs) | Every claim the launch article makes about the SDK, checked. Live, it also finds the equation job's grade on Base (`OFFLINE=1` skips that) | `every claim holds` |
|
|
71
|
+
|
|
72
|
+
## Settings
|
|
73
|
+
|
|
74
|
+
Only the two live examples read anything from the environment.
|
|
75
|
+
|
|
76
|
+
| Variable | Used by | Required | Default |
|
|
77
|
+
|---|---|---|---|
|
|
78
|
+
| `TYPESAFE_KEY` | 17 | yes, for 17 | none: 17 explains how to get one and stops. Your key is sent to TypeSafe only |
|
|
79
|
+
| `BASE_RPC` | 32 | no | `https://mainnet.base.org` |
|
|
80
|
+
| `JOB` | 32 | no | `74926` |
|
|
81
|
+
| `FROM_BLOCK`, `WINDOWS` | 32 | no | `50427200`, `4` windows of 500 blocks |
|
|
82
|
+
|
|
83
|
+
Nothing here signs or sends a transaction. Where a step would write to a chain (14, 15), the example prints the unsigned
|
|
84
|
+
call for you to review and sign with your own wallet.
|
|
85
|
+
|
|
86
|
+
## Troubleshooting
|
|
87
|
+
|
|
88
|
+
| You see | Do this |
|
|
89
|
+
|---|---|
|
|
90
|
+
| `Cannot find package '@moonbeam-foundation/sdk'` | Install it (`npm i @moonbeam-foundation/sdk`), or from a clone run `npm run build` first |
|
|
91
|
+
| `set TYPESAFE_KEY to your own key` | 17 needs your own key from console.typesafe.ai |
|
|
92
|
+
| `nothing in this window` | 32 read the wrong blocks: set `FROM_BLOCK` near the job's creation, or raise `WINDOWS` |
|
|
93
|
+
| `eth_getLogs: … range` | Your RPC caps the block range: use another `BASE_RPC` |
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Jev's answers in the shape it returns them: a value, a confidence and the full distribution per question.
|
|
2
|
+
// CLEAN/REJECT/UNSURE are written for these examples; data/pilot-grade.recorded.json and data/base-grade.recorded.json hold real graded jobs.
|
|
3
|
+
const a = (id, value, probabilities, confidence = 0.9) => ({ id, value, confidence, probabilities });
|
|
4
|
+
export const CLEAN = [a('spec_met', 'yes', { yes: 0.95, no: 0.05 }), a('unsupported_claim', 'no', { yes: 0.05, no: 0.95 }), a('ending', 'complete', { complete: 0.92, reject: 0.03, expire: 0, needs_review: 0.05 }), a('cheat_shaped', 'no', { yes: 0.02, no: 0.98 })];
|
|
5
|
+
export const REJECT = [a('spec_met', 'no', { yes: 0.1, no: 0.9 }), a('unsupported_claim', 'yes', { yes: 0.8, no: 0.2 }), a('ending', 'reject', { complete: 0.05, reject: 0.9, expire: 0, needs_review: 0.05 }), a('cheat_shaped', 'no', { yes: 0.1, no: 0.9 })];
|
|
6
|
+
export const UNSURE = [a('spec_met', 'yes', { yes: 0.6, no: 0.4 }, 0.6), a('unsupported_claim', 'no', { yes: 0.3, no: 0.7 }), a('ending', 'complete', { complete: 0.55, reject: 0.1, expire: 0, needs_review: 0.35 }), a('cheat_shaped', 'no', { yes: 0.1, no: 0.9 })];
|
|
7
|
+
// Moonbeam's first covered hire on Base (a pilot between our own wallets)
|
|
8
|
+
export const PILOT_JOB = '0x5bf26c8eece0ca8a7cd3df7389860e323291b002f7e6ab6ce07470bf73a7027d';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_about": "A real job on Base graded by Jev (jev-1.13.0) and recorded on Base on 27 September 2026: an Olas Mech marketplace request. Copied from the recorded decision; the demo re-derives its digest offline.",
|
|
3
|
+
"job": {
|
|
4
|
+
"what": "Olas Mech request",
|
|
5
|
+
"ref": "0x8872c9369af22be743b9d5cbc8cbe5d8f39aa8ee7e9468bec5ecbe74080d5c51",
|
|
6
|
+
"chainId": 8453
|
|
7
|
+
},
|
|
8
|
+
"subject": {
|
|
9
|
+
"chainId": 8453,
|
|
10
|
+
"ref": "0x8872c9369af22be743b9d5cbc8cbe5d8f39aa8ee7e9468bec5ecbe74080d5c51",
|
|
11
|
+
"label": "RUBRIC_v1 · 0x8872c9369af22be743b9d5cbc8cbe5d8f39aa8ee7e9468bec5ecbe74080d5c51"
|
|
12
|
+
},
|
|
13
|
+
"evidence": "marketplace: Olas Mech Marketplace (Base); request 0x8872c9369af22be743b9d5cbc8cbe5d8f39aa8ee7e9468bec5ecbe74080d5c51\nwhat the buyer asked: solve the equation x^2 - 4x + 4 = 0 (tool openai-gpt-3.5-turbo)\nbuyer: 0x0afc909c92967cfc6d89ad2f214d7c697a183e51\nseller: mech 0x723f6a7fc401a8d2eade269b5c65643b9ad3719f (service 111)\nfee: 0.000099 USD (100 CREDITS)\nrequested: 2025-03-19 08:52:39 UTC, tx 0x2bebcc81488d0c09bd844a4d36bc08a59f87eec2151a237fbb9574f1481e7077\ndelivered: 2025-03-19 08:54:03 UTC (84 s after the request), tx 0x150a1104f43459c41b20781189ed55006e2f3593d58f9506d20c137a941393f3, model [unhandled type]\nwhat came back: 225 characters, sha256 0x376d994ea14f0def83380353ef0adfa09c791804853623bc34d970ad135274c7:\nTo solve the equation x^2 - 4x + 4 = 0, we can first try to factor it:\n\n(x - 2)(x - 2) = 0\n\nSince both factors are the same, we have a repeated root at x = 2. Therefore, the solution to the equation x^2 - 4x + 4 = 0 is x = 2.\nhow it ended: the marketplace has no acceptance step: payment is the request fee, released to the mech at delivery; no buyer verdict exists on chain",
|
|
14
|
+
"facts": {
|
|
15
|
+
"delivered": true,
|
|
16
|
+
"checks": {
|
|
17
|
+
"delivered": true
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"model": "jev-1.13.0",
|
|
21
|
+
"answers": [
|
|
22
|
+
{
|
|
23
|
+
"id": "spec_met",
|
|
24
|
+
"value": "yes",
|
|
25
|
+
"confidence": 0.96,
|
|
26
|
+
"probabilities": {
|
|
27
|
+
"no": 0.02,
|
|
28
|
+
"yes": 0.98
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "unsupported_claim",
|
|
33
|
+
"value": "no",
|
|
34
|
+
"confidence": 0.67,
|
|
35
|
+
"probabilities": {
|
|
36
|
+
"no": 0.83,
|
|
37
|
+
"yes": 0.17
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "ending",
|
|
42
|
+
"value": "complete",
|
|
43
|
+
"confidence": 0.99,
|
|
44
|
+
"probabilities": {
|
|
45
|
+
"complete": 0.99,
|
|
46
|
+
"expire": 0,
|
|
47
|
+
"needs_review": 0.01,
|
|
48
|
+
"reject": 0
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"id": "cheat_shaped",
|
|
53
|
+
"value": "no",
|
|
54
|
+
"confidence": 1,
|
|
55
|
+
"probabilities": {
|
|
56
|
+
"no": 1,
|
|
57
|
+
"yes": 0
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"recorded": {
|
|
62
|
+
"decision": "decision-1790535328078-03f3008665",
|
|
63
|
+
"digest": "0x03f300866571588d48e3c7cef76082022f15603a4c44132963d7d2fe2a3a4610",
|
|
64
|
+
"input_digest": "0xe243de7b0ca6533f8a6fa94997902a00b4b19970b45830748cc47d2de6c0a9ae",
|
|
65
|
+
"confidence_bps": 6700,
|
|
66
|
+
"base": {
|
|
67
|
+
"contract": "0x209490d6A0FFC5368A42b0c2208BDCda853f6a92",
|
|
68
|
+
"tx": "0xb964a585fab3b445c6110277097ee31694083835ebdc87a00cc899826ec45ef6",
|
|
69
|
+
"block": 51872995
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_about": "Moonbeam's first covered hire on Base, graded by Jev (jev-1.13.0) and recorded on Base on 28 September 2026. Copied from the recorded decision; the demo re-derives its digest offline.",
|
|
3
|
+
"job": {
|
|
4
|
+
"what": "Moonbeam covered hire",
|
|
5
|
+
"ref": "0x5bf26c8eece0ca8a7cd3df7389860e323291b002f7e6ab6ce07470bf73a7027d",
|
|
6
|
+
"chainId": 8453
|
|
7
|
+
},
|
|
8
|
+
"subject": {
|
|
9
|
+
"chainId": 8453,
|
|
10
|
+
"ref": "0x5bf26c8eece0ca8a7cd3df7389860e323291b002f7e6ab6ce07470bf73a7027d"
|
|
11
|
+
},
|
|
12
|
+
"evidence": "job: assurance-hook job 0x5bf26c8eece0ca8a7cd3df7389860e323291b002f7e6ab6ce07470bf73a7027d on chain 8453, held by the Moonbeam ACP assurance hook (Moonbeam ACP on Base), hook 0xc0578657Eda85e0a246771aa1839ce79b54eE80d\nwhat the buyer asked (job description on chain): not on chain: the hook records no job description\nprice: 10 GLMR funded into escrow in JobFunded by 0x90db8fb40a3429233b2a3ce5d143f3edbca764bb (the buyer); token 0xb3846fd356c2149ee8d30b0449088dc74e265459\npremium: 0.1 GLMR, paid by the buyer together with the price\nseller deposit: 12.000000000000000001 GLMR, pulled from the seller when the job was funded (the hook requires it above the price)\ncover: pool 0x2f8e5378a2d850a18d857ad8ad30f242b89e3a58 reserved a cover cap of 10 GLMR for this job (JobCovered); the reservation was released at 2026-09-26 15:26:29 UTC\nbuyer: 0x90db8fb40a3429233b2a3ce5d143f3edbca764bb\nseller: 0xdca0f0166bbc52a94073781d3971d8aa1938ef20\nevaluator: none recorded on the hook job\ncreated: 2026-09-26 15:21:49 UTC\nfunded: 2026-09-26 15:21:49 UTC (0 s after creation)\ndeadline: 2026-09-27 15:21:44 UTC (24.0 h after funding)\nchallenge window: 60 min (set when the job was funded)\nsubmitted: 2026-09-26 15:24:41 UTC (3 min after funding), 24.0 h before the deadline\nwhat was delivered: the seller sealed a 32-byte evidence digest 0x432872327170eee40585de07538fba8e745a00ee9f4c0518c127adb00de372ec with submit; the content behind it is not published on chain\nhow it ended: completed on the hook: the price was released to the seller, at 2026-09-26 15:26:29 UTC; sent by 0x90db8fb40a3429233b2a3ce5d143f3edbca764bb (the buyer)\npayment to the seller: 10 GLMR released to 0xdca0f0166bbc52a94073781d3971d8aa1938ef20 (the seller) in the completion transaction\npremium to the pool: 0.1 GLMR at completion\nevents in order: JobCreated (block 51823381) → JobFunded (block 51823381) → JobCovered (block 51823381) → Encumbered (block 51823381) → JobSubmitted (block 51823467) → JobCompleted (block 51823521) → PaymentReleased (block 51823521) → PremiumReceived (block 51823521) → Released (block 51823521)\nseller record (paid jobs that ended): 1 completed and paid, 0 delivered then rejected or paid and never delivered, 0 paid and expired after delivery with no ruling; 1 jobs in all\nseller speed: median 3 min from funding to delivery over 1 paid jobs\nseller buyers: 1 distinct buyers; the largest placed 100% of its jobs\nnot known:\n- the task the buyer asked for is not on chain: the hook records the parties, the amounts, the deadline and the evidence digest, not a specification of the work\n- the delivered content itself is not on chain, only its evidence digest",
|
|
13
|
+
"facts": {
|
|
14
|
+
"delivered": true,
|
|
15
|
+
"checks": {
|
|
16
|
+
"funded": true,
|
|
17
|
+
"submitted": true
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"model": "jev-1.13.0",
|
|
21
|
+
"answers": [
|
|
22
|
+
{
|
|
23
|
+
"id": "spec_met",
|
|
24
|
+
"value": "no",
|
|
25
|
+
"confidence": 0.94,
|
|
26
|
+
"probabilities": {
|
|
27
|
+
"no": 0.97,
|
|
28
|
+
"yes": 0.03
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "unsupported_claim",
|
|
33
|
+
"value": "no",
|
|
34
|
+
"confidence": 0.94,
|
|
35
|
+
"probabilities": {
|
|
36
|
+
"no": 0.97,
|
|
37
|
+
"yes": 0.03
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "ending",
|
|
42
|
+
"value": "complete",
|
|
43
|
+
"confidence": 0.98,
|
|
44
|
+
"probabilities": {
|
|
45
|
+
"complete": 0.98,
|
|
46
|
+
"expire": 0,
|
|
47
|
+
"needs_review": 0.02,
|
|
48
|
+
"reject": 0
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"id": "cheat_shaped",
|
|
53
|
+
"value": "no",
|
|
54
|
+
"confidence": 0.45,
|
|
55
|
+
"probabilities": {
|
|
56
|
+
"no": 0.72,
|
|
57
|
+
"yes": 0.28
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"recorded": {
|
|
62
|
+
"decision": "decision-1790596700677-ae89127c1f",
|
|
63
|
+
"digest": "0xae89127c1f345c560d379fd8adf60baa0ab6e1fa22b4f23cf71597332a2aeb3c",
|
|
64
|
+
"input_digest": "0x2bf9c6b462863183b3209ed9dbc2d4d63a77db21a031152c5f033731ab7ff5e0",
|
|
65
|
+
"confidence_bps": 4500,
|
|
66
|
+
"base": {
|
|
67
|
+
"contract": "0x209490d6A0FFC5368A42b0c2208BDCda853f6a92",
|
|
68
|
+
"tx": "0x25c51d53c57f67224c1df7064a145893b72da3b96609fc8017ce3a3af4bf01b3",
|
|
69
|
+
"block": 51903684
|
|
70
|
+
},
|
|
71
|
+
"answers": {
|
|
72
|
+
"contract": "0x8e9B9cE86a2d55c10318607b0c815B7B8C66254d",
|
|
73
|
+
"tx": "0x2238a05579e9b4d5ff6c05bd83b103c87ed4790c9f8b01462206b96564b2f3a8",
|
|
74
|
+
"block": 51903685,
|
|
75
|
+
"answers_digest": "0xe40386e613ffc49204a8731cb3fee55aa61e51ab3ed8dd0697fbfd5ef7b988c1"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_about": "Moonbeam's first covered hire on Base, 26 September 2026: a pilot run between our own wallets. Every figure is read from these public transactions.",
|
|
3
|
+
"chainId": 8453,
|
|
4
|
+
"hook": "0xc0578657Eda85e0a246771aa1839ce79b54eE80d",
|
|
5
|
+
"jobId": "0x5bf26c8eece0ca8a7cd3df7389860e323291b002f7e6ab6ce07470bf73a7027d",
|
|
6
|
+
"token": {
|
|
7
|
+
"symbol": "GLMR",
|
|
8
|
+
"decimals": 18
|
|
9
|
+
},
|
|
10
|
+
"terms": {
|
|
11
|
+
"pay": "10",
|
|
12
|
+
"premium": "0.1",
|
|
13
|
+
"deposit": "12",
|
|
14
|
+
"evaluatorBond": "0",
|
|
15
|
+
"poolCapital": "10",
|
|
16
|
+
"damage": "0"
|
|
17
|
+
},
|
|
18
|
+
"txs": {
|
|
19
|
+
"funded": {
|
|
20
|
+
"hash": "0xfbe436ced5caf66dde0e96033f041480316fc5f62cd273006ad9c1852a57f193",
|
|
21
|
+
"block": 51823381,
|
|
22
|
+
"what": "buyer funds price + premium; the pool reserves cover; the seller's deposit is locked"
|
|
23
|
+
},
|
|
24
|
+
"delivered": {
|
|
25
|
+
"hash": "0x3c5afe1278a28894726a70263a253cf307211edda444750fb87d6b7ecfce428b",
|
|
26
|
+
"block": 51823467,
|
|
27
|
+
"what": "seller submits the digest of its deliverable"
|
|
28
|
+
},
|
|
29
|
+
"completed": {
|
|
30
|
+
"hash": "0xc606d00fed64e912585bbc93feb15a9289cfcde94289f49f7c74a7a468903116",
|
|
31
|
+
"block": 51823521,
|
|
32
|
+
"what": "buyer completes: seller paid, deposit back, premium to the pool"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { parseUnits } from '@moonbeam-foundation/sdk';
|
|
2
|
+
export const usdc = (v) => parseUnits(v);
|
|
3
|
+
// A 100 USDC job with 1 USDC of cover. The deposit is deliberately thin (40): onboarding should flag it.
|
|
4
|
+
export const TERMS = { pay: usdc('100'), premium: usdc('1'), deposit: usdc('40'), evaluatorBond: usdc('25'), poolCapital: usdc('5000'), damage: usdc('70') };
|
|
5
|
+
|
|
6
|
+
/** Print a readiness report the way a person should read it: the verdict, what you put up, what you can lose, what to fix. */
|
|
7
|
+
export function show(r, summarise) {
|
|
8
|
+
console.log(summarise(r));
|
|
9
|
+
console.log(` you put up: ${r.youBond}\n you can lose: ${r.youRisk}`);
|
|
10
|
+
for (const f of r.findings) console.log(` [${f.severity}] ${f.message}${f.remedy ? `\n → ${f.remedy}` : ''}`);
|
|
11
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"address": "0x238e541bfefd82238730d00a2208e5497f1832e0",
|
|
4
|
+
"topics": [
|
|
5
|
+
"0xb0f0239bfdd96453e24733e18bfc24b70d8fadf123dd977473518dd577ee79b9",
|
|
6
|
+
"0x00000000000000000000000000000000000000000000000000000000000124ae",
|
|
7
|
+
"0x00000000000000000000000022cbc8b546978fd414fc02cbb91d0981cf94ae40",
|
|
8
|
+
"0x000000000000000000000000ccf57d593aa2cf8f8329e5e8353f69f2b21e34e9"
|
|
9
|
+
],
|
|
10
|
+
"data": "0x00000000000000000000000022cbc8b546978fd414fc02cbb91d0981cf94ae40000000000000000000000000000000000000000000000000000000006a8d55ca0000000000000000000000000000000000000000000000000000000000000000",
|
|
11
|
+
"blockNumber": "0x301756e",
|
|
12
|
+
"transactionHash": "0x56c947fde8052f8ee8899b996c86d1f49c9bd2d5b1b8b81add5be07ce01a2cdc",
|
|
13
|
+
"logIndex": "0xb9"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"address": "0x238e541bfefd82238730d00a2208e5497f1832e0",
|
|
17
|
+
"topics": [
|
|
18
|
+
"0x869e2577b006bf47ee981cf6fec2e25583548081c14b98deab587f77b5068038",
|
|
19
|
+
"0x00000000000000000000000000000000000000000000000000000000000124ae"
|
|
20
|
+
],
|
|
21
|
+
"data": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
22
|
+
"blockNumber": "0x301757f",
|
|
23
|
+
"transactionHash": "0x7de18128f69bcab56581a85085a4f437f526882cbba295a83dc1b57367febb00",
|
|
24
|
+
"logIndex": "0x219"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"address": "0x238e541bfefd82238730d00a2208e5497f1832e0",
|
|
28
|
+
"topics": [
|
|
29
|
+
"0xe3fbcc1ea1bdc559ec7f0347efde7655e58b5f45a30b0e4470a583c3ef5496b3",
|
|
30
|
+
"0x00000000000000000000000000000000000000000000000000000000000124ae",
|
|
31
|
+
"0x00000000000000000000000022cbc8b546978fd414fc02cbb91d0981cf94ae40"
|
|
32
|
+
],
|
|
33
|
+
"data": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
34
|
+
"blockNumber": "0x301758d",
|
|
35
|
+
"transactionHash": "0xabee77b38d2d060965083c8734d4a9df3b2537eff2ee5c15ed4eee297d897db0",
|
|
36
|
+
"logIndex": "0x15d"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"address": "0x238e541bfefd82238730d00a2208e5497f1832e0",
|
|
40
|
+
"topics": [
|
|
41
|
+
"0x80c17db79857f338a6a6df68a6883ecc0ce78e2202fe61ed979733573f40538e",
|
|
42
|
+
"0x00000000000000000000000000000000000000000000000000000000000124ae",
|
|
43
|
+
"0x000000000000000000000000ccf57d593aa2cf8f8329e5e8353f69f2b21e34e9"
|
|
44
|
+
],
|
|
45
|
+
"data": "0x1f1e98562244c2274c1d71e1672a184339300ab0b6f9c5203e34af8aded50249",
|
|
46
|
+
"blockNumber": "0x30175a3",
|
|
47
|
+
"transactionHash": "0xb2025a23b611088a5f41bc71b2d73e2f05deddd0299961344ba4aaefaefd419c",
|
|
48
|
+
"logIndex": "0x93"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"address": "0x238e541bfefd82238730d00a2208e5497f1832e0",
|
|
52
|
+
"topics": [
|
|
53
|
+
"0x0fd54bd364fa9e67f17b091aefe930932c09fe7651cf5ad02c71a418f3341444",
|
|
54
|
+
"0x00000000000000000000000000000000000000000000000000000000000124ae",
|
|
55
|
+
"0x00000000000000000000000022cbc8b546978fd414fc02cbb91d0981cf94ae40"
|
|
56
|
+
],
|
|
57
|
+
"data": "0x583e46526905aa81bad85c4cd8ce6b5c701e48ad8c1206e3a66ee976937837b1",
|
|
58
|
+
"blockNumber": "0x30175af",
|
|
59
|
+
"transactionHash": "0x33831befe1218b22d6a36aa5f773075968e5a7154bde16b91e916e474b054ce9",
|
|
60
|
+
"logIndex": "0xac"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"address": "0x238e541bfefd82238730d00a2208e5497f1832e0",
|
|
64
|
+
"topics": [
|
|
65
|
+
"0x21d71db5be59bb9fa133895586b7404307dd33fb93b16db09dc6f1d9d7d231b0",
|
|
66
|
+
"0x00000000000000000000000000000000000000000000000000000000000124ae",
|
|
67
|
+
"0x000000000000000000000000ccf57d593aa2cf8f8329e5e8353f69f2b21e34e9"
|
|
68
|
+
],
|
|
69
|
+
"data": "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
70
|
+
"blockNumber": "0x30175af",
|
|
71
|
+
"transactionHash": "0x33831befe1218b22d6a36aa5f773075968e5a7154bde16b91e916e474b054ce9",
|
|
72
|
+
"logIndex": "0xad"
|
|
73
|
+
}
|
|
74
|
+
]
|