Open the app

Accounts and types

Every account the agora program owns, its address seeds and size, every field, and the types they use.

Every account below is owned by the agora program and starts with Anchor's 8-byte discriminator, which the sizes include. Seeds appear in order: text seeds are their UTF-8 bytes, public keys their 32 bytes, and ids 8 little-endian bytes. A PDA's bump is the canonical one.

AccountSeedsBytesWhat it is
Ledger"ledger"172Singleton settings for the register, admission and custody of ledger cash.
Member"member", wallet157Permanent admission record, identity and counters for one wallet.
Instrument"instrument", code208An issued security, its terms and its income and trading history.
Position"position", owner, asset120One wallet's units or cash across the free, locked and pledged lanes.
Offer"offer", maker, id (u64, little-endian)114Open commitment to buy or sell whole units at a fixed cash price.
RepoOffer"repo_offer", lender, id (u64, little-endian)110Cash a lender has reserved to advance against one instrument.
Repo"repo", borrower, id (u64, little-endian)185A borrower's collateral pledge, received advance and fixed repayment obligation.

The cash vault is not an Anchor account: it is a classic SPL token account for the cash mint at the PDA with seed "vault", and its token authority is the Ledger account. Sizes and rent are in Measured figures.

Ledger

The singleton config, created by initialize. Its address is also the token authority of the cash vault, so only the program can move cash out of the vault.

FieldTypeDescription
adminPubkeyWallet authorized to update ledger settings.
operatorPubkeyWallet whose signature authorizes a new member.
cash_mintPubkeySix-decimal SPL mint accepted as ledger cash.
cash_vaultPubkeyToken account holding cash deposited into the register.
fee_recipientPubkeyWallet whose cash ATA receives the settlement fee.
fee_bpsu16Settlement fee in basis points of the gross cash leg.
bumpu8PDA bump used to derive this account.
vault_bumpu8PDA bump used to derive the cash vault.

Member

Created by admit, one per wallet, never closed. Its three counters set the ids of the member's next offer, repo offer and borrowed repo.

FieldTypeDescription
walletPubkeyWallet address of the admitted entity.
roleRoleHolder or issuer permissions granted to the member.
entity_namestringRegistered name of the entity represented by the wallet.
admitted_ati64Unix second when the operator and wallet completed admission.
next_offer_idu64ID the member must use for its next spot offer.
next_repo_offer_idu64ID the member must use for its next repo offer.
next_repo_idu64ID the borrower must use for its next repo.

Instrument

Created by list_instrument. income_index and income_pool carry income; last_price is set by each fill.

FieldTypeDescription
codestringUnique uppercase instrument code used to derive its register account.
namestringIssuer's display name for the instrument.
issuerPubkeyWallet authorized to issue this instrument and pay its income.
termsTermsEquity designation or bond coupon and maturity.
faceu64Face value per bond unit in cash atoms, or zero for an equity.
outstandingu64Whole units of this instrument on the register.
income_indexu128Cumulative cash atoms per unit scaled by 10 to the twelfth power.
income_poolu64Cash atoms still held for distributions to unit owners.
last_priceu64Cash atoms per unit at the last fill, or zero before the first fill.
created_ati64Unix second when this record was created.
bumpu8PDA bump used to derive this account.

Position

Created on first use by whichever instruction credits or locks for that owner and asset. For units the asset is the Instrument's address; for ledger cash it is the cash mint, and pledged, snapshot and accrued stay 0.

FieldTypeDescription
ownerPubkeyMember wallet that owns this register position.
assetPubkeyInstrument PDA for securities or the mint address for ledger cash.
freeu64Whole units or cash atoms available to the owner.
lockedu64Whole units or cash atoms reserved for outstanding offers.
pledgedu64Whole units securing active repos in the owner's own account.
snapshotu128Instrument income index already accounted for by this position.
accruedu64Whole cash atoms earned and still available to claim.

Offer

Created by post_offer, closed by cancel_offer or by the fill that takes its last unit. Rent returns to the maker.

FieldTypeDescription
makerPubkeyMember wallet that posted the offer.
instrumentPubkeyRegister account of the security involved in this operation.
idu64Wallet-local sequential ID used in the account's PDA seeds.
sideSideBuy locks cash and sell locks units.
priceu64Cash atoms per whole unit offered.
units_openu64Whole units still available to fill after this operation.
units_at_postingu64Whole units offered before any fills.
created_ati64Unix second when this record was created.
bumpu8PDA bump used to derive this account.

RepoOffer

Created by post_repo_offer, closed by cancel_repo_offer or by the take that empties its cash. Rent returns to the lender.

FieldTypeDescription
idu64Wallet-local sequential ID used in the account's PDA seeds.
lenderPubkeyMember wallet lending cash against the instrument.
instrumentPubkeyRegister account of the security involved in this operation.
advance_per_unitu64Cash atoms advanced per pledged whole unit.
rate_bpsu16Annual simple interest in basis points, using actual seconds and a 365-day year.
term_secondsu32Seconds between opening the repo and its maturity.
cash_availableu64Cash atoms remaining for further advances from the offer.
created_ati64Unix second when this record was created.

Repo

Created by take_repo_offer and kept after it is repaid or defaulted.

FieldTypeDescription
idu64Wallet-local sequential ID used in the account's PDA seeds.
borrowerPubkeyMember wallet pledging its units and receiving the advance.
lenderPubkeyMember wallet lending cash against the instrument.
instrumentPubkeyRegister account of the security involved in this operation.
repo_offerPubkeyLender's offer from which the advance is drawn.
units_pledgedu64Whole collateral units pledged by the borrower.
cash_advancedu64Cash atoms transferred from the lender to the borrower at opening.
repurchase_amountu64Full cash atom amount due at repayment, including fixed interest.
opened_ati64Unix second when the borrower drew the advance.
maturityi64Unix second when the obligation matures.
statusRepoStatusCurrent repo state, active, repaid or defaulted.

Types

The structs and enums accounts and events use. An enum is one byte for its variant, followed by the variant's fields.

Leg

One balance that moved, as events list them. A debit has credit: false.

FieldTypeDescription
ownerPubkeyWallet for a register lane, instrument for an income pool, or SPL token account for custody.
assetPubkeyInstrument PDA for securities or the mint address for ledger cash.
laneLaneBalance on the register or in token custody affected by this entry.
creditboolTrue when this entry adds to the named balance; false when it debits it.
amountu64Unsigned whole units or cash atoms moved on this entry.

Lane

Where a leg's amount sat or arrived.

VariantFieldsMeaning
FreeA position's free lane.
LockedA position's locked lane.
PledgedA position's pledged lane.
IncomePoolAn instrument's income pool. The leg's owner is the Instrument address.
TokenAn SPL token account: the vault, a wallet's cash ATA or the fee account.

Terms

An instrument's kind and, for a bond, its terms.

VariantFieldsMeaning
EquityA share. Face is 0.
Bondcoupon_bps: u16, maturity: i64A bond with a yearly coupon in basis points and a maturity in Unix seconds. Face is 1,000,000,000 cash atoms per unit.

Role

A member's role.

VariantFieldsMeaning
HolderHolds positions, trades, lends and borrows.
IssuerCan also list instruments, issue their units and pay income.

Side

An offer's side.

VariantFieldsMeaning
BuyA bid. The maker locks units times price in cash.
SellAn ask. The maker locks the units.

RepoStatus

A repo's state.

VariantFieldsMeaning
ActiveOpen. The borrower can repay until maturity.
RepaidRepaid in full before maturity. The pledge was released.
DefaultedSettled at or after maturity. The pledged units went to the lender.

CashDirection

Which way a CashMoved event went.

VariantFieldsMeaning
DepositUSDC into the vault, credited to free ledger cash.
WithdrawFree ledger cash debited, USDC out of the vault.