Documentation ¶
Index ¶
- Constants
- Variables
- func ArgsToInput(args utils.CallData) (res []byte, err error)
- func CallData2Input(data utils.CallData) (utils.WasmInput, error)
- func GetAccountContractListKey(accountAddr sdk.AccAddress) []byte
- func GetCodeKey(codeHash []byte) []byte
- func GetContractAddressKey(addr sdk.AccAddress) []byte
- func GetContractStorePrefixKey(addr sdk.AccAddress) []byte
- func GetWasmerKey() []byte
- func RegisterCodec(cdc *codec.Codec)
- func ValidType(signature *utils.Signature) error
- type CodeInfo
- type CodeInfoParams
- type CodeType
- type Contract
- type ContractExistParams
- type ContractInfo
- type ContractInfoParams
- type ContractListParams
- type ContractListResponse
- type ContractState
- type ContractStateParam
- type CreatedAt
- type GenesisState
- type MsgExecuteContract
- type MsgInstantiateContract
- type MsgMigrateContract
- type MsgUploadContract
- type RustI128
- type RustU128
- type Sink
- func (sink Sink) Bytes() []byte
- func (sink Sink) ReadBool() (bool, error)
- func (sink Sink) ReadByte() (byte, error)
- func (sink Sink) ReadBytes() ([]byte, int, error)
- func (sink Sink) ReadI32() (result int32, err error)
- func (sink Sink) ReadI64() (result int64, err error)
- func (sink Sink) ReadString() (string, error)
- func (sink Sink) ReadU32() (result uint32, err error)
- func (sink Sink) ReadU64() (result uint64, err error)
- func (sink Sink) ReadUSize() (result uint32, err error)
- func (sink Sink) WriteBool(b bool)
- func (sink Sink) WriteBytes(b []byte)
- func (sink Sink) WriteI128(i128 *RustI128)
- func (sink Sink) WriteI32(i int32)
- func (sink Sink) WriteI64(i int64)
- func (sink Sink) WriteString(s string)
- func (sink Sink) WriteU128(u128 *RustU128)
- func (sink Sink) WriteU32(i uint32)
- func (sink Sink) WriteU64(i uint64)
- type WasmConfig
Constants ¶
View Source
const ( EventType = "contract" AttributeKeyCodeHash = "code_hash" AttributeKeyAddress = "contract_address" AttributeKeyMethod = "operation" AttributeValueUpload = "upload_contract" AttributeValueInitiate = "init_contract" AttributeValueInvoke = "invoke_contract" AttributeValueMigrate = "migrate_contract" AttributeValueCategory = vmmodule.ModuleName )
View Source
const ( QueryContractInfo = "queryContractInfo" QueryCodeInfo = "queryCodeInfo" QueryContractState = "queryContractState" QueryContractList = "queryContractList" QueryContractExist = "queryContractExist" SystemContract = "system_contract" ModePerm os.FileMode = 0666 SuffixName = ".wasm" FolderName = "wasm" InitFunctionName = "init" HandleFunctionName = "handle" QueryFunctionName = "query" )
View Source
const (
DefaultCodespace sdk.CodespaceType = "wasm"
)
View Source
const (
InitMethodStr = "init(string)"
)
Variables ¶
View Source
var ( ErrInvalidParams = sdkerrors.Register(string(DefaultCodespace), uint32(CodeCheckParamsError), "invalid params") ErrInvalidEndPoint = sdkerrors.Register(string(DefaultCodespace), uint32(CodeInvalidEndPoint), "invalid endpoint") ErrCdcUnMarshalFailed = sdkerrors.Register(string(DefaultCodespace), uint32(CodeCdcUnMarshalFailed), "cdc marshal failed") ErrQueryFailed = sdkerrors.Register(string(DefaultCodespace), uint32(CodeQueryFailed), "query failed") ErrJsonUnmarshalFailed = sdkerrors.Register(string(DefaultCodespace), uint32(CodeJsonUnmarshalFailed), "json marshal failed") ErrCdcMarshalFailed = sdkerrors.Register(string(DefaultCodespace), uint32(CodeCdcMarshalFailed), "cdc marshal failed") ErrGetBlockBloomFailed = sdkerrors.Register(string(DefaultCodespace), uint32(CodeGetBlockBloomFailed), "get block bloom failed") )
View Source
var ( WasmerKey = []byte("wasmer") CodeKeyPrefix = []byte{0x01} ContractKeyPrefix = []byte{0x02} ContractStorePrefix = []byte{0x03} AccountContractListPrefix = []byte{0x04} )
View Source
var (
EmptyAddress = sdk.HexToAddress("0x0000000000000000000000000000000000000000")
)
View Source
var WasmCodec *codec.Codec
View Source
var WasmIdent = []byte("\x00\x61\x73\x6D")
Functions ¶
func GetAccountContractListKey ¶
func GetAccountContractListKey(accountAddr sdk.AccAddress) []byte
func GetCodeKey ¶
func GetContractAddressKey ¶
func GetContractAddressKey(addr sdk.AccAddress) []byte
func GetContractStorePrefixKey ¶
func GetContractStorePrefixKey(addr sdk.AccAddress) []byte
func GetWasmerKey ¶
func GetWasmerKey() []byte
func RegisterCodec ¶
Types ¶
type CodeInfo ¶
type CodeInfo struct { CodeHash string `json:"code_hash"` Creator sdk.AccAddress `json:"creator"` }
func NewCodeInfo ¶
func NewCodeInfo(codeHash string, creator sdk.AccAddress) CodeInfo
type CodeInfoParams ¶
type CodeInfoParams struct {
Hash []byte `json:"hash"`
}
func NewQueryCodeInfoParams ¶
func NewQueryCodeInfoParams(hashStr string) CodeInfoParams
type CodeType ¶
const ( CodeCheckParamsError CodeType = 1750 CodeInvalidEndPoint CodeType = 1751 //CodeInvalidMsgError CodeType = 1751 //CodeHandleMsgFailedError CodeType = 1752 //CodeSetSequenceFailedError CodeType = 1753 //CodeInvalidAddress CodeType = 1754 //CodeQueryCodeInfoFailed CodeType = 1755 CodeCdcUnMarshalFailed CodeType = 1756 CodeQueryFailed CodeType = 1757 CodeJsonUnmarshalFailed CodeType = 1758 CodeCdcMarshalFailed CodeType = 1759 CodeGetBlockBloomFailed CodeType = 1760 )
type ContractExistParams ¶
type ContractExistParams struct {
WasmCodeHash []byte `json:"wasm_code_hash"`
}
func NewContractExistParams ¶
func NewContractExistParams(hash []byte) ContractExistParams
type ContractInfo ¶
type ContractInfo struct { CodeInfo CodeInfo `json:"code_info"` Name string `json:"name"` Version string `json:"version"` Author string `json:"author"` Email string `json:"email"` Describe string `json:"describe"` InitMsg json.RawMessage `json:"init_msg"` Created *CreatedAt `json:"created"` }
func NewContractInfo ¶
func NewContractInfo(codeInfo CodeInfo, initMsg []byte, name, version, author, email, describe string, createdAt *CreatedAt) ContractInfo
type ContractInfoParams ¶
type ContractInfoParams struct {
ContractAddress sdk.AccAddress `json:"contract_address"`
}
func NewQueryContractInfoParams ¶
func NewQueryContractInfoParams(contractAddress sdk.AccAddress) ContractInfoParams
type ContractListParams ¶
type ContractListParams struct {
AccountAddress sdk.AccAddress `json:"account_address"`
}
func NewContractListParams ¶
func NewContractListParams(accountAddress sdk.AccAddress) ContractListParams
type ContractListResponse ¶
type ContractListResponse struct {
ContractAddressList []string `json:"contract_address_list"`
}
func NewContractListResponse ¶
func NewContractListResponse(contractList []string) ContractListResponse
type ContractState ¶
type ContractState struct {
Result string `json:"result"`
}
type ContractStateParam ¶
type ContractStateParam struct { ContractAddress sdk.AccAddress `json:"contract_address"` InvokerAddress sdk.AccAddress `json:"invoker_address"` QueryMessage utils.CallData `json:"query_message"` }
func NewContractStateParam ¶
func NewContractStateParam(addr, invokerAddr sdk.AccAddress, msg utils.CallData) ContractStateParam
type CreatedAt ¶
func NewCreatedAt ¶
type GenesisState ¶
type GenesisState struct { Contracts []Contract `json:"contracts"` Invoker string `json:"invoker"` //invoker. Name string `json:"name"` Version string `json:"version"` Author string `json:"author"` Email string `json:"email"` Describe string `json:"describe"` }
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
type MsgExecuteContract ¶
type MsgExecuteContract struct { FromAddress sdk.AccAddress `json:"from_address"` Contract sdk.AccAddress `json:"contract"` Args utils.CallData `json:"args"` }
func NewMsgExecuteContract ¶
func NewMsgExecuteContract(from sdk.AccAddress, contractAddress sdk.AccAddress, msg utils.CallData) *MsgExecuteContract
func (*MsgExecuteContract) Bytes ¶
func (msg *MsgExecuteContract) Bytes() []byte
func (*MsgExecuteContract) GetFromAddress ¶
func (msg *MsgExecuteContract) GetFromAddress() sdk.AccAddress
func (*MsgExecuteContract) MsgType ¶
func (msg *MsgExecuteContract) MsgType() string
func (*MsgExecuteContract) Route ¶
func (msg *MsgExecuteContract) Route() string
func (*MsgExecuteContract) ValidateBasic ¶
func (msg *MsgExecuteContract) ValidateBasic() error
TODO
type MsgInstantiateContract ¶
type MsgInstantiateContract struct { FromAddress sdk.AccAddress `json:"from_address"` CodeHash []byte `json:"code"` Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Author string `json:"author,omitempty"` Email string `json:"email,omitempty"` Describe string `json:"describe,omitempty"` Args utils.CallData `json:"args,omitempty"` }
func NewMsgInstantiateContract ¶
func NewMsgInstantiateContract(codeHash []byte, from sdk.AccAddress, name, version, author, email, describe string, initMsg utils.CallData) *MsgInstantiateContract
func (*MsgInstantiateContract) Bytes ¶
func (msg *MsgInstantiateContract) Bytes() []byte
func (*MsgInstantiateContract) GetFromAddress ¶
func (msg *MsgInstantiateContract) GetFromAddress() sdk.AccAddress
func (*MsgInstantiateContract) MsgType ¶
func (msg *MsgInstantiateContract) MsgType() string
func (*MsgInstantiateContract) Route ¶
func (msg *MsgInstantiateContract) Route() string
func (*MsgInstantiateContract) ValidateBasic ¶
func (msg *MsgInstantiateContract) ValidateBasic() error
TODO
type MsgMigrateContract ¶
type MsgMigrateContract struct { FromAddress sdk.AccAddress `json:"from_address"` CodeHash []byte `json:"code"` Contract sdk.AccAddress `json:"contract"` Name string `json:"name,omitempty"` Version string `json:"version,omitempty"` Author string `json:"author,omitempty"` Email string `json:"email,omitempty"` Describe string `json:"describe,omitempty"` Args utils.CallData `json:"args,omitempty"` }
func NewMsgMigrateContract ¶
func NewMsgMigrateContract(codeHash []byte, from sdk.AccAddress, name, version, author, email, describe string, contract sdk.AccAddress, initMsg utils.CallData) *MsgMigrateContract
func (*MsgMigrateContract) Bytes ¶
func (msg *MsgMigrateContract) Bytes() []byte
func (*MsgMigrateContract) GetFromAddress ¶
func (msg *MsgMigrateContract) GetFromAddress() sdk.AccAddress
func (*MsgMigrateContract) MsgType ¶
func (msg *MsgMigrateContract) MsgType() string
func (*MsgMigrateContract) Route ¶
func (msg *MsgMigrateContract) Route() string
func (*MsgMigrateContract) ValidateBasic ¶
func (msg *MsgMigrateContract) ValidateBasic() error
type MsgUploadContract ¶
type MsgUploadContract struct { FromAddress sdk.AccAddress `json:"from_address"` Code []byte `json:"code"` }
func NewMsgUploadContract ¶
func NewMsgUploadContract(code []byte, from sdk.AccAddress) *MsgUploadContract
func (*MsgUploadContract) Bytes ¶
func (msg *MsgUploadContract) Bytes() []byte
func (*MsgUploadContract) GetFromAddress ¶
func (msg *MsgUploadContract) GetFromAddress() sdk.AccAddress
func (*MsgUploadContract) MsgType ¶
func (msg *MsgUploadContract) MsgType() string
func (*MsgUploadContract) Route ¶
func (msg *MsgUploadContract) Route() string
type Sink ¶
type Sink struct {
// contains filtered or unexported fields
}
func (Sink) ReadString ¶
func (Sink) WriteBytes ¶
func (Sink) WriteString ¶
type WasmConfig ¶
type WasmConfig struct{}
Click to show internal directories.
Click to hide internal directories.