Skip to main content

Module discriminators

Module discriminators 

Source
Expand description

Anchor-compatible instruction discriminators for Kvault.

Each instruction is identified by the first 8 bytes of SHA-256("global:<snake_case_name>"). The constants are computed at compile time via a const-compatible SHA-256 implementation.

Enums§

KvaultInstruction
Known Kvault instruction types, identified by their 8-byte discriminator.

Statics§

BUY
Discriminator for the buy instruction.
DEPOSIT
Discriminator for the deposit instruction.
INVEST
Discriminator for the invest instruction.
INVEST_WITH_MAX_AMOUNT
Discriminator for the invest_with_max_amount instruction.
REDEEM_IN_KIND
Discriminator for the redeem_in_kind instruction.
SELL
Discriminator for the sell instruction.
WITHDRAW
Discriminator for the withdraw instruction.
WITHDRAW_FROM_AVAILABLE
Discriminator for the withdraw_from_available instruction.

Functions§

compute_discriminator
Compute the 8-byte Anchor discriminator for a given instruction name.
identify_instruction
Identify a Kvault instruction from its raw instruction data.
sha256_first8
Const-compatible SHA-256 returning only the first 8 bytes. Supports messages up to 119 bytes (two 64-byte blocks).