Documentation ¶
Overview ¶
Package testutil provides utilities for testing the RFQ relayer. TODO: deduplicate w/ rfq/quoting-api/testutil & combine these into one package
Package testutil implements utilities for testing the RFQ Quoter. TODO: deduplicate with
Index ¶
- Constants
- func GenerateTestLog() *types.Log
- func NewAnvilBackend(ctx context.Context, t *testing.T, chainID uint32) backends.SimulatedTestBackend
- func NewEVMClientFromAnvil(ctx context.Context, backend backends.SimulatedTestBackend, ...) (client.EVM, error)
- type ITestContractHandler
- type TestContractHandlerImpl
- func (t *TestContractHandlerImpl) ChainID() uint32
- func (t *TestContractHandlerImpl) FBExecuteBridge(ctx context.Context, bridgeParams bindings.IFastBridgeBridgeParams) (*types.Transaction, error)
- func (t *TestContractHandlerImpl) FBExecuteClaim(ctx context.Context, request []byte, to common.Address) (*types.Transaction, error)
- func (t *TestContractHandlerImpl) FBExecuteProve(ctx context.Context, request []byte, destTxHash [32]byte) (*types.Transaction, error)
- func (t *TestContractHandlerImpl) FBExecuteRelay(ctx context.Context, request []byte) (*types.Transaction, error)
- func (t *TestContractHandlerImpl) FastBridgeAddress() common.Address
- func (t *TestContractHandlerImpl) Tokens() []TokenContract
- type TokenContract
Constants ¶
const ( // AnvilMaxRetries is the maximum number of times to retry creating an Anvil backend. AnvilMaxRetries = 3 // AnvilMaxTimeToWait is the maximum time to wait for an Anvil backend to be created. AnvilMaxTimeToWait = 3 )
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 ¶
func NewAnvilBackend ¶
func NewAnvilBackend(ctx context.Context, t *testing.T, chainID uint32) backends.SimulatedTestBackend
NewAnvilBackend creates a new instance of the Anvil backend with a given chain. Because NewAnvilBackend sometimes fails or times out, it will retry a few times if it does not return within 5 seconds.
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 bindings.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) }
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.
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 ¶
func (t *TestContractHandlerImpl) FBExecuteBridge(ctx context.Context, bridgeParams bindings.IFastBridgeBridgeParams) (*types.Transaction, error)
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) Tokens ¶
func (t *TestContractHandlerImpl) Tokens() []TokenContract
Tokens returns the list of tokens.