Smart Contracts

Job Contract

Per-job escrow contract for native TON payments. Each job is deployed as a separate contract by the JobFactory.

Source: contracts/job.tolk — compiled with Tolk 1.2
OPEN
awaiting funds
fund
FUNDED
escrow locked
cancel
CANCELLED
take
submit
SUBMITTED
awaiting evaluation
approve
COMPLETED
provider paid
reject
DISPUTED
client refunded
evaluator silence past timeout → auto-claim by provider · quit → job reopens

6 States

CodeStateDescription
0OPENCreated, awaiting budget & funding
1FUNDEDTON locked in escrow
2SUBMITTEDProvider submitted result
3COMPLETEDApproved — provider paid
4DISPUTEDRejected — client refunded
5CANCELLEDTimeout — client refunded

9 Operations

OpcodeOperationSenderStateEffect
0x01FundClientOPENLock TON → FUNDED
0x02TakeJobAnyoneFUNDEDClaim as provider
0x03SubmitResultProviderFUNDEDPush hash → SUBMITTED
0x04EvaluateEvaluatorSUBMITTEDApprove/Reject
0x05CancelClientFUNDEDRefund after timeout
0x06InitJobFactoryInternalInitialize data
0x07ClaimProviderSUBMITTEDAuto-claim after eval timeout
0x08QuitProviderFUNDEDExit, job reopens
0x09SetBudgetClientOPENSet/update price

Network Fees

ENACT charges 0% protocol fee — all funds go to the provider. The only costs are TON network gas fees. Excess gas is automatically refunded.

OperationGas AttachedActual CostRefunded
Create Job0.03 TON~0.021 TON~0.009 TON
Fund Jobbudget + 0.01 TON~0.004 TON~0.006 TON
Take / Submit / Evaluate0.01 TON~0.003 TON~0.007 TON
Cancel / Claim / Quit0.01 TON~0.003 TON~0.007 TON
Set USDT Wallet0.01 TON~0.003 TON~0.007 TON
Fund USDT Job0.1 TON (gas only)~0.057 TON~0.04 TON
USDT transfers require extra gas (0.065 TON) for the Jetton transfer message. This is network gas, not a protocol fee. The unused portion is returned to the sender.

3 Roles

Storage Layout

Contract data is stored in a 3-cell chain:

Cell structure
// Main Cell
jobId(32) · factory(267) · client(267) · hasProvider(1) · [provider?(267)] · state(8)

// Details Cell
evaluator(267) · budget(coins) · descHash(256) · resultHash(256)

// Extension Cell
timeout(32) · createdAt(32) · evalTimeout(32) · submittedAt(32) · resultType(8) · reason(256)

Now that you understand the contract architecture, see the SDK Job Wrapper for TypeScript integration.