Skip to main content

Onchain Events

The indexer listens to Sui events emitted by the Walrus Memory contract and uses them to update local backend state.

Events​

The Walrus Memory contract emits the following events:

EventEmitted whenFields
AccountCreatedA new account is createdaccount_id, owner
DelegateKeyAddedA delegate key is addedaccount_id, public_key, sui_address, label
DelegateKeyRemovedA delegate key is removedaccount_id, public_key
AccountDeactivatedAn account's active flag changes to false (owner deactivate_account, or admin_deactivate_account when the account was still active)account_id, owner
AccountReactivatedA frozen account is unfrozenaccount_id, owner
AccountQuarantinedAdmin containment is appliedaccount_id, owner
AccountQuarantineClearedAdmin containment is releasedaccount_id, owner

Current coverage​

The indexer currently targets the AccountCreated event flow as its primary sync path. Delegate key events and account activation events are part of the broader design and might be indexed in future iterations.

Account freeze and quarantine states​

Owner deactivation and Admin quarantine use separate flags on the account. AccountDeactivated reports that the active flag changed to false. Two calls emit it:

  • The owner calls deactivate_account. The call aborts if the account is already deactivated.
  • An AdminCap holder calls admin_deactivate_account. If the account is not already quarantined, this sets the admin_quarantined flag and emits AccountQuarantined, and also emits AccountDeactivated if the account was still active. A repeat call on a quarantined account returns without emitting events.

While quarantine is active, the owner cannot reactivate the account. admin_clear_quarantine releases quarantine without reactivating the account. The account stays frozen until the owner calls reactivate_account.

How the indexer uses AccountCreated​

The indexer runs on the Sui checkpoint-ingestion framework. It reads checkpoints from a remote checkpoint store and picks out AccountCreated events from the Walrus Memory package. For each event, it inserts an account_id → owner mapping into the accounts table. The relayer uses this same PostgreSQL database, so it can resolve accounts quickly. The framework records the indexer's checkpoint watermark, which lets it resume after restarts.