Documentation
      ¶
    
    
  
    
  
    Overview ¶
Defines the interface for the configuration and execution of a precompile contract
Package contract is a generated GoMock package.
Index ¶
- Constants
 - func CalculateFunctionSelector(functionSignature string) []byte
 - func DeductGas(suppliedGas uint64, requiredGas uint64) (uint64, error)
 - func PackOrderedHashes(dst []byte, hashes []common.Hash) error
 - func PackOrderedHashesWithSelector(dst []byte, functionSelector []byte, hashes []common.Hash) error
 - func PackedHash(packed []byte, index int) []byte
 - func ParseABI(rawABI string) abi.ABI
 - type AccessibleState
 - type ActivationFunc
 - type BlockContext
 - type ConfigurationBlockContext
 - type Configurator
 - type MockAccessibleState
 - func (m *MockAccessibleState) EXPECT() *MockAccessibleStateMockRecorder
 - func (m *MockAccessibleState) GetBlockContext() BlockContext
 - func (m *MockAccessibleState) GetChainConfig() precompileconfig.ChainConfig
 - func (m *MockAccessibleState) GetSnowContext() *snow.Context
 - func (m *MockAccessibleState) GetStateDB() StateDB
 - func (m *MockAccessibleState) NativeAssetCall(caller common.Address, input []byte, suppliedGas, gasCost uint64, ...) ([]byte, uint64, error)
 
- type MockAccessibleStateMockRecorder
 - func (mr *MockAccessibleStateMockRecorder) GetBlockContext() *gomock.Call
 - func (mr *MockAccessibleStateMockRecorder) GetChainConfig() *gomock.Call
 - func (mr *MockAccessibleStateMockRecorder) GetSnowContext() *gomock.Call
 - func (mr *MockAccessibleStateMockRecorder) GetStateDB() *gomock.Call
 - func (mr *MockAccessibleStateMockRecorder) NativeAssetCall(caller, input, suppliedGas, gasCost, readOnly interface{}) *gomock.Call
 
- type MockBlockContext
 - type MockBlockContextMockRecorder
 - type MockConfigurationBlockContext
 - type MockConfigurationBlockContextMockRecorder
 - type MockConfigurator
 - type MockConfiguratorMockRecorder
 - type MockStateDB
 - func (m *MockStateDB) AddBalance(arg0 common.Address, arg1 *big.Int)
 - func (m *MockStateDB) AddLog(addr common.Address, topics []common.Hash, data []byte, blockNumber uint64)
 - func (m *MockStateDB) CreateAccount(arg0 common.Address)
 - func (m *MockStateDB) EXPECT() *MockStateDBMockRecorder
 - func (m *MockStateDB) Exist(arg0 common.Address) bool
 - func (m *MockStateDB) Finalise(deleteEmptyObjects bool)
 - func (m *MockStateDB) GetBalance(arg0 common.Address) *big.Int
 - func (m *MockStateDB) GetBalanceMultiCoin(arg0 common.Address, arg1 common.Hash) *big.Int
 - func (m *MockStateDB) GetLogData() [][]byte
 - func (m *MockStateDB) GetNonce(arg0 common.Address) uint64
 - func (m *MockStateDB) GetPredicateStorageSlots(address common.Address, index int) ([]byte, bool)
 - func (m *MockStateDB) GetState(arg0 common.Address, arg1 common.Hash) common.Hash
 - func (m *MockStateDB) GetTxHash() common.Hash
 - func (m *MockStateDB) RevertToSnapshot(arg0 int)
 - func (m *MockStateDB) SetNonce(arg0 common.Address, arg1 uint64)
 - func (m *MockStateDB) SetPredicateStorageSlots(address common.Address, predicates [][]byte)
 - func (m *MockStateDB) SetState(arg0 common.Address, arg1, arg2 common.Hash)
 - func (m *MockStateDB) Snapshot() int
 - func (m *MockStateDB) Suicide(arg0 common.Address) bool
 
- type MockStateDBMockRecorder
 - func (mr *MockStateDBMockRecorder) AddBalance(arg0, arg1 interface{}) *gomock.Call
 - func (mr *MockStateDBMockRecorder) AddLog(addr, topics, data, blockNumber interface{}) *gomock.Call
 - func (mr *MockStateDBMockRecorder) CreateAccount(arg0 interface{}) *gomock.Call
 - func (mr *MockStateDBMockRecorder) Exist(arg0 interface{}) *gomock.Call
 - func (mr *MockStateDBMockRecorder) Finalise(deleteEmptyObjects interface{}) *gomock.Call
 - func (mr *MockStateDBMockRecorder) GetBalance(arg0 interface{}) *gomock.Call
 - func (mr *MockStateDBMockRecorder) GetBalanceMultiCoin(arg0, arg1 interface{}) *gomock.Call
 - func (mr *MockStateDBMockRecorder) GetLogData() *gomock.Call
 - func (mr *MockStateDBMockRecorder) GetNonce(arg0 interface{}) *gomock.Call
 - func (mr *MockStateDBMockRecorder) GetPredicateStorageSlots(address, index interface{}) *gomock.Call
 - func (mr *MockStateDBMockRecorder) GetState(arg0, arg1 interface{}) *gomock.Call
 - func (mr *MockStateDBMockRecorder) GetTxHash() *gomock.Call
 - func (mr *MockStateDBMockRecorder) RevertToSnapshot(arg0 interface{}) *gomock.Call
 - func (mr *MockStateDBMockRecorder) SetNonce(arg0, arg1 interface{}) *gomock.Call
 - func (mr *MockStateDBMockRecorder) SetPredicateStorageSlots(address, predicates interface{}) *gomock.Call
 - func (mr *MockStateDBMockRecorder) SetState(arg0, arg1, arg2 interface{}) *gomock.Call
 - func (mr *MockStateDBMockRecorder) Snapshot() *gomock.Call
 - func (mr *MockStateDBMockRecorder) Suicide(arg0 interface{}) *gomock.Call
 
- type MockStatefulPrecompiledContract
 - type MockStatefulPrecompiledContractMockRecorder
 - type RunStatefulPrecompileFunc
 - type StateDB
 - type StatefulPrecompileFunction
 - type StatefulPrecompiledContract
 
Constants ¶
const ( WriteGasCostPerSlot = 20_000 ReadGasCostPerSlot = 5_000 )
Gas costs for stateful precompiles
const (
	SelectorLen = 4
)
    Variables ¶
This section is empty.
Functions ¶
func CalculateFunctionSelector ¶
CalculateFunctionSelector returns the 4 byte function selector that results from [functionSignature] Ex. the function setBalance(addr address, balance uint256) should be passed in as the string: "setBalance(address,uint256)" TODO: remove this after moving to ABI based function selectors.
func DeductGas ¶
DeductGas checks if [suppliedGas] is sufficient against [requiredGas] and deducts [requiredGas] from [suppliedGas].
func PackOrderedHashes ¶
PackOrderedHashes packs the ordered list of [hashes] into the [dst] byte buffer. assumes that [dst] has sufficient space to pack [hashes] or else this function will panic.
func PackOrderedHashesWithSelector ¶
PackOrderedHashesWithSelector packs the function selector and ordered list of hashes into [dst] byte slice. assumes that [dst] has sufficient room for [functionSelector] and [hashes].
func PackedHash ¶
PackedHash returns packed the byte slice with common.HashLength from [packed] at the given [index]. Assumes that [packed] is composed entirely of packed 32 byte segments.
Types ¶
type AccessibleState ¶
type AccessibleState interface {
	GetStateDB() StateDB
	GetBlockContext() BlockContext
	GetSnowContext() *snow.Context
	GetChainConfig() precompileconfig.ChainConfig
	NativeAssetCall(caller common.Address, input []byte, suppliedGas uint64, gasCost uint64, readOnly bool) (ret []byte, remainingGas uint64, err error)
}
    AccessibleState defines the interface exposed to stateful precompile contracts
type ActivationFunc ¶
type ActivationFunc func(AccessibleState) bool
ActivationFunc defines a function that is used to determine if a function is active The return value is whether or not the function is active
type BlockContext ¶
type ConfigurationBlockContext ¶
ConfigurationBlockContext defines the interface required to configure a precompile.
type Configurator ¶
type Configurator interface {
	MakeConfig() precompileconfig.Config
	Configure(
		chainConfig precompileconfig.ChainConfig,
		precompileconfig precompileconfig.Config,
		state StateDB,
		blockContext ConfigurationBlockContext,
	) error
}
    type MockAccessibleState ¶
type MockAccessibleState struct {
	// contains filtered or unexported fields
}
    MockAccessibleState is a mock of AccessibleState interface.
func NewMockAccessibleState ¶
func NewMockAccessibleState(ctrl *gomock.Controller) *MockAccessibleState
NewMockAccessibleState creates a new mock instance.
func (*MockAccessibleState) EXPECT ¶
func (m *MockAccessibleState) EXPECT() *MockAccessibleStateMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockAccessibleState) GetBlockContext ¶
func (m *MockAccessibleState) GetBlockContext() BlockContext
GetBlockContext mocks base method.
func (*MockAccessibleState) GetChainConfig ¶
func (m *MockAccessibleState) GetChainConfig() precompileconfig.ChainConfig
GetChainConfig mocks base method.
func (*MockAccessibleState) GetSnowContext ¶
func (m *MockAccessibleState) GetSnowContext() *snow.Context
GetSnowContext mocks base method.
func (*MockAccessibleState) GetStateDB ¶
func (m *MockAccessibleState) GetStateDB() StateDB
GetStateDB mocks base method.
type MockAccessibleStateMockRecorder ¶
type MockAccessibleStateMockRecorder struct {
	// contains filtered or unexported fields
}
    MockAccessibleStateMockRecorder is the mock recorder for MockAccessibleState.
func (*MockAccessibleStateMockRecorder) GetBlockContext ¶
func (mr *MockAccessibleStateMockRecorder) GetBlockContext() *gomock.Call
GetBlockContext indicates an expected call of GetBlockContext.
func (*MockAccessibleStateMockRecorder) GetChainConfig ¶
func (mr *MockAccessibleStateMockRecorder) GetChainConfig() *gomock.Call
GetChainConfig indicates an expected call of GetChainConfig.
func (*MockAccessibleStateMockRecorder) GetSnowContext ¶
func (mr *MockAccessibleStateMockRecorder) GetSnowContext() *gomock.Call
GetSnowContext indicates an expected call of GetSnowContext.
func (*MockAccessibleStateMockRecorder) GetStateDB ¶
func (mr *MockAccessibleStateMockRecorder) GetStateDB() *gomock.Call
GetStateDB indicates an expected call of GetStateDB.
func (*MockAccessibleStateMockRecorder) NativeAssetCall ¶
func (mr *MockAccessibleStateMockRecorder) NativeAssetCall(caller, input, suppliedGas, gasCost, readOnly interface{}) *gomock.Call
NativeAssetCall indicates an expected call of NativeAssetCall.
type MockBlockContext ¶
type MockBlockContext struct {
	// contains filtered or unexported fields
}
    MockBlockContext is a mock of BlockContext interface.
func NewMockBlockContext ¶
func NewMockBlockContext(ctrl *gomock.Controller) *MockBlockContext
NewMockBlockContext creates a new mock instance.
func (*MockBlockContext) EXPECT ¶
func (m *MockBlockContext) EXPECT() *MockBlockContextMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockBlockContext) GetPredicateResults ¶
func (m *MockBlockContext) GetPredicateResults(txHash common.Hash, precompileAddress common.Address) []byte
GetPredicateResults mocks base method.
func (*MockBlockContext) Number ¶
func (m *MockBlockContext) Number() *big.Int
Number mocks base method.
func (*MockBlockContext) Timestamp ¶
func (m *MockBlockContext) Timestamp() uint64
Timestamp mocks base method.
type MockBlockContextMockRecorder ¶
type MockBlockContextMockRecorder struct {
	// contains filtered or unexported fields
}
    MockBlockContextMockRecorder is the mock recorder for MockBlockContext.
func (*MockBlockContextMockRecorder) GetPredicateResults ¶
func (mr *MockBlockContextMockRecorder) GetPredicateResults(txHash, precompileAddress interface{}) *gomock.Call
GetPredicateResults indicates an expected call of GetPredicateResults.
func (*MockBlockContextMockRecorder) Number ¶
func (mr *MockBlockContextMockRecorder) Number() *gomock.Call
Number indicates an expected call of Number.
func (*MockBlockContextMockRecorder) Timestamp ¶
func (mr *MockBlockContextMockRecorder) Timestamp() *gomock.Call
Timestamp indicates an expected call of Timestamp.
type MockConfigurationBlockContext ¶
type MockConfigurationBlockContext struct {
	// contains filtered or unexported fields
}
    MockConfigurationBlockContext is a mock of ConfigurationBlockContext interface.
func NewMockConfigurationBlockContext ¶
func NewMockConfigurationBlockContext(ctrl *gomock.Controller) *MockConfigurationBlockContext
NewMockConfigurationBlockContext creates a new mock instance.
func (*MockConfigurationBlockContext) EXPECT ¶
func (m *MockConfigurationBlockContext) EXPECT() *MockConfigurationBlockContextMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockConfigurationBlockContext) Number ¶
func (m *MockConfigurationBlockContext) Number() *big.Int
Number mocks base method.
func (*MockConfigurationBlockContext) Timestamp ¶
func (m *MockConfigurationBlockContext) Timestamp() uint64
Timestamp mocks base method.
type MockConfigurationBlockContextMockRecorder ¶
type MockConfigurationBlockContextMockRecorder struct {
	// contains filtered or unexported fields
}
    MockConfigurationBlockContextMockRecorder is the mock recorder for MockConfigurationBlockContext.
func (*MockConfigurationBlockContextMockRecorder) Number ¶
func (mr *MockConfigurationBlockContextMockRecorder) Number() *gomock.Call
Number indicates an expected call of Number.
func (*MockConfigurationBlockContextMockRecorder) Timestamp ¶
func (mr *MockConfigurationBlockContextMockRecorder) Timestamp() *gomock.Call
Timestamp indicates an expected call of Timestamp.
type MockConfigurator ¶
type MockConfigurator struct {
	// contains filtered or unexported fields
}
    MockConfigurator is a mock of Configurator interface.
func NewMockConfigurator ¶
func NewMockConfigurator(ctrl *gomock.Controller) *MockConfigurator
NewMockConfigurator creates a new mock instance.
func (*MockConfigurator) Configure ¶
func (m *MockConfigurator) Configure(chainConfig precompileconfig.ChainConfig, precompileconfig precompileconfig.Config, state StateDB, blockContext ConfigurationBlockContext) error
Configure mocks base method.
func (*MockConfigurator) EXPECT ¶
func (m *MockConfigurator) EXPECT() *MockConfiguratorMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockConfigurator) MakeConfig ¶
func (m *MockConfigurator) MakeConfig() precompileconfig.Config
MakeConfig mocks base method.
type MockConfiguratorMockRecorder ¶
type MockConfiguratorMockRecorder struct {
	// contains filtered or unexported fields
}
    MockConfiguratorMockRecorder is the mock recorder for MockConfigurator.
func (*MockConfiguratorMockRecorder) Configure ¶
func (mr *MockConfiguratorMockRecorder) Configure(chainConfig, precompileconfig, state, blockContext interface{}) *gomock.Call
Configure indicates an expected call of Configure.
func (*MockConfiguratorMockRecorder) MakeConfig ¶
func (mr *MockConfiguratorMockRecorder) MakeConfig() *gomock.Call
MakeConfig indicates an expected call of MakeConfig.
type MockStateDB ¶
type MockStateDB struct {
	// contains filtered or unexported fields
}
    MockStateDB is a mock of StateDB interface.
func NewMockStateDB ¶
func NewMockStateDB(ctrl *gomock.Controller) *MockStateDB
NewMockStateDB creates a new mock instance.
func (*MockStateDB) AddBalance ¶
func (m *MockStateDB) AddBalance(arg0 common.Address, arg1 *big.Int)
AddBalance mocks base method.
func (*MockStateDB) AddLog ¶
func (m *MockStateDB) AddLog(addr common.Address, topics []common.Hash, data []byte, blockNumber uint64)
AddLog mocks base method.
func (*MockStateDB) CreateAccount ¶
func (m *MockStateDB) CreateAccount(arg0 common.Address)
CreateAccount mocks base method.
func (*MockStateDB) EXPECT ¶
func (m *MockStateDB) EXPECT() *MockStateDBMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockStateDB) Exist ¶
func (m *MockStateDB) Exist(arg0 common.Address) bool
Exist mocks base method.
func (*MockStateDB) Finalise ¶
func (m *MockStateDB) Finalise(deleteEmptyObjects bool)
Finalise mocks base method.
func (*MockStateDB) GetBalance ¶
func (m *MockStateDB) GetBalance(arg0 common.Address) *big.Int
GetBalance mocks base method.
func (*MockStateDB) GetBalanceMultiCoin ¶
GetBalanceMultiCoin mocks base method.
func (*MockStateDB) GetLogData ¶
func (m *MockStateDB) GetLogData() [][]byte
GetLogData mocks base method.
func (*MockStateDB) GetNonce ¶
func (m *MockStateDB) GetNonce(arg0 common.Address) uint64
GetNonce mocks base method.
func (*MockStateDB) GetPredicateStorageSlots ¶
GetPredicateStorageSlots mocks base method.
func (*MockStateDB) GetTxHash ¶
func (m *MockStateDB) GetTxHash() common.Hash
GetTxHash mocks base method.
func (*MockStateDB) RevertToSnapshot ¶
func (m *MockStateDB) RevertToSnapshot(arg0 int)
RevertToSnapshot mocks base method.
func (*MockStateDB) SetNonce ¶
func (m *MockStateDB) SetNonce(arg0 common.Address, arg1 uint64)
SetNonce mocks base method.
func (*MockStateDB) SetPredicateStorageSlots ¶
func (m *MockStateDB) SetPredicateStorageSlots(address common.Address, predicates [][]byte)
SetPredicateStorageSlots mocks base method.
type MockStateDBMockRecorder ¶
type MockStateDBMockRecorder struct {
	// contains filtered or unexported fields
}
    MockStateDBMockRecorder is the mock recorder for MockStateDB.
func (*MockStateDBMockRecorder) AddBalance ¶
func (mr *MockStateDBMockRecorder) AddBalance(arg0, arg1 interface{}) *gomock.Call
AddBalance indicates an expected call of AddBalance.
func (*MockStateDBMockRecorder) AddLog ¶
func (mr *MockStateDBMockRecorder) AddLog(addr, topics, data, blockNumber interface{}) *gomock.Call
AddLog indicates an expected call of AddLog.
func (*MockStateDBMockRecorder) CreateAccount ¶
func (mr *MockStateDBMockRecorder) CreateAccount(arg0 interface{}) *gomock.Call
CreateAccount indicates an expected call of CreateAccount.
func (*MockStateDBMockRecorder) Exist ¶
func (mr *MockStateDBMockRecorder) Exist(arg0 interface{}) *gomock.Call
Exist indicates an expected call of Exist.
func (*MockStateDBMockRecorder) Finalise ¶
func (mr *MockStateDBMockRecorder) Finalise(deleteEmptyObjects interface{}) *gomock.Call
Finalise indicates an expected call of Finalise.
func (*MockStateDBMockRecorder) GetBalance ¶
func (mr *MockStateDBMockRecorder) GetBalance(arg0 interface{}) *gomock.Call
GetBalance indicates an expected call of GetBalance.
func (*MockStateDBMockRecorder) GetBalanceMultiCoin ¶
func (mr *MockStateDBMockRecorder) GetBalanceMultiCoin(arg0, arg1 interface{}) *gomock.Call
GetBalanceMultiCoin indicates an expected call of GetBalanceMultiCoin.
func (*MockStateDBMockRecorder) GetLogData ¶
func (mr *MockStateDBMockRecorder) GetLogData() *gomock.Call
GetLogData indicates an expected call of GetLogData.
func (*MockStateDBMockRecorder) GetNonce ¶
func (mr *MockStateDBMockRecorder) GetNonce(arg0 interface{}) *gomock.Call
GetNonce indicates an expected call of GetNonce.
func (*MockStateDBMockRecorder) GetPredicateStorageSlots ¶
func (mr *MockStateDBMockRecorder) GetPredicateStorageSlots(address, index interface{}) *gomock.Call
GetPredicateStorageSlots indicates an expected call of GetPredicateStorageSlots.
func (*MockStateDBMockRecorder) GetState ¶
func (mr *MockStateDBMockRecorder) GetState(arg0, arg1 interface{}) *gomock.Call
GetState indicates an expected call of GetState.
func (*MockStateDBMockRecorder) GetTxHash ¶
func (mr *MockStateDBMockRecorder) GetTxHash() *gomock.Call
GetTxHash indicates an expected call of GetTxHash.
func (*MockStateDBMockRecorder) RevertToSnapshot ¶
func (mr *MockStateDBMockRecorder) RevertToSnapshot(arg0 interface{}) *gomock.Call
RevertToSnapshot indicates an expected call of RevertToSnapshot.
func (*MockStateDBMockRecorder) SetNonce ¶
func (mr *MockStateDBMockRecorder) SetNonce(arg0, arg1 interface{}) *gomock.Call
SetNonce indicates an expected call of SetNonce.
func (*MockStateDBMockRecorder) SetPredicateStorageSlots ¶
func (mr *MockStateDBMockRecorder) SetPredicateStorageSlots(address, predicates interface{}) *gomock.Call
SetPredicateStorageSlots indicates an expected call of SetPredicateStorageSlots.
func (*MockStateDBMockRecorder) SetState ¶
func (mr *MockStateDBMockRecorder) SetState(arg0, arg1, arg2 interface{}) *gomock.Call
SetState indicates an expected call of SetState.
func (*MockStateDBMockRecorder) Snapshot ¶
func (mr *MockStateDBMockRecorder) Snapshot() *gomock.Call
Snapshot indicates an expected call of Snapshot.
func (*MockStateDBMockRecorder) Suicide ¶
func (mr *MockStateDBMockRecorder) Suicide(arg0 interface{}) *gomock.Call
Suicide indicates an expected call of Suicide.
type MockStatefulPrecompiledContract ¶
type MockStatefulPrecompiledContract struct {
	// contains filtered or unexported fields
}
    MockStatefulPrecompiledContract is a mock of StatefulPrecompiledContract interface.
func NewMockStatefulPrecompiledContract ¶
func NewMockStatefulPrecompiledContract(ctrl *gomock.Controller) *MockStatefulPrecompiledContract
NewMockStatefulPrecompiledContract creates a new mock instance.
func (*MockStatefulPrecompiledContract) EXPECT ¶
func (m *MockStatefulPrecompiledContract) EXPECT() *MockStatefulPrecompiledContractMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockStatefulPrecompiledContractMockRecorder ¶
type MockStatefulPrecompiledContractMockRecorder struct {
	// contains filtered or unexported fields
}
    MockStatefulPrecompiledContractMockRecorder is the mock recorder for MockStatefulPrecompiledContract.
func (*MockStatefulPrecompiledContractMockRecorder) Run ¶
func (mr *MockStatefulPrecompiledContractMockRecorder) Run(accessibleState, caller, addr, input, suppliedGas, readOnly interface{}) *gomock.Call
Run indicates an expected call of Run.
type StateDB ¶
type StateDB interface {
	GetState(common.Address, common.Hash) common.Hash
	SetState(common.Address, common.Hash, common.Hash)
	SetNonce(common.Address, uint64)
	GetNonce(common.Address) uint64
	GetBalance(common.Address) *big.Int
	AddBalance(common.Address, *big.Int)
	GetBalanceMultiCoin(common.Address, common.Hash) *big.Int
	CreateAccount(common.Address)
	Exist(common.Address) bool
	AddLog(addr common.Address, topics []common.Hash, data []byte, blockNumber uint64)
	GetLogData() [][]byte
	GetPredicateStorageSlots(address common.Address, index int) ([]byte, bool)
	SetPredicateStorageSlots(address common.Address, predicates [][]byte)
	GetTxHash() common.Hash
	Suicide(common.Address) bool
	Finalise(deleteEmptyObjects bool)
	Snapshot() int
	RevertToSnapshot(int)
}
    StateDB is the interface for accessing EVM state
type StatefulPrecompileFunction ¶
type StatefulPrecompileFunction struct {
	// contains filtered or unexported fields
}
    StatefulPrecompileFunction defines a function implemented by a stateful precompile
func NewStatefulPrecompileFunction ¶
func NewStatefulPrecompileFunction(selector []byte, execute RunStatefulPrecompileFunc) *StatefulPrecompileFunction
NewStatefulPrecompileFunction creates a stateful precompile function with the given arguments
func NewStatefulPrecompileFunctionWithActivator ¶
func NewStatefulPrecompileFunctionWithActivator(selector []byte, execute RunStatefulPrecompileFunc, activation ActivationFunc) *StatefulPrecompileFunction
func (*StatefulPrecompileFunction) IsActivated ¶
func (f *StatefulPrecompileFunction) IsActivated(accessibleState AccessibleState) bool
type StatefulPrecompiledContract ¶
type StatefulPrecompiledContract interface {
	// Run executes the precompiled contract.
	Run(accessibleState AccessibleState, caller common.Address, addr common.Address, input []byte, suppliedGas uint64, readOnly bool) (ret []byte, remainingGas uint64, err error)
}
    StatefulPrecompiledContract is the interface for executing a precompiled contract
func NewStatefulPrecompileContract ¶
func NewStatefulPrecompileContract(fallback RunStatefulPrecompileFunc, functions []*StatefulPrecompileFunction) (StatefulPrecompiledContract, error)
NewStatefulPrecompileContract generates new StatefulPrecompile using [functions] as the available functions and [fallback] as an optional fallback if there is no input data. Note: the selector of [fallback] will be ignored, so it is required to be left empty.