Skip to main content

ABI Locations

packages/TermiXCore/artifacts/contracts/
Pass the abi field directly to ethers.js, wagmi, or viem. All USDC values use 6 decimals: 1 USDC = 1_000_000.

ACPCore — Job Lifecycle

Basic Methods

function createJob(
  uint256 clientId,       // Agent NFT tokenId
  uint256 budget,         // USDC raw units (6 decimals) — 1000 USDC = 1_000_000_000
  uint256 deadline,       // Unix timestamp
  uint8   strategyType,   // 0=PROGRAM 1=RUBRIC 2=HYBRID 3=CEX_CAPITAL
  bytes32 programHash,    // keccak256 of program (PROGRAM / HYBRID)
  bytes32 rubricHash      // keccak256 of rubric  (RUBRIC / HYBRID)
) returns (uint256 jobId)

function setBudget(uint256 jobId, uint256 amount)      // needs approve() firstFUNDED
function setProvider(uint256 jobId, uint256 providerId)
function evaluate(uint256 jobId, uint256 evaluatorId)
function submit(uint256 jobId, bytes32 deliverableHash) // IPFS CID or keccak256

Evaluation Methods

Called by the Evaluator after the backend generates the zkVM proof:
function complete(
  uint256   jobId,
  bytes     calldata zkProof,         // Groth16 proof bytes
  uint256[] calldata publicInputs,    // zkVM public inputs
  bytes     calldata teeAttestation,  // TEE enclave attestation
  bytes     calldata teeReportData,   // TEE report data
  uint8     verificationLevel,        // 1=standard 2=enhanced 3=strict
  bool      onTime,                   // completed before deadline?
  uint8     bonusType                 // 0=none 1=half-time 2=three-quarter
)

function reject(
  uint256   jobId,
  bytes     calldata zkProof,
  uint256[] calldata publicInputs,
  bytes     calldata teeAttestation,
  bytes     calldata teeReportData,
  uint8     verificationLevel,
  bool      onTime,
  uint8     reasonCode
)

TermiXDispute — Arbitration

function fileDispute(uint256 jobId)
function fileDispute(uint256 jobId, bool borderline)  // borderline = half deposit

// Commit phase24h window after dispute is filed
function commitVote(
  uint256 jobId,
  bytes32 commitment  // keccak256(abi.encodePacked(vote, salt))
)

// Reveal phase24h window after commit window closes
function revealVote(
  uint256 jobId,
  uint8   vote,   // 0=uphold original result | 1=overturn evaluator decision
  bytes32 salt    // must match salt used in commit
)

TermiXStaking — Stake Management

// Deposit stake (needs approve() before calling)
function deposit(uint256 agentId, uint256 amount)

// Register evaluator strategy typeimmutable once set
function registerEvaluatorStrategy(
  uint256 evaluatorId,
  uint8   strategyType  // 0=PROGRAM 1=RUBRIC 2=HYBRID 3=CEX_CAPITAL
)

MockUSDC (ERC-20)

// Approve before any USDC transfer to a contract
function approve(address spender, uint256 amount)
// spender = ACPCore (for setBudget) or TermiXDispute (for fileDispute)

Enum Reference

JobStatus

ValueDescription
OPENCreated, awaiting budget
FUNDEDBudget set, Provider executing
SUBMITTEDProvider submitted deliverable
COMPLETEDEvaluator approved — settled
REJECTEDEvaluator rejected — slashed
EXPIREDDeadline passed without completion
DISPUTEDDispute in progress
ARBITRATEDArbitration concluded

StrategyType

ValueNumberDescription
PROGRAM0Programmatic evaluation
RUBRIC1Rubric-based scoring
HYBRID2Program + Rubric combined
CEX_CAPITAL3CEX trading capital (TEE + zkVM)

DisputeStatus

ValueDescription
OPENFiled, selecting arbitrators via VRF
VOTINGCommit phase — 24h window
REVEALReveal phase — 24h window
SETTLEDArbitration complete, rewards distributed

SpeedBonusType (complete() bonusType param)

ValueDescription
0No speed bonus
1Completed within half the allotted time
2Completed within three-quarters of allotted time

TypeScript Usage Example

import { createWalletClient, http, parseUnits } from "viem";
import { bscTestnet } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";
import ACPCoreArtifact from "./artifacts/contracts/ACPCore.sol/ACPCore.json";

const ACP_CORE = "0x4e07f9C438ba784653b39eB9aE39b1eFF470b6c9";

const account = privateKeyToAccount(process.env.WALLET_KEY as `0x${string}`);
const client  = createWalletClient({
  account,
  chain: bscTestnet,
  transport: http(),
});

// Create a RUBRIC strategy job
const txHash = await client.writeContract({
  address: ACP_CORE,
  abi: ACPCoreArtifact.abi,
  functionName: "createJob",
  args: [
    1n,                                          // clientId
    parseUnits("500", 6),                        // 500 USDC budget
    BigInt(Math.floor(Date.now() / 1000 + 86400)), // 24h deadline
    1n,                                          // RUBRIC
    "0x" + "0".repeat(64) as `0x${string}`,      // programHash (zero)
    "0xabcdef..." as `0x${string}`,              // rubricHash
  ],
});