Documentation
¶
Overview ¶
Package sanctum preloads Sanctum S Controller LST pool state.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AssociatedTokenProgramID = sgo.MustPublicKeyFromBase58("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL")
AssociatedTokenProgramID is the real SPL Associated Token Account program. Verified directly against igneous-labs/sanctum-ata-sdk (core/src/lib.rs) and a decoded live swap_exact_in transaction -- do not confuse with the visually-similar but wrong "...LJe1bxr" address that was hardcoded on the Rust side for a while (same vanity prefix, wrong tail); see catscope-rust-bot's docs/SANCTUM_ROUTING_DEBUG.md for the full story of how that bug was found.
PDAs derived from the Sanctum S Controller program. LstStateListPDA is exported so callers outside this package (e.g. prefetch/lst-yield) can read the single shared account tracking every Sanctum LST's sol_value without re-deriving the PDA themselves.
var (
ProgramID = sgo.MustPublicKeyFromBase58("5ocnV1qiCgaQR8Jb8xWnVbApfaygJ8tNoZfgPwsgx9kx")
)
var Schema string
Functions ¶
func ExportJSON ¶ added in v0.4.16
ExportJSON writes every tracked Sanctum LST to path as a JSON array of LstEntry values (its own existing json tags) -- the same real query loadLsts already runs for in-process use, reused verbatim, so catscope-rust-bot's build.rs can read this file instead of opening prefetch.db directly.
func FindPoolReservesAddress ¶ added in v0.4.16
FindPoolReservesAddress derives an LST's pool-reserves ATA the same way s-controller-lib's find_pool_reserves_address does: standard ATA seeds [wallet, token_program, mint] under AssociatedTokenProgramID, with wallet = the pool_state PDA -- mirrors sanctum.rs's spl_ata helper on the Rust side (now fixed to use the same correct program ID). Exported so callers outside this package (e.g. prefetch/lst-yield's generic rate fetcher) can derive an LST's reserve ATA without a live Subscribe/Hook round-trip.
Types ¶
type LstConfig ¶
type LstEntry ¶
type LstEntry struct {
Mint sgo.PublicKey `json:"mint"`
SolValueCalculator sgo.PublicKey `json:"sol_value_calculator"`
SolValue uint64 `json:"sol_value"`
// PoolState is the LST's underlying stake-pool account, needed as one
// of the SOL-value-calculator CPI accounts for the SanctumSpl/
// SanctumSplMulti/Spl calculator kinds (see registry.go). Zero value
// means unknown -- either this LST's calculator kind doesn't need it
// (Marinade/Lido/Wsol are resolved without this field, on the Rust
// side) or the vendored registry didn't have an entry for it.
PoolState sgo.PublicKey `json:"pool_state"`
// Reserve is the raw token balance of this LST's pool-reserves ATA
// (see findPoolReservesAddress), fetched live during Create. Seeds the
// Rust side's SanctumState so spot_price() can resolve from the first
// commit instead of waiting on a live on_token event -- see
// SanctumLstSetup.reserve in sanctum.rs.
Reserve uint64 `json:"reserve"`
}
LstEntry holds one LST's parsed state from the Sanctum S Controller.
func ParseLstStateList ¶ added in v0.4.16
ParseLstStateList parses the lst_state_list account data into a slice of LstEntry. Each entry is lstStateSize bytes; the body starts at offset 0 (no discriminator). Exported so callers outside this package (e.g. prefetch/lst-yield's generic rate fetcher) can decode a raw account read of LstStateListPDA without going through this package's live Subscribe/Hook flow.
type Query ¶ added in v0.4.16
type Query struct {
// contains filtered or unexported fields
}
func CreateQuery ¶ added in v0.4.16
CreateQuery prepares the top-LSTs-by-SOL-value statement against sanctum_lst. Callers wrap the result as one dispatch case of a single, consolidated "get top pools" tool (see prefetch/prompttool.go) rather than exposing their own separate tool.
type Sanctum ¶
type Sanctum struct {
Lsts []*LstEntry
}
Sanctum holds pool state and LST entries loaded at startup.
func Create ¶
func Create(ctx context.Context, stateClient state.Client, db *sql.DB, force bool) (*Sanctum, error)
Create queries the Sanctum S Controller PDAs and parses LST entries, persisting results to db (sanctum_lst). If db already has LSTs from a previous run, they're loaded back instead of re-fetching, unless force is true.
Source Files
¶
- event.go
- export.go
- loader.go
- lst.go
- print.go
- query.go
- registry.go
- sanctum.go
- schema.go
- store.go