Documentation ¶
Index ¶
- Constants
- Variables
- func AddKeyPrefix(hash string) string
- func GetDefaultValue(method pabi.Method, t *pabi.Type, defaultAddr string) interface{}
- func InitDetector(cfg *proto.ConfigNew)
- func InitESDB(cli db.DBCreator) error
- type Contract
- type DB
- type DetectClient
- func (c *DetectClient) ContractCall(contract *Contract, contractABI *pabi.ABI, method string, args ...interface{}) (map[string]interface{}, error)
- func (c *DetectClient) CreateCallTx(contractAddr string, data []byte) string
- func (c *DetectClient) Detect(contract *Contract)
- func (c *DetectClient) GetChainID() int32
- func (c *DetectClient) GetContractName(contractABI *pabi.ABI, contract *Contract)
- func (c *DetectClient) GetContractSymbol(contractABI *pabi.ABI, contract *Contract)
- func (c *DetectClient) GetContractURI(contractABI *pabi.ABI, contract *Contract)
- type EstimateGasReq
- type EstimateGasResp
- type Record
Constants ¶
View Source
const ( TableName = "contract" KeyPrefix = TableName + "-" )
View Source
const ( MethodChain33Version = "Chain33.Version" MethodChain33Query = "Chain33.Query" Default20Abi = "" /* 3775-byte string literal not displayed */ Default721Abi = "" /* 4654-byte string literal not displayed */ Default1155Abi = "" /* 4411-byte string literal not displayed */ ERC20 = "ERC20" ERC721 = "ERC721" ERC1155 = "ERC1155" ExecEVM = "evm" FuncNameEstimateGas = "EstimateGas" FuncNameQuery = "Query" )
View Source
const Mapping = `` /* 970-byte string literal not displayed */
Mapping 合约验证表
Variables ¶
View Source
var DefaultABIs map[string]*pabi.ABI
Functions ¶
func GetDefaultValue ¶
func InitDetector ¶
Types ¶
type Contract ¶
type Contract struct { Address string `json:"contract_address"` Creator string `json:"creator"` DeployBlockHash string `json:"deploy_block_hash"` DeployBlockTime int64 `json:"deploy_block_time"` DeployHeight int64 `json:"deploy_height"` DeployHeightIndex int64 `json:"deploy_height_index"` DeployTxHash string `json:"deploy_tx_hash"` // 部署的交易hash ContractBinHash string `json:"contract_bin_hash"` // bin文件直接sha256处理 ContractBin string `json:"contract_bin"` ContractAbi string `json:"contract_abi"` ContractType string `json:"contract_type"` TxCount int64 `json:"tx_count"` PublishCount int64 `json:"publish_count"` ParsedAbi *pabi.ABI `json:"-"` ParsedAbiErr error `json:"-"` ContractVerify *contractverify.ContractVerify `json:"-"` Name string `json:"name"` Symbol string `json:"symbol"` URI string `json:"uri"` }
func NewContractByMap ¶
func (*Contract) GetContractBinHash ¶
func (*Contract) SetContractBinHash ¶
type DB ¶
type DB interface { Get(hash string) (*Contract, error) Set(r *Record) error GetABI(addr string) (*pabi.ABI, error) GetContract(addr string) (*Contract, error) UpdateCache(contract *Contract) }
DB operate FilePart
type DetectClient ¶
type DetectClient struct {
// contains filtered or unexported fields
}
var Detector *DetectClient
func NewDetectClient ¶
func NewDetectClient(host, paraName string) *DetectClient
func (*DetectClient) ContractCall ¶
func (*DetectClient) CreateCallTx ¶
func (c *DetectClient) CreateCallTx(contractAddr string, data []byte) string
func (*DetectClient) Detect ¶
func (c *DetectClient) Detect(contract *Contract)
func (*DetectClient) GetChainID ¶
func (c *DetectClient) GetChainID() int32
func (*DetectClient) GetContractName ¶
func (c *DetectClient) GetContractName(contractABI *pabi.ABI, contract *Contract)
func (*DetectClient) GetContractSymbol ¶
func (c *DetectClient) GetContractSymbol(contractABI *pabi.ABI, contract *Contract)
func (*DetectClient) GetContractURI ¶
func (c *DetectClient) GetContractURI(contractABI *pabi.ABI, contract *Contract)
type EstimateGasReq ¶
type EstimateGasReq struct { Tx string `json:"tx"` // 部署合约交易或者调用合约交易的序列化后的字符串 From string `json:"from"` // 合约交易调用者地址 }
EstimateGasReq 估算部署交易或者调用交易需要的 gas 请求
type EstimateGasResp ¶
type EstimateGasResp struct {
Gas string `json:"gas"` // 估算需要的 gas 数值
}
EstimateGasResp 估算部署交易或者调用交易需要的 gas 响应
Click to show internal directories.
Click to hide internal directories.