util

package
v0.0.0-...-24e5678 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: LGPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ChainID = big.NewInt(1)

	Admin       = common.HexToAddress("0x477C578843cBe53C3568736347f640c2cdA4616F")
	AdminKey, _ = key.NewMemoryKeyFromString(ChainID, "a000000000000000000000000000000000000000000000000000000000000999")
	Users       []common.Address
	UserKeys    []key.Key
	Obstrs      = [5]string{
		"c000000000000000000000000000000000000000000000000000000000000000",
		"c000000000000000000000000000000000000000000000000000000000000001",
		"c000000000000000000000000000000000000000000000000000000000000002",
		"c000000000000000000000000000000000000000000000000000000000000003",
		"c000000000000000000000000000000000000000000000000000000000000004",
	}
	ObserverKeys = []common.PublicKey{}

	Frstrs = [10]string{
		"b000000000000000000000000000000000000000000000000000000000000010",
		"b000000000000000000000000000000000000000000000000000000000000011",
		"b000000000000000000000000000000000000000000000000000000000000012",
		"b000000000000000000000000000000000000000000000000000000000000013",
		"b000000000000000000000000000000000000000000000000000000000000014",
		"b000000000000000000000000000000000000000000000000000000000000015",
		"b000000000000000000000000000000000000000000000000000000000000016",
		"b000000000000000000000000000000000000000000000000000000000000017",
		"b000000000000000000000000000000000000000000000000000000000000018",
		"b000000000000000000000000000000000000000000000000000000000000019",
	}
)
View Source
var ClassMap map[string]uint64

Functions

func Exec

func Exec(ctx *types.Context, user common.Address, contAddr common.Address, methodName string, args []interface{}) ([]interface{}, error)

func GetCC

func GetCC(ctx *types.Context, contAddr common.Address, user common.Address) (*types.ContractContext, error)

///////// context ///////////

func Owner

func RegisterContractClass

func RegisterContractClass(cont types.Contract, className string) uint64

func RemoveChain

func RemoveChain(idx int) (string, error)

func RemoveTestData

func RemoveTestData() error

Types

type TestContext

type TestContext struct {
	Ctx       *types.Context
	Cn        *chain.Chain
	Idx       int
	MainToken common.Address
}

func NewTestContext

func NewTestContext() *TestContext

func (*TestContext) AddBlock

func (tc *TestContext) AddBlock(seconds uint64, txs []*types.Transaction, signer []key.Key) (hash.Hash256, error)

func (*TestContext) Call

func (tc *TestContext) Call(toAddr common.Address, from, method string, params []interface{}) ([]interface{}, error)

func (*TestContext) DeployContract

func (tc *TestContext) DeployContract(contType interface{}, contArgs io.WriterTo) common.Address

func (*TestContext) InitChain

func (tc *TestContext) InitChain(adm common.Address) error

func (*TestContext) InitMainToken

func (tc *TestContext) InitMainToken(adminAddress common.Address, ClassMap map[string]uint64) common.Address

func (*TestContext) MakeToken

func (tc *TestContext) MakeToken(name string, symbol string, amt string) common.Address

func (*TestContext) MakeTx

func (tc *TestContext) MakeTx(to common.Address, method string, params ...interface{}) (*types.Transaction, error)

func (*TestContext) MultiSendTx

func (tc *TestContext) MultiSendTx(txs []*types.Transaction, keys []key.Key) ([]interface{}, error)

func (*TestContext) MustSendTx

func (tc *TestContext) MustSendTx(mkey key.Key, to common.Address, method string, params ...interface{}) []interface{}

func (*TestContext) MustSendTxs

func (tc *TestContext) MustSendTxs(txcs []*TxCase) [][]interface{}

func (*TestContext) MustSkipBlock

func (tc *TestContext) MustSkipBlock(blockCount int)

func (*TestContext) ReadTx

func (tc *TestContext) ReadTx(mkey key.Key, to common.Address, method string, params ...interface{}) ([]interface{}, error)

func (*TestContext) SendTx

func (tc *TestContext) SendTx(mkey key.Key, to common.Address, method string, params ...interface{}) ([]interface{}, error)

func (*TestContext) SkipBlock

func (tc *TestContext) SkipBlock(blockCount int) (*types.Context, error)

func (*TestContext) Sleep

func (tc *TestContext) Sleep(seconds uint64, tx []*types.Transaction, signer []key.Key) error

func (*TestContext) SleepBlocks

func (tc *TestContext) SleepBlocks(block int)

type TxCase

type TxCase struct {
	Mkey   key.Key
	To     common.Address
	Method string
	Params []interface{}
}

Jump to

Keyboard shortcuts

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