mock

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: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Header = &types.Header{
		ParentHash:  common.HexToHash("0x3a537c89809712367218bb171b3b1c46aa95df3dee7200ae9dc78f4052024068"),
		UncleHash:   common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"),
		Coinbase:    common.HexToAddress("0x0000000000000000000000000000000000000000"),
		Root:        common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"),
		TxHash:      common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"),
		ReceiptHash: common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"),
		Bloom:       types.Bloom{},
		Difficulty:  new(big.Int).SetInt64(2),
		Number:      new(big.Int).SetInt64(1),
		GasLimit:    100000,
		GasUsed:     2000,
		Time:        1234,
		Extra:       []byte{0x7f},
		MixDigest:   common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"),
		Nonce:       types.BlockNonce{0x13},
	}
	EmptyHeader = &types.Header{}
)
View Source
var (
	SuccessMsgHash = [32]byte{0x1}
	SuccessId      = big.NewInt(1)
	FailSignal     = [32]byte{0x2}
)
View Source
var (
	MockChainID              = big.NewInt(167001)
	LatestBlockNumber        = big.NewInt(10)
	NotFoundTxHash           = common.HexToHash("0x123")
	SucceedTxHash            = common.HexToHash("0x456")
	FailTxHash               = common.HexToHash("0x789")
	BlockNum                 = 10
	PendingNonce      uint64 = 10
)
View Source
var ProcessMessageTx = types.NewTransaction(
	PendingNonce,
	common.HexToAddress(dummyAddress),
	big.NewInt(1),
	100,
	big.NewInt(10),
	nil,
)

Functions

This section is empty.

Types

type Blocker

type Blocker struct {
}

func (*Blocker) BlockByHash

func (b *Blocker) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*Blocker) BlockByNumber

func (b *Blocker) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

type Bridge

type Bridge struct {
}

func (*Bridge) FilterMessageReceived

func (b *Bridge) FilterMessageReceived(
	opts *bind.FilterOpts,
	msgHash [][32]byte,
) (*bridge.BridgeMessageReceivedIterator, error)

func (*Bridge) FilterMessageSent

func (b *Bridge) FilterMessageSent(
	opts *bind.FilterOpts,
	signal [][32]byte,
) (*bridge.BridgeMessageSentIterator, error)

func (*Bridge) FilterMessageStatusChanged

func (b *Bridge) FilterMessageStatusChanged(
	opts *bind.FilterOpts,
	signal [][32]byte,
) (*bridge.BridgeMessageStatusChangedIterator, error)

func (*Bridge) GetInvocationDelays

func (b *Bridge) GetInvocationDelays(opts *bind.CallOpts) (struct {
	InvocationDelay      *big.Int
	InvocationExtraDelay *big.Int
}, error)

func (*Bridge) IsMessageSent

func (b *Bridge) IsMessageSent(opts *bind.CallOpts, _message bridge.IBridgeMessage) (bool, error)

func (*Bridge) MessageStatus

func (b *Bridge) MessageStatus(opts *bind.CallOpts, msgHash [32]byte) (uint8, error)

func (*Bridge) ParseMessageSent

func (b *Bridge) ParseMessageSent(log types.Log) (*bridge.BridgeMessageSent, error)

func (*Bridge) ProcessMessage

func (b *Bridge) ProcessMessage(
	opts *bind.TransactOpts,
	_message bridge.IBridgeMessage,
	_proof []byte,
) (*types.Transaction, error)

func (*Bridge) ProofReceipt

func (b *Bridge) ProofReceipt(opts *bind.CallOpts, msgHash [32]byte) (struct {
	ReceivedAt        uint64
	PreferredExecutor common.Address
}, error)

func (*Bridge) ProveMessageReceived

func (b *Bridge) ProveMessageReceived(
	opts *bind.CallOpts,
	_message bridge.IBridgeMessage,
	_proof []byte,
) (bool, error)

func (*Bridge) SuspendMessages

func (b *Bridge) SuspendMessages(
	opts *bind.TransactOpts,
	_msgHashes [][32]byte,
	_toSuspend bool,
) (*types.Transaction, error)

type Caller

type Caller struct {
}

func (*Caller) CallContext

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

type DB

type DB struct {
}

func (*DB) DB

func (db *DB) DB() (*sql.DB, error)

func (*DB) GormDB

func (db *DB) GormDB() *gorm.DB

type EthClient

type EthClient struct {
}

func (*EthClient) BlockByHash

func (c *EthClient) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*EthClient) BlockByNumber

func (c *EthClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

func (*EthClient) BlockNumber

func (c *EthClient) BlockNumber(ctx context.Context) (uint64, error)

func (*EthClient) ChainID

func (c *EthClient) ChainID(ctx context.Context) (*big.Int, error)

func (*EthClient) HeaderByHash

func (c *EthClient) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

func (*EthClient) HeaderByNumber

func (c *EthClient) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

func (*EthClient) PendingNonceAt

func (c *EthClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

func (*EthClient) SuggestGasPrice

func (c *EthClient) SuggestGasPrice(ctx context.Context) (*big.Int, error)

func (*EthClient) SuggestGasTipCap

func (c *EthClient) SuggestGasTipCap(ctx context.Context) (*big.Int, error)

func (*EthClient) TransactionReceipt

func (c *EthClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

type EventRepository

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

func NewEventRepository

func NewEventRepository() *EventRepository

func (*EventRepository) ChainDataSyncedEventByBlockNumberOrGreater

func (r *EventRepository) ChainDataSyncedEventByBlockNumberOrGreater(
	ctx context.Context,
	srcChainId uint64,
	syncedChainId uint64,
	blockNumber uint64,
) (*relayer.Event, error)

func (*EventRepository) Delete

func (r *EventRepository) Delete(
	ctx context.Context,
	id int,
) error

func (*EventRepository) DeleteAllAfterBlockID

func (r *EventRepository) DeleteAllAfterBlockID(blockID uint64, srcChainID uint64, destChainID uint64) error

DeleteAllAfterBlockID is used when a reorg is detected

func (*EventRepository) FindAllByAddress

func (r *EventRepository) FindAllByAddress(
	ctx context.Context,
	req *http.Request,
	opts relayer.FindAllByAddressOpts,
) (paginate.Page, error)

func (*EventRepository) FindLatestBlockID

func (r *EventRepository) FindLatestBlockID(
	event string,
	srcChainID uint64,
	destChainID uint64,
) (uint64, error)

GetLatestBlockID get latest block id

func (*EventRepository) FirstByEventAndMsgHash

func (r *EventRepository) FirstByEventAndMsgHash(
	ctx context.Context,
	event string,
	msgHash string,
) (*relayer.Event, error)

func (*EventRepository) FirstByMsgHash

func (r *EventRepository) FirstByMsgHash(
	ctx context.Context,
	msgHash string,
) (*relayer.Event, error)

func (*EventRepository) LatestChainDataSyncedEvent

func (r *EventRepository) LatestChainDataSyncedEvent(
	ctx context.Context,
	srcChainId uint64,
	syncedChainId uint64,
) (uint64, error)

func (*EventRepository) Save

func (*EventRepository) UpdateStatus

func (r *EventRepository) UpdateStatus(ctx context.Context, id int, status relayer.EventStatus) error

type Queue

type Queue struct {
}

func (*Queue) Ack

func (r *Queue) Ack(ctx context.Context, msg queue.Message) error

func (*Queue) Close

func (r *Queue) Close(ctx context.Context)

func (*Queue) Nack

func (r *Queue) Nack(ctx context.Context, msg queue.Message, requeue bool) error

func (*Queue) Notify

func (r *Queue) Notify(ctx context.Context, wg *sync.WaitGroup) error

func (*Queue) Publish

func (r *Queue) Publish(ctx context.Context, msg []byte) error

func (*Queue) Start

func (r *Queue) Start(ctx context.Context, queueName string) error

func (*Queue) Subscribe

func (r *Queue) Subscribe(ctx context.Context, msgChan chan<- queue.Message, wg *sync.WaitGroup) error

type SignalService

type SignalService struct {
}

func (*SignalService) FilterChainDataSynced

func (s *SignalService) FilterChainDataSynced(
	opts *bind.FilterOpts,
	chainid []uint64,
	blockId []uint64,
	kind [][32]byte,
) (*signalservice.SignalServiceChainDataSyncedIterator, error)

func (*SignalService) GetSignalSlot

func (s *SignalService) GetSignalSlot(
	opts *bind.CallOpts,
	_chainId uint64,
	_app common.Address,
	_signal [32]byte,
) ([32]byte, error)

func (*SignalService) GetSyncedChainData

func (s *SignalService) GetSyncedChainData(
	opts *bind.CallOpts,
	_chainId uint64,
	_kind [32]byte,
	_blockId uint64,
) (struct {
	BlockId   uint64
	ChainData [32]byte
}, error)

type SuspendedTransactionRepository

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

func NewSuspendedTransactionRepository

func NewSuspendedTransactionRepository() *SuspendedTransactionRepository

func (*SuspendedTransactionRepository) Find

func (*SuspendedTransactionRepository) Save

type TokenVault

type TokenVault struct {
}

func (*TokenVault) CanonicalToBridged

func (t *TokenVault) CanonicalToBridged(
	opts *bind.CallOpts,
	chainID *big.Int,
	canonicalAddress common.Address,
) (common.Address, error)

Jump to

Keyboard shortcuts

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