Instruction reference
Sixteen instructions. Data is one tag byte, then little-endian fields. In the account lists, s means signer and w means writable.
Users
| Tag | Instruction | Data | Accounts |
|---|
| 4 | mint_pair | amount u64 | user s, config w, market w, quote_mint, user_quote w, vault w, treasury w, long_mint w, short_mint w, user_long w, user_short w, token, token_2022 |
| 5 | redeem_pair | amount u64 | user s, market, quote_mint, vault w, user_quote w, long_mint w, short_mint w, user_long w, user_short w, token, token_2022 |
| 12 | redeem_settled | side u8 (0 LONG, 1 SHORT), amount u64 | user s, market, quote_mint, vault w, user_quote w, side_mint w, user_side w, token, token_2022 |
mint_pair takes amount USDC into the vault and the fee into the treasury, then mints amount LONG and amount SHORT. Refused once the market has settled.
redeem_pair burns amount of both sides and pays amount USDC. Works before and after settlement, with no fee.
redeem_settled burns one side and pays floor(amount x share / 1,000,000) USDC. Requires a settled market.
Anyone
| Tag | Instruction | Data | Accounts |
|---|
| 10 | fold_prints | none | market w |
| 11 | settle_market | none | market w |
fold_prints folds every pending print whose 24-hour window has passed, oldest first, stopping at the first disputed or still-open one.
settle_market fixes the average once the final print has folded, or by fallback 45 days after the month ended.
Keeper and authority: prints
| Tag | Instruction | Data | Accounts |
|---|
| 6 | post_print | date u32 (yyyymmdd), rate u32, final u8 | poster s (keeper or authority), config, market w |
| 7 | dispute_print | index u8 | keeper or authority s, config, market w |
| 8 | correct_print | index u8, rate u32 | authority s, config, market w |
| 9 | void_prints | from u8 | authority s, config, market w |
post_print checks, in order: the market is trading, the month is not closed, the queue has room (8 entries), the rate is at most 25%, the date is between 7 days before the 1st and the month's last day, the date is after every earlier print, an earlier rate exists if the date is past the 1st, and the clock is past 19:30 UTC on the day after the date. It folds whatever is ready before queueing.
Authority: setup and teardown
| Tag | Instruction | Data | Accounts |
|---|
| 0 | init_config | keeper Pubkey | authority s w (the program's upgrade authority), config w, treasury w, quote_mint, program_data, system, token |
| 1 | update_config | keeper, pending_authority, buyback_destination (Pubkey each) | authority s, config w |
| 2 | accept_authority | none | pending_authority s, config w |
| 3 | list_market | year u16, month u8, target_mid u32 | authority s w, config w, market w, long_mint w, short_mint w, vault w, quote_mint, system, token, token_2022 |
| 13 | claim_protocol | bucket u8 (0 operations, 1 reserved), amount u64 | authority s, config w, quote_mint, treasury w, destination w, token |
| 14 | close_market | none | authority s w, config w, market w, long_mint w, short_mint w, vault w, treasury w, quote_mint, token, token_2022 |
| 15 | close_config | none | authority s w, config w, treasury w, quote_mint, destination w, token |
list_market fixes the collar from target_mid: [max(0, mid - 25000), mid + 25000] in rate units. The launch lineup uses target_mid = 38750 (3.875%).
claim_protocol bucket 1 pays only to buyback_destination and is refused while that address is unset.
close_market needs a market settled at least 90 days ago with no paying token outstanding.
close_config needs every market closed.
Measured compute
| Instruction | Compute units |
|---|
| init_config | 24,195 |
| list_market | 58,396 |
| mint_pair (first time, with token accounts) | 53,723 to about 61,000 |
| mint_pair | 16,571 |
| redeem_pair | 14,255 |
| post_print | 1,820 to 2,597 |
| dispute_print / correct_print / void_prints | 1,536 / 1,544 / 1,598 |
| fold_prints (2 prints) | 1,075 |
| settle_market | 1,762 |
| redeem_settled | 9,568 |
| claim_protocol | 4,087 |
| update_config / accept_authority | 946 / 888 |
| close_market / close_config | 6,852 / 6,773 |