werc20

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 26 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpectBalanceChange added in v0.5.0

func ExpectBalanceChange(
	addr sdk.AccAddress,
	beforeSnapshot *BalanceSnapshot,
	expectedIntegerDelta *big.Int,
	expectedFractionalDelta *big.Int,
	description string,
	grpcHandler grpc.Handler,
)

ExpectBalanceChange verifies expected balance changes after operations

func ResetExpectedDeltas added in v0.5.0

func ResetExpectedDeltas(accounts []*AccountBalanceInfo)

ResetExpectedDeltas resets all account balance deltas to zero

func TakeBalanceSnapshots added in v0.5.0

func TakeBalanceSnapshots(accounts []*AccountBalanceInfo, grpcHandler grpc.Handler)

TakeBalanceSnapshots captures current balance states for all accounts

func TestPrecompileIntegrationTestSuite

func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmApp, options ...network.ConfigOption)

func VerifyBalanceChanges added in v0.5.0

func VerifyBalanceChanges(
	accounts []*AccountBalanceInfo,
	grpcHandler grpc.Handler,
)

VerifyBalanceChanges verifies expected balance changes for all accounts

Types

type AccountBalanceInfo added in v0.5.0

type AccountBalanceInfo struct {
	AccountType     AccountType
	Address         sdk.AccAddress
	BeforeSnapshot  *BalanceSnapshot
	IntegerDelta    *big.Int
	FractionalDelta *big.Int
}

AccountBalanceInfo holds balance tracking information for a test account

func GetAccountBalance added in v0.5.0

func GetAccountBalance(accounts []*AccountBalanceInfo, accountType AccountType) *AccountBalanceInfo

GetAccountBalance returns the AccountBalanceInfo for a given account type

func InitializeAccountBalances added in v0.5.0

func InitializeAccountBalances(
	senderAddr, receiverAddr sdk.AccAddress,
	precompileAddr, contractAddr common.Address,
) []*AccountBalanceInfo

InitializeAccountBalances creates the account balance tracking slice with proper addresses

type AccountType added in v0.5.0

type AccountType int

AccountType represents different account types in the test

const (
	Sender AccountType = iota
	Receiver
	Precompile
	Contract
)

func (AccountType) String added in v0.5.0

func (at AccountType) String() string

String returns the string representation of AccountType

type BalanceSnapshot added in v0.5.0

type BalanceSnapshot struct {
	IntegerBalance *big.Int
}

BalanceSnapshot represents a snapshot of account balances for testing

func GetBalanceSnapshot added in v0.5.0

func GetBalanceSnapshot(addr sdk.AccAddress, grpcHandler grpc.Handler) (*BalanceSnapshot, error)

GetBalanceSnapshot gets complete balance information using grpcHandler

type CallsData

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

CallsData is a helper struct to hold the addresses and ABIs for the different contract instances that are subject to testing here.

type DepositEvent

type DepositEvent struct {
	Dst common.Address
	Wad *big.Int
}

type PrecompileIntegrationTestSuite

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

type PrecompileUnitTestSuite

type PrecompileUnitTestSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

func NewPrecompileUnitTestSuite

func NewPrecompileUnitTestSuite(
	create network.CreateEvmApp,
	options ...network.ConfigOption,
) *PrecompileUnitTestSuite

func (*PrecompileUnitTestSuite) SetupTest

func (s *PrecompileUnitTestSuite) SetupTest(chainID testconstants.ChainID)

SetupTest allows to configure the testing suite embedding a network with a custom chainID. This is important to check that the correct address is used for the precompile.

func (*PrecompileUnitTestSuite) TestEmitDepositEvent

func (s *PrecompileUnitTestSuite) TestEmitDepositEvent()

func (*PrecompileUnitTestSuite) TestEmitWithdrawalEvent

func (s *PrecompileUnitTestSuite) TestEmitWithdrawalEvent()

type WithdrawalEvent

type WithdrawalEvent struct {
	Src common.Address
	Wad *big.Int
}

Jump to

Keyboard shortcuts

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