LogoLogo
DocsBlog
  • What is Sanctum?
  • Introduction to LSTs
    • PoW and PoS blockchains
    • From native to liquid staking
    • The current state of liquid staking isn't optimal
  • Technical documentation
    • Router
    • Infinity
    • Reserve
    • Sanctum LSTs
  • CREATING YOUR OWN LST WITH SANCTUM
    • Understanding Sanctum LSTs
    • The Sanctum package
    • The setup process: launching your LST
    • Post-deployment additional information
  • For developers
    • Deployed programs
    • Resources
    • Sanctum API
  • MISC
    • Press Kit
    • Disclaimer
Powered by GitBook
LogoLogo

Learn

  • Docs
  • Blog

Community

  • X
  • Discord
On this page
  • Relevant Instructions
  • An Example Swap Flow
  • Fees
  • Security
Export as PDF
  1. Technical documentation

Router

PreviousThe current state of liquid staking isn't optimalNextInfinity

Last updated 5 days ago

The Router's primary role is to streamline complex staking and swapping processes. It handles the underlying logic for:

  • Staking and Withdrawing SOL: Allows users to stake and withdraw SOL.

  • Swapping via Stake Accounts: Facilitates swaps between different LSTs by leveraging stake accounts, acting as a routing layer.

The Router currently only works with active stake accounts.

Relevant Instructions

The Router Program exposes a comprehensive set of instructions to manage its various functionalities:

  • StakeWrappedSol: Allows users to stake SOL into a staking pool, receiving an LST in return

  • WithdrawWrappedSol: Allows users to withdraw undelegated SOL from a stake pool's reserve.

  • WithdrawStake: Prepares a temporary stake account that will receive SOL from an unstake operation.

  • DepositStake: Allows users to deposit a stake account directly into a staking pool, receiving an LST in return.

  • SwapViaStake: Executes a "swap" between two different LSTs. This operation requires that the two stake pools involved in the swap have a validator in common within their validator set.

The SwapViaStake instruction can also be used in conjunction with to access instant SOL liquidity.

An Example Swap Flow

When a user swaps amount_in LST A for amount_out LST B via the Router:

Fees

  • No fees on StakeWrappedSol

  • 1bps on WithdrawWrappedSol

  • 10bps on DepositStake unless output mint is SOL (via The Reserve) in which case there are no fees

Security

The Router program is a simple CPI wrapper program that is integrated into Jupiter. Its main purpose is to glue stake pool operations together so that they involve only SPL token inputs and outputs so that it can be treated as an AMM on Jupiter. As such, there is no value at risk.

The Reserve