github.com/neatlab/neatio@v1.7.3-0.20220425043230-d903e92fcc75/chain/core/vm/noop.go (about)

     1  package vm
     2  
     3  import (
     4  	"math/big"
     5  
     6  	"github.com/neatlab/neatio/chain/core/types"
     7  	"github.com/neatlab/neatio/utilities/common"
     8  )
     9  
    10  func NoopCanTransfer(db StateDB, from common.Address, balance *big.Int) bool {
    11  	return true
    12  }
    13  func NoopTransfer(db StateDB, from, to common.Address, amount *big.Int) {}
    14  
    15  type NoopEVMCallContext struct{}
    16  
    17  func (NoopEVMCallContext) Call(caller ContractRef, addr common.Address, data []byte, gas, value *big.Int) ([]byte, error) {
    18  	return nil, nil
    19  }
    20  func (NoopEVMCallContext) CallCode(caller ContractRef, addr common.Address, data []byte, gas, value *big.Int) ([]byte, error) {
    21  	return nil, nil
    22  }
    23  func (NoopEVMCallContext) Create(caller ContractRef, data []byte, gas, value *big.Int) ([]byte, common.Address, error) {
    24  	return nil, common.Address{}, nil
    25  }
    26  func (NoopEVMCallContext) DelegateCall(me ContractRef, addr common.Address, data []byte, gas *big.Int) ([]byte, error) {
    27  	return nil, nil
    28  }
    29  
    30  type NoopStateDB struct{}
    31  
    32  func (NoopStateDB) CreateAccount(common.Address)                                       {}
    33  func (NoopStateDB) SubBalance(common.Address, *big.Int)                                {}
    34  func (NoopStateDB) AddBalance(common.Address, *big.Int)                                {}
    35  func (NoopStateDB) GetBalance(common.Address) *big.Int                                 { return nil }
    36  func (NoopStateDB) GetNonce(common.Address) uint64                                     { return 0 }
    37  func (NoopStateDB) SetNonce(common.Address, uint64)                                    {}
    38  func (NoopStateDB) GetCodeHash(common.Address) common.Hash                             { return common.Hash{} }
    39  func (NoopStateDB) GetCode(common.Address) []byte                                      { return nil }
    40  func (NoopStateDB) SetCode(common.Address, []byte)                                     {}
    41  func (NoopStateDB) GetCodeSize(common.Address) int                                     { return 0 }
    42  func (NoopStateDB) AddRefund(uint64)                                                   {}
    43  func (NoopStateDB) GetRefund() uint64                                                  { return 0 }
    44  func (NoopStateDB) GetState(common.Address, common.Hash) common.Hash                   { return common.Hash{} }
    45  func (NoopStateDB) SetState(common.Address, common.Hash, common.Hash)                  {}
    46  func (NoopStateDB) Suicide(common.Address) bool                                        { return false }
    47  func (NoopStateDB) HasSuicided(common.Address) bool                                    { return false }
    48  func (NoopStateDB) Exist(common.Address) bool                                          { return false }
    49  func (NoopStateDB) Empty(common.Address) bool                                          { return false }
    50  func (NoopStateDB) RevertToSnapshot(int)                                               {}
    51  func (NoopStateDB) Snapshot() int                                                      { return 0 }
    52  func (NoopStateDB) AddLog(*types.Log)                                                  {}
    53  func (NoopStateDB) AddPreimage(common.Hash, []byte)                                    {}
    54  func (NoopStateDB) ForEachStorage(common.Address, func(common.Hash, common.Hash) bool) {}