csminipool

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: AGPL-3.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterMinipoolRoute

func RegisterMinipoolRoute[ContextType IMinipoolCallContext[DataType], DataType any](
	router *mux.Router,
	functionName string,
	factory IMinipoolCallContextFactory[ContextType, DataType],
	ctx context.Context,
	logger *slog.Logger,
	serviceProvider cscommon.IConstellationServiceProvider,
)

Registers a new route with the router, which will invoke the provided factory to create and execute the context for the route when it's called; use this for complex calls that will iterate over and query each minipool in the node

Types

type IMinipoolCallContext

type IMinipoolCallContext[DataType any] interface {
	// Initialize the context with any bootstrapping, requirements checks, or bindings it needs to set up
	Initialize(walletStatus wallet.WalletStatus) (types.ResponseStatus, error)

	// Used to get any supplemental state required during initialization - anything in here will be fed into an rp.Query() multicall
	GetState(node *node.Node, mc *batch.MultiCaller)

	// Check the initialized state after being queried to see if the response needs to be updated and the query can be ended prematurely
	// Return true if the function should continue, or false if it needs to end and just return the response as-is
	CheckState(node *node.Node, data *DataType) bool

	// Get whatever details of the given minipool are necessary; this will be passed into an rp.BatchQuery call, one run per minipool
	// belonging to the node
	GetMinipoolDetails(mc *batch.MultiCaller, mp minipool.IMinipool, index int)

	// Prepare the response data using all of the provided artifacts
	PrepareData(addresses []common.Address, mps []minipool.IMinipool, data *DataType, blockHeader *ethtypes.Header, opts *bind.TransactOpts) (types.ResponseStatus, error)
}

Wrapper for callbacks used by functions that will query all of the node's minipools - they follow this pattern: Create bindings, query the chain, return prematurely if some state isn't correct, query all of the minipools, and process them to populate a response. Structs implementing this will handle the caller-specific functionality.

type IMinipoolCallContextFactory

type IMinipoolCallContextFactory[ContextType IMinipoolCallContext[DataType], DataType any] interface {
	// Create the context for the route
	Create(args url.Values) (ContextType, error)
}

Interface for minipool call context factories - these will be invoked during route handling to create the unique context for the route

type MinipoolCloseContext

type MinipoolCloseContext struct {
	Handler           *MinipoolHandler
	MinipoolAddresses []common.Address
	// contains filtered or unexported fields
}

func (*MinipoolCloseContext) GetState

func (c *MinipoolCloseContext) GetState(mc *batch.MultiCaller)

func (*MinipoolCloseContext) Initialize

func (c *MinipoolCloseContext) Initialize(walletStatus wallet.WalletStatus) (types.ResponseStatus, error)

func (*MinipoolCloseContext) PrepareData

type MinipoolCloseDetailsContext

type MinipoolCloseDetailsContext struct {
	// Dependencies
	ServiceProvider   cscommon.IConstellationServiceProvider
	Logger            *slog.Logger
	Context           context.Context
	SnServiceProvider snservices.ISmartNodeServiceProvider
	// contains filtered or unexported fields
}

func (*MinipoolCloseDetailsContext) CheckState

func (*MinipoolCloseDetailsContext) GetMinipoolDetails

func (c *MinipoolCloseDetailsContext) GetMinipoolDetails(mc *batch.MultiCaller, mp minipool.IMinipool, index int)

func (*MinipoolCloseDetailsContext) GetState

func (c *MinipoolCloseDetailsContext) GetState(node *node.Node, mc *batch.MultiCaller)

func (*MinipoolCloseDetailsContext) Initialize

func (*MinipoolCloseDetailsContext) PrepareData

func (c *MinipoolCloseDetailsContext) PrepareData(addresses []common.Address, mps []minipool.IMinipool, data *csapi.MinipoolCloseDetailsData, latestBlockHeader *ethtypes.Header, opts *bind.TransactOpts) (types.ResponseStatus, error)

type MinipoolCreateContext

type MinipoolCreateContext struct {
	// Dependencies
	ServiceProvider cscommon.IConstellationServiceProvider
	Logger          *slog.Logger
	Context         context.Context

	// Inputs
	ExpectedMinipoolAddress common.Address
	Salt                    *big.Int
	// contains filtered or unexported fields
}

func (*MinipoolCreateContext) GetState

func (c *MinipoolCreateContext) GetState(mc *batch.MultiCaller)

func (*MinipoolCreateContext) Initialize

func (c *MinipoolCreateContext) Initialize(walletStatus wallet.WalletStatus) (types.ResponseStatus, error)

func (*MinipoolCreateContext) PrepareData

type MinipoolExitContext

type MinipoolExitContext struct {
	// Dependencies
	ServiceProvider cscommon.IConstellationServiceProvider
	Logger          *slog.Logger
	Context         context.Context

	// Arguments
	Infos []csapi.MinipoolValidatorInfo
}

func (*MinipoolExitContext) PrepareData

func (c *MinipoolExitContext) PrepareData(data *types.SuccessData, walletStatus wallet.WalletStatus, opts *bind.TransactOpts) (types.ResponseStatus, error)

type MinipoolExitDetailsContext

type MinipoolExitDetailsContext struct {
	// Dependencies
	ServiceProvider cscommon.IConstellationServiceProvider
	Logger          *slog.Logger
	Context         context.Context

	// Arguments
	Verbose bool
}

func (*MinipoolExitDetailsContext) CheckState

func (c *MinipoolExitDetailsContext) CheckState(node *node.Node, response *csapi.MinipoolExitDetailsData) bool

func (*MinipoolExitDetailsContext) GetMinipoolDetails

func (c *MinipoolExitDetailsContext) GetMinipoolDetails(mc *batch.MultiCaller, mp minipool.IMinipool, index int)

func (*MinipoolExitDetailsContext) GetState

func (c *MinipoolExitDetailsContext) GetState(node *node.Node, mc *batch.MultiCaller)

func (*MinipoolExitDetailsContext) Initialize

func (*MinipoolExitDetailsContext) PrepareData

type MinipoolHandler

type MinipoolHandler struct {
	// contains filtered or unexported fields
}

func NewMinipoolHandler

func NewMinipoolHandler(logger *log.Logger, ctx context.Context, serviceProvider cscommon.IConstellationServiceProvider) *MinipoolHandler

func (*MinipoolHandler) RegisterRoutes

func (h *MinipoolHandler) RegisterRoutes(router *mux.Router)

type MinipoolStakeContext

type MinipoolStakeContext struct {
	// Dependencies
	ServiceProvider cscommon.IConstellationServiceProvider
	Logger          *slog.Logger
	Context         context.Context
	// contains filtered or unexported fields
}

func (*MinipoolStakeContext) CheckState

func (c *MinipoolStakeContext) CheckState(node *node.Node, data *csapi.MinipoolStakeData) bool

func (*MinipoolStakeContext) GetMinipoolDetails

func (c *MinipoolStakeContext) GetMinipoolDetails(mc *batch.MultiCaller, mp minipool.IMinipool, index int)

func (*MinipoolStakeContext) GetState

func (c *MinipoolStakeContext) GetState(node *node.Node, mc *batch.MultiCaller)

func (*MinipoolStakeContext) Initialize

func (c *MinipoolStakeContext) Initialize(walletStatus wallet.WalletStatus) (types.ResponseStatus, error)

func (*MinipoolStakeContext) PrepareData

func (c *MinipoolStakeContext) PrepareData(addresses []common.Address, mps []minipool.IMinipool, data *csapi.MinipoolStakeData, blockHeader *ethtypes.Header, opts *bind.TransactOpts) (types.ResponseStatus, error)

type MinipoolStatusContext

type MinipoolStatusContext struct {
	// Dependencies
	ServiceProvider   cscommon.IConstellationServiceProvider
	Logger            *slog.Logger
	Context           context.Context
	SnServiceProvider snservices.ISmartNodeServiceProvider
	// contains filtered or unexported fields
}

func (*MinipoolStatusContext) CheckState

func (c *MinipoolStatusContext) CheckState(node *node.Node, data *csapi.MinipoolStatusData) bool

func (*MinipoolStatusContext) GetMinipoolDetails

func (c *MinipoolStatusContext) GetMinipoolDetails(mc *batch.MultiCaller, mp minipool.IMinipool, index int)

func (*MinipoolStatusContext) GetState

func (c *MinipoolStatusContext) GetState(node *node.Node, mc *batch.MultiCaller)

func (*MinipoolStatusContext) Initialize

func (c *MinipoolStatusContext) Initialize(walletStatus wallet.WalletStatus) (types.ResponseStatus, error)

func (*MinipoolStatusContext) PrepareData

func (c *MinipoolStatusContext) PrepareData(addresses []common.Address, mps []minipool.IMinipool, data *csapi.MinipoolStatusData, latestBlockHeader *ethtypes.Header, opts *bind.TransactOpts) (types.ResponseStatus, error)

type MinipoolUploadSignedExitsContext

type MinipoolUploadSignedExitsContext struct {
	// Dependencies
	ServiceProvider cscommon.IConstellationServiceProvider
	Logger          *slog.Logger
	Context         context.Context

	// Arguments
	Infos []csapi.MinipoolValidatorInfo
}

func (*MinipoolUploadSignedExitsContext) PrepareData

type MinipoolVanityContext

type MinipoolVanityContext struct {
	// contains filtered or unexported fields
}

func (*MinipoolVanityContext) PrepareData

Jump to

Keyboard shortcuts

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