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

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmwasm/wasm/v1beta1/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 {
  // 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" ];
  // Source is a valid absolute HTTPS URI to the contract's source code,
  // optional
  string source = 5;
  // Builder is a valid docker image name with tag, optional
  string builder = 6;
  // InstantiatePermission to apply on contract creation, optional
  AccessConfig instantiate_permission = 7;
}

// InstantiateContractProposal gov proposal content type to instantiate a
// contract.
message InstantiateContractProposal {
  // 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;
  // InitMsg json encoded message to be passed to the contract on instantiation
  bytes init_msg = 7;
  // 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"
  ];
}

// MigrateContractProposal gov proposal content type to migrate a contract.
message MigrateContractProposal {
  // 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;
  // CodeID references the new WASM code
  uint64 code_id = 5 [ (gogoproto.customname) = "CodeID" ];
  // MigrateMsg json encoded message to be passed to the contract on migration
  bytes migrate_msg = 6;
}

// UpdateAdminProposal gov proposal content type to set an admin for a contract.
message UpdateAdminProposal {
  // 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 {
  // 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 {
  // 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 {
  // 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\""
  ];
}
