Skip to Content
x207x207 Docs
Smart contracts

Events and errors

The 52 events of the x207-circle contract with their fields, and the error codes a call can fail with.

Event format

Each event is a NEP-297 log line:

EVENT_JSON:{"standard":"x207","version":"0.0.18","event":"<name>","data":[{...}]}

version is the contract interface version. data is a list; one log can carry several items (up to 50, MAX_EVENT_ITEMS). A log stays under 16,384 bytes, so large results are emitted as a hash plus counts, or in chunks (limits_updated has chunk and chunks). The backend indexer reads these logs to build its read model. The field lists below are from contracts/abi.json.

Events

Membership and stake

EventFields
member_joinedaccount_id, pubkey_voucher, terms_hash, status, joined_at
member_admittedaccount_id, status
member_removedaccount_id, by_owner
stake_addedaccount_id, sender_id, amount, stake, limit, status
member_reactivatedaccount_id, stake, limit, effective_epoch
exit_requestedaccount_id, epoch
stake_withdrawnaccount_id, amount
stake_withdraw_failedaccount_id, amount
auto_settle_setaccount_id, enabled
member_frozenaccount_id, from_epoch
freeze_proposedaccount_id, eta, reason_hash
freeze_cancelledaccount_id
member_unfrozenaccount_id

Vouchers and the epoch cycle

EventFields
voucher_registeredpayer, payee, epoch, seq, cumulative_amount, delta, obligation, outstanding_debt, mode
epoch_cutoffepoch, closed_at, proposal_deadline, edge_count, participant_count, total_obligation, next_epoch, next_cutoff_at
clearing_submittedepoch, solver, cleared_total, edge_count, replaced_solver, replaced_cleared_total
clearing_appliedepoch, solver, cleared_total, edge_count, edges_hash, clearing_fee, solver_fee
epoch_committedepoch, committed_at, payment_deadline, total_due, total_claimable, position_count, positions_hash, positions
residual_paidepoch, account_id, sender_id, amount, refunded, settled_history
auto_settledepoch, account_id, due, stake, status, position_status, outstanding_debt
member_defaultedepoch, account_id, due, from_stake, from_reserve, shortfall, stake, status, position_status, outstanding_debt
limits_updatedepoch, changes, chunk, chunks
epoch_finalizedepoch, finalized_at, defaulted_count, total_defaulted, pool, shortfall
params_updatedold, new, changed, effective_epoch

Payouts

EventFields
residual_claimedepoch, account_id, amount, destination, status
residual_claim_failedepoch, account_id, amount, destination, status
solver_fee_claimedaccount_id, amount
solver_fee_claim_failedaccount_id, amount
intents_withdrawnamount
relayer_fee_paidaccount_id, relayer, action, epoch, amount
relayer_fee_failedaccount_id, relayer, action, epoch, amount

Barter, deals and bonds

EventFields
intent_postedintent_hash, account_id, posted_at
intent_removedintent_hash, account_id
bundle_committedbundle_id, terms_hash, epoch, legs, solver
bond_lockedbundle_id, account_id, amount
deal_confirmedbundle_id, account_id, of
deal_disputedbundle_id, complainant, accused, evidence_hash, disputed_at
deal_ruledbundle_id, arbiter, verdict
bond_slashedbundle_id, from, to, amount, from_stake, to_stake
bond_releasedbundle_id, account_id, amount, reason

Grants, escrow and asset classes

EventFields
asset_class_setasset_type, class
asset_contracts_setasset_type, contracts
grant_offeredgrant_id, asset_type, grantor, class, unit, unit_price, expires_at
grant_activatedgrant_id, grantee, delivery_pubkey
grant_revokedgrant_id, reason
escrow_heldgrant_id, nft_contract, token_id
ft_escrow_heldgrant_id, ft_contract, amount
mt_escrow_heldgrant_id, mt_contract, token_id, amount
account_escrow_heldgrant_id, account_id
escrow_failedgrant_id, step, epoch, payer, payee, delta, reverted

Upgrade

EventFields
upgrade_proposedcode_hash, eta
upgrade_appliedcode_hash, applied_at

Enumerations used in events

  • Member status: pending, active, suspended, exited.
  • Position status: due, paid, defaulted, claimable, claimed.
  • destination: near, intents.
  • Deal verdict: accused_guilty, complaint_false, no_fault.
  • Grant revoke reason: grantor, grantee, operator, expired, defaulted.
  • escrow_failed step: complete, cancel.

Errors

A failed call panics with a message that starts with a stable code, in the form ERR_CODE: detail. Match on the code, not on the detail. Codes below are those used in the contract source.

Access and state

ERR_NOT_OWNER, ERR_NOT_MEMBER, ERR_NOT_ADMITTED, ERR_NOT_PENDING, ERR_ALREADY_MEMBER, ERR_ALREADY_ADMITTED, ERR_ADMISSION_NOT_DAO, ERR_MEMBER_EXITED, ERR_EXITING, ERR_EXIT_NOT_READY, ERR_HAS_DUE, ERR_MAX_MEMBERS, ERR_PENDING_TOO_YOUNG, ERR_WRONG_STATUS, ERR_WRONG_PHASE, ERR_NO_STATE, ERR_NOT_IMPLEMENTED, ERR_BAD_TRANSITION, ERR_FROZEN, ERR_NOT_FROZEN, ERR_ALREADY_FROZEN, ERR_FREEZE_PENDING, ERR_FREEZE_NOT_PENDING, ERR_FREEZE_TIMELOCK, ERR_NO_UPGRADE, ERR_TIMELOCK_ACTIVE, ERR_CODE_HASH_MISMATCH.

Input and signatures

CodeMeaning
ERR_BAD_MSGmsg of a token transfer is not one of the accepted shapes
ERR_WRONG_TOKENtoken is not the circle's single token
ERR_BAD_PUBKEYpubkey_voucher must be an ed25519 key
ERR_BAD_SIGNATUREed25519 verification failed
ERR_BAD_TERMS_HASHterms_hash must be 64 lowercase hex characters
ERR_BAD_HASH, ERR_HASH_JSON, ERR_DUPLICATE_HASHmalformed or repeated hash input
ERR_WRONG_CIRCLE, ERR_WRONG_CIRCLE_ID, ERR_BAD_CIRCLE_IDcircle id does not match
ERR_BAD_UNIT, ERR_RESOURCE_NOT_ASCIIvoucher unit or resource invalid
ERR_PARAM_OUT_OF_RANGEa param is outside its allowed range
ERR_ZERO_AMOUNTamount must be above zero
ERR_INSUFFICIENT_STORAGE_DEPOSITjoin attached less than 0.35 NEAR
ERR_STAKE_OVERFLOW, ERR_LIMIT_EXCEEDS_STAKEstake or limit arithmetic out of bounds
ERR_GAS_TOO_LOWnot enough gas attached for the follow-up calls

Vouchers and epochs

ERR_SELF_PAYMENT, ERR_EPOCH_MISMATCH, ERR_PAST_CUTOFF, ERR_BEFORE_CUTOFF, ERR_PAYER_NOT_ACTIVE, ERR_PAYEE_NOT_ACTIVE, ERR_SEQ_NOT_INCREASING, ERR_SEQ_GAP, ERR_CUMULATIVE_DECREASED, ERR_INSUFFICIENT_CREDIT, ERR_UNKNOWN_EPOCH, ERR_NOT_FINALIZED, ERR_PRUNE_TOO_EARLY.

Clearing

CodeMeaning
ERR_PROPOSAL_WINDOW_CLOSED, ERR_PROPOSAL_WINDOW_OPENwrong time for submit_clearing or commit_epoch
ERR_PROPOSAL_NOT_BETTERthe stored proposal is at least as good
ERR_EMPTY_PROPOSALthe proposal has no edges
ERR_ZERO_CLEAREDan edge clears 0
ERR_TOO_MANY_EDGESmore than MAX_EDGES_PER_TX (300) edges
ERR_DUPLICATE_EDGE, ERR_EDGE_NOT_IN_SNAPSHOTrepeated edge, or no obligation behind it
ERR_CLEARED_EXCEEDS_OBLIGATIONan edge clears more than the pair owes
ERR_UNBALANCED_MEMBERa member's cleared inflow differs from its outflow
ERR_PAYMENT_WINDOW_OPEN, ERR_PAYMENT_WINDOW_CLOSEDwrong time for finalize_epoch or a residual payment
ERR_NOT_DUEthe account's position is not due
ERR_UNDERPAYMENTthe amount sent is below what is due

Claims and withdrawals

ERR_NO_POSITION, ERR_NOT_CREDITOR, ERR_NOT_CLAIMABLE, ERR_NOTHING_TO_CLAIM, ERR_NOTHING_TO_WITHDRAW, ERR_WITHDRAW_IN_FLIGHT, ERR_POOL_INSUFFICIENT, ERR_D2_ACCOUNTING, ERR_D6_ACCOUNTING. The last two are internal accounting guards; seeing one means a bug, not a user mistake.

Barter, deals and bonds

ERR_BAD_BUNDLE, ERR_BUNDLE_EXISTS, ERR_UNKNOWN_BUNDLE, ERR_BUNDLE_LEG, ERR_BUNDLE_LEG_EXCEEDED, ERR_BUNDLE_LIMIT, ERR_BUNDLE_HEADROOM, ERR_BUNDLE_SIGNATURES, ERR_SEARCH_SHARE_EXCEEDED, ERR_INTENT_EXISTS, ERR_INTENT_LIMIT, ERR_UNKNOWN_INTENT, ERR_NOT_INTENT_OWNER, ERR_ARBITER_INVALID, ERR_NOT_ARBITER, ERR_DEAL_UNKNOWN, ERR_DEAL_NOT_PARTY, ERR_DEAL_CLOSED, ERR_DEAL_LIMIT, ERR_DEAL_WINDOW, ERR_DEAL_WINDOW_OVER, ERR_DEAL_ALREADY_DISPUTED, ERR_DEAL_NOT_DISPUTED, ERR_DEAL_NOT_DUE, ERR_DEAL_NO_STAKE_AT_RISK, ERR_RULING_WINDOW, ERR_BOND_REQUIRED, ERR_BOND_LOCKED, ERR_BOND_INSUFFICIENT_STAKE.

Grants and escrow

ERR_BAD_GRANT, ERR_UNKNOWN_GRANT, ERR_GRANT_EXPIRED, ERR_GRANT_FINAL, ERR_GRANT_NOT_OFFERED, ERR_GRANT_NOT_ACTIVE_MEMBER, ERR_GRANT_REVOKE_DENIED, ERR_GRANT_SELF, ERR_BAD_ASSET_TYPE, ERR_ASSET_TYPE_UNKNOWN, ERR_ASSET_CLASS_FORBIDDEN, ERR_ASSET_CLASS_NOT_A, ERR_PROOF_KIND_NOT_ACCEPTED, ERR_DELIVERY_NOT_ALLOWED, ERR_CONTRACT_NOT_OFFICIAL, ERR_TOO_MANY_CONTRACTS, ERR_DUPLICATE_CONTRACT, ERR_TOO_MANY_HASHES.

Escrow: ERR_ESCROW_EXISTS, ERR_ESCROW_UNKNOWN, ERR_ESCROW_NOT_HELD, ERR_ESCROW_PENDING, ERR_ESCROW_NOT_EXPIRED, ERR_ESCROW_NOT_GRANTOR, ERR_ESCROW_NOT_CLASS_A, ERR_ESCROW_NOT_ACCOUNT, ERR_ESCROW_DEPOSITOR, ERR_ESCROW_NEEDS_PUBKEY, ERR_ESCROW_PRICE, ERR_ESCROW_USDT, ERR_ESCROW_VOUCHER, ERR_ESCROW_TOO_LATE, ERR_ESCROW_EPOCH_WAIT, ERR_ESCROW_TTL_TOO_LONG, ERR_BAD_ESCROW_TTL, ERR_ESCROW_NFT_MISMATCH, ERR_ESCROW_FT_MISMATCH, ERR_ESCROW_FT_AMOUNT, ERR_ESCROW_MT_MISMATCH, ERR_ESCROW_MT_AMOUNT, ERR_ESCROW_MT_BATCH, ERR_ESCROW_ACCOUNT_MISMATCH, ERR_ACCOUNT_ASSET_TYPE, ERR_ACCOUNT_LOCKED, ERR_ACCOUNT_NOT_SELLABLE, ERR_ACCOUNT_SELF, ERR_BAD_GC_DELAY.

EVM relayed calls

CodeMeaning
ERR_BAD_EVM_ADDRESSaddress is not 0x plus 40 lowercase hex characters
ERR_BAD_EVM_SIGEIP-712 verification failed
ERR_BAD_EVM_RECEIVERreceiver not allowed (the Intents contract is refused)
ERR_EVM_NONCEnonce does not match the member's next nonce
ERR_EVM_EXPIREDdeadline passed
ERR_EVM_DEADLINE_TOO_FARdeadline is more than 24 hours ahead
ERR_EVM_FEE_NOT_ALLOWEDjoin_evm with a relayer fee above 0
ERR_NOT_EVM_MEMBERthe member is not an EVM member
joinmember_joinedERR_INSUFFICIENT_STORAGE_DEPOSITregister_cumulativevoucher_registeredERR_PAST_CUTOFF,ERR_INSUFFICIENT_CREDITclose_epochepoch_cutoffERR_BEFORE_CUTOFFsubmit_clearingclearing_submittedERR_PROPOSAL_NOT_BETTER,ERR_UNBALANCED_MEMBERcommit_epochclearing_applied,epoch_committedERR_PROPOSAL_WINDOW_OPENsettle residualresidual_paidERR_NOT_DUE,ERR_UNDERPAYMENTfinalize_epochmember_defaulted,limits_updated,epoch_finalizedERR_PAYMENT_WINDOW_OPENclaimresidual_claimedERR_NOT_CLAIMABLE

Source

Edit on GitHub

On this page