testutil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package testutil implements utilities for testing the RFQ Quoter. TODO: deduplicate with

Index

Constants

View Source
const (
	// DefaultMintAmount is the default amount of tokens to mint.
	DefaultMintAmount = params.Ether
	// NumberOfTokens is the number of tokens to create.
	NumberOfTokens = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ITestContractHandler

type ITestContractHandler interface {
	// ChainID returns the chain ID of the contract handler.
	ChainID() uint32
	// FastBridgeAddress returns the address of the fast bridge contract.
	FastBridgeAddress() common.Address
	// Tokens returns the list of tokens.
	Tokens() []TokenContract
	// FBExecuteBridge executes the bridge function on the fast bridge contract.
	FBExecuteBridge(ctx context.Context, bridgeParams bindings2.IFastBridgeBridgeParams) (*types.Transaction, error)
	// FBExecuteRelay executes the relay function on the fast bridge contract.
	FBExecuteRelay(ctx context.Context, request []byte) (*types.Transaction, error)
	// FBExecuteProve executes the prove function on the fast bridge contract.
	FBExecuteProve(ctx context.Context, request []byte, destTxHash [32]byte) (*types.Transaction, error)
	// FBExecuteClaim executes the claim function on the fast bridge contract. Will likely be unused.
	FBExecuteClaim(ctx context.Context, request []byte, to common.Address) (*types.Transaction, error)
	// TestWallet returns the test wallet.
	TestWallet() wallet.Wallet
}

ITestContractHandler is the interface for the handling contracts on a given chain.

func NewTestContractHandlerImpl

func NewTestContractHandlerImpl(ctx context.Context, anvilBackend backends.SimulatedTestBackend, testWallet wallet.Wallet, chainID uint32) (ITestContractHandler, error)

NewTestContractHandlerImpl creates a new instance of the ITestContractHandler interface. TODO: just get chainid from rpc, don't require passing.

type TestContractHandlerImpl

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

TestContractHandlerImpl is the implementation of the ITestContractHandler interface.

func (*TestContractHandlerImpl) ChainID

func (t *TestContractHandlerImpl) ChainID() uint32

ChainID returns the chain ID of the contract handler.

func (*TestContractHandlerImpl) FBExecuteBridge

FBExecuteBridge executes the bridge function on the fast bridge contract.

func (*TestContractHandlerImpl) FBExecuteClaim

func (t *TestContractHandlerImpl) FBExecuteClaim(ctx context.Context, request []byte, to common.Address) (*types.Transaction, error)

FBExecuteClaim executes the claim function on the fast bridge contract. Will likely be unused.

func (*TestContractHandlerImpl) FBExecuteProve

func (t *TestContractHandlerImpl) FBExecuteProve(ctx context.Context, request []byte, destTxHash [32]byte) (*types.Transaction, error)

FBExecuteProve executes the prove function on the fast bridge contract.

func (*TestContractHandlerImpl) FBExecuteRelay

func (t *TestContractHandlerImpl) FBExecuteRelay(ctx context.Context, request []byte) (*types.Transaction, error)

FBExecuteRelay executes the relay function on the fast bridge contract.

func (*TestContractHandlerImpl) FastBridgeAddress

func (t *TestContractHandlerImpl) FastBridgeAddress() common.Address

FastBridgeAddress returns the address of the fast bridge contract.

func (*TestContractHandlerImpl) TestWallet

func (t *TestContractHandlerImpl) TestWallet() wallet.Wallet

TestWallet returns the test wallet.

func (*TestContractHandlerImpl) Tokens

func (t *TestContractHandlerImpl) Tokens() []TokenContract

Tokens returns the list of tokens.

type TokenContract

type TokenContract struct {
	Erc20Address  common.Address
	Erc20Contract *bindings2.MockERC20
}

TokenContract is a struct containing the address and contract of a token.

Jump to

Keyboard shortcuts

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