RSTAR

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

TagInstructionDataAccounts
4mint_pairamount u64user 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
5redeem_pairamount u64user s, market, quote_mint, vault w, user_quote w, long_mint w, short_mint w, user_long w, user_short w, token, token_2022
12redeem_settledside u8 (0 LONG, 1 SHORT), amount u64user s, market, quote_mint, vault w, user_quote w, side_mint w, user_side w, token, token_2022

Anyone

TagInstructionDataAccounts
10fold_printsnonemarket w
11settle_marketnonemarket w

Keeper and authority: prints

TagInstructionDataAccounts
6post_printdate u32 (yyyymmdd), rate u32, final u8poster s (keeper or authority), config, market w
7dispute_printindex u8keeper or authority s, config, market w
8correct_printindex u8, rate u32authority s, config, market w
9void_printsfrom u8authority 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

TagInstructionDataAccounts
0init_configkeeper Pubkeyauthority s w (the program's upgrade authority), config w, treasury w, quote_mint, program_data, system, token
1update_configkeeper, pending_authority, buyback_destination (Pubkey each)authority s, config w
2accept_authoritynonepending_authority s, config w
3list_marketyear u16, month u8, target_mid u32authority s w, config w, market w, long_mint w, short_mint w, vault w, quote_mint, system, token, token_2022
13claim_protocolbucket u8 (0 operations, 1 reserved), amount u64authority s, config w, quote_mint, treasury w, destination w, token
14close_marketnoneauthority s w, config w, market w, long_mint w, short_mint w, vault w, treasury w, quote_mint, token, token_2022
15close_confignoneauthority s w, config w, treasury w, quote_mint, destination w, token

Measured compute

InstructionCompute units
init_config24,195
list_market58,396
mint_pair (first time, with token accounts)53,723 to about 61,000
mint_pair16,571
redeem_pair14,255
post_print1,820 to 2,597
dispute_print / correct_print / void_prints1,536 / 1,544 / 1,598
fold_prints (2 prints)1,075
settle_market1,762
redeem_settled9,568
claim_protocol4,087
update_config / accept_authority946 / 888
close_market / close_config6,852 / 6,773