scenario

package
v0.0.0-...-613d1fa Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package scenario allows creating orders for testing purposes with a variety of options. It also supports setting up the necessary on-chain state for both the taker and maker.

Index

Constants

This section is empty.

Variables

View Source
var (
	ZRXAssetData  = constants.ZRXAssetData
	WETHAssetData = constants.WETHAssetData
)

Functions

func GetDummyERC1155AssetData

func GetDummyERC1155AssetData(t *testing.T, tokenIDs []*big.Int, amounts []*big.Int) []byte

func GetDummyERC721AssetData

func GetDummyERC721AssetData(tokenID *big.Int) []byte

func GetTestSignerFn

func GetTestSignerFn(signerAddress common.Address) func(signer types.Signer, address common.Address, tx *types.Transaction) (*types.Transaction, error)

GetTestSignerFn returns a test signer function that can be used to sign Ethereum transactions

func NewSignedTestOrder

func NewSignedTestOrder(t *testing.T, opts ...orderopts.Option) *zeroex.SignedOrder

func NewSignedTestOrdersBatch

func NewSignedTestOrdersBatch(t *testing.T, numOrders int, optionsForIndex func(index int) []orderopts.Option) []*zeroex.SignedOrder

NewSignedTestOrdersBatch efficiently creates numOrders orders with independent options. If the options require setting up maker or taker state, that state will be set up efficiently with one transaction per address.

optionsForIndex is a function which returns the options for creating the order at a specific index (between 0 and numOrders). For example, you can create ERC721 orders which each have a unique token ID. optionsForIndex can be nil to always use the default options. It can return nil to use the default options for an order at a specific index.

func NewTestOrder

func NewTestOrder(t *testing.T, opts ...orderopts.Option) *zeroex.Order

func OptionsForAll

func OptionsForAll(opts ...orderopts.Option) func(_ int) []orderopts.Option

OptionsForAll is a convenience function which can be used in combination with NewSignedTestOrdersBatch when you want all orders to be created with the same options. It returns a function which can be used as optionsForIndex which always returns the given options, regardless of the index.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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