Events
The event every agora instruction emits, how to decode it, and every field.
Each successful instruction emits exactly one event, through Anchor's event CPI: the program calls itself with the event as instruction data, signed by its event authority PDA (seed "__event_authority"). The event is in the transaction's inner instructions, not its logs, so log truncation can't drop it.
Decoding
An event's inner instruction is addressed to the agora program, and its data is, in order:
- Anchor's 8-byte event CPI tag,
e445a52e51cb9a1d. - The event's 8-byte discriminator, from the table below.
- The event's fields, Borsh-encoded in the order listed on this page.
With the IDL, Anchor's BorshCoder decodes it: new BorshCoder(idl).events.decode(base64OfTheRest), where the rest is the data after the tag. The outer transaction gives the signature, slot and block time; the event's own timestamp is the Solana clock's Unix time in seconds.
| Event | Discriminator | Emitted by | What happened |
|---|---|---|---|
Admission | a03af6fbbf3fe112 | admit | Records the wallet, role and rent for a completed admission. |
CashMoved | 66cef1dfeb216694 | deposit, withdraw | Records the custody and register entries of a deposit or withdrawal. |
Configured | 2136500eb18952eb | initialize, update_config | Records the active ledger authorities, custody accounts and fee settings. |
IncomeClaimed | 155990e679125df3 | claim_income | Records cash collected by a position owner and the remaining income pool. |
IncomePaid | abd010eaa29ad866 | pay_income | Records an issuer's contribution to the pool and the updated per-unit index. |
InstrumentListed | 80192b59c2e55ff3 | list_instrument | Records the terms of the new security at listing. |
OfferCancelled | 2d2aafd633c09a09 | cancel_offer | Records the remaining commitment released when a spot offer closes. |
OfferPosted | d531efdd6499d220 | post_offer | Records a maker's reserved units or cash when the offer opens. |
RepoDefaulted | 52616990be93aa24 | settle_default | Records the lender's receipt of collateral after the unpaid repo matured. |
RepoOfferCancelled | 9e0908a53bd468f9 | cancel_repo_offer | Records the lender's remaining cash released by cancellation. |
RepoOfferPosted | 4bf00ef81dc63ed5 | post_repo_offer | Records the lender's terms and the cash locked for advances. |
RepoOpened | fa89fc3918c3980f | take_repo_offer | Records collateral pledged, cash advanced, maturity and the fixed repurchase amount. |
RepoRepaid | f4284b80fb6ca0df | repay_repo | Records payment in full and release of the borrower's collateral. |
Trade | 18feda98fd2b1251 | take_offer | Records the units, gross cash and taker fee settled in a single fill. |
UnitsIssued | 4e971048836443cd | issue | Records the holder's credit and the resulting outstanding supply. |
Legs
Every event except Configured, Admission and InstrumentListed carries legs, one per balance the instruction moved. A leg is a Leg: owner, asset, lane, amount and whether it was a credit. Register lanes (Free, Locked, Pledged) name a wallet as owner. IncomePool names the Instrument. Token legs name an SPL token account: they record custody moving between the vault, a wallet's cash ATA and the fee account.
The API turns legs into settlement legs, each with a from and a to: see Settlements.
Configured
The ledger was initialized or its config changed. Emitted by initialize and update_config.
| Field | Type | Description |
|---|---|---|
initialized | bool | True when the ledger is first opened and false on a configuration update. |
actor | Pubkey | Wallet that authorized this change. |
ledger | Pubkey | Singleton register configuration and vault authority. |
admin | Pubkey | Wallet authorized to update ledger settings. |
operator | Pubkey | Wallet whose signature authorizes a new member. |
cash_mint | Pubkey | Six-decimal SPL mint accepted as ledger cash. |
cash_vault | Pubkey | Token account holding cash deposited into the register. |
fee_recipient | Pubkey | Wallet whose cash ATA receives the settlement fee. |
fee_bps | u16 | Settlement fee in basis points of the gross cash leg. |
timestamp | i64 | Unix second recorded by the chain for this event. |
Admission
A wallet was admitted. Emitted by admit.
| Field | Type | Description |
|---|---|---|
wallet | Pubkey | Wallet address of the admitted entity. |
member | Pubkey | Permanent membership record for the wallet. |
operator | Pubkey | Wallet whose signature authorizes a new member. |
role | Role | Holder or issuer permissions granted to the member. |
entity_name | string | Registered name of the entity represented by the wallet. |
rent_lamports | u64 | Lamports paid to keep the new membership record rent-exempt. |
timestamp | i64 | Unix second recorded by the chain for this event. |
CashMoved
Cash was deposited or withdrawn. Emitted by deposit and withdraw. A deposit's legs debit the wallet's cash ATA, credit the vault and credit the owner's free cash; a withdrawal's run the other way.
| Field | Type | Description |
|---|---|---|
direction | CashDirection | Whether cash entered the vault or left it. |
owner | Pubkey | Member wallet that owns this register position. |
legs | Vec<Leg> | Ordered debits and credits that settled together. |
timestamp | i64 | Unix second recorded by the chain for this event. |
InstrumentListed
An instrument was listed. Emitted by list_instrument.
| Field | Type | Description |
|---|---|---|
instrument | Pubkey | Register account of the security involved in this operation. |
issuer | Pubkey | Wallet authorized to issue this instrument and pay its income. |
code | string | Unique uppercase instrument code used to derive its register account. |
name | string | Issuer's display name for the instrument. |
terms | Terms | Equity designation or bond coupon and maturity. |
face | u64 | Face value per bond unit in cash atoms, or zero for an equity. |
timestamp | i64 | Unix second recorded by the chain for this event. |
UnitsIssued
Units were issued. Emitted by issue, with one leg crediting the recipient's free lane.
| Field | Type | Description |
|---|---|---|
instrument | Pubkey | Register account of the security involved in this operation. |
issuer | Pubkey | Wallet authorized to issue this instrument and pay its income. |
recipient | Pubkey | Admitted wallet receiving newly issued units. |
outstanding | u64 | Whole units of this instrument on the register. |
legs | Vec<Leg> | Ordered debits and credits that settled together. |
timestamp | i64 | Unix second recorded by the chain for this event. |
OfferPosted
An offer was posted. Emitted by post_offer, with two legs: the maker's free lane debited and locked lane credited.
| Field | Type | Description |
|---|---|---|
offer | Pubkey | Spot offer whose reserved balance changes. |
id | u64 | Wallet-local sequential ID used in the account's PDA seeds. |
maker | Pubkey | Member wallet that posted the offer. |
instrument | Pubkey | Register account of the security involved in this operation. |
side | Side | Buy locks cash and sell locks units. |
price | u64 | Cash atoms per whole unit offered. |
units_open | u64 | Whole units still available to fill after this operation. |
created_at | i64 | Unix second when this record was created. |
legs | Vec<Leg> | Ordered debits and credits that settled together. |
OfferCancelled
An offer was cancelled. Emitted by cancel_offer, with the lock's two legs reversed.
| Field | Type | Description |
|---|---|---|
offer | Pubkey | Spot offer whose reserved balance changes. |
maker | Pubkey | Member wallet that posted the offer. |
instrument | Pubkey | Register account of the security involved in this operation. |
side | Side | Buy locks cash and sell locks units. |
units_cancelled | u64 | Whole units returned or released by cancellation. |
units_open | u64 | Whole units still available to fill after this operation. |
timestamp | i64 | Unix second recorded by the chain for this event. |
legs | Vec<Leg> | Ordered debits and credits that settled together. |
Trade
An offer was filled. Emitted by take_offer, with seven legs in this order: units out of the seller, units into the buyer's free lane, cash out of the buyer, cash into the seller's free lane, the fee out of the taker's free cash, the fee out of the vault and the fee into the fee account.
| Field | Type | Description |
|---|---|---|
offer | Pubkey | Spot offer whose reserved balance changes. |
maker | Pubkey | Member wallet that posted the offer. |
taker | Pubkey | Member wallet filling another member's offer and paying the fee. |
instrument | Pubkey | Register account of the security involved in this operation. |
side | Side | Buy locks cash and sell locks units. |
units | u64 | Whole instrument units involved in this operation. |
last_price | u64 | Cash atoms per unit at the last fill, or zero before the first fill. |
units_open | u64 | Whole units still available to fill after this operation. |
gross_cash | u64 | Cash atoms exchanged before the settlement fee. |
fee | u64 | Cash atoms charged to the taker and delivered to the fee recipient. |
fee_recipient | Pubkey | Wallet whose cash ATA receives the settlement fee. |
timestamp | i64 | Unix second recorded by the chain for this event. |
legs | Vec<Leg> | Ordered debits and credits that settled together. |
RepoOfferPosted
A repo offer was posted. Emitted by post_repo_offer, with the lender's cash moving from free to locked.
| Field | Type | Description |
|---|---|---|
repo_offer | Pubkey | Lender's offer from which the advance is drawn. |
id | u64 | Wallet-local sequential ID used in the account's PDA seeds. |
lender | Pubkey | Member wallet lending cash against the instrument. |
instrument | Pubkey | Register account of the security involved in this operation. |
advance_per_unit | u64 | Cash atoms advanced per pledged whole unit. |
rate_bps | u16 | Annual simple interest in basis points, using actual seconds and a 365-day year. |
term_seconds | u32 | Seconds between opening the repo and its maturity. |
cash_available | u64 | Cash atoms remaining for further advances from the offer. |
created_at | i64 | Unix second when this record was created. |
legs | Vec<Leg> | Ordered debits and credits that settled together. |
RepoOfferCancelled
A repo offer was cancelled. Emitted by cancel_repo_offer, with the remaining cash moving from locked to free.
| Field | Type | Description |
|---|---|---|
repo_offer | Pubkey | Lender's offer from which the advance is drawn. |
lender | Pubkey | Member wallet lending cash against the instrument. |
instrument | Pubkey | Register account of the security involved in this operation. |
cash_available | u64 | Cash atoms remaining after cancellation, always zero. |
cancelled_at | i64 | Unix second when the lender released its remaining cash. |
legs | Vec<Leg> | Ordered debits and credits that settled together. |
RepoOpened
A repo opened. Emitted by take_repo_offer, with four legs: the borrower's units from free to pledged, and the lender's locked cash to the borrower's free cash.
| Field | Type | Description |
|---|---|---|
repo | Pubkey | Register account for this borrowing agreement. |
repo_offer | Pubkey | Lender's offer from which the advance is drawn. |
id | u64 | Wallet-local sequential ID used in the account's PDA seeds. |
borrower | Pubkey | Member wallet pledging its units and receiving the advance. |
lender | Pubkey | Member wallet lending cash against the instrument. |
instrument | Pubkey | Register account of the security involved in this operation. |
units_pledged | u64 | Whole collateral units pledged by the borrower. |
cash_advanced | u64 | Cash atoms transferred from the lender to the borrower at opening. |
repurchase_amount | u64 | Full cash atom amount due at repayment, including fixed interest. |
opened_at | i64 | Unix second when the borrower drew the advance. |
maturity | i64 | Unix second when the obligation matures. |
status | RepoStatus | Current repo state, active, repaid or defaulted. |
cash_available | u64 | Cash atoms remaining for further advances from the offer. |
legs | Vec<Leg> | Ordered debits and credits that settled together. |
RepoRepaid
A repo was repaid. Emitted by repay_repo, with four legs: the repurchase amount from the borrower's free cash to the lender's, and the units from pledged to free.
| Field | Type | Description |
|---|---|---|
repo | Pubkey | Register account for this borrowing agreement. |
repo_offer | Pubkey | Lender's offer from which the advance is drawn. |
borrower | Pubkey | Member wallet pledging its units and receiving the advance. |
lender | Pubkey | Member wallet lending cash against the instrument. |
instrument | Pubkey | Register account of the security involved in this operation. |
repaid_at | i64 | Unix second when repayment released the collateral. |
repurchase_amount | u64 | Full cash atom amount due at repayment, including fixed interest. |
status | RepoStatus | Current repo state, active, repaid or defaulted. |
legs | Vec<Leg> | Ordered debits and credits that settled together. |
RepoDefaulted
A matured repo defaulted. Emitted by settle_default, with two legs: the borrower's pledged units out, the lender's free units in.
| Field | Type | Description |
|---|---|---|
repo | Pubkey | Register account for this borrowing agreement. |
repo_offer | Pubkey | Lender's offer from which the advance is drawn. |
borrower | Pubkey | Member wallet pledging its units and receiving the advance. |
lender | Pubkey | Member wallet lending cash against the instrument. |
instrument | Pubkey | Register account of the security involved in this operation. |
caller | Pubkey | Wallet submitting permissionless default settlement. |
defaulted_at | i64 | Unix second when the lender received the collateral after maturity. |
status | RepoStatus | Current repo state, active, repaid or defaulted. |
legs | Vec<Leg> | Ordered debits and credits that settled together. |
IncomePaid
An issuer paid income. Emitted by pay_income, with two legs: the issuer's free cash out, the instrument's income pool in.
| Field | Type | Description |
|---|---|---|
instrument | Pubkey | Register account of the security involved in this operation. |
issuer | Pubkey | Wallet authorized to issue this instrument and pay its income. |
outstanding | u64 | Whole units of this instrument on the register. |
income_index | u128 | Cumulative cash atoms per unit scaled by 10 to the twelfth power. |
income_pool | u64 | Cash atoms still held for distributions to unit owners. |
legs | Vec<Leg> | Ordered debits and credits that settled together. |
timestamp | i64 | Unix second recorded by the chain for this event. |
IncomeClaimed
A holder claimed income. Emitted by claim_income, with two legs: the income pool out, the owner's free cash in.
| Field | Type | Description |
|---|---|---|
instrument | Pubkey | Register account of the security involved in this operation. |
owner | Pubkey | Member wallet that owns this register position. |
income_index | u128 | Cumulative cash atoms per unit scaled by 10 to the twelfth power. |
income_pool | u64 | Cash atoms still held for distributions to unit owners. |
legs | Vec<Leg> | Ordered debits and credits that settled together. |
timestamp | i64 | Unix second recorded by the chain for this event. |