Open the app

Program instructions

Every instruction the agora program takes, with its arguments, accounts, effects and errors.

Agora is one Anchor program. The API serves its IDL at GET /idl.json, and every table on this page is read from it:

ProgramAddressVersion
agoraAwiCVSwQj1KaBBfyNmpkMhB2Dj6LdKdhaSqzd47NNsmw0.1.0

Amounts are u64: whole units for instruments, cash atoms for ledger cash. Times are Solana Unix timestamps in seconds. Every instruction also takes event_authority and program, for the event it emits through a self-CPI (Events). Account names follow the IDL, which is snake_case; Anchor's TypeScript client turns them into camelCase.

InstructionArgumentsSignersEmits
initializeoperator: Pubkey, fee_recipient: PubkeyadminConfigured
update_configadmin_key: Pubkey, operator: Pubkey, fee_recipient: Pubkey, fee_bps: u16adminConfigured
admitrole: Role, entity_name: stringwallet, operatorAdmission
depositamount: u64ownerCashMoved
withdrawamount: u64ownerCashMoved
list_instrumentcode: string, name: string, terms: TermsissuerInstrumentListed
issueunits: u64issuerUnitsIssued
post_offerid: u64, side: Side, price: u64, units: u64makerOfferPosted
cancel_offernonemakerOfferCancelled
take_offerunits: u64takerTrade
post_repo_offerid: u64, advance_per_unit: u64, rate_bps: u16, term_seconds: u32, cash_available: u64lenderRepoOfferPosted
cancel_repo_offernonelenderRepoOfferCancelled
take_repo_offerid: u64, units: u64borrowerRepoOpened
repay_repononeborrowerRepoRepaid
settle_defaultnonecallerRepoDefaulted
pay_incomeamount: u64issuerIncomePaid
claim_incomenoneownerIncomeClaimed

initialize

Creates the Ledger config and the cash vault, once. The signer must be the program's upgrade authority, named in its ProgramData account; it becomes the admin. The cash mint must have 6 decimals and is fixed for good. The fee starts at 2 bps.

Arguments

ArgumentTypeDescription
operatorPubkeyWallet whose signature authorizes a new member.
fee_recipientPubkeyWallet whose cash ATA receives the settlement fee.

Accounts

AccountAccessDescription
adminsigner, writableProgram upgrade authority that pays to create the ledger and vault.
program_datareadUpgradeable-loader record that identifies Agora's upgrade authority. Seeds: "�� �O+���q����)^/,�bj��%fN".
ledgerwritableSingleton register configuration and vault authority. Seeds: "ledger".
cash_mintreadSix-decimal SPL mint accepted as ledger cash.
cash_vaultwritableToken account holding cash deposited into the register. Seeds: "vault".
token_programreadClassic SPL Token program that moves cash between token accounts. Address TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA.
system_programreadSolana System Program that allocates new register accounts. Address 11111111111111111111111111111111.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits Configured.

Errors

CodeNameMessage
6019WrongUpgradeAuthorityThe signer must be the program upgrade authority.
6027BadCashMintCash must use a six-decimal SPL mint.
6031UnsetAddressAuthority and fee recipient addresses must be set.

update_config

Replaces the admin, operator, fee recipient and fee together. Only the current admin signs. The three keys must be set, and the fee is 0 to 50 bps.

Arguments

ArgumentTypeDescription
admin_keyPubkeyWallet that will administer the ledger after this update.
operatorPubkeyWallet whose signature authorizes a new member.
fee_recipientPubkeyWallet whose cash ATA receives the settlement fee.
fee_bpsu16Settlement fee in basis points of the gross cash leg.

Accounts

AccountAccessDescription
adminsignerWallet authorized to update ledger settings.
ledgerwritableSingleton register configuration and vault authority. Seeds: "ledger".
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits Configured.

Errors

CodeNameMessage
6018FeeAboveCapThe settlement fee exceeds 50 basis points.
6020WrongAdminThe signer must be the ledger admin.
6031UnsetAddressAuthority and fee recipient addresses must be set.

admit

Creates the wallet's Member with its role and entity name. The wallet signs and pays the rent; the ledger's operator co-signs. The entity name must contain text and fit in 80 UTF-8 bytes. A wallet is admitted once: the member account can't be created twice.

Arguments

ArgumentTypeDescription
roleRoleHolder or issuer permissions granted to the member.
entity_namestringEntity name approved by the operator for this wallet.

Accounts

AccountAccessDescription
walletsigner, writableApplicant wallet signing admission and paying the member account rent.
operatorsignerWallet whose signature authorizes a new member.
ledgerreadSingleton register configuration and vault authority. Seeds: "ledger".
memberwritablePermanent membership record for the wallet. Seeds: "member", wallet.
system_programreadSolana System Program that allocates new register accounts. Address 11111111111111111111111111111111.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits Admission.

Errors

CodeNameMessage
6021WrongOperatorThe admission needs the ledger operator's signature.
6025BadNameNames must contain text and fit in 80 UTF-8 bytes.

deposit

Moves amount cash atoms from the owner's associated token account for the cash mint into the vault, and credits the same amount to the owner's cash position, free. Creates the cash position on first use. The owner must be admitted.

Arguments

ArgumentTypeDescription
amountu64Cash atoms to deposit into the vault.

Accounts

AccountAccessDescription
ownersigner, writableMember wallet that owns this register position.
memberreadPermanent membership record for the wallet. Seeds: "member", owner.
ledgerreadSingleton register configuration and vault authority. Seeds: "ledger".
owner_atawritableOwner's associated token account for the cash mint.
cash_vaultwritableToken account holding cash deposited into the register.
cash_positionwritableOwner's free and locked cash lanes on the register. Seeds: "position", owner, ledger.cash_mint.
token_programreadClassic SPL Token program that moves cash between token accounts. Address TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA.
system_programreadSolana System Program that allocates new register accounts. Address 11111111111111111111111111111111.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits CashMoved.

Errors

CodeNameMessage
6000OverflowAn amount exceeds the register's numeric range.
6001ZeroAmountThe amount must be positive.
6003InsufficientFreeCashThe account has insufficient free cash.
6009WrongAccountThe account does not belong to this operation.
6010NotAdmittedThis wallet needs an admitted member account.
6030InvalidCashAccountThe wallet cash account must be its associated token account.

withdraw

Debits amount from the owner's free cash and transfers it from the vault to the owner's associated token account for the cash mint. The owner must be admitted.

Arguments

ArgumentTypeDescription
amountu64Cash atoms to withdraw from free ledger cash.

Accounts

AccountAccessDescription
ownersignerMember wallet that owns this register position.
memberreadPermanent membership record for the wallet. Seeds: "member", owner.
ledgerreadSingleton register configuration and vault authority. Seeds: "ledger".
owner_atawritableOwner's associated token account for the cash mint.
cash_vaultwritableToken account holding cash deposited into the register.
cash_positionwritableOwner's free and locked cash lanes on the register. Seeds: "position", owner, ledger.cash_mint.
token_programreadClassic SPL Token program that moves cash between token accounts. Address TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits CashMoved.

Errors

CodeNameMessage
6000OverflowAn amount exceeds the register's numeric range.
6001ZeroAmountThe amount must be positive.
6003InsufficientFreeCashThe account has insufficient free cash.
6009WrongAccountThe account does not belong to this operation.
6010NotAdmittedThis wallet needs an admitted member account.
6030InvalidCashAccountThe wallet cash account must be its associated token account.

list_instrument

Creates an Instrument from its code, name and terms, with the signer as issuer. The signer must be admitted with the Issuer role. The code is 1 to 12 ASCII uppercase letters or digits and is the account's seed. A bond's maturity must be later than now, and its face is set to 1,000,000,000 cash atoms; an equity's face is 0.

Arguments

ArgumentTypeDescription
codestringUnique uppercase instrument code used to derive its register account.
namestringIssuer's display name for the instrument.
termsTermsEquity designation or bond coupon and maturity.

Accounts

AccountAccessDescription
issuersigner, writableWallet authorized to issue this instrument and pay its income.
issuer_memberreadMembership record proving the issuer's admission and role. Seeds: "member", issuer.
instrumentwritableRegister account of the security involved in this operation.
system_programreadSolana System Program that allocates new register accounts. Address 11111111111111111111111111111111.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits InstrumentListed.

Errors

CodeNameMessage
6010NotAdmittedThis wallet needs an admitted member account.
6022WrongRoleThe member must hold the issuer role.
6024BadCodeInstrument codes must contain 1 to 12 uppercase letters or digits.
6025BadNameNames must contain text and fit in 80 UTF-8 bytes.
6026BadMaturityBond maturity must be in the future.

issue

Credits units to the recipient's free lane and raises outstanding by the same amount. Only the instrument's issuer signs, and the recipient must have a Member account. The recipient's position settles its income first.

Arguments

ArgumentTypeDescription
unitsu64Positive number of whole instrument units.

Accounts

AccountAccessDescription
issuersigner, writableWallet authorized to issue this instrument and pay its income.
recipient_memberreadMembership record identifying the admitted recipient of issued units.
instrumentwritableRegister account of the security involved in this operation.
positionwritableOwner's security position, including lanes and unpaid income. Seeds: "position", recipient_member.wallet, instrument.
system_programreadSolana System Program that allocates new register accounts. Address 11111111111111111111111111111111.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits UnitsIssued.

Errors

CodeNameMessage
6000OverflowAn amount exceeds the register's numeric range.
6001ZeroAmountThe amount must be positive.
6009WrongAccountThe account does not belong to this operation.
6023NotIssuerOnly the instrument's issuer may perform this action.

post_offer

Creates an Offer and locks its side: for Sell, units from the maker's free units; for Buy, units × price from the maker's free cash. id must equal the maker's next_offer_id, which then rises by one. Creates the maker's unit and cash positions as needed.

Arguments

ArgumentTypeDescription
idu64Next ID from the signing member's counter.
sideSideBuy locks cash and sell locks units.
priceu64Cash atoms per whole unit offered.
unitsu64Positive number of whole instrument units.

Accounts

AccountAccessDescription
makersigner, writableMember wallet that posted the offer.
memberwritablePermanent membership record for the wallet. Seeds: "member", maker.
ledgerreadSingleton register configuration and vault authority. Seeds: "ledger".
instrumentreadRegister account of the security involved in this operation.
offerwritableSpot offer whose reserved balance changes. Seeds: "offer", maker, id (u64, little-endian).
maker_unitswritableMaker's position in the security offered. Seeds: "position", maker, instrument.
maker_cashwritableMaker's cash position reserved or credited by this offer. Seeds: "position", maker, ledger.cash_mint.
system_programreadSolana System Program that allocates new register accounts. Address 11111111111111111111111111111111.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits OfferPosted.

Errors

CodeNameMessage
6000OverflowAn amount exceeds the register's numeric range.
6001ZeroAmountThe amount must be positive.
6002InsufficientFreeUnitsThe account has insufficient free units.
6003InsufficientFreeCashThe account has insufficient free cash.
6009WrongAccountThe account does not belong to this operation.
6010NotAdmittedThis wallet needs an admitted member account.
6011InvalidIdThe offer or repo ID differs from the member counter.

cancel_offer

Returns the offer's remaining lock to the maker's free lane and closes the offer, sending its rent to the maker. Only the maker signs.

Arguments: none.

Accounts

AccountAccessDescription
makersigner, writableMember wallet that posted the offer.
ledgerreadSingleton register configuration and vault authority. Seeds: "ledger".
instrumentreadRegister account of the security involved in this operation.
offerwritableSpot offer whose reserved balance changes.
maker_unitswritableMaker's position in the security offered. Seeds: "position", maker, instrument.
maker_cashwritableMaker's cash position reserved or credited by this offer. Seeds: "position", maker, ledger.cash_mint.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits OfferCancelled.

Errors

CodeNameMessage
6000OverflowAn amount exceeds the register's numeric range.
6004InsufficientLockedCashThe account has insufficient locked cash.
6005InsufficientLockedUnitsThe account has insufficient locked units.
6009WrongAccountThe account does not belong to this operation.

take_offer

Fills units of the offer, 1 to its open size. Gross cash is units × price and the fee is floor(gross × fee_bps / 10,000), paid by the taker. Taking an ask: the maker's locked units go to the taker's free lane, and the taker's free cash pays gross plus fee, gross to the maker. Taking a bid: the taker's free units go to the maker's free lane, and the maker's locked cash pays gross, less the fee, to the taker. The fee moves from the vault to the fee recipient's cash ATA. Both unit positions settle income first. The instrument's last price becomes the offer's price, and a fill to zero closes the offer.

Arguments

ArgumentTypeDescription
unitsu64Positive number of whole instrument units.

Accounts

AccountAccessDescription
takersigner, writableMember wallet filling another member's offer and paying the fee.
taker_memberreadMembership record proving the taker's admission. Seeds: "member", taker.
makerwritableMember wallet that posted the offer.
ledgerreadSingleton register configuration and vault authority. Seeds: "ledger".
instrumentwritableRegister account of the security involved in this operation.
offerwritableSpot offer whose reserved balance changes.
maker_unitswritableMaker's position in the security offered. Seeds: "position", maker, instrument.
maker_cashwritableMaker's cash position reserved or credited by this offer. Seeds: "position", maker, ledger.cash_mint.
taker_unitswritableTaker's security position delivering or receiving the fill. Seeds: "position", taker, instrument.
taker_cashwritableTaker's cash position paying or receiving the fill and fee. Seeds: "position", taker, ledger.cash_mint.
cash_vaultwritableToken account holding cash deposited into the register.
fee_accountwritableCash ATA belonging to the configured fee recipient.
token_programreadClassic SPL Token program that moves cash between token accounts. Address TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA.
system_programreadSolana System Program that allocates new register accounts. Address 11111111111111111111111111111111.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits Trade.

Errors

CodeNameMessage
6000OverflowAn amount exceeds the register's numeric range.
6001ZeroAmountThe amount must be positive.
6002InsufficientFreeUnitsThe account has insufficient free units.
6003InsufficientFreeCashThe account has insufficient free cash.
6004InsufficientLockedCashThe account has insufficient locked cash.
6005InsufficientLockedUnitsThe account has insufficient locked units.
6007SelfTradeThe maker cannot take their own offer.
6008OfferTooSmallThe requested fill exceeds the available offer.
6009WrongAccountThe account does not belong to this operation.
6010NotAdmittedThis wallet needs an admitted member account.
6012InvalidFeeAccountThe fee destination must be the recipient's cash ATA.

post_repo_offer

Creates a RepoOffer and locks cash_available from the lender's free cash. The advance per unit must be positive and fit at least once in the cash; the term is 3,600 to 31,536,000 seconds. id must equal the lender's next_repo_offer_id. Creates the lender's unit position in the instrument, so a default can credit it later.

Arguments

ArgumentTypeDescription
idu64Next ID from the signing member's counter.
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 the lender commits when posting this offer.

Accounts

AccountAccessDescription
ledgerreadSingleton register configuration and vault authority. Seeds: "ledger".
lendersigner, writableMember wallet lending cash against the instrument.
lender_memberwritableMembership record used for the lender's next offer ID.
instrumentreadRegister account of the security involved in this operation.
lender_cashwritableLender's ledger cash reserved, advanced or returned. Seeds: "position", lender, ledger.cash_mint.
lender_unitswritableLender's security position that receives defaulted collateral. Seeds: "position", lender, instrument.
repo_offerwritableLender's offer from which the advance is drawn. Seeds: "repo_offer", lender, id (u64, little-endian).
system_programreadSolana System Program that allocates new register accounts. Address 11111111111111111111111111111111.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits RepoOfferPosted.

Errors

CodeNameMessage
6000OverflowAn amount exceeds the register's numeric range.
6001ZeroAmountThe amount must be positive.
6003InsufficientFreeCashThe account has insufficient free cash.
6009WrongAccountThe account does not belong to this operation.
6010NotAdmittedThis wallet needs an admitted member account.
6011InvalidIdThe offer or repo ID differs from the member counter.
6013TermOutOfRangeRepo terms run from one hour to 365 days.
6017InvalidRepoAmountThe available cash must cover at least one collateral unit.

cancel_repo_offer

Returns the offer's remaining cash to the lender's free lane and closes it, sending its rent to the lender. Only the lender signs.

Arguments: none.

Accounts

AccountAccessDescription
ledgerreadSingleton register configuration and vault authority. Seeds: "ledger".
lendersigner, writableMember wallet lending cash against the instrument.
repo_offerwritableLender's offer from which the advance is drawn.
lender_cashwritableLender's ledger cash reserved, advanced or returned.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits RepoOfferCancelled.

Errors

CodeNameMessage
6000OverflowAn amount exceeds the register's numeric range.
6004InsufficientLockedCashThe account has insufficient locked cash.
6009WrongAccountThe account does not belong to this operation.

take_repo_offer

Opens a Repo: moves units from the borrower's free lane to pledged, and units × advance_per_unit from the lender's locked cash to the borrower's free cash. Maturity is now plus the term. The repurchase amount is the advance plus ceil(advance × rate_bps × term_seconds / 315,360,000,000). id must equal the borrower's next_repo_id. Closes the repo offer when its cash reaches zero.

Arguments

ArgumentTypeDescription
idu64Next ID from the signing member's counter.
unitsu64Positive number of whole instrument units.

Accounts

AccountAccessDescription
ledgerreadSingleton register configuration and vault authority. Seeds: "ledger".
borrowersigner, writableMember wallet pledging its units and receiving the advance.
borrower_memberwritableMembership record used for the borrower's next repo ID.
lenderwritableMember wallet lending cash against the instrument.
instrumentreadRegister account of the security involved in this operation.
repo_offerwritableLender's offer from which the advance is drawn.
borrower_unitswritableBorrower's collateral position with its free and pledged lanes. Seeds: "position", borrower, instrument.
borrower_cashwritableBorrower's free cash credited at opening or debited on repayment. Seeds: "position", borrower, ledger.cash_mint.
lender_cashwritableLender's ledger cash reserved, advanced or returned.
repowritableRegister account for this borrowing agreement. Seeds: "repo", borrower, id (u64, little-endian).
system_programreadSolana System Program that allocates new register accounts. Address 11111111111111111111111111111111.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits RepoOpened.

Errors

CodeNameMessage
6000OverflowAn amount exceeds the register's numeric range.
6001ZeroAmountThe amount must be positive.
6002InsufficientFreeUnitsThe account has insufficient free units.
6004InsufficientLockedCashThe account has insufficient locked cash.
6007SelfTradeThe maker cannot take their own offer.
6008OfferTooSmallThe requested fill exceeds the available offer.
6009WrongAccountThe account does not belong to this operation.
6010NotAdmittedThis wallet needs an admitted member account.
6011InvalidIdThe offer or repo ID differs from the member counter.

repay_repo

For an active repo before its maturity: moves the repurchase amount from the borrower's free cash to the lender's free cash, moves the pledged units back to the borrower's free lane, and marks the repo Repaid. Only the borrower signs.

Arguments: none.

Accounts

AccountAccessDescription
ledgerreadSingleton register configuration and vault authority. Seeds: "ledger".
borrowersignerMember wallet pledging its units and receiving the advance.
repowritableRegister account for this borrowing agreement.
borrower_cashwritableBorrower's free cash credited at opening or debited on repayment.
lender_cashwritableLender's ledger cash reserved, advanced or returned.
borrower_unitswritableBorrower's collateral position with its free and pledged lanes.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits RepoRepaid.

Errors

CodeNameMessage
6000OverflowAn amount exceeds the register's numeric range.
6003InsufficientFreeCashThe account has insufficient free cash.
6006InsufficientPledgedUnitsThe account has insufficient pledged units.
6009WrongAccountThe account does not belong to this operation.
6015RepoMaturedThe repo has reached maturity.
6016RepoNotActiveThe repo is no longer active.

settle_default

For an active repo at or after its maturity: moves the pledged units from the borrower to the lender's free lane and marks the repo Defaulted. Any wallet signs. Both unit positions settle income first.

Arguments: none.

Accounts

AccountAccessDescription
callersignerWallet submitting permissionless default settlement.
instrumentreadRegister account of the security involved in this operation.
repowritableRegister account for this borrowing agreement.
borrower_unitswritableBorrower's collateral position with its free and pledged lanes.
lender_unitswritableLender's security position that receives defaulted collateral.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits RepoDefaulted.

Errors

CodeNameMessage
6000OverflowAn amount exceeds the register's numeric range.
6006InsufficientPledgedUnitsThe account has insufficient pledged units.
6009WrongAccountThe account does not belong to this operation.
6014RepoNotMaturedThe repo has not reached maturity.
6016RepoNotActiveThe repo is no longer active.

pay_income

Moves amount from the issuer's free cash into the instrument's income pool and raises its income index by floor(amount × 10^12 / outstanding). Only the instrument's issuer signs, and units must be outstanding.

Arguments

ArgumentTypeDescription
amountu64Cash atoms the issuer will distribute to holders.

Accounts

AccountAccessDescription
issuersignerWallet authorized to issue this instrument and pay its income.
ledgerreadSingleton register configuration and vault authority. Seeds: "ledger".
instrumentwritableRegister account of the security involved in this operation.
issuer_cashwritableIssuer's free ledger cash used to fund the distribution. Seeds: "position", issuer, ledger.cash_mint.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits IncomePaid.

Errors

CodeNameMessage
6000OverflowAn amount exceeds the register's numeric range.
6001ZeroAmountThe amount must be positive.
6003InsufficientFreeCashThe account has insufficient free cash.
6023NotIssuerOnly the instrument's issuer may perform this action.
6028NoUnitsOutstandingThe instrument has no units outstanding.

claim_income

Settles the owner's position in the instrument, then pays all its accrued whole cash atoms from the income pool to the owner's free cash. Creates the cash position if needed.

Arguments: none.

Accounts

AccountAccessDescription
ownersigner, writableMember wallet that owns this register position.
ledgerreadSingleton register configuration and vault authority. Seeds: "ledger".
instrumentwritableRegister account of the security involved in this operation.
positionwritableOwner's security position, including lanes and unpaid income. Seeds: "position", owner, instrument.
cash_positionwritableOwner's free and locked cash lanes on the register. Seeds: "position", owner, ledger.cash_mint.
system_programreadSolana System Program that allocates new register accounts. Address 11111111111111111111111111111111.
event_authorityreadAgora's PDA authenticating each settlement event. Seeds: "__event_authority".
programreadExecutable Agora program receiving the event CPI.

Emits IncomeClaimed.

Errors

CodeNameMessage
6000OverflowAn amount exceeds the register's numeric range.
6009WrongAccountThe account does not belong to this operation.
6029NothingToClaimThe position has no whole cash atoms to claim.

Framework errors

Anchor checks the accounts before an instruction's own logic runs. A typed account that doesn't exist fails with AccountNotInitialized (issuing to a wallet that has no Member, for example), and a wrong PDA, owner or discriminator on a typed account fails with Anchor's own constraint errors. Where the program reads a member as an unchecked account (deposit, withdraw, list_instrument, take_offer), a missing one raises NotAdmitted instead. A transaction missing a required signature never reaches the program: the runtime rejects it. Creating an account that already exists (a second admission, a code already listed, a stale offer or repo id) fails in the System program as "already in use". SPL Token returns its own errors for a frozen token account or a short USDC balance.