Program reference
Anchor 1.2.2. Program id 9mdgf5jHk8xNkBV3K7jASMZc38Xp3wH3HCaCEjXYk1aP. The IDL ships with the app at app/lib/idl/quantark.json.
“Guard” below means the instruction fails once Q-day is latched or the canary reads tripped. “Pause” means it also fails while the admin pause is on.
Instructions
Section titled “Instructions”| Instruction | Args | Signer | Guard | Pause |
|---|---|---|---|---|
init_config |
canary, canary_owner, canary_offset: u16 |
admin | ||
set_pause |
paused: bool |
admin | yes | |
set_canary |
canary, canary_owner, canary_offset: u16 |
admin | yes | |
init_basket |
components: Vec<Component> (1 to 4) |
admin | yes | |
post_snapshot |
epoch: u64, root: [u8; 32], holders: u32, total: u64 |
admin | yes |
| Instruction | Args | Signer | Guard | Pause |
|---|---|---|---|---|
mint_q2 |
amount: u64 (Q2 base units) |
user | yes | yes |
redeem_q2 |
amount: u64 |
user | yes | yes |
register_lifeboat |
commitment: [u8; 32] |
holder | yes | yes |
Permissionless
Section titled “Permissionless”| Instruction | Args | Notes |
|---|---|---|
freeze_on_canary |
none | Sets the Q-day latch. Fails with CanaryNotTripped unless the canary reads tripped |
init_pq_vault |
id: [u8; 16], key: [u8; 24] |
Creates a treasury vault at leaf q = 0 |
pq_withdraw |
sig: Vec<u8>, next_key: [u8; 24], amount: u64 |
Verifies LM-OTS over the vault message, transfers, rotates the key. Not guarded |
Remaining accounts for mint and redeem
Section titled “Remaining accounts for mint and redeem”Four accounts per component, in basket order.
| Position | mint_q2 |
redeem_q2 |
|---|---|---|
| 0 | component mint | component mint |
| 1 | user source token account | user destination token account |
| 2 | basket vault for the mint | basket vault for the mint |
| 3 | token program (SPL Token or Token-2022) | token program |
Component amounts are ceil(amount × amount_per_q2 / 10^6) on mint and floor(...) on redeem.
Accounts
Section titled “Accounts”pub struct Config { admin: Pubkey, canary: Pubkey, canary_owner: Pubkey, canary_offset: u16, paused: bool, tripped: bool, bump: u8 }pub struct Basket { q2_mint: Pubkey, components: Vec<Component>, bump: u8 } // max 4 componentspub struct Component { mint: Pubkey, amount_per_q2: u64 } // base units per 1 whole Q2pub struct PqVault { id: [u8; 16], q: u32, key: [u8; 24], bump: u8 }pub struct Lifeboat { holder: Pubkey, commitment: [u8; 32], slot: u64, bump: u8 }pub struct Snapshot { coin_mint: Pubkey, epoch: u64, root: [u8; 32], holders: u32, total: u64, slot: u64, bump: u8 }Seeds are listed on Addresses.
Events
Section titled “Events”| Event | Fields |
|---|---|
QDay |
slot: u64, emitted by freeze_on_canary |
Errors
Section titled “Errors”| Error | Message |
|---|---|
QDay |
Q-day: the canary tripped, Ed25519-authorised actions are frozen |
Paused |
Paused by admin |
WrongCanary |
Canary account does not match config |
CanaryNotTripped |
Canary has not tripped |
BadComponents |
Bad basket components or accounts |
BadVault |
Vault token account not owned by the basket |
BadSignature |
LM-OTS signature does not verify |
ZeroAmount |
Amount must be positive |
Overflow |
Arithmetic overflow |