exporter

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvalidBenchmarkTxPos = -1
View Source
var ScAddressPrefix = []byte{0, 0, 0, 0, 0, 0, 0, 0, 5, 0}

ScAddressPrefix is the smart contract address prefix

View Source
var ScAddressPrefixLength = 10

ScAddressPrefixLength defines the length of the smart contract address prefix

Functions

func GetSCCode

func GetSCCode(fileName string) []byte

GetSCCode retrieves the bytecode of a WASM module from a file

Types

type ScenarioWithBenchmark

type ScenarioWithBenchmark struct {
	Accs           []*TestAccount
	DeployedAccs   []*TestAccount
	Txs            []*Transaction
	DeployTxs      []*Transaction
	BenchmarkTxPos int
}

ScenarioWithBenchmark defines the component used to hold scenario benchmark

func GetAccountsAndTransactionsFromScenarios

func GetAccountsAndTransactionsFromScenarios(testPath string) (stateAndBenchmarkInfo ScenarioWithBenchmark, err error)

GetAccountsAndTransactionsFromScenarios will retrieve the ScenarioWithBenchmark component

type TestAccount

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

TestAccount defines the test account structure

func NewTestAccount

func NewTestAccount() *TestAccount

NewTestAccount will create a new instance of type TestAccount

func SetNewAccount

func SetNewAccount(nonce uint64, address []byte, balance *big.Int, storage map[string][]byte, code []byte, ownerAddress []byte) *TestAccount

SetNewAccount will create a new TestAccount

func (*TestAccount) GetAddress

func (tAcc *TestAccount) GetAddress() []byte

GetAddress gets the address

func (*TestAccount) GetBalance

func (tAcc *TestAccount) GetBalance() *big.Int

GetBalance gets the balance

func (*TestAccount) GetCode

func (tAcc *TestAccount) GetCode() []byte

GetCode gets the code

func (*TestAccount) GetNonce

func (tAcc *TestAccount) GetNonce() uint64

GetNonce gets the nonce

func (*TestAccount) GetOwner

func (tAcc *TestAccount) GetOwner() []byte

GetOwner gets the owner

func (*TestAccount) GetStorage

func (tAcc *TestAccount) GetStorage() map[string][]byte

GetStorage gets the storage

func (*TestAccount) WithAddress

func (tAcc *TestAccount) WithAddress(address []byte) *TestAccount

WithAddress sets the address

func (*TestAccount) WithBalance

func (tAcc *TestAccount) WithBalance(balance *big.Int) *TestAccount

WithBalance sets the balance

func (*TestAccount) WithCode

func (tAcc *TestAccount) WithCode(code []byte) *TestAccount

WithCode sets the account's code

func (*TestAccount) WithNonce

func (tAcc *TestAccount) WithNonce(nonce uint64) *TestAccount

WithNonce sets the nonce

func (*TestAccount) WithOwner

func (tAcc *TestAccount) WithOwner(owner []byte) *TestAccount

WithOwner sets the owner

func (*TestAccount) WithStorage

func (tAcc *TestAccount) WithStorage(storage map[string][]byte) *TestAccount

WithStorage sets the account's storage

type Transaction

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

Transaction defines the test tranaction structure

func CreateDeployTransaction

func CreateDeployTransaction(
	args [][]byte,
	scCodePath string,
	sndAddr []byte,
	gasLimit uint64,
	gasPrice uint64,
) *Transaction

CreateDeployTransaction creates a deploy transaction

func CreateTransaction

func CreateTransaction(
	function string,
	args [][]byte,
	nonce uint64,
	value *big.Int,
	dctTransfers []*scenmodel.DCTTxData,
	sndAddr []byte,
	rcvAddr []byte,
	gasLimit uint64,
	gasPrice uint64,
) *Transaction

CreateTransaction will create a transaction based on the parameters provided

func CreateUpgradeTransaction

func CreateUpgradeTransaction(
	args [][]byte,
	scCodePath string,
	sndAddr []byte,
	rcvAddr []byte,
	gasLimit uint64,
	gasPrice uint64,
) *Transaction

CreateUpgradeTransaction creates a deploy transaction

func NewTransaction

func NewTransaction() *Transaction

NewTransaction creates a new transaction instance

func (*Transaction) GetCallArguments

func (tx *Transaction) GetCallArguments() [][]byte

GetCallArguments gets the call arguments

func (*Transaction) GetCallFunction

func (tx *Transaction) GetCallFunction() string

GetCallFunction gets the call function

func (*Transaction) GetCallValue

func (tx *Transaction) GetCallValue() *big.Int

GetCallValue gets the call value

func (*Transaction) GetDCTTransfers

func (tx *Transaction) GetDCTTransfers() []*scenmodel.DCTTxData

GetDCTTransfers gets the DCT transfers

func (*Transaction) GetDeployData

func (tx *Transaction) GetDeployData() []byte

func (*Transaction) GetGasLimitAndPrice

func (tx *Transaction) GetGasLimitAndPrice() (uint64, uint64)

GetGasLimitAndPrice gets the gas limit & gas price

func (*Transaction) GetNonce

func (tx *Transaction) GetNonce() uint64

GetNonce gets the nonce

func (*Transaction) GetReceiverAddress

func (tx *Transaction) GetReceiverAddress() []byte

GetReceiverAddress gets the receiver address

func (*Transaction) GetSenderAddress

func (tx *Transaction) GetSenderAddress() []byte

GetSenderAddress gets the sender address

func (*Transaction) WithCallArguments

func (tx *Transaction) WithCallArguments(arguments [][]byte) *Transaction

WithCallArguments sets the call arguments

func (*Transaction) WithCallFunction

func (tx *Transaction) WithCallFunction(functionName string) *Transaction

WithCallFunction sets the call function

func (*Transaction) WithCallValue

func (tx *Transaction) WithCallValue(value *big.Int) *Transaction

WithCallValue sets the call value

func (*Transaction) WithDCTTransfers

func (tx *Transaction) WithDCTTransfers(dctTransfers []*scenmodel.DCTTxData) *Transaction

WithDCTTransfers sets the DCT transafers

func (*Transaction) WithDeployData

func (tx *Transaction) WithDeployData(scCodePath string, args [][]byte) *Transaction

WithDeployData sets the deploy data: sc code + arguments

func (*Transaction) WithGasLimitAndPrice

func (tx *Transaction) WithGasLimitAndPrice(gasLimit, gasPrice uint64) *Transaction

WithGasLimitAndPrice sets the gas limit & gas price

func (*Transaction) WithNonce

func (tx *Transaction) WithNonce(nonce uint64) *Transaction

WithNonce sets the nonce

func (*Transaction) WithReceiverAddress

func (tx *Transaction) WithReceiverAddress(address []byte) *Transaction

WithReceiverAddress sets the receiver address

func (*Transaction) WithSenderAddress

func (tx *Transaction) WithSenderAddress(address []byte) *Transaction

WithSenderAddress sets the sender address

Jump to

Keyboard shortcuts

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