sol

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2025 License: LGPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

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

func New

func New() *Chain

func (*Chain) Conn

func (c *Chain) Conn() core.Connection

Conn return Connection interface for relayer register

func (*Chain) Id

func (c *Chain) Id() msg.ChainId

func (*Chain) Name

func (c *Chain) Name() string

func (*Chain) New

func (c *Chain) New(chainCfg *core.ChainConfig, logger log15.Logger, sysErr chan<- error, role mapprotocol.Role) (core.Chain, error)

func (*Chain) SetRouter

func (c *Chain) SetRouter(r core.Router)

func (*Chain) Start

func (c *Chain) Start() error

func (*Chain) Stop

func (c *Chain) Stop()

Stop signals to any running routines to exit

type Config

type Config struct {
	chain.Config
	Pri         string
	MessageIn   string
	LightNode   string
	McsContract []string
	SolEvent    []string
	ButterHost  string
}

type Connection

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

func NewConnection

func NewConnection(endpoint string, log log15.Logger) *Connection

func (*Connection) CallOpts

func (c *Connection) CallOpts() *bind.CallOpts

func (*Connection) Client

func (c *Connection) Client() *ethclient.Client

func (*Connection) Close

func (c *Connection) Close()

func (*Connection) Connect

func (c *Connection) Connect() error

Connect starts the ethereum WS connection

func (*Connection) EnsureHasBytecode

func (c *Connection) EnsureHasBytecode(addr ethcommon.Address) error

EnsureHasBytecode asserts if contract code exists at the specified address

func (*Connection) Keypair

func (c *Connection) Keypair() *keystore.Key

func (*Connection) LatestBlock

func (c *Connection) LatestBlock() (*big.Int, error)

LatestBlock returns the latest block from the current chain

func (*Connection) LockAndUpdateOpts

func (c *Connection) LockAndUpdateOpts(needNewNonce bool) error

func (*Connection) Opts

func (c *Connection) Opts() *bind.TransactOpts

func (*Connection) UnlockOpts

func (c *Connection) UnlockOpts()

func (*Connection) WaitForBlock

func (c *Connection) WaitForBlock(targetBlock *big.Int, delay *big.Int) error

type GenerateRequest

type GenerateRequest struct {
	LogAddr      string   `json:"logAddr"`
	LogTopics    []string `json:"logTopics"`
	LogData      string   `json:"logData"`
	Signatures   []string `json:"signatures"`
	OraclePacked string   `json:"oraclePacked"`
	Relayer      string   `json:"relayer"`
}

type Handler

type Handler func(*sync) (int64, error)

type Log

type Log struct {
	Id          int64  `json:"id"`
	BlockNumber int64  `json:"blockNumber"`
	Addr        string `json:"addr"`
	Topic       string `json:"topic"`
	Data        string `json:"data"`
	TxHash      string `json:"txHash"`
}

type LogData

type LogData struct {
	OrderId     string `json:"orderId"`
	Relay       int    `json:"relay"`
	MessageType int    `json:"messageType"`
	FromChain   string `json:"fromChain"`
	ToChain     string `json:"toChain"`
	Mos         string `json:"mos"`
	Token       string `json:"token"`
	Initiator   string `json:"initiator"`
	From        string `json:"from"`
	To          string `json:"to"`
	Amount      string `json:"amount"`
	GasLimit    string `json:"gasLimit"`
	SwapData    string `json:"swapData"`
}

type MessageData

type MessageData struct {
	Version      *big.Int
	MessageType  *big.Int
	TokenLen     *big.Int
	MosLen       *big.Int
	FromLen      *big.Int
	ToLen        *big.Int
	PayloadLen   *big.Int
	TokenAmount  *big.Int
	TokenAddress []byte
	Mos          []byte
	From         []byte
	To           []byte
	Payload      []byte
}

func DecodeRelayData

func DecodeRelayData(data string) (*MessageData, error)

type Pubkey

type Pubkey [32]byte

type Resp

type Resp struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    struct {
		Tx       []string `json:"tx"`
		SwapData struct {
			ToToken        string `json:"to_token"`
			ToAddress      string `json:"to_address"`
			MinAmountOutBN string `json:"minAmountOutBN"`
		} `json:"swap_data"`
	} `json:"data"`
}

type RouteOrder

type RouteOrder struct {
	OrderID     [32]byte
	Payer       Pubkey
	User        Pubkey
	FromChainID uint64
	ToChainID   uint64
	FromToken   Pubkey
	TokenAmount uint128 // uint128 is implemented as a custom struct
	AmountOut   uint64
	SwapData    []byte
}

func DecodeRouteOrder

func DecodeRouteOrder(data []byte) (*RouteOrder, error)

func (*RouteOrder) Encode

func (ro *RouteOrder) Encode() ([]byte, error)

type SwapData

type SwapData struct {
	ToToken      []byte   `json:"toToken"`
	Receiver     []byte   `json:"receiver"`
	Initiator    []byte   `json:"initiator"`
	MinAmountOut *big.Int `json:"minAmountOut"`
	Relay        bool     `json:"relay"`
	MessageType  *big.Int `json:"messageType"`
}

type Writer

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

func (*Writer) ResolveMessage

func (w *Writer) ResolveMessage(m msg.Message) bool

Jump to

Keyboard shortcuts

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