#[event] macro.
Event Structure
Events are emitted using Anchor’semit! macro and written to transaction logs. They can be parsed by indexers like Helius, QuickNode, or custom RPC listeners.
Location: lib.rs:532-573
ProtocolInitialized
Emitted once when the protocol is first initialized. Location:lib.rs:532-536
Emitted by: initialize_protocol (line 30)
Fields
The protocol admin wallet address that initialized the protocol.
The protocol fee rate in basis points (e.g., 250 = 2.5%).
Code Reference
Example Usage
Indexers can track protocol deployment and fee configuration:NullResultSubmitted
Emitted when a new Null Knowledge Asset (NKA) is submitted. Location:lib.rs:538-542
Emitted by: submit_null_result (line 65)
Fields
The sequential ID assigned to this NKA (e.g., 1, 2, 3…). Displayed as
NKA-{specimen_number:04} in the UI.The wallet address of the researcher who submitted the NKA.
Code Reference
Example Usage
Track new NKA submissions in real-time:BountyCreated
Emitted when a new bounty is created and USDC is escrowed. Location:lib.rs:544-550
Emitted by: create_bounty (line 114)
Fields
The sequential ID assigned to this bounty (e.g., 1, 2, 3…). Displayed as
NB-{bounty_number:04} in the UI.The wallet address of the bounty creator.
The USDC reward amount in base units (6 decimals). Divide by 1,000,000 to get human-readable USDC.Example:
2500000 = 2.5 USDCUnix timestamp deadline for submissions.
Code Reference
Example Usage
Monitor new bounties and their rewards:BountySubmissionCreated
Emitted when a researcher submits their NKA to a bounty. Location:lib.rs:552-557
Emitted by: submit_to_bounty (line 147)
Fields
The sequential ID of the bounty receiving the submission.
The sequential ID of the NKA being submitted.
The wallet address of the researcher submitting the NKA.
Code Reference
Example Usage
Track bounty-NKA matching:BountyFulfilled
Emitted when a bounty creator approves a submission and payouts are executed. Location:lib.rs:559-566
Emitted by: approve_bounty_submission (line 221)
Fields
The sequential ID of the bounty being fulfilled.
The sequential ID of the NKA that won the bounty.
The wallet address of the researcher receiving the payout.
The USDC amount paid to the researcher in base units (6 decimals). Equals
reward_amount - fee.Example: 97500000 = 97.5 USDCThe USDC protocol fee paid to the treasury in base units (6 decimals).Example:
2500000 = 2.5 USDC (2.5% of 100 USDC)Code Reference
Example Usage
Monitor payouts and fee collection:BountyClosed
Emitted when a bounty creator closes a bounty and reclaims escrowed USDC. Location:lib.rs:568-573
Emitted by: close_bounty (line 267)
Fields
The sequential ID of the bounty being closed.
The wallet address of the bounty creator receiving the refund.
The USDC amount refunded to the creator in base units (6 decimals). Equals the vault’s balance at closure time.Example:
100000000 = 100 USDCCode Reference
Example Usage
Track bounty closures and refunds:Event Summary Table
| Event | Trigger | Key Data | Use Case |
|---|---|---|---|
ProtocolInitialized | Protocol setup | Authority, fee rate | Track deployment, monitor fee changes |
NullResultSubmitted | New NKA | Specimen number, researcher | NKA registry indexing, researcher analytics |
BountyCreated | New bounty | Bounty number, reward, deadline | Bounty marketplace indexing, expiry monitoring |
BountySubmissionCreated | NKA submitted to bounty | Bounty & specimen numbers, researcher | Match tracking, notification systems |
BountyFulfilled | Approval & payout | Payout breakdown, winner | Payment verification, fee analytics |
BountyClosed | Bounty refund | Refund amount | Lifecycle tracking, treasury accounting |
Indexing Events
All events can be indexed using Anchor’s event listener:- Helius or QuickNode webhooks for real-time event streams
- The Graph protocol for decentralized indexing
- Custom RPC polling with
getProgramAccounts+ transaction parsing