Contracts reference
Generated from the NatSpec comments in contracts/src (Foundry artifacts). Addresses per network are in packages/contracts-sdk/deployments. Amounts are in the asset's native decimals.
IsaacParams
Functions
| function |
mutability |
notes |
MAX_TOTAL_FEE_BPS() returns (uint16) |
view |
Sum of the three fee pools may not exceed this many bps. |
acceptOwnership() |
nonpayable |
The new owner accepts the ownership transfer. |
arbiter() returns (address) |
view |
|
baseSessionReward() returns (uint256) |
view |
|
checkout() returns (address) |
view |
|
collectorPoolBps() returns (uint16) |
view |
|
collectorStakePerSession() returns (uint256) |
view |
|
dataAttestation() returns (address) |
view |
|
flagBond() returns (uint256) |
view |
|
foundryRatePerMinute() returns (uint256) |
view |
|
foundrySigner() returns (address) |
view |
|
listings() returns (address) |
view |
|
maxSessionsPerSkill() returns (uint256) |
view |
|
maxUpstreamBps() returns (uint16) |
view |
|
owner() returns (address) |
view |
Returns the address of the current owner. |
pendingOwner() returns (address) |
view |
Returns the address of the pending owner. |
platformFeeBps() returns (uint16) |
view |
|
renounceOwnership() |
nonpayable |
Leaves the contract without owner. It will not be possible to call onlyOwner functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner. |
requiredVerifications() returns (uint8) |
view |
|
rewardAsset() returns (address) |
view |
|
rewards() returns (address) |
view |
|
robotIdentity() returns (address) |
view |
|
setAddress(bytes32 key, address value) |
nonpayable |
Set an address. Setting "usdg" re-reads its decimals. |
setUint(bytes32 key, uint256 value) |
nonpayable |
Set a numeric parameter. Fee bps keep platform + collector + verifier <= 5000. |
skillRegistry() returns (address) |
view |
|
telemetryRewardPerHour() returns (uint256) |
view |
|
transferOwnership(address newOwner) |
nonpayable |
Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner. Setting newOwner to the zero address is allowed; this can be used to cancel an initiated ownership transfer. |
treasury() returns (address) |
view |
|
usdg() returns (address) |
view |
|
usdgDecimals() returns (uint8) |
view |
|
verificationReward() returns (uint256) |
view |
|
verifierPoolBps() returns (uint16) |
view |
|
verifierStake() returns (uint256) |
view |
|
Events
| event |
notes |
AddressUpdated(bytes32 indexed key, address value) |
|
OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner) |
|
OwnershipTransferred(address indexed previousOwner, address indexed newOwner) |
|
ParamsUpdated(bytes32 indexed key, uint256 value) |
|
Errors: FeeCapExceeded, OwnableInvalidOwner, OwnableUnauthorizedAccount, UnknownKey, ValueOutOfRange, ZeroAddress.
RobotIdentity
Functions
| function |
mutability |
notes |
DOMAIN_SEPARATOR() returns (bytes32) |
view |
|
MAX_CLASS_ID() returns (uint32) |
view |
|
PAIR_INTENT_TYPEHASH() returns (bytes32) |
view |
|
deviceNonce(address) returns (uint256) |
view |
Next PairIntent nonce per device key. Consumed on every successful pairing. |
eip712Domain() returns (bytes1, string, string, uint256, address, bytes32, uint256[]) |
view |
returns the fields and values that describe the domain separator used by this contract for EIP-712 signature. |
getRobot(bytes32 robotId) returns (tuple) |
view |
|
isOwner(bytes32 robotId, address who) returns (bool) |
view |
|
pairDevice(bytes32 robotId, address deviceKey, bytes deviceSig) |
nonpayable |
Pair a device key to a robot. deviceSig is the device's EIP-712 signature over PairIntent{robotId, owner, nonce} with nonce = deviceNonce[deviceKey]. |
pairIntentDigest(bytes32 robotId, address owner, uint256 nonce) returns (bytes32) |
view |
|
register(bytes32 bodyHash, uint32 classId, bytes32 salt) returns (bytes32) |
nonpayable |
Register a robot. robotId = keccak256(abi.encode(msg.sender, bodyHash, salt)). classId: 1 companion, 2 tracked, 3 diffdrive, 4 arm, 5 quadruped. |
robotOfDevice(address) returns (bytes32) |
view |
|
robots(bytes32) returns (address, bytes32, address, uint64, uint32, bool) |
view |
|
robotsOf(address, uint256) returns (bytes32) |
view |
|
robotsOfOwner(address owner) returns (bytes32[]) |
view |
|
setActive(bytes32 robotId, bool active) |
nonpayable |
|
transfer(bytes32 robotId, address to) |
nonpayable |
Transfer a robot. Any paired device is unpaired, since its PairIntent named the old owner. |
unpairDevice(bytes32 robotId) |
nonpayable |
|
updateBody(bytes32 robotId, bytes32 newBodyHash) |
nonpayable |
|
Events
| event |
notes |
BodyUpdated(bytes32 indexed robotId, bytes32 oldHash, bytes32 newHash) |
|
DevicePaired(bytes32 indexed robotId, address deviceKey) |
|
DeviceUnpaired(bytes32 indexed robotId, address deviceKey) |
|
EIP712DomainChanged() |
|
RobotActiveSet(bytes32 indexed robotId, bool active) |
|
RobotRegistered(bytes32 indexed robotId, address indexed owner, bytes32 bodyHash, uint32 classId) |
|
RobotTransferred(bytes32 indexed robotId, address from, address to) |
|
Errors: BadDeviceSignature, DeviceAlreadyPaired, InvalidClass, InvalidShortString, NoDevicePaired, NotRobotOwner, RobotAlreadyPaired, RobotExists, StringTooLong, ZeroAddress, ZeroBodyHash.
Listings
Functions
| function |
mutability |
notes |
create(uint8 kind, uint256 priceUsdg, bytes32 contentHash, bytes32 ref) returns (uint256) |
nonpayable |
Create a listing. For SKILL, ref is the skillId as bytes32, the caller must be the skill's trainer, and the skill's upstreamBps is copied. BUILD and PHYSICAL can be created by anyone; the API checks the manifest against contentHash before showing it. |
getListing(uint256 id) returns (tuple) |
view |
|
listings(uint256) returns (address, uint8, uint256, bytes32, bytes32, uint16, bool, uint64, uint32) |
view |
|
nextListingId() returns (uint256) |
view |
Ids start at 1; 0 means "no listing". |
params() returns (address) |
view |
|
recordSale(uint256 id) |
nonpayable |
Called by Checkout on each purchase. |
update(uint256 id, uint256 priceUsdg, bytes32 contentHash, bool active) |
nonpayable |
|
Events
| event |
notes |
ListingCreated(uint256 indexed id, address indexed creator, uint8 kind, bytes32 ref, uint256 price) |
|
ListingUpdated(uint256 indexed id, uint256 price, bytes32 contentHash, bool active) |
|
SaleRecorded(uint256 indexed id, uint32 sales) |
|
Errors: NotCheckout, NotCreator, NotSkillTrainer, SkillRevoked, UnknownListing, ZeroContentHash.
Checkout
Functions
| function |
mutability |
notes |
buy(uint256 listingId) |
nonpayable |
Buy a listing with a prior USDG approval. |
buyWithPermit(uint256 listingId, uint256 deadline, uint8 v, bytes32 r, bytes32 s) |
nonpayable |
Buy with an EIP-2612 permit. A permit that fails (e.g. front-run) is ignored and the purchase proceeds on the existing allowance. |
collectorDrained(uint256) returns (uint256) |
view |
|
collectorPool(uint256) returns (uint256) |
view |
Cumulative USDG accrued to a skill's collectors. Never decreases; see collectorDrained. |
computeSplit(uint256 price, bool isSkill, bool hasCollectors, uint16 upstreamBps) returns (tuple) |
view |
Compute the split for a price. Pure helper exposed for clients and tests. hasCollectors: false folds the collector share into the remainder (skill trained on no sessions).; isSkill: whether the collector and verifier pools apply. |
drainCollectorPool(uint256 skillId, address to, uint256 amount) |
nonpayable |
Pay collectors from a skill's pool. SkillRegistry only. |
drainVerifierPool(uint256 skillId, address to, uint256 amount) |
nonpayable |
Pay verifiers from a skill's pool. SkillRegistry only. |
foundryEscrow(bytes32) returns (uint256) |
view |
|
foundryPayer(bytes32) returns (address) |
view |
|
fundFoundryJob(bytes32 jobId, uint256 amount) |
nonpayable |
Prepay USDG for a hosted foundry job. Top-ups are allowed from the same user. |
hasPurchased(uint256 listingId, address buyer) returns (bool) |
view |
|
params() returns (address) |
view |
|
purchased(bytes32) returns (bool) |
view |
|
receipts(bytes32) returns (uint256, address, uint256, uint64) |
view |
|
settleFoundryJob(bytes32 jobId, address user, uint256 spent) |
nonpayable |
Settle a foundry job: spent goes to the treasury and the rest is refunded. Foundry signer only. |
verifierDrained(uint256) returns (uint256) |
view |
|
verifierPool(uint256) returns (uint256) |
view |
Cumulative USDG accrued to a skill's verifiers. Never decreases; see verifierDrained. |
Events
| event |
notes |
FoundryFunded(bytes32 indexed jobId, address indexed user, uint256 amount) |
|
FoundrySettled(bytes32 indexed jobId, address indexed user, uint256 spent, uint256 refunded) |
|
PoolDrained(uint256 indexed skillId, address indexed to, uint256 amount, bool collectors) |
|
Purchased(uint256 indexed listingId, address indexed buyer, uint256 price, uint256 toCreator, uint256 toUpstream, uint256 toCollectors, uint256 toVerifiers, uint256 toPlatform) |
|
Errors: AlreadyPurchased, EscrowOwnedByOther, ListingInactive, NotFoundrySigner, NotSkillRegistry, PoolExceeded, ReentrancyGuardReentrantCall, SafeERC20FailedOperation, SkillRevoked, SpentExceedsEscrow, WrongJobUser, ZeroAmount.
SkillRegistry
Functions
| function |
mutability |
notes |
REASON_VERIFICATION() returns (bytes32) |
view |
|
UNSTAKE_COOLDOWN() returns (uint256) |
view |
|
VALID_CLASS_BITS() returns (uint32) |
view |
|
claimCollector(uint256 skillId) |
nonpayable |
Claim the caller's pro-rata share of a skill's collector pool. |
claimDeferred() |
nonpayable |
Pay out everything deferred to the caller. Reverts if Rewards still cannot cover it. |
claimVerifier(uint256 skillId) |
nonpayable |
Claim the caller's equal share of a verified skill's verifier pool. |
collectorClaimable(uint256 skillId, address collector) returns (uint256) |
view |
|
collectorClaimed(uint256, address) returns (uint256) |
view |
|
collectorWeight(uint256, address) returns (uint256) |
view |
|
declaredSessions(uint256, uint256) returns (uint256, address, uint32) |
view |
|
declaredSessionsOf(uint256 skillId) returns (tuple[]) |
view |
|
deferred(address) returns (uint256) |
view |
Deferred reward owed per address, in reward asset units. |
getSkill(uint256 skillId) returns (tuple) |
view |
|
isVerifier(uint256, address) returns (bool) |
view |
|
lastVerificationAt(address) returns (uint64) |
view |
|
nextSkillId() returns (uint256) |
view |
|
params() returns (address) |
view |
|
publish(bytes32 manifestHash, uint32 classMask, uint256 parentSkillId, uint16 upstreamBps, uint256[] sessionIds) returns (uint256) |
nonpayable |
Publish a skill. sessionIds must be ACCEPTED in DataAttestation; each contributes its duration in seconds as weight to its collector's share of the collector pool. |
revoke(uint256 skillId, string reason) |
nonpayable |
Revoke a skill. Arbiter only. |
skills(uint256) returns (address, bytes32, uint32, uint256, uint16, uint8, uint8, uint64, uint256) |
view |
|
stakeAsVerifier() |
nonpayable |
Stake verifierStake USDG to become a verifier. |
submitVerification(uint256 skillId, bytes32 robotId, bool passed, bytes32 evidenceHash) |
nonpayable |
Record an on-hardware verification run. Pays verificationReward on every submission. The skill becomes VERIFIED at requiredVerifications passes; after that the verifier set is frozen so verifier pool shares are fixed. |
submitted(uint256, address) returns (bool) |
view |
skillId => verifier => submitted. One submission per verifier per skill. |
sweepVerifierPool(uint256 skillId) |
nonpayable |
Send the verifier pool of a skill that was revoked before it was ever verified to the treasury, since no verifier can claim it. Arbiter only. |
unstakeAsVerifier() |
nonpayable |
Withdraw the verifier stake. Not allowed within 7 days of the caller's last verification. |
verifiedAt(uint256) returns (uint64) |
view |
|
verifiedBy(uint256, bytes32) returns (bool) |
view |
skillId => robotId => verified. One verification per robot per skill. |
verifierClaimable(uint256 skillId, address verifier) returns (uint256) |
view |
|
verifierClaimed(uint256, address) returns (uint256) |
view |
|
verifierStakeOf(address) returns (uint256) |
view |
|
verifiers(uint256, uint256) returns (address) |
view |
|
verifiersOf(uint256 skillId) returns (address[]) |
view |
|
Events
| event |
notes |
CollectorClaimed(uint256 indexed skillId, address indexed collector, uint256 amount) |
|
DeferredClaimed(address indexed to, uint256 amount) |
|
RewardDeferred(address indexed to, uint256 amount, bytes32 reason) |
|
SkillPublished(uint256 indexed skillId, address indexed trainer, bytes32 manifestHash, uint32 classMask, uint256 parent) |
|
SkillRevoked(uint256 indexed skillId, string reason) |
|
SkillVerified(uint256 indexed skillId) |
|
VerificationRun(uint256 indexed skillId, address indexed verifier, bytes32 indexed robotId, bool passed, bytes32 evidenceHash) |
|
VerifierClaimed(uint256 indexed skillId, address indexed verifier, uint256 amount) |
|
VerifierPoolSwept(uint256 indexed skillId, uint256 amount) |
|
VerifierStaked(address indexed verifier, uint256 amount) |
|
VerifierUnstaked(address indexed verifier, uint256 amount) |
|
Errors: AlreadyRevoked, AlreadyStaked, AlreadySubmitted, ClassNotSupported, CooldownActive, DuplicateSession, InvalidClassMask, NotArbiter, NotOpenForVerification, NotRobotOwner, NotStaked, NotSweepable, NotVerified, NothingDeferred, NothingToClaim, ReentrancyGuardReentrantCall, RobotAlreadyUsed, RobotInactive, SafeERC20FailedOperation, SessionNotAccepted, TooManySessions, TrainerCannotVerify, UnknownParent, UnknownSkill, UpstreamTooHigh, UpstreamWithoutParent, ZeroHash.
DataAttestation
Functions
| function |
mutability |
notes |
FLAG_WINDOW() returns (uint256) |
view |
|
MAX_REPUTATION_DISCOUNT() returns (uint256) |
view |
|
REASON_SESSION() returns (bytes32) |
view |
|
VALID_CLASS_BITS() returns (uint32) |
view |
Bits 1..5 are the valid class ids. |
acceptSession(uint256 sessionId) |
nonpayable |
Accept a session: by the request's trainer at any time, or by anyone once the flag window has passed without a flag. Returns the stake and pays the reward. |
claimDeferred() |
nonpayable |
Pay out everything deferred to the caller. Reverts if Rewards still cannot cover it. |
closeRequest(uint256 requestId) |
nonpayable |
|
dataHashUsed(bytes32) returns (bool) |
view |
|
deferred(address) returns (uint256) |
view |
Deferred reward owed per address, in reward asset units. |
flagSession(uint256 sessionId) |
nonpayable |
Flag a session as junk within 72 hours of submission. Pulls the flag bond. |
getRequest(uint256 requestId) returns (tuple) |
view |
|
getSession(uint256 sessionId) returns (tuple) |
view |
|
nextRequestId() returns (uint256) |
view |
|
nextSessionId() returns (uint256) |
view |
|
openRequest(bytes32 specHash, uint32 classMask, uint32 maxSessions, uint256 rewardPerSession) returns (uint256) |
nonpayable |
|
params() returns (address) |
view |
|
pending(uint256) returns (uint32) |
view |
Sessions submitted or flagged and not yet resolved, per request. Counts toward maxSessions. |
reputation(address) returns (uint256) |
view |
Accepted sessions per collector; drives the stake discount. |
requests(uint256) returns (address, bytes32, uint32, uint32, uint32, uint256, bool) |
view |
|
resolveFlag(uint256 sessionId, bool junk) |
nonpayable |
Arbiter resolves a flag. Junk: stake and bond go to the flagger, session REJECTED. Not junk: bond and stake go to the collector, session ACCEPTED with reward. |
sessions(uint256) returns (uint256, bytes32, address, bytes32, uint32, uint64, uint8, uint256, address, uint256) |
view |
|
stakeFor(address collector) returns (uint256) |
view |
|
submitSession(uint256 requestId, bytes32 robotId, bytes32 dataHash, uint32 durationSec) returns (uint256) |
nonpayable |
Submit a recorded session. Pulls the collector stake, discounted by 1% per accepted session up to 80%: stake = base * (100 - min(reputation, 80)) / 100. |
Events
| event |
notes |
DeferredClaimed(address indexed to, uint256 amount) |
|
RequestClosed(uint256 indexed requestId) |
|
RequestOpened(uint256 indexed requestId, address indexed trainer, bytes32 specHash, uint32 classMask, uint32 maxSessions) |
|
RewardDeferred(address indexed to, uint256 amount, bytes32 reason) |
|
SessionAccepted(uint256 indexed sessionId) |
|
SessionFlagged(uint256 indexed sessionId, address flagger) |
|
SessionResolved(uint256 indexed sessionId, bool junk) |
|
SessionSubmitted(uint256 indexed sessionId, uint256 indexed requestId, bytes32 indexed robotId, address collector, bytes32 dataHash, uint32 durationSec) |
|
Errors: ClassNotAccepted, DuplicateData, FlagWindowClosed, InvalidClassMask, NotAllowedYet, NotArbiter, NotRobotOwner, NotTrainer, NothingDeferred, ReentrancyGuardReentrantCall, RequestFull, RequestNotOpen, RobotInactive, SafeERC20FailedOperation, WrongState, ZeroDuration, ZeroHash, ZeroMaxSessions.
Rewards
Functions
| function |
mutability |
notes |
DOMAIN_SEPARATOR() returns (bytes32) |
view |
|
REASON_TELEMETRY() returns (bytes32) |
view |
|
TELEMETRY_CLAIM_TYPEHASH() returns (bytes32) |
view |
|
acceptOwnership() |
nonpayable |
The new owner accepts the ownership transfer. |
asset() returns (address) |
view |
|
attestationUsed(bytes32) returns (bool) |
view |
|
eip712Domain() returns (bytes1, string, string, uint256, address, bytes32, uint256[]) |
view |
returns the fields and values that describe the domain separator used by this contract for EIP-712 signature. |
fund(uint256 amount) |
nonpayable |
|
migrateAsset(address newAsset) |
nonpayable |
Switch the reward asset. Only allowed once the old asset's balance is zero. |
owner() returns (address) |
view |
Returns the address of the current owner. |
params() returns (address) |
view |
|
pause() |
nonpayable |
|
paused() returns (bool) |
view |
Returns true if the contract is paused, and false otherwise. |
pay(address to, uint256 amount, bytes32 reason) |
nonpayable |
Pay a contributor. Reverts when the pool cannot cover the amount; callers catch the revert and record a deferred IOU. |
payTelemetry(address to, uint256 hours_, bytes32 attestation, bytes apiSig) |
nonpayable |
Pay telemetry rewards against an API-signed TelemetryClaim{to, hours, attestation, nonce}. Anyone may relay; the reward always goes to to. |
payers(address) returns (bool) |
view |
|
pendingOwner() returns (address) |
view |
Returns the address of the pending owner. |
renounceOwnership() |
nonpayable |
Leaves the contract without owner. It will not be possible to call onlyOwner functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner. |
setPayer(address payer, bool allowed) |
nonpayable |
|
sweepToTreasury() |
nonpayable |
Send the whole balance of the current asset to the treasury, ahead of a migration. |
telemetryClaimDigest(address to, uint256 hours_, bytes32 attestation, uint256 nonce) returns (bytes32) |
view |
|
telemetryNonce(address) returns (uint256) |
view |
Next TelemetryClaim nonce per recipient. |
transferOwnership(address newOwner) |
nonpayable |
Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. Can only be called by the current owner. Setting newOwner to the zero address is allowed; this can be used to cancel an initiated ownership transfer. |
unpause() |
nonpayable |
|
Events
| event |
notes |
AssetMigrated(address oldAsset, address newAsset) |
|
EIP712DomainChanged() |
|
Funded(address from, uint256 amount) |
|
OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner) |
|
OwnershipTransferred(address indexed previousOwner, address indexed newOwner) |
|
Paid(address indexed to, uint256 amount, bytes32 indexed reason) |
|
Paused(address account) |
|
PayerSet(address indexed payer, bool allowed) |
|
Swept(address indexed to, uint256 amount) |
|
Unpaused(address account) |
|
Errors: AttestationUsed, BadApiSignature, BalanceNotZero, EnforcedPause, ExpectedPause, InsufficientRewards, InvalidShortString, NotPayer, OwnableInvalidOwner, OwnableUnauthorizedAccount, SafeERC20FailedOperation, StringTooLong, ZeroAddress.