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
Types ¶
type Context ¶
type Context interface { Caller() string Args() map[string][]byte Method() string PutObject(key []byte, value []byte) error GetObject(key []byte) ([]byte, error) DeleteObject(key []byte) error Call(module, contract, method string, args map[string][]byte) (*Response, error) }
GetContractState is the context in which the contract runs
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.