syntax = "proto3";
package wormhole_foundation.wormchain.wormhole;

import "gogoproto/gogo.proto";
// this line is used by starport scaffolding # proto/tx/import
import "wormhole/guardian_key.proto";

option go_package = "github.com/wormhole-foundation/wormchain/x/wormhole/types";

// Msg defines the Msg service.
service Msg {
      rpc ExecuteGovernanceVAA(MsgExecuteGovernanceVAA) returns (MsgExecuteGovernanceVAAResponse);
  rpc RegisterAccountAsGuardian(MsgRegisterAccountAsGuardian) returns (MsgRegisterAccountAsGuardianResponse);

  // 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);
// this line is used by starport scaffolding # proto/tx/rpc
}

message MsgExecuteGovernanceVAA {
  bytes vaa = 1;
  string signer = 2;
}

message MsgExecuteGovernanceVAAResponse {
}

message MsgRegisterAccountAsGuardian {
  string signer = 1;
  GuardianKey guardianPubkey = 2;
  bytes signature = 3;
}

message MsgRegisterAccountAsGuardianResponse {
}

// Same as from x/wasmd but with vaa auth
message MsgStoreCode {
  // Signer is the that actor that signed the messages
  string signer = 1;
  // WASMByteCode can be raw or gzip compressed
  bytes wasm_byte_code = 2 [ (gogoproto.customname) = "WASMByteCode" ];
  // vaa must be governance msg with payload containing sha3 256 hash of `wasm_byte_code`
  bytes vaa = 3;
}

message MsgStoreCodeResponse {
  // CodeID is the reference to the stored WASM code
  uint64 code_id = 1 [ (gogoproto.customname) = "CodeID" ];
}

// Same as from x/wasmd but with vaa auth
message MsgInstantiateContract {
  // Signer is the that actor that signed the messages
  string signer = 1;
  // 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;
  // Msg json encoded message to be passed to the contract on instantiation
  bytes msg = 5;
  // vaa must be governance msg with payload containing sha3 256 hash of `bigEndian(code_id) || label || msg`
  bytes vaa = 6;
}

message MsgInstantiateContractResponse {
  // Address is the bech32 address of the new contract instance.
  string address = 1;
  // Data contains base64-encoded bytes to returned from the contract
  bytes data = 2;
}

// this line is used by starport scaffolding # proto/tx/message
