github.com/neatlab/neatio@v1.7.3-0.20220425043230-d903e92fcc75/chain/accounts/abi/bind/backend.go (about)

     1  package bind
     2  
     3  import (
     4  	"context"
     5  	"errors"
     6  	"math/big"
     7  
     8  	"github.com/neatlab/neatio"
     9  	"github.com/neatlab/neatio/chain/core/types"
    10  	"github.com/neatlab/neatio/utilities/common"
    11  )
    12  
    13  var (
    14  	ErrNoCode = errors.New("no contract code at given address")
    15  
    16  	ErrNoPendingState = errors.New("backend does not support pending state")
    17  
    18  	ErrNoCodeAfterDeploy = errors.New("no contract code after deployment")
    19  )
    20  
    21  type ContractCaller interface {
    22  	CodeAt(ctx context.Context, contract common.Address, blockNumber *big.Int) ([]byte, error)
    23  
    24  	CallContract(ctx context.Context, call neatio.CallMsg, blockNumber *big.Int) ([]byte, error)
    25  }
    26  
    27  type PendingContractCaller interface {
    28  	PendingCodeAt(ctx context.Context, contract common.Address) ([]byte, error)
    29  
    30  	PendingCallContract(ctx context.Context, call neatio.CallMsg) ([]byte, error)
    31  }
    32  
    33  type ContractTransactor interface {
    34  	PendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)
    35  
    36  	PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)
    37  
    38  	SuggestGasPrice(ctx context.Context) (*big.Int, error)
    39  
    40  	EstimateGas(ctx context.Context, call neatio.CallMsg) (gas uint64, err error)
    41  
    42  	SendTransaction(ctx context.Context, tx *types.Transaction) error
    43  }
    44  
    45  type ContractFilterer interface {
    46  	FilterLogs(ctx context.Context, query neatio.FilterQuery) ([]types.Log, error)
    47  
    48  	SubscribeFilterLogs(ctx context.Context, query neatio.FilterQuery, ch chan<- types.Log) (neatio.Subscription, error)
    49  }
    50  
    51  type DeployBackend interface {
    52  	TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
    53  	CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)
    54  }
    55  
    56  type ContractBackend interface {
    57  	ContractCaller
    58  	ContractTransactor
    59  	ContractFilterer
    60  }