testperpv1

package
v0.4.16 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package testperpv1 is the Go-side orchestrator for the testperpv1 bot mode -- a real-transaction smoke test, not a real trading strategy. Otherwise a direct copy of package perpfundingv1's orchestration: same allocation/upload/handshake/wallet-init flow, only MODE=testperpv1 selected at upload time instead.

It implements the brain.Brain interface and is responsible for:

  • Allocating a slot on a Catscope/Solpipe validator pipeline (bid = 0, free tier).
  • Uploading a WASM bot image to the validator with MODE=testperpv1.
  • Completing the handshake with the running bot instance.
  • Sending a child keypair to the bot via stdin -- unlike perpfundingv1, this mode's Rust side (catscope-rust-bot/src/brain/testperpv1) does use it, to sign the real Solend/Kamino deposit/withdraw transactions its evaluate() state machine builds.

The WASM bot (catscope-rust-bot/src/brain/testperpv1) runs the real bootstrap -> deposit -> withdraw sequence for Solend then Kamino -- see that module's doc comment for why it exists and what it proves.

Index

Constants

View Source
const (
	KeyFlagEchoRequest          uint8 = 1
	KeyFlagEchoResponse         uint8 = 2
	KeyFlagWallet               uint8 = 3
	KeyFlagTargetAllocation     uint8 = 4
	KeyFlagLstApy               uint8 = 5
	KeyFlagTriggerTestAstralane uint8 = 6
	// KeyFlagCommonAccountUsage is shared across every brain/* package
	// (not just this one) -- see the doc comment above.
	KeyFlagCommonAccountUsage uint8 = 200
)

Variables

View Source
var ErrBotNotConnectedYet = errors.New("testperpv1: bot not connected yet")

ErrBotNotConnectedYet is returned by SendBundlerTipUpdate while the bot hasn't finished its handshake yet -- mirrors leveragedloopv1's own sentinel of the same name. Not an error condition RunTipBroadcaster treats specially; it just logs and retries on its next tick.

Functions

func DoEchoRequest

func DoEchoRequest(payload string) catmsg.FixedPair

func DoLstApy

func DoLstApy(symbol string, stakingApy float64) catmsg.FixedPair

DoLstApy builds the wire message for a real annualized LST staking-yield update (fraction, e.g. 0.073 for 7.3%/yr) for one liquid-staking-token symbol. symbol must fit in 16 bytes (jitoSOL/bSOL/mSOL all do).

func DoTargetAllocation

func DoTargetAllocation(symbol string, allocationPct float64) catmsg.FixedPair

DoTargetAllocation builds the wire message for a target portfolio allocation update for symbol (fraction of total portfolio value, 0.0-1.0). symbol must fit in 16 bytes (matches every currently tracked symbol: SOL/BTC/ETH/XRP/BNB/SUI).

func DoTriggerTestAstralane

func DoTriggerTestAstralane() catmsg.FixedPair

DoTriggerTestAstralane builds the wire message requesting the bot send a real tip payment to one of Astralane's tip wallets plus a second, deliberately inert self-transfer, tagged for Astralane -- proves the generic transactionprocessor::batch host import end-to-end without risking a real trading operation on it.

func DoWallet

func DoWallet(key sgo.PrivateKey) catmsg.FixedPair

Types

type Configuration

type Configuration struct {
	BotImage string
}

type Hook

type Hook interface {
	brain.Brain
	SendBundlerTipUpdate(update bundler.TipUpdate) error
	SendTriggerTestAstralane() error
}

Hook is brain.Brain plus SendBundlerTipUpdate/SendTriggerTestAstralane -- returned instead of a bare brain.Brain so cmd/*.go can call them on the same instance it hands to mothership.Create (a Hook value is itself a valid brain.Brain, since this interface embeds it). Mirrors leveragedloopv1.Hook's own reasoning for its trigger-sender methods.

func Create

func Create(ctx context.Context, cancel context.CancelCauseFunc, parentKey sgo.PrivateKey, config *Configuration, db *sql.DB) (Hook, error)

Create creates a testperpv1 gRPC event hook. db is the already-open prefetch.db connection (see store.DB.Raw()), used to persist target allocation updates sent via SendTargetAllocation.

Source Files

  • eval.go
  • init.go
  • instance.go
  • message.go
  • testperpv1.go

Jump to

Keyboard shortcuts

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