Docs
How a job purse works.
One contract, NevfourJobPurse, on Elysium (99901). Not deployed yet.
The rule
cap = reward − minMargin (fixed at open, can only be lowered) headroom = cap − spent accept = estimate ≤ headroom net = rewardPaid + rewardDeclared − spent
Funding is limited to the cap minus what was already spent and withdrawn, so the escrow can never hold more than the agent may use. The accept check is a read; it does not reserve anything.
Roles and powers
| Call | Who | Effect |
|---|---|---|
| openJob | anyone (becomes operator) | Creates the job, optional first funding, agent and up to 16 providers. |
| fund | operator | Adds escrow, never above the cap. |
| withdraw | operator | Takes unspent escrow back at any time, open or closed. |
| setAgent / setProvider | operator | Changes or revokes the agent key; edits the allow-list. |
| lowerCap | operator | Lowers the cap, never below what is spent. |
| close | operator | Succeeded / Failed / Cancelled, declared reward, result hash; refunds the rest. |
| spend | agent key | Pays an allow-listed provider, or records a held spend. |
| payReward | anyone | Forwards the reward to the operator and records it. |
No owner, admin, pause, fee or upgrade. Nobody but the operator can move a job's escrow anywhere except to its allowed providers through the agent key.
Reason bits
Returned by checkSpend and spend. Limit bits (provider, cap, escrow, per-spend) make a spend held; the others make it revert with SpendRefused.
| Bit | Meaning | Effect |
|---|---|---|
| 1 | no such job | reverts |
| 2 | the job is closed | reverts |
| 4 | the job's deadline has passed | reverts |
| 8 | this address is not the job's agent key | reverts |
| 16 | the provider is not on the job's allow-list | held |
| 32 | the amount is zero | reverts |
| 64 | it would pass the spending cap | held |
| 128 | the escrow holds less than the amount | held |
| 256 | it is above the per-spend limit | held |
Events
| JobOpened(jobId, operator, agent, token, reward, minMargin, cap, maxPerSpend, deadline, specHash) | A job and its cap exist. |
| JobFunded(jobId, amount, balance) | Escrow added (only the operator, never above the cap). |
| AgentSet(jobId, agent) | Agent key set; zero address = revoked. |
| ProviderSet(jobId, provider, allowed) | Allow-list changed. |
| CapLowered(jobId, oldCap, newCap) | Cap went down. It cannot go up. |
| Spent(jobId, provider, agent, kind, amount, memo, spentTotal, headroom) | A provider was paid from the escrow. |
| SpendHeld(jobId, provider, agent, kind, amount, memo, reasons) | A spend hit a limit; nothing moved. |
| Withdrawn(jobId, amount, balance) | The operator took unspent funds back. |
| RewardPaid(jobId, payer, amount) | Someone paid the reward; it went straight to the operator. |
| JobClosedOut(jobId, status, spent, rewardPaid, rewardDeclared, refunded, resultHash) | Outcome recorded, remainder refunded. |
jobId is indexed (topic1), so one job's ledger is a single eth_getLogs call. This site reads it that way.
Assets and limits
- HYPE (native) or an ERC-20 per job. The open-job form offers HYPE and USDC; a USDC job is two transactions (approve the purse for exactly the funding amount, then openJob pulls it). Other tokens go through the SDK call. Tokens that take a fee on transfer are refused; tokens that return nothing are accepted; rebasing tokens are not supported.
- A provider that rejects HYPE makes the spend revert, so nothing is lost or stuck.
- The reward is only known on-chain when paid through payReward. A reward declared at close is the operator's statement and is labelled that way.
- An estimate is the operator's or agent's number. NEV4 does not predict costs, prices or earnings.
- Nothing is priced in USD: Elysium has no price feed this site trusts.
Check a deployment against this build: /api/proof · status: /api/health · agents: SDK