syntax = "proto3";
package cosmwasm.wasm.v1;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmwasm/wasm/v1/types.proto";

option go_package = "github.com/CosmWasm/wasmd/x/wasm/types";
option (gogoproto.goproto_stringer_all) = false;
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.equal_all) = true;

// StoreCodeProposal gov proposal content type to submit WASM code to the system
message StoreCodeProposal {
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

  // Title is a short summary
  string title = 1;
  // Description is a human readable text
  string description = 2;
  // RunAs is the address that is passed to the contract's environment as sender
  string run_as = 3;
  // WASMByteCode can be raw or gzip compressed
  bytes wasm_byte_code = 4 [ (gogoproto.customname) = "WASMByteCode" ];
  // Used in v1beta1
  reserved 5, 6;
  // InstantiatePermission to apply on contract creation, optional
  AccessConfig instantiate_permission = 7;
  // UnpinCode code on upload, optional
  bool unpin_code = 8;
  // Source is the URL where the code is hosted
  string source = 9;
  // Builder is the docker image used to build the code deterministically, used
  // for smart contract verification
  string builder = 10;
  // CodeHash is the SHA256 sum of the code outputted by builder, used for smart
  // contract verification
  bytes code_hash = 11;
}

// InstantiateContractProposal gov proposal content type to instantiate a
// contract.
message InstantiateContractProposal {
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

  // Title is a short summary
  string title = 1;
  // Description is a human readable text
  string description = 2;
  // RunAs is the address that is passed to the contract's environment as sender
  string run_as = 3;
  // Admin is an optional address that can execute migrations
  string admin = 4;
  // CodeID is the reference to the stored WASM code
  uint64 code_id = 5 [ (gogoproto.customname) = "CodeID" ];
  // Label is optional metadata to be stored with a constract instance.
  string label = 6;
  // Msg json encoded message to be passed to the contract on instantiation
  bytes msg = 7 [ (gogoproto.casttype) = "RawContractMessage" ];
  // Funds coins that are transferred to the contract on instantiation
  repeated cosmos.base.v1beta1.Coin funds = 8 [
    (gogoproto.nullable) = false,
    (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
  ];
}

// InstantiateContract2Proposal gov proposal content type to instantiate
// contract 2
message InstantiateContract2Proposal {
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

  // Title is a short summary
  string title = 1;
  // Description is a human readable text
  string description = 2;
  // RunAs is the address that is passed to the contract's enviroment as sender
  string run_as = 3;
  // Admin is an optional address that can execute migrations
  string admin = 4;
  // CodeID is the reference to the stored WASM code
  uint64 code_id = 5 [ (gogoproto.customname) = "CodeID" ];
  // Label is optional metadata to be stored with a constract instance.
  string label = 6;
  // Msg json encode message to be passed to the contract on instantiation
  bytes msg = 7 [ (gogoproto.casttype) = "RawContractMessage" ];
  // Funds coins that are transferred to the contract on instantiation
  repeated cosmos.base.v1beta1.Coin funds = 8 [
    (gogoproto.nullable) = false,
    (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
  ];
  // Salt is an arbitrary value provided by the sender. Size can be 1 to 64.
  bytes salt = 9;
  // FixMsg include the msg value into the hash for the predictable address.
  // Default is false
  bool fix_msg = 10;
}

// MigrateContractProposal gov proposal content type to migrate a contract.
message MigrateContractProposal {
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

  // Title is a short summary
  string title = 1;
  // Description is a human readable text
  string description = 2;
  // Note: skipping 3 as this was previously used for unneeded run_as

  // Contract is the address of the smart contract
  string contract = 4;
  // CodeID references the new WASM code
  uint64 code_id = 5 [ (gogoproto.customname) = "CodeID" ];
  // Msg json encoded message to be passed to the contract on migration
  bytes msg = 6 [ (gogoproto.casttype) = "RawContractMessage" ];
}

// SudoContractProposal gov proposal content type to call sudo on a contract.
message SudoContractProposal {
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

  // Title is a short summary
  string title = 1;
  // Description is a human readable text
  string description = 2;
  // Contract is the address of the smart contract
  string contract = 3;
  // Msg json encoded message to be passed to the contract as sudo
  bytes msg = 4 [ (gogoproto.casttype) = "RawContractMessage" ];
}

// ExecuteContractProposal gov proposal content type to call execute on a
// contract.
message ExecuteContractProposal {
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

  // Title is a short summary
  string title = 1;
  // Description is a human readable text
  string description = 2;
  // RunAs is the address that is passed to the contract's environment as sender
  string run_as = 3;
  // Contract is the address of the smart contract
  string contract = 4;
  // Msg json encoded message to be passed to the contract as execute
  bytes msg = 5 [ (gogoproto.casttype) = "RawContractMessage" ];
  // Funds coins that are transferred to the contract on instantiation
  repeated cosmos.base.v1beta1.Coin funds = 6 [
    (gogoproto.nullable) = false,
    (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
  ];
}

// UpdateAdminProposal gov proposal content type to set an admin for a contract.
message UpdateAdminProposal {
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

  // Title is a short summary
  string title = 1;
  // Description is a human readable text
  string description = 2;
  // NewAdmin address to be set
  string new_admin = 3 [ (gogoproto.moretags) = "yaml:\"new_admin\"" ];
  // Contract is the address of the smart contract
  string contract = 4;
}

// ClearAdminProposal gov proposal content type to clear the admin of a
// contract.
message ClearAdminProposal {
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

  // Title is a short summary
  string title = 1;
  // Description is a human readable text
  string description = 2;
  // Contract is the address of the smart contract
  string contract = 3;
}

// PinCodesProposal gov proposal content type to pin a set of code ids in the
// wasmvm cache.
message PinCodesProposal {
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

  // Title is a short summary
  string title = 1 [ (gogoproto.moretags) = "yaml:\"title\"" ];
  // Description is a human readable text
  string description = 2 [ (gogoproto.moretags) = "yaml:\"description\"" ];
  // CodeIDs references the new WASM codes
  repeated uint64 code_ids = 3 [
    (gogoproto.customname) = "CodeIDs",
    (gogoproto.moretags) = "yaml:\"code_ids\""
  ];
}

// UnpinCodesProposal gov proposal content type to unpin a set of code ids in
// the wasmvm cache.
message UnpinCodesProposal {
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

  // Title is a short summary
  string title = 1 [ (gogoproto.moretags) = "yaml:\"title\"" ];
  // Description is a human readable text
  string description = 2 [ (gogoproto.moretags) = "yaml:\"description\"" ];
  // CodeIDs references the WASM codes
  repeated uint64 code_ids = 3 [
    (gogoproto.customname) = "CodeIDs",
    (gogoproto.moretags) = "yaml:\"code_ids\""
  ];
}

// AccessConfigUpdate contains the code id and the access config to be
// applied.
message AccessConfigUpdate {
  // CodeID is the reference to the stored WASM code to be updated
  uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ];
  // InstantiatePermission to apply to the set of code ids
  AccessConfig instantiate_permission = 2 [ (gogoproto.nullable) = false ];
}

// UpdateInstantiateConfigProposal gov proposal content type to update
// instantiate config to a  set of code ids.
message UpdateInstantiateConfigProposal {
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";

  // Title is a short summary
  string title = 1 [ (gogoproto.moretags) = "yaml:\"title\"" ];
  // Description is a human readable text
  string description = 2 [ (gogoproto.moretags) = "yaml:\"description\"" ];
  // AccessConfigUpdate contains the list of code ids and the access config
  // to be applied.
  repeated AccessConfigUpdate access_config_updates = 3
      [ (gogoproto.nullable) = false ];
}

// StoreAndInstantiateContractProposal gov proposal content type to store
// and instantiate the contract.
message StoreAndInstantiateContractProposal {
  option (cosmos_proto.implements_interface) = "cosmos.gov.v1beta1.Content";
  
  // Title is a short summary
  string title = 1;
  // Description is a human readable text
  string description = 2;
  // RunAs is the address that is passed to the contract's environment as sender
  string run_as = 3;
  // WASMByteCode can be raw or gzip compressed
  bytes wasm_byte_code = 4 [ (gogoproto.customname) = "WASMByteCode" ];
  // InstantiatePermission to apply on contract creation, optional
  AccessConfig instantiate_permission = 5;
  // UnpinCode code on upload, optional
  bool unpin_code = 6;
  // Admin is an optional address that can execute migrations
  string admin = 7;
  // Label is optional metadata to be stored with a constract instance.
  string label = 8;
  // Msg json encoded message to be passed to the contract on instantiation
  bytes msg = 9 [ (gogoproto.casttype) = "RawContractMessage" ];
  // Funds coins that are transferred to the contract on instantiation
  repeated cosmos.base.v1beta1.Coin funds = 10 [
    (gogoproto.nullable) = false,
    (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
  ];
  // Source is the URL where the code is hosted
  string source = 11;
  // Builder is the docker image used to build the code deterministically, used
  // for smart contract verification
  string builder = 12;
  // CodeHash is the SHA256 sum of the code outputted by builder, used for smart
  // contract verification
  bytes code_hash = 13;
}

Graph