Liquid staking and restaking decoders
Decode 2 Solana liquid staking and restaking programs in Rust, including Marinade Finance and Solayer Restaking, with Carbon decoder crates.
Carbon 2.0.0 has decoder crates for 2 liquid staking and restaking programs on Solana: 32 instructions, 3 account types and 25 events in all. Use them to index stake deposits, unstake orders, liquid staking token mints and restaking as typed Rust values instead of parsing raw bytes. Each program's page lists every instruction with its discriminator, data fields and accounts, every account and event, and a complete program that runs against the public RPC.
Programs#
Program IDs are the mainnet addresses compiled into each crate as PROGRAM_ID. Instruction counts exclude the CpiEvent wrapper.
| Program | Crate | Program ID | Instructions | Accounts | Events |
|---|---|---|---|---|---|
| Marinade Finance | carbon-marinade-finance-decoder | MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD | 28 | 2 | 25 |
| Solayer Restaking | carbon-solayer-restaking-program-decoder | sSo1iU21jBrU9VaJ8PJib1MtorefUV4fzC9GURa2KNn | 4 | 1 | 0 |
Decode several in one pipeline#
Add carbon-core and the decoder crates you need, all at the same version. For every program in this category:
cargo add carbon-core@2.0.0 carbon-marinade-finance-decoder@2.0.0 carbon-solayer-restaking-program-decoder@2.0.0Register each decoder with a processor for its instruction enum. This fragment goes in your pipeline setup; the processors are yours, one per program, each implementing Processor for that program's instruction input (see processors):
use carbon_marinade_finance_decoder::MarinadeFinanceDecoder;
use carbon_solayer_restaking_program_decoder::SolayerRestakingProgramDecoder;
Pipeline::builder()
.datasource(datasource) // a datasource that emits these programs' transactions
.instruction(MarinadeFinanceDecoder, MarinadeFinanceProcessor)
.instruction(SolayerRestakingProgramDecoder, SolayerRestakingProgramProcessor)
.build()?
.run()
.awaitEach decoder only returns instructions whose program ID matches its own PROGRAM_ID, so one pipeline can hold all of them. For datasource filters that follow several programs, and one processor that sees every program's instructions in a transaction, see index multiple programs.
A program that is not listed#
Generate a decoder from the program's Anchor or Codama IDL with the Carbon CLI: see generate a decoder. Every crate above was generated the same way. The full catalog lists decoders in every category.