solvernet

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2025 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderNone uint8 = iota // No provider
	ProviderCore uint8 = 1    // Omni Core
	ProviderHL   uint8 = 2    // Hyperlane
)

Variables

View Source
var (

	// Event log topics (common.Hash).
	TopicOpened   = mustGetEventTopic(inboxABI, "Open")
	TopicRejected = mustGetEventTopic(inboxABI, "Rejected")
	TopicClosed   = mustGetEventTopic(inboxABI, "Closed")
	TopicFilled   = mustGetEventTopic(inboxABI, "Filled")
	TopicClaimed  = mustGetEventTopic(inboxABI, "Claimed")
)

Functions

func AddHLNetwork added in v0.15.0

func AddHLNetwork(ctx context.Context, network netconf.Network, selectors ...func(netconf.ID, netconf.Chain) bool) netconf.Network

AddHLNetwork returns a copy of the network with hyperlane-secured chains added. Optional selector functions can be provided to filter the chains.

func AllEventTopics

func AllEventTopics() []common.Hash

AllEventTopics returns all solvernet event topics.

func CallsToBindings added in v0.14.0

func CallsToBindings(calls []Call) []bindings.SolverNetCall

CallsToBindings is a convenience function to convert a slice of Calls to a slice of bindings.SolverNetCall.

func DetectCustomError

func DetectCustomError(custom error) string

func FillHash added in v0.15.0

func FillHash(
	orderID OrderID,
	fillData bindings.SolverNetFillOriginData,
) (common.Hash, error)

FillHash returns the fill hash for the given order and fill data.

func FilterByBackends added in v0.15.0

func FilterByBackends(backends ethbackend.Backends) func(netconf.ID, netconf.Chain) bool

FilterByBackends returns an HL chain selector that excludes chains not in backends. Useful when needing to deploy contracts to configured backends.

func FilterByContracts added in v0.15.0

func FilterByContracts(ctx context.Context, endpoints xchain.RPCEndpoints) func(netconf.ID, netconf.Chain) bool

FilterByContracts returns an HL chain selector that excludes chains without inbox contracts deployed. Note this also excludes chains without endpoints, or with any other error fetching inbox DeployedAt.

func FilterByEndpoints added in v0.15.0

func FilterByEndpoints(endpoints xchain.RPCEndpoints) func(netconf.ID, netconf.Chain) bool

FilterByEndpoints returns an HL chain selector that excludes chains without endpoints.

func HLChains added in v0.15.0

func HLChains(network netconf.ID) []netconf.Chain

HLChains returns the list of hyperlane-secured chains for a given solvernet network.

func HyperlaneMailbox added in v0.15.0

func HyperlaneMailbox(chainID uint64) (common.Address, bool)

HyperlaneMailbox returns the Hyperlane mailbox address for `chainID`.

func IsCore added in v0.15.0

func IsCore(chainID uint64) bool

IsCore returns true if the chain supports Omni Core interop.

func IsDisabled added in v0.15.0

func IsDisabled(_ uint64) bool

IsDisabled returns true if the chain is disabled. This configures all routes for this chain to be disabled locally and remotely.

func IsHL added in v0.15.0

func IsHL(chainID uint64) bool

IsHL returns true if the chain supports Hyperlane interop.

func IsHLOnly added in v0.15.0

func IsHLOnly(chainID uint64) bool

IsHLOnly returns true if the chain only supports Hyperlane interop.

func IsHLRole added in v0.15.0

func IsHLRole(role eoa.Role) bool

IsHLRole returns true if the role is a hyperlane-related role.

func IsSupported added in v0.15.0

func IsSupported(chainID uint64) bool

IsSupported returns true if the chain ID is supported.

func OnlyCoreEndpoints added in v0.15.0

func OnlyCoreEndpoints(endpoints xchain.RPCEndpoints) xchain.RPCEndpoints

onlyCoreEndpoints filters the given RPC endpoints to only include core endpoints. Necessary prereq for netconf.AwaitOnExecutionChain, which expects all endopints to have portal registrations.

func PackFillCalldata

func PackFillCalldata(orderID OrderID, fillOriginData []byte) ([]byte, error)

func PackFillOriginData

func PackFillOriginData(data bindings.SolverNetFillOriginData) ([]byte, error)

func PackOrderData

func PackOrderData(data bindings.SolverNetOrderData) ([]byte, error)

func ParseEvent added in v0.14.0

func ParseEvent(l types.Log) (OrderID, OrderStatus, error)

ParseEvent return the order ID and status from the event log.

func ParseFillOriginData

func ParseFillOriginData(data []byte) (bindings.SolverNetFillOriginData, error)

func ParseOrderData

func ParseOrderData(data []byte) (bindings.SolverNetOrderData, error)

func Provider added in v0.15.0

func Provider(srcChainID, destChainID uint64) (uint8, bool)

Provider returns the provider between a source and destination chain. It returns false if the route is not supported.

func WithFillDeadline

func WithFillDeadline(t time.Time) func(*OpenOpts)

Types

type Call

type Call struct {
	Target common.Address
	Value  *big.Int
	Data   []byte
}

Call is a bindings.SolverNetCall with Selector and Params joined into Data.

func CallFromBinding added in v0.15.0

func CallFromBinding(c bindings.SolverNetCall) Call

func (Call) ToBinding added in v0.14.0

func (c Call) ToBinding() bindings.SolverNetCall

ToBinding converts a Call to a bindings.SolverNetCall. Specifically, it splits the Data field into Selector and Params.

type Deposit

type Deposit = bindings.SolverNetDeposit

type EventMeta

type EventMeta struct {
	Topic   common.Hash
	Status  OrderStatus
	ParseID func(log types.Log) (OrderID, error)
}

EventMeta contains metadata about an event.

func EventByTopic

func EventByTopic(topic common.Hash) (EventMeta, bool)

EventByTopic returns the event metadata for a given topic.

type Expense

func FilterNativeExpenses added in v0.14.0

func FilterNativeExpenses(expenses []Expense) []Expense

FilterNativeExpenses filters out native expenses. Specifying explicit native expenses is not required (not valid), since they are automatically inferred from calls (having non-zero value).

type FillOriginData

type FillOriginData = bindings.SolverNetFillOriginData

type OpenOpts

type OpenOpts struct {
	FillDeadline time.Time
}

func DefaultOpenOpts

func DefaultOpenOpts() *OpenOpts

type OrderID

type OrderID [32]byte

func OpenOrder

func OpenOrder(
	ctx context.Context,
	network netconf.ID,
	chainID uint64,
	backends ethbackend.Backends,
	user common.Address,
	orderData bindings.SolverNetOrderData,
	opts ...func(*OpenOpts),
) (OrderID, error)

OpenOrder opens an order on chainID for user. user pays for the order, and must be in the backend for chainID. It returns the order id.

func ParseClaimed

func ParseClaimed(log types.Log) (OrderID, error)

func ParseClosed

func ParseClosed(log types.Log) (OrderID, error)

func ParseFilled

func ParseFilled(log types.Log) (OrderID, error)

func ParseOpened

func ParseOpened(log types.Log) (OrderID, error)

func ParseRejected

func ParseRejected(log types.Log) (OrderID, error)

func (OrderID) Hex added in v0.14.0

func (id OrderID) Hex() string

Hex returns the full 0xHEX representation of the order ID.

func (OrderID) String

func (id OrderID) String() string

String returns the short hex (7 chars) representation of the order ID.

type OrderStatus

type OrderStatus uint8
const (
	StatusInvalid  OrderStatus = 0
	StatusPending  OrderStatus = 1
	StatusRejected OrderStatus = 2
	StatusClosed   OrderStatus = 3
	StatusFilled   OrderStatus = 4
	StatusClaimed  OrderStatus = 5
)

func (OrderStatus) String

func (s OrderStatus) String() string

func (OrderStatus) Uint8

func (s OrderStatus) Uint8() uint8

func (OrderStatus) ValidTarget added in v0.15.0

func (s OrderStatus) ValidTarget(target OrderStatus) bool

ValidTarget returns true if the target status can be reached from the current status.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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