instruments
TS/Gdesign
The program has exactly nine instruments. Each is listed below with its purpose, its signer, the accounts it touches, and its arguments. This list is fixed by the program's interface description. If the interface on chain ever differs from this page, the chain is correct and this page is an incident.
initialize
set_rates
lock
open
settle
release
hold
name
batch_memo
interface
read from the chain at load timeThe interface description below is read from the chain at load time using the program's published IDL account. It is shown raw so that it can be compared against the list above.
The interface account could not be read from the cluster at this time.
seeds
| ACCOUNT | SEEDS |
|---|---|
| config | ["config"] |
| float | ["float", mint] |
| float vault | ["vault", float] |
| collateral | ["collateral", counterparty, mint] |
| collateral vault | ["vault", collateral] |
| position | ["position", counterparty, nonce] |
| name account | ["name", counterparty] |
errors
| CODE NAME | MEANING |
|---|---|
| NotOperator | The signer is not the operator key in config. |
| BatchClosed | The settle or hold instrument was called outside the position's batch window. |
| InsufficientCollateral | Collateral is below the ratio on the rate sheet. |
| CollateralInUse | Release was attempted while positions are open. |
| FloatLocked | Operator withdrawal was attempted while positions are open. |
| NameTooLong | More than 32 bytes. |
| RatesNotEffective | set_rates was called with an effective batch in the past. |
| PositionSettled | An instrument was called on an already settled position. |
reading an instruction from the log
Every transaction against the system produces program log lines. The first line names the program. The next names the instrument. Lines beginning with the program's own prefix record what it checked and what it moved. The last line records success or the error name. The settlement detail pages print these lines unchanged. If you learn to read them you do not need this site.
instrument families
| FAMILY | INSTRUMENTS | WHO SIGNS | WHAT MOVES |
|---|---|---|---|
| setup | initialize, set_rates | operator | nothing |
| collateral | lock, release | counterparty | collateral between the counterparty and its vault |
| position | open, settle | counterparty; settle also operator | float between the float vault and the counterparty |
| review | hold | operator | nothing |
| record | name, batch_memo | counterparty; batch_memo operator | nothing |
why nothing takes an arbitrary account
Every account an instrument touches is either a program-derived address with fixed seeds, a token account whose owner is checked against the signer, a well-known program, or a sysvar.1 There is no instrument that accepts "an account" without constraint. This is what makes the seeds table on this page useful: anyone can derive every account the system will ever touch and check that a transaction used the right ones. A program that accepts arbitrary accounts is a program whose behaviour depends on who is calling, and that is a program you cannot audit from its interface alone.
what initialize cannot do twice
Initialize creates the config account at a fixed address. A second call finds the account exists and fails at account creation, before any of the program's own code runs. There is no re-initialize. If config is wrong, the remedy is a new deployment with a new program id, announced by memo, and this site's environment pointing at the new id. The old program, and its book, remain readable forever.
the reason codes on hold
| CODE | MEANING | WHAT THE COUNTERPARTY CAN DO |
|---|---|---|
| 0 | collateral below ratio | lock more collateral; the next batch will re-check |
| 1 | collateral mint mismatch | nothing; this should be unreachable because open checks the mint, and its appearance is a serious incident |
| 2 | manual hold | read the memo that accompanies it |
arguments that look like they should exist and do not
There is no argument for a price. There is no argument for a duration. There is no argument for a recipient other than the signer. There is no argument for a memo on open or settle, because the chain's memo program exists for that and the desk uses it separately. There is no admin override argument on any instrument. Where this list surprises you, the surprise is the design.
- 1. A program derived address is an account address computed from fixed seeds, so anyone can derive it and check the desk's work.