relayer

package
v0.3.1-0...-ee1233d Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 23 Imported by: 0

README

Golang Relayer

Relayer

A relayer for the Bridge to watch and sync event between Layer 1 and Taiko Layer 2.

Build the Source

To build the source, ensure you have an updated Go compiler installed. Run the following command to compile the executable:

go build -o relayer ./cmd/

Configuration

Configure MySQL and RabbitMQ

Before configuring environment variables, ensure that you have MySQL and RabbitMQ instances running. Replace the MYSQL_ environment variables with your specific configurations.

RabbitMQ can be installed using the provided script:

./scripts/install-rabbitmq.sh

Alternatively, use Docker Compose to set up MySQL and RabbitMQ in your local environment:

cd ./docker-compose
docker-compose up

To migrate the database schema in MySQL:

cd ./migrations
goose mysql "root:passw00d@tcp(localhost:3306)/relayer" status
goose mysql "root:passw00d@tcp(localhost:3306)/relayer" up
Configure Environment Variables

Environment variables are crucial for the configuration of the Relayer’s processor and indexer. These variables are set in environment files, which are then loaded by the Relayer at runtime.

Setting up the Processor:
  1. Create the Environment File for the Processor: Copy the example processor environment file to a new file:

    cp .l1processor.example.env .l1processor.env
    

    Modify .l1processor.env as necessary to suit your environment settings.

  2. Run the Processor: Before running the processor, specify which environment file it should use by setting the RELAYER_ENV_FILE environment variable:

    export RELAYER_ENV_FILE=./.l1processor.env
    

    Now, you can run the processor:

    ./relayer processor
    
Setting up the Indexer:
  1. Create the Environment File for the Indexer: Copy the example indexer environment file to a new file:

    cp .l1indexer.example.env .l1indexer.env
    

    Edit .l1indexer.env to reflect your specific configurations.

  2. Run the Indexer: Set the RELAYER_ENV_FILE to point to the indexer's environment file:

    export RELAYER_ENV_FILE=./.l1indexer.env
    

    Execute the indexer:

    ./relayer indexer
    

Usage

To review all available sub-commands, use:

./relayer --help

To review each sub-command's command line flags, use:

./relayer <sub-command> --help

Project structure

Path Description
bindings/ Go contract bindings for Taiko smart contracts, and few related utility functions
cmd/ Main executable for this project
db/ Database interfaces and connection methods.
encoding/ Encoding helper utility functions for interacting with smart contract functions
indexer/ Indexer sub-command
metrics/ Metrics related
migrations/ Database migrations
mock/ Mocks for testing
proof/ Merkle proof generation service
queue/ Queue related interfaces and types, with implementations in subfolders
repo/ Database repository interaction layer

API Doc

/events?.

Filter params:

Mandatory:
address: user's ethereum address who sent the message.

Optional: chainID: chain ID of the source chain. Default: all chains. Options: any integer. msgHash: filter events by message hash. Default: all msgHashs. Options: any hash. eventType: filter events by event type. Default: all eventType. Options: Enum value, 0 for sendETH, 1 for sendERC20. event: filter events by event name. Default: all event names. Options: MessageSent, MessageStatusChanged

Pagination: page: page number to retrieve. Default: 0. size: size to retrieve per page. Default: 100

Example: http://localhost:4101/events?page=3&address=0x79B9F64744C98Cd8cc20ADb79B6a297E964254cc&size=1&msgHash=0x47ce4d255907937aba12dfa09d87a0a707fea7eeac687924ac0a80fa291c3289&eventType=1:

{"items":[{"id":4,"name":"MessageSent","data":{"Raw":{"data":"0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000007777000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000028c590000000000000000000000000000000000000000000000000000000000007a6800000000000000000000000079b9f64744c98cd8cc20adb79b6a297e964254cc0000000000000000000000005e506e2e0ead3ff9d93859a5879caa02582f77c300000000000000000000000079b9f64744c98cd8cc20adb79b6a297e964254cc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002625a000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000038000000000000000000000000000000000000000000000000000000000000001a40c6fab82000000000000000000000000000000000000000000000000000000000000008000000000000000000000000079b9f64744c98cd8cc20adb79b6a297e964254cc00000000000000000000000079b9f64744c98cd8cc20adb79b6a297e964254cc00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000028c590000000000000000000000000000777700000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000035052450000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e5072656465706c6f79455243323000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001243726f6e4a6f622053656e64546f6b656e730000000000000000000000000000","topics":["0x47866f7dacd4a276245be6ed543cae03c9c17eb17e6980cee28e3dd168b7f9f3","0x47ce4d255907937aba12dfa09d87a0a707fea7eeac687924ac0a80fa291c3289"],"address":"0x0000777700000000000000000000000000000004","removed":false,"logIndex":"0x4","blockHash":"0xee6437aee05f0d2f8680462c82269ce971df1040134b145d664609d9a06cc864","blockNumber":"0x5","transactionHash":"0xc79e67b30255bfee2bdf2f149aadf426613e8e0ab38aa79d8a2d186d096ec4a9","transactionIndex":"0x2"},"Message":{"Id":1,"To":"0x5e506e2e0ead3ff9d93859a5879caa02582f77c3","Data":"DG+rggAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAAebn2R0TJjNjMIK23m2opfpZCVMwAAAAAAAAAAAAAAAB5ufZHRMmM2Mwgrbebail+lkJUzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACjFkAAAAAAAAAAAAAAAAAAHd3AAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADUFJFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADlByZWRlcGxveUVSQzIwAAAAAAAAAAAAAAAAAAAAAAAA","Memo":"CronJob SendTokens","Owner":"0x79b9f64744c98cd8cc20adb79b6a297e964254cc","Sender":"0x0000777700000000000000000000000000000002","GasLimit":2500000,"CallValue":0,"SrcChainId":167001,"DestChainId":31336,"DepositValue":0,"ProcessingFee":0,"RefundAddress":"0x79b9f64744c98cd8cc20adb79b6a297e964254cc"},"MsgHash":[71,206,77,37,89,7,147,122,186,18,223,160,157,135,160,167,7,254,167,238,172,104,121,36,172,10,128,250,41,28,50,137]},"status":1,"eventType":1,"chainID":167001,"canonicalTokenAddress":"0x0000777700000000000000000000000000000005","canonicalTokenSymbol":"PRE","canonicalTokenName":"PredeployERC20","canonicalTokenDecimals":18,"amount":"1","msgHash":"0x47ce4d255907937aba12dfa09d87a0a707fea7eeac687924ac0a80fa291c3289","messageOwner":"0x79B9F64744C98Cd8cc20ADb79B6a297E964254cc"}],"page":3,"size":1,"max_page":3352,"total_pages":3353,"total":3353,"last":false,"first":false,"visible":1}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoEthClient       = errors.Validation.NewWithKeyAndDetail("ERR_NO_ETH_CLIENT", "EthClient is required")
	ErrNoECDSAKey        = errors.Validation.NewWithKeyAndDetail("ERR_NO_ECDSA_KEY", "ECDSAKey is required")
	ErrNoBridgeAddress   = errors.Validation.NewWithKeyAndDetail("ERR_NO_BRIDGE_ADDRESS", "BridgeAddress is required")
	ErrNoEventRepository = errors.Validation.NewWithKeyAndDetail("ERR_NO_EVENT_REPOSITORY", "EventRepository is required")
	ErrNoBlockRepository = errors.Validation.NewWithKeyAndDetail(
		"ERR_NO_BLOCK_REPOSITORY",
		"BlockRepository is required",
	)
	ErrNoCORSOrigins = errors.Validation.NewWithKeyAndDetail("ERR_NO_CORS_ORIGINS", "CORS Origins are required")
	ErrNoProver      = errors.Validation.NewWithKeyAndDetail("ERR_NO_PROVER", "Prover is required")
	ErrNoRPCClient   = errors.Validation.NewWithKeyAndDetail("ERR_NO_RPC_CLIENT", "RPCClient is required")
	ErrNoBridge      = errors.Validation.NewWithKeyAndDetail("ERR_NO_BRIDGE", "Bridge is required")
	ErrNoTaikoL2     = errors.Validation.NewWithKeyAndDetail("ERR_NO_TAIKO_L2", "TaikoL2 is required")

	ErrInvalidConfirmations = errors.Validation.NewWithKeyAndDetail(
		"ERR_INVALID_CONFIRMATIONS",
		"Confirmations amount is invalid, must be numerical and > 0",
	)
	ErrInvalidConfirmationsTimeoutInSeconds = errors.Validation.NewWithKeyAndDetail(
		"ERR_INVALID_CONFIRMATIONS_TIMEOUT_IN_SECONDS",
		"ConfirmationsTimeoutInSeconds amount is invalid, must be numerical and > 0",
	)
	ErrInvalidMode  = errors.Validation.NewWithKeyAndDetail("ERR_INVALID_MODE", "Mode not supported")
	ErrUnprofitable = errors.Validation.NewWithKeyAndDetail("ERR_UNPROFITABLE", "Transaction is unprofitable to process")
	ErrNotReceived  = errors.BadRequest.NewWithKeyAndDetail(
		"ERR_NOT_RECEIVED",
		"Message not received on destination chain",
	)
)
View Source
var (
	EventNameMessageSent          = "MessageSent"
	EventNameMessageStatusChanged = "MessageStatusChanged"
	EventNameMessageReceived      = "MessageReceived"
	EventNameChainDataSynced      = "ChainDataSynced"
)
View Source
var (
	QueueMessageAcknowledged = promauto.NewCounter(prometheus.CounterOpts{
		Name: "queue_message_acknowledged_ops_total",
		Help: "The total number of acknowledged queue events",
	})
	QueueMessageNegativelyAcknowledged = promauto.NewCounter(prometheus.CounterOpts{
		Name: "queue_message_negatively_acknowledged_ops_total",
		Help: "The total number of negatively acknowledged queue events",
	})
	QueueChannelNotifyClosed = promauto.NewCounter(prometheus.CounterOpts{
		Name: "queue_channel_notify_closed_ops_total",
		Help: "The total number of times a queue channel was notified as closed",
	})
	QueueConnectionNotifyClosed = promauto.NewCounter(prometheus.CounterOpts{
		Name: "queue_connection_notify_closed_ops_total",
		Help: "The total number of times a queue connection was notified as closed",
	})
	QueueMessagePublished = promauto.NewCounter(prometheus.CounterOpts{
		Name: "queue_message_published_ops_total",
		Help: "The total number of times a queue message was published",
	})
	QueueMessagePublishedErrors = promauto.NewCounter(prometheus.CounterOpts{
		Name: "queue_message_published_errors_ops_total",
		Help: "The total number of times a queue message was published with an error",
	})
	QueueConnectionInstantiated = promauto.NewCounter(prometheus.CounterOpts{
		Name: "queue_connection_instantiated_ops_total",
		Help: "The total number of times a queue connection was instantiated",
	})
	QueueConnectionInstantiatedErrors = promauto.NewCounter(prometheus.CounterOpts{
		Name: "queue_connection_instantiated_errors_ops_total",
		Help: "The total number of times a queue connection was instantiated with an error",
	})
	ChainDataSyncedEventsIndexed = promauto.NewCounter(prometheus.CounterOpts{
		Name: "chain_data_synced_events_indexed_ops_total",
		Help: "The total number of ChainDataSynced indexed events",
	})
	MessageSentEventsProcessed = promauto.NewCounter(prometheus.CounterOpts{
		Name: "message_sent_events_processed_ops_total",
		Help: "The total number of MessageSent processed events",
	})
	MessageSentEventsIndexed = promauto.NewCounter(prometheus.CounterOpts{
		Name: "message_sent_events_indexed_ops_total",
		Help: "The total number of MessageSent indexed events",
	})
	MessageSentEventsIndexingErrors = promauto.NewCounter(prometheus.CounterOpts{
		Name: "message_sent_events_indexing_errors_ops_total",
		Help: "The total number of errors indexing MessageSent events",
	})
	MessageSentEventsRetries = promauto.NewCounter(prometheus.CounterOpts{
		Name: "message_sent_events_retries_ops_total",
		Help: "The total number of MessageSent events retries",
	})
	MessageSentEventsMaxRetriesReached = promauto.NewCounter(prometheus.CounterOpts{
		Name: "message_sent_events_max_retries_reached_ops_total",
		Help: "The total number of MessageSent events that reached max retries",
	})
	MessageReceivedEventsIndexingErrors = promauto.NewCounter(prometheus.CounterOpts{
		Name: "message_received_events_indexing_errors_ops_total",
		Help: "The total number of errors indexing MessageReceived events",
	})
	MessageStatusChangedEventsIndexed = promauto.NewCounter(prometheus.CounterOpts{
		Name: "message_status_changed_events_indexed_ops_total",
		Help: "The total number of MessageStatusChanged indexed events",
	})
	MessageStatusChangedEventsIndexingErrors = promauto.NewCounter(prometheus.CounterOpts{
		Name: "message_status_changed_events_indexing_errors_ops_total",
		Help: "The total number of errors indexing MessageStatusChanged events",
	})
	ChainDataSyncedEventsIndexingErrors = promauto.NewCounter(prometheus.CounterOpts{
		Name: "chain_data_synced_events_indexing_errors_ops_total",
		Help: "The total number of errors indexing ChainDataSynced events",
	})
	BlocksProcessed = promauto.NewCounter(prometheus.CounterOpts{
		Name: "blocks_processed_ops_total",
		Help: "The total number of processed blocks",
	})
	TransactionsSuspended = promauto.NewCounter(prometheus.CounterOpts{
		Name: "transactions_suspended_ops_total",
		Help: "The total number of suspended transactions",
	})
	BlocksScanned = promauto.NewCounter(prometheus.CounterOpts{
		Name: "blocks_scanned_ops_total",
		Help: "The total number of scanned blocks. Acts as heartbeat metric.",
	})
	BlocksScannedError = promauto.NewCounter(prometheus.CounterOpts{
		Name: "blocks_scanned_error_ops_total",
		Help: "The total number of scanned block errors.",
	})
	RetriableEvents = promauto.NewCounter(prometheus.CounterOpts{
		Name: "events_processed_retriable_status_ops_total",
		Help: "The total number of processed events that ended up in Retriable status",
	})
	DoneEvents = promauto.NewCounter(prometheus.CounterOpts{
		Name: "events_processed_done_status_ops_total",
		Help: "The total number of processed events that ended up in Done status",
	})
	ErrorEvents = promauto.NewCounter(prometheus.CounterOpts{
		Name: "events_processed_error_ops_total",
		Help: "The total number of processed events that failed due to an error",
	})
	MessagesNotReceivedOnDestChain = promauto.NewCounter(prometheus.CounterOpts{
		Name: "messages_not_received_on_dest_chain_opts_total",
		Help: "The total number of messages that were not received on the destination chain",
	})
	ErrorsEncounteredDuringSubscription = promauto.NewCounter(prometheus.CounterOpts{
		Name: "errors_encountered_during_subscription_opts_total",
		Help: "The total number of errors that occurred during active subscription",
	})
)
View Source
var (
	ZeroHash    = common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000")
	ZeroAddress = common.HexToAddress("0x0000000000000000000000000000000000000000")
)
View Source
var (
	ErrNoDB = errors.Validation.NewWithKeyAndDetail("ERR_NO_DB", "DB is required")
)

Functions

func DecodeMessageData

func DecodeMessageData(eventData []byte, value *big.Int) (EventType, CanonicalToken, *big.Int, error)

DecodeMessageData tries to tell if it's an ETH, ERC20, ERC721, or ERC1155 bridge, which lets the processor look up whether the contract has already been deployed or not, to help better estimate gas needed for processing the message.

func DecodeRevertReason

func DecodeRevertReason(hexStr string) (string, error)

DecodeRevertReason decodes a hex-encoded revert reason from an Ethereum transaction.

func IsInSlice

func IsInSlice[T comparable](v T, s []T) bool

IsInSlice determines whether v is in slice s

func WaitConfirmations

func WaitConfirmations(ctx context.Context, confirmer confirmer, confirmations uint64, txHash common.Hash) error

WaitConfirmations won't return before N blocks confirmations have been seen on destination chain, or context is cancelled.

func WaitReceipt

func WaitReceipt(ctx context.Context, confirmer confirmer, txHash common.Hash) (*types.Receipt, error)

WaitReceipt keeps waiting until the given transaction has an execution receipt to know whether it was reverted or not.

Types

type Bridge

type Bridge interface {
	IsMessageSent(opts *bind.CallOpts, _message bridge.IBridgeMessage) (bool, error)
	FilterMessageSent(opts *bind.FilterOpts, msgHash [][32]byte) (*bridge.BridgeMessageSentIterator, error)
	FilterMessageReceived(opts *bind.FilterOpts, msgHash [][32]byte) (*bridge.BridgeMessageReceivedIterator, error)
	MessageStatus(opts *bind.CallOpts, msgHash [32]byte) (uint8, error)
	ProcessMessage(opts *bind.TransactOpts, _message bridge.IBridgeMessage, _proof []byte) (*types.Transaction, error)
	ProveMessageReceived(opts *bind.CallOpts, _message bridge.IBridgeMessage, _proof []byte) (bool, error)
	FilterMessageStatusChanged(
		opts *bind.FilterOpts,
		msgHash [][32]byte,
	) (*bridge.BridgeMessageStatusChangedIterator, error)
	ParseMessageSent(log types.Log) (*bridge.BridgeMessageSent, error)
	ProofReceipt(opts *bind.CallOpts, msgHash [32]byte) (struct {
		ReceivedAt        uint64
		PreferredExecutor common.Address
	}, error)
	GetInvocationDelays(opts *bind.CallOpts) (struct {
		InvocationDelay      *big.Int
		InvocationExtraDelay *big.Int
	}, error)
	SuspendMessages(opts *bind.TransactOpts, _msgHashes [][32]byte, _toSuspend bool) (*types.Transaction, error)
}

type Caller

type Caller interface {
	CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
}

type CanonicalERC20

type CanonicalERC20 struct {
	// nolint
	ChainId  uint64         `json:"chainId"`
	Addr     common.Address `json:"addr"`
	Decimals uint8          `json:"decimals"`
	Symbol   string         `json:"symbol"`
	Name     string         `json:"name"`
}

func (CanonicalERC20) Address

func (c CanonicalERC20) Address() common.Address

func (CanonicalERC20) ChainID

func (c CanonicalERC20) ChainID() uint64

func (CanonicalERC20) ContractName

func (c CanonicalERC20) ContractName() string

func (CanonicalERC20) ContractSymbol

func (c CanonicalERC20) ContractSymbol() string

func (CanonicalERC20) TokenDecimals

func (c CanonicalERC20) TokenDecimals() uint8

type CanonicalNFT

type CanonicalNFT struct {
	// nolint
	ChainId uint64         `json:"chainId"`
	Addr    common.Address `json:"addr"`
	Symbol  string         `json:"symbol"`
	Name    string         `json:"name"`
}

func (CanonicalNFT) Address

func (c CanonicalNFT) Address() common.Address

func (CanonicalNFT) ChainID

func (c CanonicalNFT) ChainID() uint64

func (CanonicalNFT) ContractName

func (c CanonicalNFT) ContractName() string

func (CanonicalNFT) ContractSymbol

func (c CanonicalNFT) ContractSymbol() string

func (CanonicalNFT) TokenDecimals

func (c CanonicalNFT) TokenDecimals() uint8

type CanonicalToken

type CanonicalToken interface {
	ChainID() uint64
	Address() common.Address
	ContractName() string
	TokenDecimals() uint8
	ContractSymbol() string
}

type DB

type DB interface {
	DB() (*sql.DB, error)
	GormDB() *gorm.DB
}

type DBConnectionOpts

type DBConnectionOpts struct {
	Name            string
	Password        string
	Host            string
	Database        string
	MaxIdleConns    uint64
	MaxOpenConns    uint64
	MaxConnLifetime uint64
	OpenFunc        func(dsn string) (DB, error)
}

type Event

type Event struct {
	ID                     int            `json:"id"`
	Name                   string         `json:"name"`
	Data                   datatypes.JSON `json:"data"`
	Status                 EventStatus    `json:"status"`
	EventType              EventType      `json:"eventType"`
	ChainID                int64          `json:"chainID"`
	DestChainID            int64          `json:"destChainID"`
	SyncedChainID          uint64         `json:"syncedChainID"`
	EmittedBlockID         uint64         `json:"emittedBlockID"`
	BlockID                uint64         `json:"blockID"`
	SyncedInBlockID        uint64         `json:"syncedInBlockID"`
	SyncData               string         `json:"syncData"`
	Kind                   string         `json:"kind"`
	CanonicalTokenAddress  string         `json:"canonicalTokenAddress"`
	CanonicalTokenSymbol   string         `json:"canonicalTokenSymbol"`
	CanonicalTokenName     string         `json:"canonicalTokenName"`
	CanonicalTokenDecimals uint8          `json:"canonicalTokenDecimals"`
	Amount                 string         `json:"amount"`
	MsgHash                string         `json:"msgHash"`
	MessageOwner           string         `json:"messageOwner"`
	Event                  string         `json:"event"`
}

Event represents a stored EVM event. The fields will be serialized into the Data field to be unmarshalled into a concrete struct dependant on the name of the event

type EventRepository

type EventRepository interface {
	Save(ctx context.Context, opts SaveEventOpts) (*Event, error)
	UpdateStatus(ctx context.Context, id int, status EventStatus) error
	FindAllByAddress(
		ctx context.Context,
		req *http.Request,
		opts FindAllByAddressOpts,
	) (paginate.Page, error)
	FirstByMsgHash(
		ctx context.Context,
		msgHash string,
	) (*Event, error)
	FirstByEventAndMsgHash(
		ctx context.Context,
		event string,
		msgHash string,
	) (*Event, error)
	Delete(ctx context.Context, id int) error
	ChainDataSyncedEventByBlockNumberOrGreater(
		ctx context.Context,
		srcChainId uint64,
		syncedChainId uint64,
		blockNumber uint64,
	) (*Event, error)
	LatestChainDataSyncedEvent(
		ctx context.Context,
		srcChainId uint64,
		syncedChainId uint64,
	) (uint64, error)
	DeleteAllAfterBlockID(blockID uint64, srcChainID uint64, destChainID uint64) error
	FindLatestBlockID(
		event string,
		srcChainID uint64,
		destChainID uint64,
	) (uint64, error)
}

EventRepository is used to interact with events in the store

type EventStatus

type EventStatus int

EventStatus is used to indicate whether processing has been attempted for this particular event, and it's success

const (
	EventStatusNew EventStatus = iota
	EventStatusRetriable
	EventStatusDone
	EventStatusFailed
	EventStatusRecalled
)

func (EventStatus) String

func (e EventStatus) String() string

String returns string representation of an event status for logging

type EventType

type EventType int
const (
	EventTypeSendETH EventType = iota
	EventTypeSendERC20
	EventTypeSendERC721
	EventTypeSendERC1155
)

func (EventType) String

func (e EventType) String() string

type FindAllByAddressOpts

type FindAllByAddressOpts struct {
	Address   common.Address
	EventType *EventType
	Event     *string
	MsgHash   *string
	ChainID   *big.Int
}

type SaveEventOpts

type SaveEventOpts struct {
	Name                   string
	Data                   string
	ChainID                *big.Int
	DestChainID            *big.Int
	Status                 EventStatus
	EventType              EventType
	CanonicalTokenAddress  string
	CanonicalTokenSymbol   string
	CanonicalTokenName     string
	CanonicalTokenDecimals uint8
	Amount                 string
	MsgHash                string
	MessageOwner           string
	Event                  string
	SyncedChainID          uint64
	BlockID                uint64
	EmittedBlockID         uint64
	SyncData               string
	Kind                   string
	SyncedInBlockID        uint64
}

SaveEventOpts

type SignalService

type SignalService interface {
	GetSignalSlot(opts *bind.CallOpts, _chainId uint64, _app common.Address, _signal [32]byte) ([32]byte, error)
	FilterChainDataSynced(
		opts *bind.FilterOpts,
		chainid []uint64,
		blockId []uint64,
		kind [][32]byte,
	) (*signalservice.SignalServiceChainDataSyncedIterator, error)
	GetSyncedChainData(opts *bind.CallOpts, _chainId uint64, _kind [32]byte, _blockId uint64) (struct {
		BlockId   uint64
		ChainData [32]byte
	}, error)
}

type SuspendTransactionOpts

type SuspendTransactionOpts struct {
	MessageID    int
	SrcChainID   int
	DestChainID  int
	Suspended    bool
	MsgHash      string
	MessageOwner string
}

type SuspendedTransaction

type SuspendedTransaction struct {
	ID           int    `json:"id"`
	MessageID    int    `json:"messageID"`
	SrcChainID   int    `json:"srcChainID"`
	DestChainID  int    `json:"destChainID"`
	Suspended    bool   `json:"suspended"`
	MsgHash      string `json:"msgHash"`
	MessageOwner string `json:"messageOwner"`
}

type SuspendedTransactionRepository

type SuspendedTransactionRepository interface {
	Save(ctx context.Context, opts SuspendTransactionOpts) (*SuspendedTransaction, error)
	Find(
		ctx context.Context,
		req *http.Request,
	) (paginate.Page, error)
}

type TokenVault

type TokenVault interface {
	CanonicalToBridged(
		opts *bind.CallOpts,
		chainID *big.Int,
		canonicalAddress common.Address,
	) (common.Address, error)
}

Directories

Path Synopsis
bindings
cmd
Package docs Code generated by swaggo/swag.
Package docs Code generated by swaggo/swag.
pkg
db

Jump to

Keyboard shortcuts

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