Documentation ¶
Overview ¶
package evmchain provides the `evmchain` contract, which allows to emulate an Ethereum blockchain on top of ISCP.
Index ¶
- Constants
- Variables
- func DecodeBlock(b []byte) (*types.Block, error)
- func DecodeCallMsg(callArgsBytes []byte) (ret ethereum.CallMsg, err error)
- func DecodeFilterQuery(b []byte) (*ethereum.FilterQuery, error)
- func DecodeGenesisAlloc(b []byte) (core.GenesisAlloc, error)
- func DecodeLog(b []byte, includeDerivedFields bool) (*types.Log, error)
- func DecodeLogs(b []byte) ([]*types.Log, error)
- func DecodeTransaction(b []byte) (*types.Transaction, error)
- func EncodeBlock(block *types.Block) []byte
- func EncodeCallMsg(c ethereum.CallMsg) []byte
- func EncodeFilterQuery(q *ethereum.FilterQuery) []byte
- func EncodeGenesisAlloc(alloc core.GenesisAlloc) []byte
- func EncodeLog(log *types.Log, includeDerivedFields bool) []byte
- func EncodeLogs(logs []*types.Log) []byte
- func EncodeTransaction(tx *types.Transaction) []byte
- type Receipt
Constants ¶
View Source
const ( FieldChainID = "chid" FieldGenesisAlloc = "g" FieldAddress = "a" FieldKey = "k" FieldAgentID = "i" FieldTransaction = "tx" FieldTransactionIndex = "ti" FieldTransactionHash = "h" FieldTransactionData = "t" FieldTransactionDataBlobHash = "th" FieldCallArguments = "c" FieldResult = "r" FieldBlockNumber = "bn" FieldBlockHash = "bh" FieldCallMsg = "c" FieldEvmOwner = "o" FieldNextEvmOwner = "n" FieldGasPerIota = "w" FieldGasFee = "f" FieldGasUsed = "gu" FieldFilterQuery = "fq" )
View Source
const DefaultGasPerIota uint64 = 1000
Variables ¶
View Source
var ( // Ethereum blockchain FuncGetBalance = coreutil.ViewFunc("getBalance") FuncSendTransaction = coreutil.Func("sendTransaction") FuncCallContract = coreutil.ViewFunc("callContract") FuncEstimateGas = coreutil.ViewFunc("estimateGas") FuncGetNonce = coreutil.ViewFunc("getNonce") FuncGetReceipt = coreutil.ViewFunc("getReceipt") FuncGetCode = coreutil.ViewFunc("getCode") FuncGetBlockNumber = coreutil.ViewFunc("getBlockNumber") FuncGetBlockByNumber = coreutil.ViewFunc("getBlockByNumber") FuncGetBlockByHash = coreutil.ViewFunc("getBlockByHash") FuncGetTransactionByHash = coreutil.ViewFunc("getTransactionByHash") FuncGetTransactionByBlockHashAndIndex = coreutil.ViewFunc("getTransactionByBlockHashAndIndex") FuncGetTransactionByBlockNumberAndIndex = coreutil.ViewFunc("getTransactionByBlockNumberAndIndex") FuncGetBlockTransactionCountByHash = coreutil.ViewFunc("getBlockTransactionCountByHash") FuncGetBlockTransactionCountByNumber = coreutil.ViewFunc("getBlockTransactionCountByNumber") FuncGetStorage = coreutil.ViewFunc("getStorage") FuncGetLogs = coreutil.ViewFunc("getLogs") // EVMchain SC management FuncSetNextOwner = coreutil.Func("setNextOwner") FuncClaimOwnership = coreutil.Func("claimOwnership") FuncGetOwner = coreutil.ViewFunc("getOwner") FuncSetGasPerIota = coreutil.Func("setGasPerIota") FuncGetGasPerIota = coreutil.ViewFunc("getGasPerIota") FuncWithdrawGasFees = coreutil.Func("withdrawGasFees") )
View Source
var Contract = coreutil.NewContract("evmchain", "EVM chain smart contract")
View Source
var Processor = Contract.Processor(initialize, FuncSendTransaction.WithHandler(applyTransaction), FuncGetBalance.WithHandler(getBalance), FuncCallContract.WithHandler(callContract), FuncEstimateGas.WithHandler(estimateGas), FuncGetNonce.WithHandler(getNonce), FuncGetReceipt.WithHandler(getReceipt), FuncGetCode.WithHandler(getCode), FuncGetBlockNumber.WithHandler(getBlockNumber), FuncGetBlockByNumber.WithHandler(getBlockByNumber), FuncGetBlockByHash.WithHandler(getBlockByHash), FuncGetTransactionByHash.WithHandler(getTransactionByHash), FuncGetTransactionByBlockHashAndIndex.WithHandler(getTransactionByBlockHashAndIndex), FuncGetTransactionByBlockNumberAndIndex.WithHandler(getTransactionByBlockNumberAndIndex), FuncGetBlockTransactionCountByHash.WithHandler(getBlockTransactionCountByHash), FuncGetBlockTransactionCountByNumber.WithHandler(getBlockTransactionCountByNumber), FuncGetStorage.WithHandler(getStorage), FuncGetLogs.WithHandler(getLogs), FuncSetNextOwner.WithHandler(setNextOwner), FuncClaimOwnership.WithHandler(claimOwnership), FuncSetGasPerIota.WithHandler(setGasPerIota), FuncWithdrawGasFees.WithHandler(withdrawGasFees), FuncGetOwner.WithHandler(getOwner), FuncGetGasPerIota.WithHandler(getGasPerIota), )
Functions ¶
func DecodeCallMsg ¶
func DecodeFilterQuery ¶
func DecodeGenesisAlloc ¶
func DecodeGenesisAlloc(b []byte) (core.GenesisAlloc, error)
func DecodeTransaction ¶
func DecodeTransaction(b []byte) (*types.Transaction, error)
func EncodeBlock ¶
func EncodeCallMsg ¶
func EncodeCallMsg(c ethereum.CallMsg) []byte
func EncodeFilterQuery ¶
func EncodeFilterQuery(q *ethereum.FilterQuery) []byte
func EncodeGenesisAlloc ¶
func EncodeGenesisAlloc(alloc core.GenesisAlloc) []byte
func EncodeLogs ¶
func EncodeTransaction ¶
func EncodeTransaction(tx *types.Transaction) []byte
Types ¶
type Receipt ¶
type Receipt struct { TxHash common.Hash TransactionIndex uint32 BlockHash common.Hash BlockNumber *big.Int From common.Address To *common.Address CumulativeGasUsed uint64 GasUsed uint64 ContractAddress *common.Address Logs []*types.Log Bloom types.Bloom Status uint64 }
func DecodeReceipt ¶
func NewReceipt ¶
func NewReceipt(r *types.Receipt, tx *types.Transaction) *Receipt
Click to show internal directories.
Click to hide internal directories.