solend

package
v0.4.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package solend preloads Solend/Save token-lending reserve accounts (global market data only -- Obligation, the per-wallet position account, is not fetched here since there is no bounded set to bulk-load).

Index

Constants

View Source
const SevenDaysOfSlots = 7 * 24 * 60 * 60 * 25 / 10 // 1,512,000 slots

SevenDaysOfSlots assumes ~400ms/slot (2.5 slots/sec), the same fallback bot/state/clock.go itself uses before real slot-timing data arrives -- see raydium/cpmm's own OldSlot for the established precedent of this convention.

Variables

View Source
var (
	ProgramID = sgo.MustPublicKeyFromBase58("So1endDq2YkqhipRh3WViPa8hdiSpxWy6z3Z6tMCpAo")
)
View Source
var Schema string

Functions

func ExportJSON

func ExportJSON(db *sql.DB, path string) error

ExportJSON writes every tracked Solend reserve to path as a JSON array of Reserve values (its own existing json tags) -- the same real query loadReserves 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.

Types

type Reserve

type Reserve struct {
	Pubkey        sgo.PublicKey `json:"pubkey"`
	LendingMarket sgo.PublicKey `json:"lending_market"`
	Mint          sgo.PublicKey `json:"mint"`
	SupplyVault   sgo.PublicKey `json:"supply_vault"`
}

Reserve is the parsed state of a Solend Reserve account.

func (*Reserve) String

func (r *Reserve) String() string

type Solend

type Solend struct {
	Reserves []*Reserve
	// contains filtered or unexported fields
}

Solend holds all Solend/Save reserve accounts loaded at startup.

func Create

func Create(ctx context.Context, stateClient state.Client, db *sql.DB, force bool) (*Solend, error)

Create discovers Solend lending markets and reserves via an active, per-node Subscribe/ack chain (program -> lending_market, then lending_market -> reserve; see event.go, which mirrors orca.fetchWhirlpool's own config->pool chain) and collects all reserve accounts, persisting results to db (solend_reserve). If db already has reserves from a previous run, they're loaded back instead of re-fetching, unless force is true.

func (*Solend) Find

func (s *Solend) Find(reserveID sgo.PublicKey) *Reserve

Find looks up a reserve by its pubkey.

func (*Solend) String

func (s *Solend) String() string

Source Files

  • event.go
  • export.go
  • print.go
  • reserve.go
  • schema.go
  • solend.go
  • store.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL