diff --git a/CHANGELOG.md b/CHANGELOG.md index d430930ab8..a648b62249 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ **Features:** +- Refactor to GRPC message server [\#366](https://github.com/CosmWasm/wasmd/pull/366) - Make it easy to initialize contracts in genesis file with new CLI commands[\#326](https://github.com/CosmWasm/wasmd/issues/326) - Upgrade to WasmVM v0.13.0 [\#358](https://github.com/CosmWasm/wasmd/pull/358) - Upgrade to cosmos-sdk v0.40.0-rc6 [\#354](https://github.com/CosmWasm/wasmd/pull/354) diff --git a/Makefile b/Makefile index 4b89bc8222..8ecb8d5afa 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ LEDGER_ENABLED ?= true SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g') # for dockerized protobuf tools -PROTO_CONTAINER := cosmwasm/prototools-docker:latest +PROTO_CONTAINER := cosmwasm/prototools-docker:v0.1.0 DOCKER_BUF := docker run --rm -v $(shell pwd)/buf.yaml:/workspace/buf.yaml -v $(shell go list -f "{{ .Dir }}" -m github.com/cosmos/cosmos-sdk):/workspace/cosmos_sdk_dir -v $(shell pwd):/workspace/wasmd --workdir /workspace $(PROTO_CONTAINER) HTTPS_GIT := https://github.com/CosmWasm/wasmd.git diff --git a/doc/proto.md b/doc/proto.md index 6d83a1162f..c32ecf6109 100644 --- a/doc/proto.md +++ b/doc/proto.md @@ -10,14 +10,6 @@ - [GenesisState.GenMsgs](#cosmwasm.wasm.v1beta1.GenesisState.GenMsgs) - [Sequence](#cosmwasm.wasm.v1beta1.Sequence) -- [x/wasm/internal/types/msg.proto](#x/wasm/internal/types/msg.proto) - - [MsgClearAdmin](#cosmwasm.wasm.v1beta1.MsgClearAdmin) - - [MsgExecuteContract](#cosmwasm.wasm.v1beta1.MsgExecuteContract) - - [MsgInstantiateContract](#cosmwasm.wasm.v1beta1.MsgInstantiateContract) - - [MsgMigrateContract](#cosmwasm.wasm.v1beta1.MsgMigrateContract) - - [MsgStoreCode](#cosmwasm.wasm.v1beta1.MsgStoreCode) - - [MsgUpdateAdmin](#cosmwasm.wasm.v1beta1.MsgUpdateAdmin) - - [x/wasm/internal/types/proposal.proto](#x/wasm/internal/types/proposal.proto) - [ClearAdminProposal](#cosmwasm.wasm.v1beta1.ClearAdminProposal) - [InstantiateContractProposal](#cosmwasm.wasm.v1beta1.InstantiateContractProposal) @@ -25,6 +17,19 @@ - [StoreCodeProposal](#cosmwasm.wasm.v1beta1.StoreCodeProposal) - [UpdateAdminProposal](#cosmwasm.wasm.v1beta1.UpdateAdminProposal) +- [x/wasm/internal/types/types.proto](#x/wasm/internal/types/types.proto) + - [AbsoluteTxPosition](#cosmwasm.wasm.v1beta1.AbsoluteTxPosition) + - [AccessConfig](#cosmwasm.wasm.v1beta1.AccessConfig) + - [AccessTypeParam](#cosmwasm.wasm.v1beta1.AccessTypeParam) + - [CodeInfo](#cosmwasm.wasm.v1beta1.CodeInfo) + - [ContractCodeHistoryEntry](#cosmwasm.wasm.v1beta1.ContractCodeHistoryEntry) + - [ContractInfo](#cosmwasm.wasm.v1beta1.ContractInfo) + - [Model](#cosmwasm.wasm.v1beta1.Model) + - [Params](#cosmwasm.wasm.v1beta1.Params) + + - [AccessType](#cosmwasm.wasm.v1beta1.AccessType) + - [ContractCodeHistoryOperationType](#cosmwasm.wasm.v1beta1.ContractCodeHistoryOperationType) + - [x/wasm/internal/types/query.proto](#x/wasm/internal/types/query.proto) - [CodeInfoResponse](#cosmwasm.wasm.v1beta1.CodeInfoResponse) - [ContractInfoWithAddress](#cosmwasm.wasm.v1beta1.ContractInfoWithAddress) @@ -47,18 +52,21 @@ - [Query](#cosmwasm.wasm.v1beta1.Query) -- [x/wasm/internal/types/types.proto](#x/wasm/internal/types/types.proto) - - [AbsoluteTxPosition](#cosmwasm.wasm.v1beta1.AbsoluteTxPosition) - - [AccessConfig](#cosmwasm.wasm.v1beta1.AccessConfig) - - [AccessTypeParam](#cosmwasm.wasm.v1beta1.AccessTypeParam) - - [CodeInfo](#cosmwasm.wasm.v1beta1.CodeInfo) - - [ContractCodeHistoryEntry](#cosmwasm.wasm.v1beta1.ContractCodeHistoryEntry) - - [ContractInfo](#cosmwasm.wasm.v1beta1.ContractInfo) - - [Model](#cosmwasm.wasm.v1beta1.Model) - - [Params](#cosmwasm.wasm.v1beta1.Params) +- [x/wasm/internal/types/tx.proto](#x/wasm/internal/types/tx.proto) + - [MsgClearAdmin](#cosmwasm.wasm.v1beta1.MsgClearAdmin) + - [MsgClearAdminResponse](#cosmwasm.wasm.v1beta1.MsgClearAdminResponse) + - [MsgExecuteContract](#cosmwasm.wasm.v1beta1.MsgExecuteContract) + - [MsgExecuteContractResponse](#cosmwasm.wasm.v1beta1.MsgExecuteContractResponse) + - [MsgInstantiateContract](#cosmwasm.wasm.v1beta1.MsgInstantiateContract) + - [MsgInstantiateContractResponse](#cosmwasm.wasm.v1beta1.MsgInstantiateContractResponse) + - [MsgMigrateContract](#cosmwasm.wasm.v1beta1.MsgMigrateContract) + - [MsgMigrateContractResponse](#cosmwasm.wasm.v1beta1.MsgMigrateContractResponse) + - [MsgStoreCode](#cosmwasm.wasm.v1beta1.MsgStoreCode) + - [MsgStoreCodeResponse](#cosmwasm.wasm.v1beta1.MsgStoreCodeResponse) + - [MsgUpdateAdmin](#cosmwasm.wasm.v1beta1.MsgUpdateAdmin) + - [MsgUpdateAdminResponse](#cosmwasm.wasm.v1beta1.MsgUpdateAdminResponse) - - [AccessType](#cosmwasm.wasm.v1beta1.AccessType) - - [ContractCodeHistoryOperationType](#cosmwasm.wasm.v1beta1.ContractCodeHistoryOperationType) + - [Msg](#cosmwasm.wasm.v1beta1.Msg) - [Scalar Value Types](#scalar-value-types) @@ -127,7 +135,7 @@ GenesisState - genesis state of x/wasm ### GenesisState.GenMsgs -GenMsgs define the messages that can be executed during genesis phase. +GenMsgs define the messages that can be executed during genesis phase in order. The intention is to have more human readable data that is auditable. @@ -167,59 +175,44 @@ Sequence key and value of an id generation counter - +
-## x/wasm/internal/types/msg.proto - - - - - -### MsgClearAdmin -MsgClearAdmin removes any admin stored for a smart contract - - -| Field | Type | Label | Description | -| ----- | ---- | ----- | ----------- | -| sender | [string](#string) | | Sender is the that actor that signed the messages | -| contract | [string](#string) | | Contract is the address of the smart contract | - - - +## x/wasm/internal/types/proposal.proto - + -### MsgExecuteContract -MsgExecuteContract submits the given message data to a smart contract +### ClearAdminProposal +ClearAdminProposal gov proposal content type to clear the admin of a contract. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| sender | [string](#string) | | Sender is the that actor that signed the messages | +| title | [string](#string) | | Title is a short summary | +| description | [string](#string) | | Description is a human readable text | | contract | [string](#string) | | Contract is the address of the smart contract | -| msg | [bytes](#bytes) | | Msg json encoded message to be passed to the contract | -| sent_funds | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | SentFunds coins that are transferred to the contract on execution | - + -### MsgInstantiateContract -MsgInstantiateContract create a new smart contract instance for the given code id. +### InstantiateContractProposal +InstantiateContractProposal gov proposal content type to instantiate a contract. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| sender | [string](#string) | | Sender is the that actor that signed the messages | +| title | [string](#string) | | Title is a short summary | +| description | [string](#string) | | Description is a human readable text | +| run_as | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender | | admin | [string](#string) | | Admin is an optional address that can execute migrations | | code_id | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | -| label | [string](#string) | | Label is optional metadata to be stored with a contract instance. | +| label | [string](#string) | | Label is optional metadata to be stored with a constract instance. | | init_msg | [bytes](#bytes) | | InitMsg json encoded message to be passed to the contract on instantiation | | init_funds | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | InitFunds coins that are transferred to the contract on instantiation | @@ -228,15 +221,17 @@ MsgInstantiateContract create a new smart contract instance for the given code i - + -### MsgMigrateContract -MsgMigrateContract runs a code upgrade/ downgrade for a smart contract +### MigrateContractProposal +MigrateContractProposal gov proposal content type to migrate a contract. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| sender | [string](#string) | | Sender is the that actor that signed the messages | +| title | [string](#string) | | Title is a short summary | +| description | [string](#string) | | Description is a human readable text | +| run_as | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender | | contract | [string](#string) | | Contract is the address of the smart contract | | code_id | [uint64](#uint64) | | CodeID references the new WASM code | | migrate_msg | [bytes](#bytes) | | MigrateMsg json encoded message to be passed to the contract on migration | @@ -246,34 +241,37 @@ MsgMigrateContract runs a code upgrade/ downgrade for a smart contract - + -### MsgStoreCode -MsgStoreCode submit Wasm code to the system +### StoreCodeProposal +StoreCodeProposal gov proposal content type to submit WASM code to the system | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| sender | [string](#string) | | Sender is the that actor that signed the messages | +| title | [string](#string) | | Title is a short summary | +| description | [string](#string) | | Description is a human readable text | +| run_as | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender | | wasm_byte_code | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | | source | [string](#string) | | Source is a valid absolute HTTPS URI to the contract's source code, optional | | builder | [string](#string) | | Builder is a valid docker image name with tag, optional | -| instantiate_permission | [AccessConfig](#cosmwasm.wasm.v1beta1.AccessConfig) | | InstantiatePermission access control to apply on contract creation, optional | +| instantiate_permission | [AccessConfig](#cosmwasm.wasm.v1beta1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional | - + -### MsgUpdateAdmin -MsgUpdateAdmin sets a new admin for a smart contract +### UpdateAdminProposal +UpdateAdminProposal gov proposal content type to set an admin for a contract. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| sender | [string](#string) | | Sender is the that actor that signed the messages | +| title | [string](#string) | | Title is a short summary | +| description | [string](#string) | | Description is a human readable text | | new_admin | [string](#string) | | NewAdmin address to be set | | contract | [string](#string) | | Contract is the address of the smart contract | @@ -291,105 +289,143 @@ MsgUpdateAdmin sets a new admin for a smart contract - + -## x/wasm/internal/types/proposal.proto +## x/wasm/internal/types/types.proto - + -### ClearAdminProposal -ClearAdminProposal gov proposal content type to clear the admin of a contract. +### AbsoluteTxPosition +AbsoluteTxPosition is a unique transaction position that allows for global ordering of transactions. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| title | [string](#string) | | Title is a short summary | -| description | [string](#string) | | Description is a human readable text | -| contract | [string](#string) | | Contract is the address of the smart contract | +| block_height | [uint64](#uint64) | | BlockHeight is the block the contract was created at | +| tx_index | [uint64](#uint64) | | TxIndex is a monotonic counter within the block (actual transaction index, or gas consumed) | - + -### InstantiateContractProposal -InstantiateContractProposal gov proposal content type to instantiate a contract. +### AccessConfig +AccessConfig access control type. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| title | [string](#string) | | Title is a short summary | -| description | [string](#string) | | Description is a human readable text | -| run_as | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender | -| admin | [string](#string) | | Admin is an optional address that can execute migrations | -| code_id | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | -| label | [string](#string) | | Label is optional metadata to be stored with a constract instance. | -| init_msg | [bytes](#bytes) | | InitMsg json encoded message to be passed to the contract on instantiation | -| init_funds | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | InitFunds coins that are transferred to the contract on instantiation | +| permission | [AccessType](#cosmwasm.wasm.v1beta1.AccessType) | | | +| address | [string](#string) | | | - + -### MigrateContractProposal -MigrateContractProposal gov proposal content type to migrate a contract. +### AccessTypeParam +AccessTypeParam | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| title | [string](#string) | | Title is a short summary | -| description | [string](#string) | | Description is a human readable text | -| run_as | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender | -| contract | [string](#string) | | Contract is the address of the smart contract | -| code_id | [uint64](#uint64) | | CodeID references the new WASM code | -| migrate_msg | [bytes](#bytes) | | MigrateMsg json encoded message to be passed to the contract on migration | +| value | [AccessType](#cosmwasm.wasm.v1beta1.AccessType) | | | - + -### StoreCodeProposal -StoreCodeProposal gov proposal content type to submit WASM code to the system +### CodeInfo +CodeInfo is data for the uploaded contract WASM code | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| title | [string](#string) | | Title is a short summary | -| description | [string](#string) | | Description is a human readable text | -| run_as | [string](#string) | | RunAs is the address that is passed to the contract's environment as sender | -| wasm_byte_code | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | +| code_hash | [bytes](#bytes) | | CodeHash is the unique CodeID | +| creator | [string](#string) | | Creator address who initially stored the code | | source | [string](#string) | | Source is a valid absolute HTTPS URI to the contract's source code, optional | | builder | [string](#string) | | Builder is a valid docker image name with tag, optional | -| instantiate_permission | [AccessConfig](#cosmwasm.wasm.v1beta1.AccessConfig) | | InstantiatePermission to apply on contract creation, optional | +| instantiate_config | [AccessConfig](#cosmwasm.wasm.v1beta1.AccessConfig) | | InstantiateConfig access control to apply on contract creation, optional | - + -### UpdateAdminProposal -UpdateAdminProposal gov proposal content type to set an admin for a contract. +### ContractCodeHistoryEntry +ContractCodeHistoryEntry metadata to a contract. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| title | [string](#string) | | Title is a short summary | -| description | [string](#string) | | Description is a human readable text | -| new_admin | [string](#string) | | NewAdmin address to be set | -| contract | [string](#string) | | Contract is the address of the smart contract | +| operation | [ContractCodeHistoryOperationType](#cosmwasm.wasm.v1beta1.ContractCodeHistoryOperationType) | | | +| code_id | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | +| updated | [AbsoluteTxPosition](#cosmwasm.wasm.v1beta1.AbsoluteTxPosition) | | Updated Tx position when the operation was executed. | +| msg | [bytes](#bytes) | | | + + + + + + + + +### ContractInfo +ContractInfo stores a WASM contract instance + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| code_id | [uint64](#uint64) | | CodeID is the reference to the stored Wasm code | +| creator | [string](#string) | | Creator address who initially instantiated the contract | +| admin | [string](#string) | | Admin is an optional address that can execute migrations | +| label | [string](#string) | | Label is optional metadata to be stored with a contract instance. | +| created | [AbsoluteTxPosition](#cosmwasm.wasm.v1beta1.AbsoluteTxPosition) | | Created Tx position when the contract was instantiated. This data should kept internal and not be exposed via query results. Just use for sorting | + + + + + + + + +### Model +Model is a struct that holds a KV pair + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| key | [bytes](#bytes) | | hex-encode key to read it better (this is often ascii) | +| value | [bytes](#bytes) | | base64-encode raw value | + + + + + + + + +### Params +Params defines the set of wasm parameters. + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| code_upload_access | [AccessConfig](#cosmwasm.wasm.v1beta1.AccessConfig) | | | +| instantiate_default_permission | [AccessType](#cosmwasm.wasm.v1beta1.AccessType) | | | +| max_wasm_code_size | [uint64](#uint64) | | | @@ -397,6 +433,34 @@ UpdateAdminProposal gov proposal content type to set an admin for a contract. + + + +### AccessType +AccessType permission types + +| Name | Number | Description | +| ---- | ------ | ----------- | +| ACCESS_TYPE_UNSPECIFIED | 0 | AccessTypeUnspecified placeholder for empty value | +| ACCESS_TYPE_NOBODY | 1 | AccessTypeNobody forbidden | +| ACCESS_TYPE_ONLY_ADDRESS | 2 | AccessTypeOnlyAddress restricted to an address | +| ACCESS_TYPE_EVERYBODY | 3 | AccessTypeEverybody unrestricted | + + + + + +### ContractCodeHistoryOperationType +ContractCodeHistoryOperationType actions that caused a code change + +| Name | Number | Description | +| ---- | ------ | ----------- | +| CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED | 0 | ContractCodeHistoryOperationTypeUnspecified placeholder for empty value | +| CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT | 1 | ContractCodeHistoryOperationTypeInit on chain contract instantiation | +| CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE | 2 | ContractCodeHistoryOperationTypeMigrate code migration | +| CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS | 3 | ContractCodeHistoryOperationTypeGenesis based on genesis data | + + @@ -724,182 +788,221 @@ Query provides defines the gRPC querier service - + -## x/wasm/internal/types/types.proto +## x/wasm/internal/types/tx.proto - + -### AbsoluteTxPosition -AbsoluteTxPosition is a unique transaction position that allows for global ordering of transactions. +### MsgClearAdmin +MsgClearAdmin removes any admin stored for a smart contract | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| block_height | [uint64](#uint64) | | BlockHeight is the block the contract was created at | -| tx_index | [uint64](#uint64) | | TxIndex is a monotonic counter within the block (actual transaction index, or gas consumed) | +| sender | [string](#string) | | Sender is the that actor that signed the messages | +| contract | [string](#string) | | Contract is the address of the smart contract | - + + +### MsgClearAdminResponse +MsgClearAdminResponse returns empty data + + + -### AccessConfig -AccessConfig access control type. + + + + +### MsgExecuteContract +MsgExecuteContract submits the given message data to a smart contract | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| permission | [AccessType](#cosmwasm.wasm.v1beta1.AccessType) | | | -| address | [string](#string) | | | +| sender | [string](#string) | | Sender is the that actor that signed the messages | +| contract | [string](#string) | | Contract is the address of the smart contract | +| msg | [bytes](#bytes) | | Msg json encoded message to be passed to the contract | +| sent_funds | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | SentFunds coins that are transferred to the contract on execution | - + -### AccessTypeParam -AccessTypeParam +### MsgExecuteContractResponse +MsgExecuteContractResponse returns execution result data. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| value | [AccessType](#cosmwasm.wasm.v1beta1.AccessType) | | | +| data | [bytes](#bytes) | | Data contains base64-encoded bytes to returned from the contract | - + -### CodeInfo -CodeInfo is data for the uploaded contract WASM code +### MsgInstantiateContract +MsgInstantiateContract create a new smart contract instance for the given code id. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| code_hash | [bytes](#bytes) | | CodeHash is the unique CodeID | -| creator | [string](#string) | | Creator address who initially stored the code | -| source | [string](#string) | | Source is a valid absolute HTTPS URI to the contract's source code, optional | -| builder | [string](#string) | | Builder is a valid docker image name with tag, optional | -| instantiate_config | [AccessConfig](#cosmwasm.wasm.v1beta1.AccessConfig) | | InstantiateConfig access control to apply on contract creation, optional | +| sender | [string](#string) | | Sender is the that actor that signed the messages | +| admin | [string](#string) | | Admin is an optional address that can execute migrations | +| code_id | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | +| label | [string](#string) | | Label is optional metadata to be stored with a contract instance. | +| init_msg | [bytes](#bytes) | | InitMsg json encoded message to be passed to the contract on instantiation | +| init_funds | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | InitFunds coins that are transferred to the contract on instantiation | - + -### ContractCodeHistoryEntry -ContractCodeHistoryEntry metadata to a contract. +### MsgInstantiateContractResponse +MsgInstantiateContractResponse return instantiation result data | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| operation | [ContractCodeHistoryOperationType](#cosmwasm.wasm.v1beta1.ContractCodeHistoryOperationType) | | | -| code_id | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | -| updated | [AbsoluteTxPosition](#cosmwasm.wasm.v1beta1.AbsoluteTxPosition) | | Updated Tx position when the operation was executed. | -| msg | [bytes](#bytes) | | | +| address | [string](#string) | | Address is the bech32 address of the new contract instance. | - + -### ContractInfo -ContractInfo stores a WASM contract instance +### MsgMigrateContract +MsgMigrateContract runs a code upgrade/ downgrade for a smart contract | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| code_id | [uint64](#uint64) | | CodeID is the reference to the stored Wasm code | -| creator | [string](#string) | | Creator address who initially instantiated the contract | -| admin | [string](#string) | | Admin is an optional address that can execute migrations | -| label | [string](#string) | | Label is optional metadata to be stored with a contract instance. | -| created | [AbsoluteTxPosition](#cosmwasm.wasm.v1beta1.AbsoluteTxPosition) | | Created Tx position when the contract was instantiated. This data should kept internal and not be exposed via query results. Just use for sorting | +| sender | [string](#string) | | Sender is the that actor that signed the messages | +| contract | [string](#string) | | Contract is the address of the smart contract | +| code_id | [uint64](#uint64) | | CodeID references the new WASM code | +| migrate_msg | [bytes](#bytes) | | MigrateMsg json encoded message to be passed to the contract on migration | - + -### Model -Model is a struct that holds a KV pair +### MsgMigrateContractResponse +MsgMigrateContractResponse returns contract migration result data. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| key | [bytes](#bytes) | | hex-encode key to read it better (this is often ascii) | -| value | [bytes](#bytes) | | base64-encode raw value | +| data | [bytes](#bytes) | | Data contains same raw bytes returned as data from the wasm contract. (May be empty) | - + -### Params -Params defines the set of wasm parameters. +### MsgStoreCode +MsgStoreCode submit Wasm code to the system | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| code_upload_access | [AccessConfig](#cosmwasm.wasm.v1beta1.AccessConfig) | | | -| instantiate_default_permission | [AccessType](#cosmwasm.wasm.v1beta1.AccessType) | | | -| max_wasm_code_size | [uint64](#uint64) | | | +| sender | [string](#string) | | Sender is the that actor that signed the messages | +| wasm_byte_code | [bytes](#bytes) | | WASMByteCode can be raw or gzip compressed | +| source | [string](#string) | | Source is a valid absolute HTTPS URI to the contract's source code, optional | +| builder | [string](#string) | | Builder is a valid docker image name with tag, optional | +| instantiate_permission | [AccessConfig](#cosmwasm.wasm.v1beta1.AccessConfig) | | InstantiatePermission access control to apply on contract creation, optional | - + - +### MsgStoreCodeResponse +MsgStoreCodeResponse returns store result data. -### AccessType -AccessType permission types -| Name | Number | Description | -| ---- | ------ | ----------- | -| ACCESS_TYPE_UNSPECIFIED | 0 | AccessTypeUnspecified placeholder for empty value | -| ACCESS_TYPE_NOBODY | 1 | AccessTypeNobody forbidden | -| ACCESS_TYPE_ONLY_ADDRESS | 2 | AccessTypeOnlyAddress restricted to an address | -| ACCESS_TYPE_EVERYBODY | 3 | AccessTypeEverybody unrestricted | +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| code_id | [uint64](#uint64) | | CodeID is the reference to the stored WASM code | - -### ContractCodeHistoryOperationType -ContractCodeHistoryOperationType actions that caused a code change -| Name | Number | Description | -| ---- | ------ | ----------- | -| CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED | 0 | ContractCodeHistoryOperationTypeUnspecified placeholder for empty value | -| CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT | 1 | ContractCodeHistoryOperationTypeInit on chain contract instantiation | -| CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE | 2 | ContractCodeHistoryOperationTypeMigrate code migration | -| CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS | 3 | ContractCodeHistoryOperationTypeGenesis based on genesis data | + + + +### MsgUpdateAdmin +MsgUpdateAdmin sets a new admin for a smart contract +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| sender | [string](#string) | | Sender is the that actor that signed the messages | +| new_admin | [string](#string) | | NewAdmin address to be set | +| contract | [string](#string) | | Contract is the address of the smart contract | + + + + + + + + +### MsgUpdateAdminResponse +MsgUpdateAdminResponse returns empty data + + + + + + + + + + +### Msg +Msg defines the wasm Msg service. + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| StoreCode | [MsgStoreCode](#cosmwasm.wasm.v1beta1.MsgStoreCode) | [MsgStoreCodeResponse](#cosmwasm.wasm.v1beta1.MsgStoreCodeResponse) | StoreCode to submit Wasm code to the system | +| InstantiateContract | [MsgInstantiateContract](#cosmwasm.wasm.v1beta1.MsgInstantiateContract) | [MsgInstantiateContractResponse](#cosmwasm.wasm.v1beta1.MsgInstantiateContractResponse) | Instantiate creates a new smart contract instance for the given code id. | +| ExecuteContract | [MsgExecuteContract](#cosmwasm.wasm.v1beta1.MsgExecuteContract) | [MsgExecuteContractResponse](#cosmwasm.wasm.v1beta1.MsgExecuteContractResponse) | Execute submits the given message data to a smart contract | +| MigrateContract | [MsgMigrateContract](#cosmwasm.wasm.v1beta1.MsgMigrateContract) | [MsgMigrateContractResponse](#cosmwasm.wasm.v1beta1.MsgMigrateContractResponse) | Migrate runs a code upgrade/ downgrade for a smart contract | +| UpdateAdmin | [MsgUpdateAdmin](#cosmwasm.wasm.v1beta1.MsgUpdateAdmin) | [MsgUpdateAdminResponse](#cosmwasm.wasm.v1beta1.MsgUpdateAdminResponse) | UpdateAdmin sets a new admin for a smart contract | +| ClearAdmin | [MsgClearAdmin](#cosmwasm.wasm.v1beta1.MsgClearAdmin) | [MsgClearAdminResponse](#cosmwasm.wasm.v1beta1.MsgClearAdminResponse) | ClearAdmin removes any admin stored for a smart contract | + diff --git a/x/wasm/alias.go b/x/wasm/alias.go index c52a70cfe6..bd22f274d8 100644 --- a/x/wasm/alias.go +++ b/x/wasm/alias.go @@ -100,31 +100,38 @@ var ( ) type ( - ProposalType = types.ProposalType - GenesisState = types.GenesisState - Code = types.Code - Contract = types.Contract - MsgStoreCode = types.MsgStoreCode - MsgInstantiateContract = types.MsgInstantiateContract - MsgExecuteContract = types.MsgExecuteContract - MsgMigrateContract = types.MsgMigrateContract - MsgUpdateAdmin = types.MsgUpdateAdmin - MsgClearAdmin = types.MsgClearAdmin - Model = types.Model - CodeInfo = types.CodeInfo - ContractInfo = types.ContractInfo - CreatedAt = types.AbsoluteTxPosition - Config = types.WasmConfig - ContractInfoWithAddress = types.ContractInfoWithAddress - CodeInfoResponse = types.CodeInfoResponse - MessageHandler = keeper.MessageHandler - BankEncoder = keeper.BankEncoder - CustomEncoder = keeper.CustomEncoder - StakingEncoder = keeper.StakingEncoder - WasmEncoder = keeper.WasmEncoder - MessageEncoders = keeper.MessageEncoders - Keeper = keeper.Keeper - QueryHandler = keeper.QueryHandler - CustomQuerier = keeper.CustomQuerier - QueryPlugins = keeper.QueryPlugins + ProposalType = types.ProposalType + GenesisState = types.GenesisState + Code = types.Code + Contract = types.Contract + MsgStoreCode = types.MsgStoreCode + MsgStoreCodeResponse = types.MsgStoreCodeResponse + MsgInstantiateContract = types.MsgInstantiateContract + MsgInstantiateContractResponse = types.MsgInstantiateContractResponse + MsgExecuteContract = types.MsgExecuteContract + MsgExecuteContractResponse = types.MsgExecuteContractResponse + MsgMigrateContract = types.MsgMigrateContract + MsgMigrateContractResponse = types.MsgMigrateContractResponse + MsgUpdateAdmin = types.MsgUpdateAdmin + MsgUpdateAdminResponse = types.MsgUpdateAdminResponse + MsgClearAdmin = types.MsgClearAdmin + MsgClearAdminResponse = types.MsgClearAdminResponse + MsgServer = types.MsgServer + Model = types.Model + CodeInfo = types.CodeInfo + ContractInfo = types.ContractInfo + CreatedAt = types.AbsoluteTxPosition + Config = types.WasmConfig + ContractInfoWithAddress = types.ContractInfoWithAddress + CodeInfoResponse = types.CodeInfoResponse + MessageHandler = keeper.MessageHandler + BankEncoder = keeper.BankEncoder + CustomEncoder = keeper.CustomEncoder + StakingEncoder = keeper.StakingEncoder + WasmEncoder = keeper.WasmEncoder + MessageEncoders = keeper.MessageEncoders + Keeper = keeper.Keeper + QueryHandler = keeper.QueryHandler + CustomQuerier = keeper.CustomQuerier + QueryPlugins = keeper.QueryPlugins ) diff --git a/x/wasm/common_test.go b/x/wasm/common_test.go new file mode 100644 index 0000000000..2b2d499ff8 --- /dev/null +++ b/x/wasm/common_test.go @@ -0,0 +1,33 @@ +package wasm + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "testing" +) + +// ensure store code returns the expected response +func assertStoreCodeResponse(t *testing.T, data []byte, expected uint64) { + var pStoreResp MsgStoreCodeResponse + require.NoError(t, pStoreResp.Unmarshal(data)) + require.Equal(t, pStoreResp.CodeID, expected) +} + +// ensure execution returns the expected data +func assertExecuteResponse(t *testing.T, data []byte, expected []byte) { + var pExecResp MsgExecuteContractResponse + require.NoError(t, pExecResp.Unmarshal(data)) + require.Equal(t, pExecResp.Data, expected) +} + +// ensures this returns a valid bech32 address and returns it +func parseInitResponse(t *testing.T, data []byte) string { + var pInstResp MsgInstantiateContractResponse + require.NoError(t, pInstResp.Unmarshal(data)) + require.NotEmpty(t, pInstResp.Address) + addr := pInstResp.Address + // ensure this is a valid sdk address + _, err := sdk.AccAddressFromBech32(addr) + require.NoError(t, err) + return addr +} diff --git a/x/wasm/genesis_test.go b/x/wasm/genesis_test.go index 8bb6f9cd4a..42c621e5f4 100644 --- a/x/wasm/genesis_test.go +++ b/x/wasm/genesis_test.go @@ -22,7 +22,7 @@ func TestInitGenesis(t *testing.T) { msg := MsgStoreCode{ Sender: creator.String(), WASMByteCode: testContract, - Source: "https://github.com/CosmWasm/wasmd/blob/master/x/wasm/testdata/escrow.wasm", + Source: "https://github.com/CosmWasm/wasmd/blob/master/x/wasm/testdata/hackatom.wasm", Builder: "confio/cosmwasm-opt:0.7.0", } err := msg.ValidateBasic() @@ -30,7 +30,7 @@ func TestInitGenesis(t *testing.T) { res, err := h(data.ctx, &msg) require.NoError(t, err) - require.Equal(t, res.Data, []byte("1")) + assertStoreCodeResponse(t, res.Data, 1) _, _, bob := keyPubAddr() initMsg := initMsg{ @@ -48,7 +48,7 @@ func TestInitGenesis(t *testing.T) { } res, err = h(data.ctx, &initCmd) require.NoError(t, err) - contractBech32Addr := string(res.Data) + contractBech32Addr := parseInitResponse(t, res.Data) execCmd := MsgExecuteContract{ Sender: fred.String(), @@ -58,6 +58,8 @@ func TestInitGenesis(t *testing.T) { } res, err = h(data.ctx, &execCmd) require.NoError(t, err) + // from https://github.com/CosmWasm/cosmwasm/blob/master/contracts/hackatom/src/contract.rs#L167 + assertExecuteResponse(t, res.Data, []byte{0xf0, 0x0b, 0xaa}) // ensure all contract state is as after init assertCodeList(t, q, data.ctx, 1) diff --git a/x/wasm/handler.go b/x/wasm/handler.go index 67f38277ab..4ef66bcd3d 100644 --- a/x/wasm/handler.go +++ b/x/wasm/handler.go @@ -2,215 +2,70 @@ package wasm import ( "fmt" - + "github.com/CosmWasm/wasmd/x/wasm/internal/keeper" "github.com/CosmWasm/wasmd/x/wasm/internal/types" + "github.com/gogo/protobuf/proto" + abci "github.com/tendermint/tendermint/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - abci "github.com/tendermint/tendermint/abci/types" ) // NewHandler returns a handler for "bank" type messages. func NewHandler(k *Keeper) sdk.Handler { + msgServer := keeper.NewMsgServerImpl(k) + return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { ctx = ctx.WithEventManager(sdk.NewEventManager()) + var ( + res proto.Message + err error + ) switch msg := msg.(type) { case *MsgStoreCode: - return handleStoreCode(ctx, k, msg) + res, err = msgServer.StoreCode(sdk.WrapSDKContext(ctx), msg) case *MsgInstantiateContract: - return handleInstantiate(ctx, k, msg) + res, err = msgServer.InstantiateContract(sdk.WrapSDKContext(ctx), msg) case *MsgExecuteContract: - return handleExecute(ctx, k, msg) + res, err = msgServer.ExecuteContract(sdk.WrapSDKContext(ctx), msg) case *MsgMigrateContract: - return handleMigration(ctx, k, msg) + res, err = msgServer.MigrateContract(sdk.WrapSDKContext(ctx), msg) case *MsgUpdateAdmin: - return handleUpdateContractAdmin(ctx, k, msg) + res, err = msgServer.UpdateAdmin(sdk.WrapSDKContext(ctx), msg) case *MsgClearAdmin: - return handleClearContractAdmin(ctx, k, msg) + res, err = msgServer.ClearAdmin(sdk.WrapSDKContext(ctx), msg) default: errMsg := fmt.Sprintf("unrecognized wasm message type: %T", msg) return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) } + + ctx = ctx.WithEventManager(filterMessageEvents(ctx)) + return sdk.WrapServiceResult(ctx, res, err) } } -// filterMessageEvents returns the same events with all of type == EventTypeMessage removed. +// filterMessageEvents returns the same events with all of type == EventTypeMessage removed except +// for wasm message types. // this is so only our top-level message event comes through -func filteredMessageEvents(manager *sdk.EventManager) []abci.Event { - events := manager.ABCIEvents() - res := make([]abci.Event, 0, len(events)) - for _, e := range events { - if e.Type != sdk.EventTypeMessage { - res = append(res, e) +func filterMessageEvents(ctx sdk.Context) *sdk.EventManager { + m := sdk.NewEventManager() + for _, e := range ctx.EventManager().Events() { + if e.Type == sdk.EventTypeMessage && + !hasWasmModuleAttribute(e.Attributes) { + continue } + m.EmitEvent(e) } - return res -} - -func handleStoreCode(ctx sdk.Context, k *Keeper, msg *MsgStoreCode) (*sdk.Result, error) { - senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return nil, sdkerrors.Wrap(err, "sender") - } - codeID, err := k.Create(ctx, senderAddr, msg.WASMByteCode, msg.Source, msg.Builder, msg.InstantiatePermission) - if err != nil { - return nil, err - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName), - sdk.NewAttribute(types.AttributeKeySigner, msg.Sender), - sdk.NewAttribute(types.AttributeKeyCodeID, fmt.Sprintf("%d", codeID)), - ), - }) - - return &sdk.Result{ - Data: []byte(fmt.Sprintf("%d", codeID)), - Events: ctx.EventManager().ABCIEvents(), - }, nil + return m } -func handleInstantiate(ctx sdk.Context, k *Keeper, msg *MsgInstantiateContract) (*sdk.Result, error) { - senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return nil, sdkerrors.Wrap(err, "sender") - } - var adminAddr sdk.AccAddress - if msg.Admin != "" { - if adminAddr, err = sdk.AccAddressFromBech32(msg.Admin); err != nil { - return nil, sdkerrors.Wrap(err, "admin") +func hasWasmModuleAttribute(attrs []abci.EventAttribute) bool { + for _, a := range attrs { + if sdk.AttributeKeyModule == string(a.Key) && + types.ModuleName == string(a.Value) { + return true } } - - contractAddr, err := k.Instantiate(ctx, msg.CodeID, senderAddr, adminAddr, msg.InitMsg, msg.Label, msg.InitFunds) - if err != nil { - return nil, err - } - - events := filteredMessageEvents(ctx.EventManager()) - custom := sdk.Events{sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName), - sdk.NewAttribute(types.AttributeKeySigner, msg.Sender), - sdk.NewAttribute(types.AttributeKeyCodeID, fmt.Sprintf("%d", msg.CodeID)), - sdk.NewAttribute(types.AttributeKeyContract, contractAddr.String()), - )} - events = append(events, custom.ToABCIEvents()...) - - return &sdk.Result{ - Data: []byte(contractAddr.String()), - Events: events, - }, nil -} - -func handleExecute(ctx sdk.Context, k *Keeper, msg *MsgExecuteContract) (*sdk.Result, error) { - senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return nil, sdkerrors.Wrap(err, "sender") - } - contractAddr, err := sdk.AccAddressFromBech32(msg.Contract) - if err != nil { - return nil, sdkerrors.Wrap(err, "contract") - } - - res, err := k.Execute(ctx, contractAddr, senderAddr, msg.Msg, msg.SentFunds) - if err != nil { - return nil, err - } - - events := filteredMessageEvents(ctx.EventManager()) - custom := sdk.Events{sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName), - sdk.NewAttribute(types.AttributeKeySigner, msg.Sender), - sdk.NewAttribute(types.AttributeKeyContract, msg.Contract), - ), - } - events = append(events, custom.ToABCIEvents()...) - - res.Events = events - return res, nil -} - -func handleMigration(ctx sdk.Context, k *Keeper, msg *MsgMigrateContract) (*sdk.Result, error) { - senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return nil, sdkerrors.Wrap(err, "sender") - } - contractAddr, err := sdk.AccAddressFromBech32(msg.Contract) - if err != nil { - return nil, sdkerrors.Wrap(err, "contract") - } - - res, err := k.Migrate(ctx, contractAddr, senderAddr, msg.CodeID, msg.MigrateMsg) - if err != nil { - return nil, err - } - - events := filteredMessageEvents(ctx.EventManager()) - custom := sdk.Events{sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName), - sdk.NewAttribute(types.AttributeKeySigner, msg.Sender), - sdk.NewAttribute(types.AttributeKeyContract, msg.Contract), - )} - events = append(events, custom.ToABCIEvents()...) - res.Events = events - return res, nil -} - -func handleUpdateContractAdmin(ctx sdk.Context, k *Keeper, msg *MsgUpdateAdmin) (*sdk.Result, error) { - senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return nil, sdkerrors.Wrap(err, "sender") - } - contractAddr, err := sdk.AccAddressFromBech32(msg.Contract) - if err != nil { - return nil, sdkerrors.Wrap(err, "contract") - } - newAdminAddr, err := sdk.AccAddressFromBech32(msg.NewAdmin) - if err != nil { - return nil, sdkerrors.Wrap(err, "new admin") - } - - if err := k.UpdateContractAdmin(ctx, contractAddr, senderAddr, newAdminAddr); err != nil { - return nil, err - } - events := ctx.EventManager().Events() - ourEvent := sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName), - sdk.NewAttribute(types.AttributeKeySigner, msg.Sender), - sdk.NewAttribute(types.AttributeKeyContract, msg.Contract), - ) - return &sdk.Result{ - Events: append(events, ourEvent).ToABCIEvents(), - }, nil -} - -func handleClearContractAdmin(ctx sdk.Context, k *Keeper, msg *MsgClearAdmin) (*sdk.Result, error) { - senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return nil, sdkerrors.Wrap(err, "sender") - } - contractAddr, err := sdk.AccAddressFromBech32(msg.Contract) - if err != nil { - return nil, sdkerrors.Wrap(err, "contract") - } - - if err := k.ClearContractAdmin(ctx, contractAddr, senderAddr); err != nil { - return nil, err - } - events := ctx.EventManager().Events() - ourEvent := sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName), - sdk.NewAttribute(types.AttributeKeySigner, msg.Sender), - sdk.NewAttribute(types.AttributeKeyContract, msg.Contract), - ) - return &sdk.Result{ - Events: append(events, ourEvent).ToABCIEvents(), - }, nil + return false } diff --git a/x/wasm/internal/keeper/msg_server.go b/x/wasm/internal/keeper/msg_server.go new file mode 100644 index 0000000000..2bf2000319 --- /dev/null +++ b/x/wasm/internal/keeper/msg_server.go @@ -0,0 +1,185 @@ +package keeper + +import ( + "context" + "fmt" + "github.com/CosmWasm/wasmd/x/wasm/internal/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +var _ types.MsgServer = msgServer{} + +type msgServer struct { + keeper *Keeper +} + +func NewMsgServerImpl(k *Keeper) types.MsgServer { + return &msgServer{keeper: k} +} + +func (m msgServer) StoreCode(goCtx context.Context, msg *types.MsgStoreCode) (*types.MsgStoreCodeResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, sdkerrors.Wrap(err, "sender") + } + codeID, err := m.keeper.Create(ctx, senderAddr, msg.WASMByteCode, msg.Source, msg.Builder, msg.InstantiatePermission) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvent(sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeKeySigner, msg.Sender), + sdk.NewAttribute(types.AttributeKeyCodeID, fmt.Sprintf("%d", codeID)), + )) + + return &types.MsgStoreCodeResponse{ + CodeID: codeID, + }, nil +} + +func (m msgServer) InstantiateContract(goCtx context.Context, msg *types.MsgInstantiateContract) (*types.MsgInstantiateContractResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, sdkerrors.Wrap(err, "sender") + } + var adminAddr sdk.AccAddress + if msg.Admin != "" { + if adminAddr, err = sdk.AccAddressFromBech32(msg.Admin); err != nil { + return nil, sdkerrors.Wrap(err, "admin") + } + } + + contractAddr, err := m.keeper.Instantiate(ctx, msg.CodeID, senderAddr, adminAddr, msg.InitMsg, msg.Label, msg.InitFunds) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvent(sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeKeySigner, msg.Sender), + sdk.NewAttribute(types.AttributeKeyCodeID, fmt.Sprintf("%d", msg.CodeID)), + sdk.NewAttribute(types.AttributeKeyContract, contractAddr.String()), + )) + + return &types.MsgInstantiateContractResponse{ + Address: contractAddr.String(), + }, nil +} + +func (m msgServer) ExecuteContract(goCtx context.Context, msg *types.MsgExecuteContract) (*types.MsgExecuteContractResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, sdkerrors.Wrap(err, "sender") + } + contractAddr, err := sdk.AccAddressFromBech32(msg.Contract) + if err != nil { + return nil, sdkerrors.Wrap(err, "contract") + } + + res, err := m.keeper.Execute(ctx, contractAddr, senderAddr, msg.Msg, msg.SentFunds) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvent(sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeKeySigner, msg.Sender), + sdk.NewAttribute(types.AttributeKeyContract, msg.Contract), + )) + + return &types.MsgExecuteContractResponse{ + Data: res.Data, + }, nil + +} + +func (m msgServer) MigrateContract(goCtx context.Context, msg *types.MsgMigrateContract) (*types.MsgMigrateContractResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, sdkerrors.Wrap(err, "sender") + } + contractAddr, err := sdk.AccAddressFromBech32(msg.Contract) + if err != nil { + return nil, sdkerrors.Wrap(err, "contract") + } + + res, err := m.keeper.Migrate(ctx, contractAddr, senderAddr, msg.CodeID, msg.MigrateMsg) + if err != nil { + return nil, err + } + + ctx.EventManager().EmitEvent(sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeKeySigner, msg.Sender), + sdk.NewAttribute(types.AttributeKeyContract, msg.Contract), + )) + + return &types.MsgMigrateContractResponse{ + Data: res.Data, + }, nil +} + +func (m msgServer) UpdateAdmin(goCtx context.Context, msg *types.MsgUpdateAdmin) (*types.MsgUpdateAdminResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, sdkerrors.Wrap(err, "sender") + } + contractAddr, err := sdk.AccAddressFromBech32(msg.Contract) + if err != nil { + return nil, sdkerrors.Wrap(err, "contract") + } + newAdminAddr, err := sdk.AccAddressFromBech32(msg.NewAdmin) + if err != nil { + return nil, sdkerrors.Wrap(err, "new admin") + } + + if err := m.keeper.UpdateContractAdmin(ctx, contractAddr, senderAddr, newAdminAddr); err != nil { + return nil, err + } + + ctx.EventManager().EmitEvent(sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeKeySigner, msg.Sender), + sdk.NewAttribute(types.AttributeKeyContract, msg.Contract), + )) + + return &types.MsgUpdateAdminResponse{}, nil +} + +func (m msgServer) ClearAdmin(goCtx context.Context, msg *types.MsgClearAdmin) (*types.MsgClearAdminResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + senderAddr, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, sdkerrors.Wrap(err, "sender") + } + contractAddr, err := sdk.AccAddressFromBech32(msg.Contract) + if err != nil { + return nil, sdkerrors.Wrap(err, "contract") + } + + if err := m.keeper.ClearContractAdmin(ctx, contractAddr, senderAddr); err != nil { + return nil, err + } + + ctx.EventManager().EmitEvent(sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.ModuleName), + sdk.NewAttribute(types.AttributeKeySigner, msg.Sender), + sdk.NewAttribute(types.AttributeKeyContract, msg.Contract), + )) + + return &types.MsgClearAdminResponse{}, nil +} diff --git a/x/wasm/internal/types/codec.go b/x/wasm/internal/types/codec.go index 0015caf587..c8b3aef2d4 100644 --- a/x/wasm/internal/types/codec.go +++ b/x/wasm/internal/types/codec.go @@ -5,6 +5,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) @@ -42,6 +43,8 @@ func RegisterInterfaces(registry types.InterfaceRegistry) { &UpdateAdminProposal{}, &ClearAdminProposal{}, ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } var ( diff --git a/x/wasm/internal/types/genesis.pb.go b/x/wasm/internal/types/genesis.pb.go index 172d0061d4..067c8e5a64 100644 --- a/x/wasm/internal/types/genesis.pb.go +++ b/x/wasm/internal/types/genesis.pb.go @@ -100,7 +100,7 @@ func (m *GenesisState) GetGenMsgs() []GenesisState_GenMsgs { return nil } -// GenMsgs define the messages that can be executed during genesis phase. +// GenMsgs define the messages that can be executed during genesis phase in order. // The intention is to have more human readable data that is auditable. type GenesisState_GenMsgs struct { // sum is a single message @@ -390,47 +390,47 @@ func init() { } var fileDescriptor_52f9f2715025dba8 = []byte{ - // 639 bytes of a gzipped FileDescriptorProto + // 638 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x94, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x86, 0xe3, 0x26, 0x4e, 0x93, 0x6d, 0xa0, 0xd5, 0xb6, 0x88, 0x28, 0xa5, 0x71, 0x49, 0x2e, + 0x10, 0x86, 0xe3, 0x26, 0x4e, 0x93, 0x69, 0xa0, 0xd5, 0xb6, 0x88, 0x28, 0xa5, 0x4e, 0x49, 0x2e, 0xad, 0x80, 0x98, 0x96, 0x23, 0x27, 0xdc, 0x22, 0x9a, 0x56, 0x45, 0xc8, 0x95, 0x40, 0xea, 0x25, - 0x72, 0xec, 0xa9, 0xb1, 0xa8, 0xbd, 0x21, 0xb3, 0x29, 0xf5, 0x4b, 0x20, 0xc4, 0x53, 0xf5, 0xd8, - 0x23, 0xa7, 0x08, 0xa5, 0x37, 0x9e, 0x02, 0x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 0xd0, 0x7e, 0xcf, 0x0d, 0xed, 0xc7, 0xb5, 0x51, 0xba, 0xba, 0x36, 0x4a, 0xbf, 0xae, 0x8d, + 0xd2, 0xe9, 0x4b, 0x3f, 0xe0, 0x9f, 0x27, 0xc3, 0x9e, 0x4b, 0x43, 0x73, 0x8f, 0xb2, 0xf0, 0x93, + 0x78, 0xb9, 0x44, 0x6a, 0x9e, 0x39, 0x55, 0xbf, 0xb7, 0xdf, 0xb1, 0x61, 0x55, 0xbe, 0x62, 0xaf, + 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0x65, 0x4f, 0x62, 0x92, 0x5c, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/wasm/internal/types/genesis.proto b/x/wasm/internal/types/genesis.proto index 806a5b0915..1564306278 100644 --- a/x/wasm/internal/types/genesis.proto +++ b/x/wasm/internal/types/genesis.proto @@ -3,7 +3,7 @@ package cosmwasm.wasm.v1beta1; import "gogoproto/gogo.proto"; import "x/wasm/internal/types/types.proto"; -import "x/wasm/internal/types/msg.proto"; +import "x/wasm/internal/types/tx.proto"; option go_package = "github.com/CosmWasm/wasmd/x/wasmd/internal/types"; diff --git a/x/wasm/internal/types/msg.pb.go b/x/wasm/internal/types/msg.pb.go deleted file mode 100644 index a8c02b34c3..0000000000 --- a/x/wasm/internal/types/msg.pb.go +++ /dev/null @@ -1,2003 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: x/wasm/internal/types/msg.proto - -package types - -import ( - encoding_json "encoding/json" - fmt "fmt" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgStoreCode submit Wasm code to the system -type MsgStoreCode struct { - // Sender is the that actor that signed the messages - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - // WASMByteCode can be raw or gzip compressed - WASMByteCode []byte `protobuf:"bytes,2,opt,name=wasm_byte_code,json=wasmByteCode,proto3" json:"wasm_byte_code,omitempty"` - // Source is a valid absolute HTTPS URI to the contract's source code, optional - Source string `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"` - // Builder is a valid docker image name with tag, optional - Builder string `protobuf:"bytes,4,opt,name=builder,proto3" json:"builder,omitempty"` - // InstantiatePermission access control to apply on contract creation, optional - InstantiatePermission *AccessConfig `protobuf:"bytes,5,opt,name=instantiate_permission,json=instantiatePermission,proto3" json:"instantiate_permission,omitempty"` -} - -func (m *MsgStoreCode) Reset() { *m = MsgStoreCode{} } -func (m *MsgStoreCode) String() string { return proto.CompactTextString(m) } -func (*MsgStoreCode) ProtoMessage() {} -func (*MsgStoreCode) Descriptor() ([]byte, []int) { - return fileDescriptor_22c4d58a052e9e95, []int{0} -} -func (m *MsgStoreCode) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgStoreCode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgStoreCode.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgStoreCode) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgStoreCode.Merge(m, src) -} -func (m *MsgStoreCode) XXX_Size() int { - return m.Size() -} -func (m *MsgStoreCode) XXX_DiscardUnknown() { - xxx_messageInfo_MsgStoreCode.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgStoreCode proto.InternalMessageInfo - -// MsgInstantiateContract create a new smart contract instance for the given code id. -type MsgInstantiateContract struct { - // Sender is the that actor that signed the messages - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - // Admin is an optional address that can execute migrations - Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` - // CodeID is the reference to the stored WASM code - CodeID uint64 `protobuf:"varint,3,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` - // Label is optional metadata to be stored with a contract instance. - Label string `protobuf:"bytes,4,opt,name=label,proto3" json:"label,omitempty"` - // InitMsg json encoded message to be passed to the contract on instantiation - InitMsg encoding_json.RawMessage `protobuf:"bytes,5,opt,name=init_msg,json=initMsg,proto3,casttype=encoding/json.RawMessage" json:"init_msg,omitempty"` - // InitFunds coins that are transferred to the contract on instantiation - InitFunds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=init_funds,json=initFunds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"init_funds"` -} - -func (m *MsgInstantiateContract) Reset() { *m = MsgInstantiateContract{} } -func (m *MsgInstantiateContract) String() string { return proto.CompactTextString(m) } -func (*MsgInstantiateContract) ProtoMessage() {} -func (*MsgInstantiateContract) Descriptor() ([]byte, []int) { - return fileDescriptor_22c4d58a052e9e95, []int{1} -} -func (m *MsgInstantiateContract) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgInstantiateContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgInstantiateContract.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgInstantiateContract) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgInstantiateContract.Merge(m, src) -} -func (m *MsgInstantiateContract) XXX_Size() int { - return m.Size() -} -func (m *MsgInstantiateContract) XXX_DiscardUnknown() { - xxx_messageInfo_MsgInstantiateContract.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgInstantiateContract proto.InternalMessageInfo - -// MsgExecuteContract submits the given message data to a smart contract -type MsgExecuteContract struct { - // Sender is the that actor that signed the messages - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - // Contract is the address of the smart contract - Contract string `protobuf:"bytes,2,opt,name=contract,proto3" json:"contract,omitempty"` - // Msg json encoded message to be passed to the contract - Msg encoding_json.RawMessage `protobuf:"bytes,3,opt,name=msg,proto3,casttype=encoding/json.RawMessage" json:"msg,omitempty"` - // SentFunds coins that are transferred to the contract on execution - SentFunds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,5,rep,name=sent_funds,json=sentFunds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"sent_funds"` -} - -func (m *MsgExecuteContract) Reset() { *m = MsgExecuteContract{} } -func (m *MsgExecuteContract) String() string { return proto.CompactTextString(m) } -func (*MsgExecuteContract) ProtoMessage() {} -func (*MsgExecuteContract) Descriptor() ([]byte, []int) { - return fileDescriptor_22c4d58a052e9e95, []int{2} -} -func (m *MsgExecuteContract) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgExecuteContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgExecuteContract.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgExecuteContract) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgExecuteContract.Merge(m, src) -} -func (m *MsgExecuteContract) XXX_Size() int { - return m.Size() -} -func (m *MsgExecuteContract) XXX_DiscardUnknown() { - xxx_messageInfo_MsgExecuteContract.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgExecuteContract proto.InternalMessageInfo - -// MsgMigrateContract runs a code upgrade/ downgrade for a smart contract -type MsgMigrateContract struct { - // Sender is the that actor that signed the messages - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - // Contract is the address of the smart contract - Contract string `protobuf:"bytes,2,opt,name=contract,proto3" json:"contract,omitempty"` - // CodeID references the new WASM code - CodeID uint64 `protobuf:"varint,3,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` - // MigrateMsg json encoded message to be passed to the contract on migration - MigrateMsg encoding_json.RawMessage `protobuf:"bytes,4,opt,name=migrate_msg,json=migrateMsg,proto3,casttype=encoding/json.RawMessage" json:"migrate_msg,omitempty"` -} - -func (m *MsgMigrateContract) Reset() { *m = MsgMigrateContract{} } -func (m *MsgMigrateContract) String() string { return proto.CompactTextString(m) } -func (*MsgMigrateContract) ProtoMessage() {} -func (*MsgMigrateContract) Descriptor() ([]byte, []int) { - return fileDescriptor_22c4d58a052e9e95, []int{3} -} -func (m *MsgMigrateContract) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgMigrateContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgMigrateContract.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgMigrateContract) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgMigrateContract.Merge(m, src) -} -func (m *MsgMigrateContract) XXX_Size() int { - return m.Size() -} -func (m *MsgMigrateContract) XXX_DiscardUnknown() { - xxx_messageInfo_MsgMigrateContract.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgMigrateContract proto.InternalMessageInfo - -// MsgUpdateAdmin sets a new admin for a smart contract -type MsgUpdateAdmin struct { - // Sender is the that actor that signed the messages - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - // NewAdmin address to be set - NewAdmin string `protobuf:"bytes,2,opt,name=new_admin,json=newAdmin,proto3" json:"new_admin,omitempty"` - // Contract is the address of the smart contract - Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty"` -} - -func (m *MsgUpdateAdmin) Reset() { *m = MsgUpdateAdmin{} } -func (m *MsgUpdateAdmin) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateAdmin) ProtoMessage() {} -func (*MsgUpdateAdmin) Descriptor() ([]byte, []int) { - return fileDescriptor_22c4d58a052e9e95, []int{4} -} -func (m *MsgUpdateAdmin) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateAdmin.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgUpdateAdmin) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateAdmin.Merge(m, src) -} -func (m *MsgUpdateAdmin) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateAdmin) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateAdmin.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateAdmin proto.InternalMessageInfo - -// MsgClearAdmin removes any admin stored for a smart contract -type MsgClearAdmin struct { - // Sender is the that actor that signed the messages - Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - // Contract is the address of the smart contract - Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty"` -} - -func (m *MsgClearAdmin) Reset() { *m = MsgClearAdmin{} } -func (m *MsgClearAdmin) String() string { return proto.CompactTextString(m) } -func (*MsgClearAdmin) ProtoMessage() {} -func (*MsgClearAdmin) Descriptor() ([]byte, []int) { - return fileDescriptor_22c4d58a052e9e95, []int{5} -} -func (m *MsgClearAdmin) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgClearAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgClearAdmin.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgClearAdmin) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgClearAdmin.Merge(m, src) -} -func (m *MsgClearAdmin) XXX_Size() int { - return m.Size() -} -func (m *MsgClearAdmin) XXX_DiscardUnknown() { - xxx_messageInfo_MsgClearAdmin.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgClearAdmin proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgStoreCode)(nil), "cosmwasm.wasm.v1beta1.MsgStoreCode") - proto.RegisterType((*MsgInstantiateContract)(nil), "cosmwasm.wasm.v1beta1.MsgInstantiateContract") - proto.RegisterType((*MsgExecuteContract)(nil), "cosmwasm.wasm.v1beta1.MsgExecuteContract") - proto.RegisterType((*MsgMigrateContract)(nil), "cosmwasm.wasm.v1beta1.MsgMigrateContract") - proto.RegisterType((*MsgUpdateAdmin)(nil), "cosmwasm.wasm.v1beta1.MsgUpdateAdmin") - proto.RegisterType((*MsgClearAdmin)(nil), "cosmwasm.wasm.v1beta1.MsgClearAdmin") -} - -func init() { proto.RegisterFile("x/wasm/internal/types/msg.proto", fileDescriptor_22c4d58a052e9e95) } - -var fileDescriptor_22c4d58a052e9e95 = []byte{ - // 634 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0xc7, 0xe3, 0xa6, 0x4d, 0x9b, 0x6d, 0xbe, 0xea, 0x93, 0xd5, 0x56, 0xa6, 0x20, 0x27, 0xa4, - 0x97, 0x5c, 0xb0, 0xdb, 0x22, 0xc1, 0x89, 0x43, 0x63, 0x40, 0xea, 0xc1, 0x08, 0xb9, 0x42, 0x95, - 0x7a, 0x89, 0xd6, 0xf6, 0x74, 0x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x43, 0x16, 0xe3, 0x21, - 0xef, 0xeb, 0x46, 0xf3, 0x26, 0x71, 0x19, 0xda, 0x87, 0x64, 0x9d, 0x0b, 0x54, 0x54, 0x28, 0x4e, - 0x15, 0xf4, 0x06, 0x90, 0x67, 0x1c, 0x91, 0x4b, 0xe1, 0x2c, 0xb4, 0xac, 0xce, 0xf2, 0xce, 0xa6, - 0x77, 0xe3, 0x8c, 0xbc, 0xdd, 0x24, 0x01, 0xc4, 0x40, 0x8a, 0x23, 0xce, 0xa2, 0xb5, 0x29, 0x8b, - 0xd7, 0x57, 0x0e, 0xed, 0x8f, 0x73, 0x64, 0x3d, 0x44, 0xb6, 0xf7, 0x27, 0x19, 0x48, 0xa1, 0x72, - 0x9a, 0xa8, 0x5b, 0xc1, 0x57, 0xc9, 0x02, 0x4d, 0x33, 0x2e, 0x0c, 0x6f, 0x3d, 0x2a, 0x02, 0x7b, - 0x93, 0x2c, 0xea, 0x21, 0xf4, 0x78, 0x6a, 0xb8, 0xe6, 0xbb, 0x64, 0x32, 0x6e, 0xd6, 0x34, 0xf1, - 0xde, 0xf3, 0xa8, 0xa6, 0x53, 0x7b, 0xa9, 0x2e, 0xed, 0xd3, 0x18, 0xfa, 0x25, 0x61, 0x11, 0xd8, - 0x4f, 0xc9, 0x12, 0x17, 0x5c, 0xf5, 0x32, 0x64, 0x86, 0xa8, 0xd1, 0x7d, 0xf0, 0x6b, 0xdc, 0x74, - 0x40, 0x24, 0x32, 0xe5, 0x82, 0xf9, 0xc7, 0x28, 0x85, 0x17, 0xd1, 0x51, 0x08, 0x88, 0x94, 0x41, - 0xb4, 0xa8, 0xd5, 0x21, 0x32, 0xfb, 0x98, 0x10, 0x53, 0x78, 0x34, 0x14, 0x29, 0x3a, 0xb5, 0x56, - 0xb5, 0xb3, 0xbc, 0x73, 0xcf, 0x2b, 0x76, 0xc0, 0xd3, 0x3b, 0x70, 0x35, 0x8a, 0x40, 0x72, 0xd1, - 0xdd, 0x3a, 0x1b, 0x37, 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 0xf4, 0x1d, 0xa5, 0x3f, 0xe5, - 0xd4, 0x3f, 0x29, 0xdf, 0xd7, 0x6f, 0xac, 0xb8, 0x66, 0x2e, 0xab, 0xc7, 0xbf, 0x03, 0x00, 0x00, - 0xff, 0xff, 0xa4, 0x16, 0x75, 0xf1, 0x3f, 0x05, 0x00, 0x00, -} - -func (m *MsgStoreCode) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgStoreCode) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgStoreCode) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.InstantiatePermission != nil { - { - size, err := m.InstantiatePermission.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMsg(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - if len(m.Builder) > 0 { - i -= len(m.Builder) - copy(dAtA[i:], m.Builder) - i = encodeVarintMsg(dAtA, i, uint64(len(m.Builder))) - i-- - dAtA[i] = 0x22 - } - if len(m.Source) > 0 { - i -= len(m.Source) - copy(dAtA[i:], m.Source) - i = encodeVarintMsg(dAtA, i, uint64(len(m.Source))) - i-- - dAtA[i] = 0x1a - } - if len(m.WASMByteCode) > 0 { - i -= len(m.WASMByteCode) - copy(dAtA[i:], m.WASMByteCode) - i = encodeVarintMsg(dAtA, i, uint64(len(m.WASMByteCode))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintMsg(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgInstantiateContract) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgInstantiateContract) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgInstantiateContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.InitFunds) > 0 { - for iNdEx := len(m.InitFunds) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.InitFunds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMsg(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if len(m.InitMsg) > 0 { - i -= len(m.InitMsg) - copy(dAtA[i:], m.InitMsg) - i = encodeVarintMsg(dAtA, i, uint64(len(m.InitMsg))) - i-- - dAtA[i] = 0x2a - } - if len(m.Label) > 0 { - i -= len(m.Label) - copy(dAtA[i:], m.Label) - i = encodeVarintMsg(dAtA, i, uint64(len(m.Label))) - i-- - dAtA[i] = 0x22 - } - if m.CodeID != 0 { - i = encodeVarintMsg(dAtA, i, uint64(m.CodeID)) - i-- - dAtA[i] = 0x18 - } - if len(m.Admin) > 0 { - i -= len(m.Admin) - copy(dAtA[i:], m.Admin) - i = encodeVarintMsg(dAtA, i, uint64(len(m.Admin))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintMsg(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgExecuteContract) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgExecuteContract) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgExecuteContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.SentFunds) > 0 { - for iNdEx := len(m.SentFunds) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.SentFunds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMsg(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } - if len(m.Msg) > 0 { - i -= len(m.Msg) - copy(dAtA[i:], m.Msg) - i = encodeVarintMsg(dAtA, i, uint64(len(m.Msg))) - i-- - dAtA[i] = 0x1a - } - if len(m.Contract) > 0 { - i -= len(m.Contract) - copy(dAtA[i:], m.Contract) - i = encodeVarintMsg(dAtA, i, uint64(len(m.Contract))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintMsg(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgMigrateContract) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgMigrateContract) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgMigrateContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.MigrateMsg) > 0 { - i -= len(m.MigrateMsg) - copy(dAtA[i:], m.MigrateMsg) - i = encodeVarintMsg(dAtA, i, uint64(len(m.MigrateMsg))) - i-- - dAtA[i] = 0x22 - } - if m.CodeID != 0 { - i = encodeVarintMsg(dAtA, i, uint64(m.CodeID)) - i-- - dAtA[i] = 0x18 - } - if len(m.Contract) > 0 { - i -= len(m.Contract) - copy(dAtA[i:], m.Contract) - i = encodeVarintMsg(dAtA, i, uint64(len(m.Contract))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintMsg(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateAdmin) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgUpdateAdmin) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateAdmin) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Contract) > 0 { - i -= len(m.Contract) - copy(dAtA[i:], m.Contract) - i = encodeVarintMsg(dAtA, i, uint64(len(m.Contract))) - i-- - dAtA[i] = 0x1a - } - if len(m.NewAdmin) > 0 { - i -= len(m.NewAdmin) - copy(dAtA[i:], m.NewAdmin) - i = encodeVarintMsg(dAtA, i, uint64(len(m.NewAdmin))) - i-- - dAtA[i] = 0x12 - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintMsg(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgClearAdmin) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgClearAdmin) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgClearAdmin) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Contract) > 0 { - i -= len(m.Contract) - copy(dAtA[i:], m.Contract) - i = encodeVarintMsg(dAtA, i, uint64(len(m.Contract))) - i-- - dAtA[i] = 0x1a - } - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintMsg(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintMsg(dAtA []byte, offset int, v uint64) int { - offset -= sovMsg(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgStoreCode) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - l = len(m.WASMByteCode) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - l = len(m.Source) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - l = len(m.Builder) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - if m.InstantiatePermission != nil { - l = m.InstantiatePermission.Size() - n += 1 + l + sovMsg(uint64(l)) - } - return n -} - -func (m *MsgInstantiateContract) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - l = len(m.Admin) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - if m.CodeID != 0 { - n += 1 + sovMsg(uint64(m.CodeID)) - } - l = len(m.Label) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - l = len(m.InitMsg) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - if len(m.InitFunds) > 0 { - for _, e := range m.InitFunds { - l = e.Size() - n += 1 + l + sovMsg(uint64(l)) - } - } - return n -} - -func (m *MsgExecuteContract) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - l = len(m.Contract) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - l = len(m.Msg) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - if len(m.SentFunds) > 0 { - for _, e := range m.SentFunds { - l = e.Size() - n += 1 + l + sovMsg(uint64(l)) - } - } - return n -} - -func (m *MsgMigrateContract) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - l = len(m.Contract) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - if m.CodeID != 0 { - n += 1 + sovMsg(uint64(m.CodeID)) - } - l = len(m.MigrateMsg) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - return n -} - -func (m *MsgUpdateAdmin) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - l = len(m.NewAdmin) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - l = len(m.Contract) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - return n -} - -func (m *MsgClearAdmin) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - l = len(m.Contract) - if l > 0 { - n += 1 + l + sovMsg(uint64(l)) - } - return n -} - -func sovMsg(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozMsg(x uint64) (n int) { - return sovMsg(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgStoreCode: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgStoreCode: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WASMByteCode", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.WASMByteCode = append(m.WASMByteCode[:0], dAtA[iNdEx:postIndex]...) - if m.WASMByteCode == nil { - m.WASMByteCode = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Source = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Builder", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Builder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InstantiatePermission", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.InstantiatePermission == nil { - m.InstantiatePermission = &AccessConfig{} - } - if err := m.InstantiatePermission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMsg(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMsg - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMsg - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgInstantiateContract) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgInstantiateContract: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgInstantiateContract: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Admin = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType) - } - m.CodeID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CodeID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Label = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitMsg", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InitMsg = append(m.InitMsg[:0], dAtA[iNdEx:postIndex]...) - if m.InitMsg == nil { - m.InitMsg = []byte{} - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitFunds", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InitFunds = append(m.InitFunds, types.Coin{}) - if err := m.InitFunds[len(m.InitFunds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMsg(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMsg - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMsg - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgExecuteContract) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgExecuteContract: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgExecuteContract: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Contract = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...) - if m.Msg == nil { - m.Msg = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SentFunds", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SentFunds = append(m.SentFunds, types.Coin{}) - if err := m.SentFunds[len(m.SentFunds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMsg(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMsg - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMsg - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgMigrateContract) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgMigrateContract: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgMigrateContract: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Contract = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType) - } - m.CodeID = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CodeID |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MigrateMsg", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MigrateMsg = append(m.MigrateMsg[:0], dAtA[iNdEx:postIndex]...) - if m.MigrateMsg == nil { - m.MigrateMsg = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMsg(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMsg - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMsg - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgUpdateAdmin) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateAdmin: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateAdmin: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NewAdmin = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Contract = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMsg(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMsg - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMsg - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgClearAdmin) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgClearAdmin: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgClearAdmin: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMsg - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthMsg - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMsg - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Contract = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMsg(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthMsg - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthMsg - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipMsg(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMsg - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMsg - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMsg - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthMsg - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupMsg - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthMsg - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthMsg = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMsg = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupMsg = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/wasm/internal/types/msg.proto b/x/wasm/internal/types/msg.proto deleted file mode 100644 index e58842865b..0000000000 --- a/x/wasm/internal/types/msg.proto +++ /dev/null @@ -1,84 +0,0 @@ -syntax = "proto3"; -package cosmwasm.wasm.v1beta1; - - -import "gogoproto/gogo.proto"; -import "cosmos/base/v1beta1/coin.proto"; -import "x/wasm/internal/types/types.proto"; - -option go_package = "github.com/CosmWasm/wasmd/x/wasmd/internal/types"; -option (gogoproto.goproto_getters_all) = false; - - -// MsgStoreCode submit Wasm code to the system -message MsgStoreCode { - // Sender is the that actor that signed the messages - string sender = 1; - // WASMByteCode can be raw or gzip compressed - bytes wasm_byte_code = 2 [(gogoproto.customname) = "WASMByteCode"]; - // Source is a valid absolute HTTPS URI to the contract's source code, optional - string source = 3; - // Builder is a valid docker image name with tag, optional - string builder = 4; - // InstantiatePermission access control to apply on contract creation, optional - AccessConfig instantiate_permission = 5; -} - -// MsgInstantiateContract create a new smart contract instance for the given code id. -message MsgInstantiateContract { - // Sender is the that actor that signed the messages - string sender = 1; - // Admin is an optional address that can execute migrations - string admin = 2; - // CodeID is the reference to the stored WASM code - uint64 code_id = 3 [(gogoproto.customname) = "CodeID"]; - // Label is optional metadata to be stored with a contract instance. - string label = 4; - // InitMsg json encoded message to be passed to the contract on instantiation - bytes init_msg = 5 [(gogoproto.casttype) = "encoding/json.RawMessage"]; - // InitFunds coins that are transferred to the contract on instantiation - repeated cosmos.base.v1beta1.Coin init_funds = 6 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; -} - -// MsgExecuteContract submits the given message data to a smart contract -message MsgExecuteContract { - // Sender is the that actor that signed the messages - string sender = 1; - // Contract is the address of the smart contract - string contract = 2; - // Msg json encoded message to be passed to the contract - bytes msg = 3 [(gogoproto.casttype) = "encoding/json.RawMessage"]; - // SentFunds coins that are transferred to the contract on execution - repeated cosmos.base.v1beta1.Coin sent_funds = 5 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; -} - -// MsgMigrateContract runs a code upgrade/ downgrade for a smart contract -message MsgMigrateContract { - // Sender is the that actor that signed the messages - string sender = 1; - // Contract is the address of the smart contract - string contract = 2; - // CodeID references the new WASM code - uint64 code_id = 3 [(gogoproto.customname) = "CodeID"]; - // MigrateMsg json encoded message to be passed to the contract on migration - bytes migrate_msg = 4 [(gogoproto.casttype) = "encoding/json.RawMessage"]; -} - -// MsgUpdateAdmin sets a new admin for a smart contract -message MsgUpdateAdmin { - // Sender is the that actor that signed the messages - string sender = 1; - // NewAdmin address to be set - string new_admin = 2; - // Contract is the address of the smart contract - string contract = 3; -} - - -// MsgClearAdmin removes any admin stored for a smart contract -message MsgClearAdmin { - // Sender is the that actor that signed the messages - string sender = 1; - // Contract is the address of the smart contract - string contract = 3; -} diff --git a/x/wasm/internal/types/msg.go b/x/wasm/internal/types/tx.go similarity index 100% rename from x/wasm/internal/types/msg.go rename to x/wasm/internal/types/tx.go diff --git a/x/wasm/internal/types/tx.pb.go b/x/wasm/internal/types/tx.pb.go new file mode 100644 index 0000000000..7399d9ee8c --- /dev/null +++ b/x/wasm/internal/types/tx.pb.go @@ -0,0 +1,3199 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: x/wasm/internal/types/tx.proto + +package types + +import ( + context "context" + encoding_json "encoding/json" + fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// MsgStoreCode submit Wasm code to the system +type MsgStoreCode struct { + // Sender is the that actor that signed the messages + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + // WASMByteCode can be raw or gzip compressed + WASMByteCode []byte `protobuf:"bytes,2,opt,name=wasm_byte_code,json=wasmByteCode,proto3" json:"wasm_byte_code,omitempty"` + // Source is a valid absolute HTTPS URI to the contract's source code, optional + Source string `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"` + // Builder is a valid docker image name with tag, optional + Builder string `protobuf:"bytes,4,opt,name=builder,proto3" json:"builder,omitempty"` + // InstantiatePermission access control to apply on contract creation, optional + InstantiatePermission *AccessConfig `protobuf:"bytes,5,opt,name=instantiate_permission,json=instantiatePermission,proto3" json:"instantiate_permission,omitempty"` +} + +func (m *MsgStoreCode) Reset() { *m = MsgStoreCode{} } +func (m *MsgStoreCode) String() string { return proto.CompactTextString(m) } +func (*MsgStoreCode) ProtoMessage() {} +func (*MsgStoreCode) Descriptor() ([]byte, []int) { + return fileDescriptor_5129e02f2349864e, []int{0} +} +func (m *MsgStoreCode) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgStoreCode) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgStoreCode.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgStoreCode) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgStoreCode.Merge(m, src) +} +func (m *MsgStoreCode) XXX_Size() int { + return m.Size() +} +func (m *MsgStoreCode) XXX_DiscardUnknown() { + xxx_messageInfo_MsgStoreCode.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgStoreCode proto.InternalMessageInfo + +// MsgStoreCodeResponse returns store result data. +type MsgStoreCodeResponse struct { + // CodeID is the reference to the stored WASM code + CodeID uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` +} + +func (m *MsgStoreCodeResponse) Reset() { *m = MsgStoreCodeResponse{} } +func (m *MsgStoreCodeResponse) String() string { return proto.CompactTextString(m) } +func (*MsgStoreCodeResponse) ProtoMessage() {} +func (*MsgStoreCodeResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5129e02f2349864e, []int{1} +} +func (m *MsgStoreCodeResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgStoreCodeResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgStoreCodeResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgStoreCodeResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgStoreCodeResponse.Merge(m, src) +} +func (m *MsgStoreCodeResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgStoreCodeResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgStoreCodeResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgStoreCodeResponse proto.InternalMessageInfo + +// MsgInstantiateContract create a new smart contract instance for the given code id. +type MsgInstantiateContract struct { + // Sender is the that actor that signed the messages + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + // Admin is an optional address that can execute migrations + Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` + // CodeID is the reference to the stored WASM code + CodeID uint64 `protobuf:"varint,3,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` + // Label is optional metadata to be stored with a contract instance. + Label string `protobuf:"bytes,4,opt,name=label,proto3" json:"label,omitempty"` + // InitMsg json encoded message to be passed to the contract on instantiation + InitMsg encoding_json.RawMessage `protobuf:"bytes,5,opt,name=init_msg,json=initMsg,proto3,casttype=encoding/json.RawMessage" json:"init_msg,omitempty"` + // InitFunds coins that are transferred to the contract on instantiation + InitFunds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=init_funds,json=initFunds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"init_funds"` +} + +func (m *MsgInstantiateContract) Reset() { *m = MsgInstantiateContract{} } +func (m *MsgInstantiateContract) String() string { return proto.CompactTextString(m) } +func (*MsgInstantiateContract) ProtoMessage() {} +func (*MsgInstantiateContract) Descriptor() ([]byte, []int) { + return fileDescriptor_5129e02f2349864e, []int{2} +} +func (m *MsgInstantiateContract) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgInstantiateContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgInstantiateContract.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgInstantiateContract) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgInstantiateContract.Merge(m, src) +} +func (m *MsgInstantiateContract) XXX_Size() int { + return m.Size() +} +func (m *MsgInstantiateContract) XXX_DiscardUnknown() { + xxx_messageInfo_MsgInstantiateContract.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgInstantiateContract proto.InternalMessageInfo + +// MsgInstantiateContractResponse return instantiation result data +type MsgInstantiateContractResponse struct { + // Address is the bech32 address of the new contract instance. + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` +} + +func (m *MsgInstantiateContractResponse) Reset() { *m = MsgInstantiateContractResponse{} } +func (m *MsgInstantiateContractResponse) String() string { return proto.CompactTextString(m) } +func (*MsgInstantiateContractResponse) ProtoMessage() {} +func (*MsgInstantiateContractResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5129e02f2349864e, []int{3} +} +func (m *MsgInstantiateContractResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgInstantiateContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgInstantiateContractResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgInstantiateContractResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgInstantiateContractResponse.Merge(m, src) +} +func (m *MsgInstantiateContractResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgInstantiateContractResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgInstantiateContractResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgInstantiateContractResponse proto.InternalMessageInfo + +// MsgExecuteContract submits the given message data to a smart contract +type MsgExecuteContract struct { + // Sender is the that actor that signed the messages + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + // Contract is the address of the smart contract + Contract string `protobuf:"bytes,2,opt,name=contract,proto3" json:"contract,omitempty"` + // Msg json encoded message to be passed to the contract + Msg encoding_json.RawMessage `protobuf:"bytes,3,opt,name=msg,proto3,casttype=encoding/json.RawMessage" json:"msg,omitempty"` + // SentFunds coins that are transferred to the contract on execution + SentFunds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,5,rep,name=sent_funds,json=sentFunds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"sent_funds"` +} + +func (m *MsgExecuteContract) Reset() { *m = MsgExecuteContract{} } +func (m *MsgExecuteContract) String() string { return proto.CompactTextString(m) } +func (*MsgExecuteContract) ProtoMessage() {} +func (*MsgExecuteContract) Descriptor() ([]byte, []int) { + return fileDescriptor_5129e02f2349864e, []int{4} +} +func (m *MsgExecuteContract) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgExecuteContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgExecuteContract.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgExecuteContract) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgExecuteContract.Merge(m, src) +} +func (m *MsgExecuteContract) XXX_Size() int { + return m.Size() +} +func (m *MsgExecuteContract) XXX_DiscardUnknown() { + xxx_messageInfo_MsgExecuteContract.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgExecuteContract proto.InternalMessageInfo + +// MsgExecuteContractResponse returns execution result data. +type MsgExecuteContractResponse struct { + // Data contains base64-encoded bytes to returned from the contract + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *MsgExecuteContractResponse) Reset() { *m = MsgExecuteContractResponse{} } +func (m *MsgExecuteContractResponse) String() string { return proto.CompactTextString(m) } +func (*MsgExecuteContractResponse) ProtoMessage() {} +func (*MsgExecuteContractResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5129e02f2349864e, []int{5} +} +func (m *MsgExecuteContractResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgExecuteContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgExecuteContractResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgExecuteContractResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgExecuteContractResponse.Merge(m, src) +} +func (m *MsgExecuteContractResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgExecuteContractResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgExecuteContractResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgExecuteContractResponse proto.InternalMessageInfo + +// MsgMigrateContract runs a code upgrade/ downgrade for a smart contract +type MsgMigrateContract struct { + // Sender is the that actor that signed the messages + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + // Contract is the address of the smart contract + Contract string `protobuf:"bytes,2,opt,name=contract,proto3" json:"contract,omitempty"` + // CodeID references the new WASM code + CodeID uint64 `protobuf:"varint,3,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` + // MigrateMsg json encoded message to be passed to the contract on migration + MigrateMsg encoding_json.RawMessage `protobuf:"bytes,4,opt,name=migrate_msg,json=migrateMsg,proto3,casttype=encoding/json.RawMessage" json:"migrate_msg,omitempty"` +} + +func (m *MsgMigrateContract) Reset() { *m = MsgMigrateContract{} } +func (m *MsgMigrateContract) String() string { return proto.CompactTextString(m) } +func (*MsgMigrateContract) ProtoMessage() {} +func (*MsgMigrateContract) Descriptor() ([]byte, []int) { + return fileDescriptor_5129e02f2349864e, []int{6} +} +func (m *MsgMigrateContract) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMigrateContract) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMigrateContract.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgMigrateContract) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMigrateContract.Merge(m, src) +} +func (m *MsgMigrateContract) XXX_Size() int { + return m.Size() +} +func (m *MsgMigrateContract) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMigrateContract.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMigrateContract proto.InternalMessageInfo + +// MsgMigrateContractResponse returns contract migration result data. +type MsgMigrateContractResponse struct { + // Data contains same raw bytes returned as data from the wasm contract. + // (May be empty) + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *MsgMigrateContractResponse) Reset() { *m = MsgMigrateContractResponse{} } +func (m *MsgMigrateContractResponse) String() string { return proto.CompactTextString(m) } +func (*MsgMigrateContractResponse) ProtoMessage() {} +func (*MsgMigrateContractResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5129e02f2349864e, []int{7} +} +func (m *MsgMigrateContractResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMigrateContractResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMigrateContractResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgMigrateContractResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMigrateContractResponse.Merge(m, src) +} +func (m *MsgMigrateContractResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgMigrateContractResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMigrateContractResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMigrateContractResponse proto.InternalMessageInfo + +// MsgUpdateAdmin sets a new admin for a smart contract +type MsgUpdateAdmin struct { + // Sender is the that actor that signed the messages + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + // NewAdmin address to be set + NewAdmin string `protobuf:"bytes,2,opt,name=new_admin,json=newAdmin,proto3" json:"new_admin,omitempty"` + // Contract is the address of the smart contract + Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty"` +} + +func (m *MsgUpdateAdmin) Reset() { *m = MsgUpdateAdmin{} } +func (m *MsgUpdateAdmin) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateAdmin) ProtoMessage() {} +func (*MsgUpdateAdmin) Descriptor() ([]byte, []int) { + return fileDescriptor_5129e02f2349864e, []int{8} +} +func (m *MsgUpdateAdmin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateAdmin.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateAdmin) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateAdmin.Merge(m, src) +} +func (m *MsgUpdateAdmin) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateAdmin) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateAdmin.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateAdmin proto.InternalMessageInfo + +// MsgUpdateAdminResponse returns empty data +type MsgUpdateAdminResponse struct { +} + +func (m *MsgUpdateAdminResponse) Reset() { *m = MsgUpdateAdminResponse{} } +func (m *MsgUpdateAdminResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateAdminResponse) ProtoMessage() {} +func (*MsgUpdateAdminResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5129e02f2349864e, []int{9} +} +func (m *MsgUpdateAdminResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateAdminResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateAdminResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateAdminResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateAdminResponse.Merge(m, src) +} +func (m *MsgUpdateAdminResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateAdminResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateAdminResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateAdminResponse proto.InternalMessageInfo + +// MsgClearAdmin removes any admin stored for a smart contract +type MsgClearAdmin struct { + // Sender is the that actor that signed the messages + Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + // Contract is the address of the smart contract + Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty"` +} + +func (m *MsgClearAdmin) Reset() { *m = MsgClearAdmin{} } +func (m *MsgClearAdmin) String() string { return proto.CompactTextString(m) } +func (*MsgClearAdmin) ProtoMessage() {} +func (*MsgClearAdmin) Descriptor() ([]byte, []int) { + return fileDescriptor_5129e02f2349864e, []int{10} +} +func (m *MsgClearAdmin) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgClearAdmin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgClearAdmin.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgClearAdmin) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClearAdmin.Merge(m, src) +} +func (m *MsgClearAdmin) XXX_Size() int { + return m.Size() +} +func (m *MsgClearAdmin) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClearAdmin.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgClearAdmin proto.InternalMessageInfo + +// MsgClearAdminResponse returns empty data +type MsgClearAdminResponse struct { +} + +func (m *MsgClearAdminResponse) Reset() { *m = MsgClearAdminResponse{} } +func (m *MsgClearAdminResponse) String() string { return proto.CompactTextString(m) } +func (*MsgClearAdminResponse) ProtoMessage() {} +func (*MsgClearAdminResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5129e02f2349864e, []int{11} +} +func (m *MsgClearAdminResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgClearAdminResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgClearAdminResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgClearAdminResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClearAdminResponse.Merge(m, src) +} +func (m *MsgClearAdminResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgClearAdminResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClearAdminResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgClearAdminResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgStoreCode)(nil), "cosmwasm.wasm.v1beta1.MsgStoreCode") + proto.RegisterType((*MsgStoreCodeResponse)(nil), "cosmwasm.wasm.v1beta1.MsgStoreCodeResponse") + proto.RegisterType((*MsgInstantiateContract)(nil), "cosmwasm.wasm.v1beta1.MsgInstantiateContract") + proto.RegisterType((*MsgInstantiateContractResponse)(nil), "cosmwasm.wasm.v1beta1.MsgInstantiateContractResponse") + proto.RegisterType((*MsgExecuteContract)(nil), "cosmwasm.wasm.v1beta1.MsgExecuteContract") + proto.RegisterType((*MsgExecuteContractResponse)(nil), "cosmwasm.wasm.v1beta1.MsgExecuteContractResponse") + proto.RegisterType((*MsgMigrateContract)(nil), "cosmwasm.wasm.v1beta1.MsgMigrateContract") + proto.RegisterType((*MsgMigrateContractResponse)(nil), "cosmwasm.wasm.v1beta1.MsgMigrateContractResponse") + proto.RegisterType((*MsgUpdateAdmin)(nil), "cosmwasm.wasm.v1beta1.MsgUpdateAdmin") + proto.RegisterType((*MsgUpdateAdminResponse)(nil), "cosmwasm.wasm.v1beta1.MsgUpdateAdminResponse") + proto.RegisterType((*MsgClearAdmin)(nil), "cosmwasm.wasm.v1beta1.MsgClearAdmin") + proto.RegisterType((*MsgClearAdminResponse)(nil), "cosmwasm.wasm.v1beta1.MsgClearAdminResponse") +} + +func init() { proto.RegisterFile("x/wasm/internal/types/tx.proto", fileDescriptor_5129e02f2349864e) } + +var fileDescriptor_5129e02f2349864e = []byte{ + // 818 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x41, 0x6f, 0xe3, 0x44, + 0x14, 0x8e, 0x37, 0x6d,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02, 0x8f, 0x02, 0x16, 0x62, + 0xe3, 0x5e, 0x4f, 0xeb, 0x77, 0x06, 0x2f, 0xac, 0x96, 0xdd, 0xce, 0xa3, 0x8b, 0x87, 0xde, 0xe0, + 0x4a, 0x28, 0x06, 0xbf, 0x23, 0x71, 0xeb, 0x48, 0xf1, 0xb1, 0x59, 0x12, 0x60, 0xa3, 0x9e, 0xf1, + 0xa9, 0x48, 0x37, 0xa0, 0x39, 0x9e, 0x91, 0x89, 0x14, 0xda, 0x53, 0x1f, 0xd6, 0xa1, 0xfe, 0x18, + 0x8e, 0x09, 0xe5, 0x02, 0x51, 0x41, 0x90, 0xc0, 0xa3, 0x29, 0x4e, 0x62, 0xc2, 0x39, 0x61, 0xd4, + 0xd8, 0xef, 0x69, 0xfd, 0xf6, 0xf9, 0x03, 0x67, 0xab, 0x47, 0xce, 0x45, 0x10, 0x60, 0xce, 0x87, + 0x8c, 0x3e, 0x21, 0x91, 0x7f, 0x54, 0xa0, 0xf8, 0x3c, 0x67, 0xb0, 0x3f, 0x84, 0xc3, 0x62, 0xb5, + 0x3e, 0xe6, 0x53, 0x46, 0x39, 0xd6, 0x1f, 0x40, 0x53, 0xd6, 0x34, 0x22, 0xa1, 0x2a, 0x7b, 0x6f, + 0x00, 0xab, 0x65, 0xb7, 0x21, 0x21, 0x97, 0x1f, 0xfb, 0x0d, 0xf9, 0xe9, 0x32, 0xb4, 0x7f, 0xbc, + 0x07, 0xc7, 0x1e, 0x8f, 0x2e, 0x6f, 0x99, 0x87, 0x8c, 0x8a, 0x04, 0x05, 0xa2, 0xd4, 0xb5, 0x43, + 0xd8, 0x47, 0x61, 0x4c, 0xa8, 0x32, 0xab, 0xe5, 0xa7, 0x41, 0x51, 0xad, 0x5e, 0xa6, 0x26, 0x53, + 0x27, 0x68, 0x8c, 0x27, 0x99, 0x3d, 0x69, 0xa0, 0xbf, 0x0f, 0x07, 0x84, 0x12, 0x31, 0x8a, 0x79, + 0xa4, 0xec, 0xe8, 0x0c,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, 0xe0, + 0xb3, 0xeb, 0xdf, 0xad, 0xda, 0xf5, 0xca, 0xd2, 0x9e, 0xad, 0x2c, 0xed, 0xb7, 0x95, 0xa5, 0xfd, + 0x70, 0x63, 0xd5, 0x9e, 0xdd, 0x58, 0xb5, 0x5f, 0x6e, 0xac, 0xda, 0xe3, 0xd3, 0xc2, 0x69, 0x36, + 0x64, 0x3c, 0x7e, 0x24, 0x2f, 0x10, 0x92, 0x35, 0x74, 0x17, 0xd9, 0xfb, 0xee, 0x75, 0x62, 0xdc, + 0x50, 0x37, 0x89, 0x77, 0xfe, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x2c, 0xda, 0x83, 0x14, 0xdb, 0x08, + 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // StoreCode to submit Wasm code to the system + StoreCode(ctx context.Context, in *MsgStoreCode, opts ...grpc.CallOption) (*MsgStoreCodeResponse, error) + // Instantiate creates a new smart contract instance for the given code id. + InstantiateContract(ctx context.Context, in *MsgInstantiateContract, opts ...grpc.CallOption) (*MsgInstantiateContractResponse, error) + // Execute submits the given message data to a smart contract + ExecuteContract(ctx context.Context, in *MsgExecuteContract, opts ...grpc.CallOption) (*MsgExecuteContractResponse, error) + // Migrate runs a code upgrade/ downgrade for a smart contract + MigrateContract(ctx context.Context, in *MsgMigrateContract, opts ...grpc.CallOption) (*MsgMigrateContractResponse, error) + // UpdateAdmin sets a new admin for a smart contract + UpdateAdmin(ctx context.Context, in *MsgUpdateAdmin, opts ...grpc.CallOption) (*MsgUpdateAdminResponse, error) + // ClearAdmin removes any admin stored for a smart contract + ClearAdmin(ctx context.Context, in *MsgClearAdmin, opts ...grpc.CallOption) (*MsgClearAdminResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) StoreCode(ctx context.Context, in *MsgStoreCode, opts ...grpc.CallOption) (*MsgStoreCodeResponse, error) { + out := new(MsgStoreCodeResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1beta1.Msg/StoreCode", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) InstantiateContract(ctx context.Context, in *MsgInstantiateContract, opts ...grpc.CallOption) (*MsgInstantiateContractResponse, error) { + out := new(MsgInstantiateContractResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1beta1.Msg/InstantiateContract", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ExecuteContract(ctx context.Context, in *MsgExecuteContract, opts ...grpc.CallOption) (*MsgExecuteContractResponse, error) { + out := new(MsgExecuteContractResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1beta1.Msg/ExecuteContract", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) MigrateContract(ctx context.Context, in *MsgMigrateContract, opts ...grpc.CallOption) (*MsgMigrateContractResponse, error) { + out := new(MsgMigrateContractResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1beta1.Msg/MigrateContract", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateAdmin(ctx context.Context, in *MsgUpdateAdmin, opts ...grpc.CallOption) (*MsgUpdateAdminResponse, error) { + out := new(MsgUpdateAdminResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1beta1.Msg/UpdateAdmin", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) ClearAdmin(ctx context.Context, in *MsgClearAdmin, opts ...grpc.CallOption) (*MsgClearAdminResponse, error) { + out := new(MsgClearAdminResponse) + err := c.cc.Invoke(ctx, "/cosmwasm.wasm.v1beta1.Msg/ClearAdmin", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // StoreCode to submit Wasm code to the system + StoreCode(context.Context, *MsgStoreCode) (*MsgStoreCodeResponse, error) + // Instantiate creates a new smart contract instance for the given code id. + InstantiateContract(context.Context, *MsgInstantiateContract) (*MsgInstantiateContractResponse, error) + // Execute submits the given message data to a smart contract + ExecuteContract(context.Context, *MsgExecuteContract) (*MsgExecuteContractResponse, error) + // Migrate runs a code upgrade/ downgrade for a smart contract + MigrateContract(context.Context, *MsgMigrateContract) (*MsgMigrateContractResponse, error) + // UpdateAdmin sets a new admin for a smart contract + UpdateAdmin(context.Context, *MsgUpdateAdmin) (*MsgUpdateAdminResponse, error) + // ClearAdmin removes any admin stored for a smart contract + ClearAdmin(context.Context, *MsgClearAdmin) (*MsgClearAdminResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) StoreCode(ctx context.Context, req *MsgStoreCode) (*MsgStoreCodeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method StoreCode not implemented") +} +func (*UnimplementedMsgServer) InstantiateContract(ctx context.Context, req *MsgInstantiateContract) (*MsgInstantiateContractResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method InstantiateContract not implemented") +} +func (*UnimplementedMsgServer) ExecuteContract(ctx context.Context, req *MsgExecuteContract) (*MsgExecuteContractResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ExecuteContract not implemented") +} +func (*UnimplementedMsgServer) MigrateContract(ctx context.Context, req *MsgMigrateContract) (*MsgMigrateContractResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MigrateContract not implemented") +} +func (*UnimplementedMsgServer) UpdateAdmin(ctx context.Context, req *MsgUpdateAdmin) (*MsgUpdateAdminResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateAdmin not implemented") +} +func (*UnimplementedMsgServer) ClearAdmin(ctx context.Context, req *MsgClearAdmin) (*MsgClearAdminResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClearAdmin not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_StoreCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgStoreCode) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).StoreCode(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1beta1.Msg/StoreCode", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).StoreCode(ctx, req.(*MsgStoreCode)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_InstantiateContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgInstantiateContract) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).InstantiateContract(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1beta1.Msg/InstantiateContract", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).InstantiateContract(ctx, req.(*MsgInstantiateContract)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ExecuteContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgExecuteContract) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ExecuteContract(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1beta1.Msg/ExecuteContract", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ExecuteContract(ctx, req.(*MsgExecuteContract)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_MigrateContract_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMigrateContract) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).MigrateContract(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1beta1.Msg/MigrateContract", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).MigrateContract(ctx, req.(*MsgMigrateContract)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateAdmin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateAdmin) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateAdmin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1beta1.Msg/UpdateAdmin", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateAdmin(ctx, req.(*MsgUpdateAdmin)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ClearAdmin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgClearAdmin) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ClearAdmin(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cosmwasm.wasm.v1beta1.Msg/ClearAdmin", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ClearAdmin(ctx, req.(*MsgClearAdmin)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "cosmwasm.wasm.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "StoreCode", + Handler: _Msg_StoreCode_Handler, + }, + { + MethodName: "InstantiateContract", + Handler: _Msg_InstantiateContract_Handler, + }, + { + MethodName: "ExecuteContract", + Handler: _Msg_ExecuteContract_Handler, + }, + { + MethodName: "MigrateContract", + Handler: _Msg_MigrateContract_Handler, + }, + { + MethodName: "UpdateAdmin", + Handler: _Msg_UpdateAdmin_Handler, + }, + { + MethodName: "ClearAdmin", + Handler: _Msg_ClearAdmin_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "x/wasm/internal/types/tx.proto", +} + +func (m *MsgStoreCode) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgStoreCode) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgStoreCode) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.InstantiatePermission != nil { + { + size, err := m.InstantiatePermission.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.Builder) > 0 { + i -= len(m.Builder) + copy(dAtA[i:], m.Builder) + i = encodeVarintTx(dAtA, i, uint64(len(m.Builder))) + i-- + dAtA[i] = 0x22 + } + if len(m.Source) > 0 { + i -= len(m.Source) + copy(dAtA[i:], m.Source) + i = encodeVarintTx(dAtA, i, uint64(len(m.Source))) + i-- + dAtA[i] = 0x1a + } + if len(m.WASMByteCode) > 0 { + i -= len(m.WASMByteCode) + copy(dAtA[i:], m.WASMByteCode) + i = encodeVarintTx(dAtA, i, uint64(len(m.WASMByteCode))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgStoreCodeResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgStoreCodeResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgStoreCodeResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CodeID != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.CodeID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgInstantiateContract) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgInstantiateContract) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgInstantiateContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.InitFunds) > 0 { + for iNdEx := len(m.InitFunds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.InitFunds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.InitMsg) > 0 { + i -= len(m.InitMsg) + copy(dAtA[i:], m.InitMsg) + i = encodeVarintTx(dAtA, i, uint64(len(m.InitMsg))) + i-- + dAtA[i] = 0x2a + } + if len(m.Label) > 0 { + i -= len(m.Label) + copy(dAtA[i:], m.Label) + i = encodeVarintTx(dAtA, i, uint64(len(m.Label))) + i-- + dAtA[i] = 0x22 + } + if m.CodeID != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.CodeID)) + i-- + dAtA[i] = 0x18 + } + if len(m.Admin) > 0 { + i -= len(m.Admin) + copy(dAtA[i:], m.Admin) + i = encodeVarintTx(dAtA, i, uint64(len(m.Admin))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgInstantiateContractResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgInstantiateContractResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgInstantiateContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTx(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgExecuteContract) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgExecuteContract) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgExecuteContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.SentFunds) > 0 { + for iNdEx := len(m.SentFunds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.SentFunds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.Msg) > 0 { + i -= len(m.Msg) + copy(dAtA[i:], m.Msg) + i = encodeVarintTx(dAtA, i, uint64(len(m.Msg))) + i-- + dAtA[i] = 0x1a + } + if len(m.Contract) > 0 { + i -= len(m.Contract) + copy(dAtA[i:], m.Contract) + i = encodeVarintTx(dAtA, i, uint64(len(m.Contract))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgExecuteContractResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgExecuteContractResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgExecuteContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgMigrateContract) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgMigrateContract) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMigrateContract) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MigrateMsg) > 0 { + i -= len(m.MigrateMsg) + copy(dAtA[i:], m.MigrateMsg) + i = encodeVarintTx(dAtA, i, uint64(len(m.MigrateMsg))) + i-- + dAtA[i] = 0x22 + } + if m.CodeID != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.CodeID)) + i-- + dAtA[i] = 0x18 + } + if len(m.Contract) > 0 { + i -= len(m.Contract) + copy(dAtA[i:], m.Contract) + i = encodeVarintTx(dAtA, i, uint64(len(m.Contract))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgMigrateContractResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgMigrateContractResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMigrateContractResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTx(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateAdmin) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateAdmin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateAdmin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Contract) > 0 { + i -= len(m.Contract) + copy(dAtA[i:], m.Contract) + i = encodeVarintTx(dAtA, i, uint64(len(m.Contract))) + i-- + dAtA[i] = 0x1a + } + if len(m.NewAdmin) > 0 { + i -= len(m.NewAdmin) + copy(dAtA[i:], m.NewAdmin) + i = encodeVarintTx(dAtA, i, uint64(len(m.NewAdmin))) + i-- + dAtA[i] = 0x12 + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateAdminResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateAdminResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateAdminResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgClearAdmin) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgClearAdmin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgClearAdmin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Contract) > 0 { + i -= len(m.Contract) + copy(dAtA[i:], m.Contract) + i = encodeVarintTx(dAtA, i, uint64(len(m.Contract))) + i-- + dAtA[i] = 0x1a + } + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgClearAdminResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgClearAdminResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgClearAdminResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgStoreCode) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.WASMByteCode) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Source) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Builder) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.InstantiatePermission != nil { + l = m.InstantiatePermission.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgStoreCodeResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CodeID != 0 { + n += 1 + sovTx(uint64(m.CodeID)) + } + return n +} + +func (m *MsgInstantiateContract) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Admin) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.CodeID != 0 { + n += 1 + sovTx(uint64(m.CodeID)) + } + l = len(m.Label) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.InitMsg) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.InitFunds) > 0 { + for _, e := range m.InitFunds { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgInstantiateContractResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Address) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgExecuteContract) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Contract) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Msg) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.SentFunds) > 0 { + for _, e := range m.SentFunds { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgExecuteContractResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgMigrateContract) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Contract) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.CodeID != 0 { + n += 1 + sovTx(uint64(m.CodeID)) + } + l = len(m.MigrateMsg) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgMigrateContractResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Data) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateAdmin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.NewAdmin) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Contract) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUpdateAdminResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgClearAdmin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Contract) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgClearAdminResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgStoreCode) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgStoreCode: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgStoreCode: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WASMByteCode", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.WASMByteCode = append(m.WASMByteCode[:0], dAtA[iNdEx:postIndex]...) + if m.WASMByteCode == nil { + m.WASMByteCode = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Source = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Builder", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Builder = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InstantiatePermission", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.InstantiatePermission == nil { + m.InstantiatePermission = &AccessConfig{} + } + if err := m.InstantiatePermission.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgStoreCodeResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgStoreCodeResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgStoreCodeResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType) + } + m.CodeID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgInstantiateContract) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgInstantiateContract: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInstantiateContract: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Admin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType) + } + m.CodeID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Label", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Label = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitMsg", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitMsg = append(m.InitMsg[:0], dAtA[iNdEx:postIndex]...) + if m.InitMsg == nil { + m.InitMsg = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitFunds", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitFunds = append(m.InitFunds, types.Coin{}) + if err := m.InitFunds[len(m.InitFunds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgInstantiateContractResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgInstantiateContractResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgInstantiateContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Address = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgExecuteContract) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgExecuteContract: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgExecuteContract: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...) + if m.Msg == nil { + m.Msg = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SentFunds", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.SentFunds = append(m.SentFunds, types.Coin{}) + if err := m.SentFunds[len(m.SentFunds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgExecuteContractResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgExecuteContractResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgExecuteContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgMigrateContract) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgMigrateContract: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMigrateContract: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeID", wireType) + } + m.CodeID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MigrateMsg", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MigrateMsg = append(m.MigrateMsg[:0], dAtA[iNdEx:postIndex]...) + if m.MigrateMsg == nil { + m.MigrateMsg = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgMigrateContractResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgMigrateContractResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMigrateContractResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) + if m.Data == nil { + m.Data = []byte{} + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateAdmin) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateAdmin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateAdmin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NewAdmin", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NewAdmin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateAdminResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateAdminResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateAdminResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgClearAdmin) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgClearAdmin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgClearAdmin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Contract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgClearAdminResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgClearAdminResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgClearAdminResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/wasm/internal/types/tx.proto b/x/wasm/internal/types/tx.proto new file mode 100644 index 0000000000..c40e3ba469 --- /dev/null +++ b/x/wasm/internal/types/tx.proto @@ -0,0 +1,127 @@ +syntax = "proto3"; +package cosmwasm.wasm.v1beta1; + + +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; +import "x/wasm/internal/types/types.proto"; + +option go_package = "github.com/CosmWasm/wasmd/x/wasmd/internal/types"; +option (gogoproto.goproto_getters_all) = false; + +// Msg defines the wasm Msg service. +service Msg { + // StoreCode to submit Wasm code to the system + rpc StoreCode(MsgStoreCode) returns (MsgStoreCodeResponse); + // Instantiate creates a new smart contract instance for the given code id. + rpc InstantiateContract(MsgInstantiateContract) returns (MsgInstantiateContractResponse); + // Execute submits the given message data to a smart contract + rpc ExecuteContract(MsgExecuteContract) returns (MsgExecuteContractResponse); + // Migrate runs a code upgrade/ downgrade for a smart contract + rpc MigrateContract(MsgMigrateContract) returns (MsgMigrateContractResponse); + // UpdateAdmin sets a new admin for a smart contract + rpc UpdateAdmin(MsgUpdateAdmin) returns (MsgUpdateAdminResponse); + // ClearAdmin removes any admin stored for a smart contract + rpc ClearAdmin(MsgClearAdmin) returns (MsgClearAdminResponse); +} + +// MsgStoreCode submit Wasm code to the system +message MsgStoreCode { + // Sender is the that actor that signed the messages + string sender = 1; + // WASMByteCode can be raw or gzip compressed + bytes wasm_byte_code = 2 [(gogoproto.customname) = "WASMByteCode"]; + // Source is a valid absolute HTTPS URI to the contract's source code, optional + string source = 3; + // Builder is a valid docker image name with tag, optional + string builder = 4; + // InstantiatePermission access control to apply on contract creation, optional + AccessConfig instantiate_permission = 5; +} +// MsgStoreCodeResponse returns store result data. +message MsgStoreCodeResponse{ + // CodeID is the reference to the stored WASM code + uint64 code_id = 1 [(gogoproto.customname) = "CodeID"]; +} + +// MsgInstantiateContract create a new smart contract instance for the given code id. +message MsgInstantiateContract { + // Sender is the that actor that signed the messages + string sender = 1; + // Admin is an optional address that can execute migrations + string admin = 2; + // CodeID is the reference to the stored WASM code + uint64 code_id = 3 [(gogoproto.customname) = "CodeID"]; + // Label is optional metadata to be stored with a contract instance. + string label = 4; + // InitMsg json encoded message to be passed to the contract on instantiation + bytes init_msg = 5 [(gogoproto.casttype) = "encoding/json.RawMessage"]; + // InitFunds coins that are transferred to the contract on instantiation + repeated cosmos.base.v1beta1.Coin init_funds = 6 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} +// MsgInstantiateContractResponse return instantiation result data +message MsgInstantiateContractResponse { + // Address is the bech32 address of the new contract instance. + string address = 1; +} + +// MsgExecuteContract submits the given message data to a smart contract +message MsgExecuteContract { + // Sender is the that actor that signed the messages + string sender = 1; + // Contract is the address of the smart contract + string contract = 2; + // Msg json encoded message to be passed to the contract + bytes msg = 3 [(gogoproto.casttype) = "encoding/json.RawMessage"]; + // SentFunds coins that are transferred to the contract on execution + repeated cosmos.base.v1beta1.Coin sent_funds = 5 [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"]; +} + +// MsgExecuteContractResponse returns execution result data. +message MsgExecuteContractResponse { + // Data contains base64-encoded bytes to returned from the contract + bytes data = 1; +} + +// MsgMigrateContract runs a code upgrade/ downgrade for a smart contract +message MsgMigrateContract { + // Sender is the that actor that signed the messages + string sender = 1; + // Contract is the address of the smart contract + string contract = 2; + // CodeID references the new WASM code + uint64 code_id = 3 [(gogoproto.customname) = "CodeID"]; + // MigrateMsg json encoded message to be passed to the contract on migration + bytes migrate_msg = 4 [(gogoproto.casttype) = "encoding/json.RawMessage"]; +} + +// MsgMigrateContractResponse returns contract migration result data. +message MsgMigrateContractResponse { + // Data contains same raw bytes returned as data from the wasm contract. + // (May be empty) + bytes data = 1; +} + +// MsgUpdateAdmin sets a new admin for a smart contract +message MsgUpdateAdmin { + // Sender is the that actor that signed the messages + string sender = 1; + // NewAdmin address to be set + string new_admin = 2; + // Contract is the address of the smart contract + string contract = 3; +} + +// MsgUpdateAdminResponse returns empty data +message MsgUpdateAdminResponse{} + +// MsgClearAdmin removes any admin stored for a smart contract +message MsgClearAdmin { + // Sender is the that actor that signed the messages + string sender = 1; + // Contract is the address of the smart contract + string contract = 3; +} + +// MsgClearAdminResponse returns empty data +message MsgClearAdminResponse{} diff --git a/x/wasm/internal/types/msg_test.go b/x/wasm/internal/types/tx_test.go similarity index 100% rename from x/wasm/internal/types/msg_test.go rename to x/wasm/internal/types/tx_test.go diff --git a/x/wasm/module.go b/x/wasm/module.go index 5a4aee1535..1d45ae517d 100644 --- a/x/wasm/module.go +++ b/x/wasm/module.go @@ -107,8 +107,9 @@ func NewAppModule(keeper *Keeper, validatorSetSource keeper.ValidatorSetSource) } } -func (am AppModule) RegisterServices(configurator module.Configurator) { - types.RegisterQueryServer(configurator.QueryServer(), NewQuerier(am.keeper)) +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), NewQuerier(am.keeper)) } func (am AppModule) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier { diff --git a/x/wasm/module_test.go b/x/wasm/module_test.go index 68fbe56f22..7291c10079 100644 --- a/x/wasm/module_test.go +++ b/x/wasm/module_test.go @@ -154,7 +154,7 @@ func TestHandleInstantiate(t *testing.T) { } res, err := h(data.ctx, msg) require.NoError(t, err) - require.Equal(t, res.Data, []byte("1")) + assertStoreCodeResponse(t, res.Data, 1) _, _, bob := keyPubAddr() _, _, fred := keyPubAddr() @@ -175,7 +175,8 @@ func TestHandleInstantiate(t *testing.T) { } res, err = h(data.ctx, &initCmd) require.NoError(t, err) - contractBech32Addr := string(res.Data) + contractBech32Addr := parseInitResponse(t, res.Data) + require.Equal(t, "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5", contractBech32Addr) // this should be standard x/wasm init event, nothing from contract require.Equal(t, 2, len(res.Events), prettyEvents(res.Events)) @@ -213,7 +214,7 @@ func TestHandleExecute(t *testing.T) { } res, err := h(data.ctx, msg) require.NoError(t, err) - require.Equal(t, res.Data, []byte("1")) + assertStoreCodeResponse(t, res.Data, 1) _, _, bob := keyPubAddr() initMsg := initMsg{ @@ -231,7 +232,8 @@ func TestHandleExecute(t *testing.T) { } res, err = h(data.ctx, &initCmd) require.NoError(t, err) - contractBech32Addr := string(res.Data) + contractBech32Addr := parseInitResponse(t, res.Data) + require.Equal(t, "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5", contractBech32Addr) // this should be standard x/wasm init event, plus a bank send event (2), with no custom contract events require.Equal(t, 3, len(res.Events), prettyEvents(res.Events)) @@ -265,6 +267,9 @@ func TestHandleExecute(t *testing.T) { } res, err = h(data.ctx, &execCmd) require.NoError(t, err) + // from https://github.com/CosmWasm/cosmwasm/blob/master/contracts/hackatom/src/contract.rs#L167 + assertExecuteResponse(t, res.Data, []byte{0xf0, 0x0b, 0xaa}) + // this should be standard x/wasm init event, plus 2 bank send event, plus a special event from the contract require.Equal(t, 4, len(res.Events), prettyEvents(res.Events)) @@ -327,7 +332,6 @@ func TestHandleExecuteEscrow(t *testing.T) { } res, err := h(data.ctx, msg) require.NoError(t, err) - require.Equal(t, res.Data, []byte("1")) _, _, bob := keyPubAddr() initMsg := map[string]interface{}{ @@ -345,7 +349,7 @@ func TestHandleExecuteEscrow(t *testing.T) { } res, err = h(data.ctx, &initCmd) require.NoError(t, err) - contractBech32Addr := string(res.Data) + contractBech32Addr := parseInitResponse(t, res.Data) require.Equal(t, "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5", contractBech32Addr) handleMsg := map[string]interface{}{ @@ -362,6 +366,8 @@ func TestHandleExecuteEscrow(t *testing.T) { } res, err = h(data.ctx, &execCmd) require.NoError(t, err) + // from https://github.com/CosmWasm/cosmwasm/blob/master/contracts/hackatom/src/contract.rs#L167 + assertExecuteResponse(t, res.Data, []byte{0xf0, 0x0b, 0xaa}) // ensure bob now exists and got both payments released bobAcct := data.acctKeeper.GetAccount(data.ctx, bob)