Documentation ¶
Index ¶
Constants ¶
View Source
const ( // StatusOK is used when contract successfully ends. StatusOK = 200 // StatusErrorThreshold is the status dividing line for the normal operation of the contract StatusErrorThreshold = 400 // StatusError is used when contract fails. StatusError = 500 )
Variables ¶
This section is empty.
Functions ¶
func IsStatusError ¶
IsStatusError is used to determine if the given status is error
func PrefixRange ¶
PrefixRange returns key range that satisfy the given prefix
Types ¶
type Context ¶
type Context interface { Args() map[string][]byte Caller() string Initiator() string AuthRequire() []string PutObject(key []byte, value []byte) error GetObject(key []byte) ([]byte, error) DeleteObject(key []byte) error NewIterator(start, limit []byte) Iterator QueryTx(txid string) (*pb.Transaction, error) QueryBlock(blockid string) (*pb.Block, error) Transfer(to string, amount *big.Int) error Call(module, contract, method string, args map[string][]byte) (*Response, error) }
Context is the context in which the contract runs
type Iterator ¶
type Iterator interface { Key() []byte Value() []byte Next() bool Error() error // Iterator 必须在使用完毕后关闭 Close() }
Iterator iterates over key/value pairs in key order
type Response ¶
type Response struct { // Status 用于反映合约的运行结果,如果status值超过CodeErrorThreshold则认为合约执行失败 // 所有的操作将会被回滚 Status int `json:"status"` // Message 用于携带一些有用的debug信息 Message string `json:"message"` // Data 字段用于存储合约执行的结果 Body []byte `json:"body"` }
Response is the result of the contract run
Click to show internal directories.
Click to hide internal directories.