relayer

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 36 Imported by: 2

Documentation

Overview

Package relayer is the CCTPRelayer responsible for relaying messages related cross-chain USDC transfers.

Index

Constants

View Source
const MessageHash = "message_hash"

MessageHash is the hash of the message used for metrics tracking.

Variables

This section is empty.

Functions

func AddressToBytes32 added in v0.2.0

func AddressToBytes32(addr common.Address) [32]byte

AddressToBytes32 converts an Ethereum address to a bytes32 value.

func Bytes32ToAddress added in v0.2.0

func Bytes32ToAddress(bytes32 [32]byte) common.Address

Bytes32ToAddress converts a bytes32 value to an Ethereum address.

func ChainIDToCircleDomain added in v0.2.0

func ChainIDToCircleDomain(chainID uint32, isTestnet bool) (domain uint32, err error)

ChainIDToCircleDomain converts a chain ID to a Circle domain.

func CircleDomainToChainID added in v0.2.0

func CircleDomainToChainID(domain uint32, isTestnet bool) (chainID uint32, err error)

CircleDomainToChainID converts a Circle domain to a chain ID.

func GetCircleRequestID added in v0.2.0

func GetCircleRequestID(sourceDomain uint32, nonce uint64) string

GetCircleRequestID returns a request ID from a source domain and nonce.

func GetMessageTransmitterAddress added in v0.2.0

func GetMessageTransmitterAddress(ctx context.Context, tokenMessengerAddr common.Address, ethClient client.EVM) (transmitterAddr common.Address, err error)

GetMessageTransmitterAddress gets the message transmitter address from a token messenger contract.

func IsTestnetChainID added in v0.2.0

func IsTestnetChainID(chainID uint32) bool

IsTestnetChainID returns true if the chain ID is a testnet chain ID.

func ParseDestDomain added in v0.2.0

func ParseDestDomain(message []byte) (uint32, error)

ParseDestDomain parses the destination domain from a CCTP message.

Types

type CCTPHandler added in v0.2.0

type CCTPHandler interface {
	HandleLog(ctx context.Context, log *types.Log, chainID uint32) (processQueue bool, err error)
	FetchAndProcessSentEvent(ctx context.Context, txHash common.Hash, chainID uint32) (*relayTypes.Message, error)
	SubmitReceiveMessage(ctx context.Context, msg *relayTypes.Message) error
}

CCTPHandler is an interface for interacting with CCTP contracts.

func NewCircleCCTPHandler added in v0.2.0

func NewCircleCCTPHandler(ctx context.Context, cfg config.Config, db db2.CCTPRelayerDB, omniRPCClient omniClient.RPCClient, txSubmitter submitter.TransactionSubmitter, handler metrics.Handler) (CCTPHandler, error)

NewCircleCCTPHandler creates a new CircleCCTPHandler.

func NewSynapseCCTPHandler added in v0.2.0

func NewSynapseCCTPHandler(ctx context.Context, cfg config.Config, db db2.CCTPRelayerDB, omniRPCClient omniClient.RPCClient, txSubmitter submitter.TransactionSubmitter, handler metrics.Handler) (CCTPHandler, error)

NewSynapseCCTPHandler creates a new SynapseCCTPHandler.

type CCTPRelayer

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

CCTPRelayer listens for USDC burn events on origin chains, fetches attestations from Circle's API, and posts the necessary data on the destination chain to complete the USDC bridging process.

func NewCCTPRelayer

func NewCCTPRelayer(ctx context.Context, cfg config.Config, store db2.CCTPRelayerDB, scribeClient client.ScribeClient, omniRPCClient omniClient.RPCClient, handler metrics.Handler, attestationAPI attestation.CCTPAPI, rawOpts ...OptionsArgsOption) (*CCTPRelayer, error)

NewCCTPRelayer creates a new CCTPRelayer. nolint: cyclop

func (*CCTPRelayer) Run

func (c *CCTPRelayer) Run(parentCtx context.Context) error

Run starts the CCTPRelayer.

func (*CCTPRelayer) Stop

func (c *CCTPRelayer) Stop(chainID uint32)

Stop stops the CCTPRelayer.

type OptionsArgsOption added in v0.6.0

type OptionsArgsOption func(options *relayerOptions)

OptionsArgsOption is an option passed into the relayer.

func WithSubmitter added in v0.6.0

func WithSubmitter(txSubmitter submitter.TransactionSubmitter) OptionsArgsOption

WithSubmitter sets the submitter for the relayer.

Jump to

Keyboard shortcuts

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