syntax = "proto3";
package gaia.liquid.v1beta1;

import "google/protobuf/timestamp.proto";
import "gogoproto/gogo.proto";

import "cosmos_proto/cosmos.proto";
import "cosmos/base/v1beta1/coin.proto";
import "gaia/liquid/v1beta1/liquid.proto";
import "cosmos/msg/v1/msg.proto";
import "amino/amino.proto";

option go_package = "github.com/cosmos/gaia/x/liquid/types";

// Msg defines the liquid Msg service.
service Msg {
  option (cosmos.msg.v1.service) = true;

  // UpdateParams defines an operation for updating the x/liquid module
  // parameters.
  rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);

  // TokenizeShares defines a method for tokenizing shares from a validator.
  rpc TokenizeShares(MsgTokenizeShares) returns (MsgTokenizeSharesResponse);

  // RedeemTokensForShares defines a method for redeeming tokens from a
  // validator for shares.
  rpc RedeemTokensForShares(MsgRedeemTokensForShares)
      returns (MsgRedeemTokensForSharesResponse);

  // TransferTokenizeShareRecord defines a method to transfer ownership of
  // TokenizeShareRecord
  rpc TransferTokenizeShareRecord(MsgTransferTokenizeShareRecord)
      returns (MsgTransferTokenizeShareRecordResponse);

  // DisableTokenizeShares defines a method to prevent the tokenization of an
  // addresses stake
  rpc DisableTokenizeShares(MsgDisableTokenizeShares)
      returns (MsgDisableTokenizeSharesResponse);

  // EnableTokenizeShares defines a method to re-enable the tokenization of an
  // addresseses stake after it has been disabled
  rpc EnableTokenizeShares(MsgEnableTokenizeShares)
      returns (MsgEnableTokenizeSharesResponse);

  // WithdrawTokenizeShareRecordReward defines a method to withdraw reward for
  // an owning TokenizeShareRecord
  rpc WithdrawTokenizeShareRecordReward(MsgWithdrawTokenizeShareRecordReward)
      returns (MsgWithdrawTokenizeShareRecordRewardResponse);

  // WithdrawAllTokenizeShareRecordReward defines a method to withdraw reward
  // for all owning TokenizeShareRecord
  rpc WithdrawAllTokenizeShareRecordReward(
      MsgWithdrawAllTokenizeShareRecordReward)
      returns (MsgWithdrawAllTokenizeShareRecordRewardResponse);
}

// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
  option (cosmos.msg.v1.signer) = "authority";
  option (amino.name) = "gaia/liquid/MsgUpdateParams";

  // authority is the address that controls the module (defaults to x/gov unless
  // overwritten).
  string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
  // params defines the x/liquid parameters to update.
  //
  // NOTE: All parameters must be supplied.
  Params params = 2
      [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
};

// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {};

// MsgTokenizeShares tokenizes a delegation
message MsgTokenizeShares {
  option (cosmos.msg.v1.signer) = "delegator_address";
  option (amino.name) = "gaia/MsgTokenizeShares";

  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;

  string delegator_address = 1
      [ (gogoproto.moretags) = "yaml:\"delegator_address\"" ];
  string validator_address = 2
      [ (gogoproto.moretags) = "yaml:\"validator_address\"" ];
  cosmos.base.v1beta1.Coin amount = 3 [ (gogoproto.nullable) = false ];
  string tokenized_share_owner = 4;
}

// MsgTokenizeSharesResponse defines the Msg/MsgTokenizeShares response type.
message MsgTokenizeSharesResponse {
  cosmos.base.v1beta1.Coin amount = 1 [ (gogoproto.nullable) = false ];
}

// MsgRedeemTokensForShares redeems a tokenized share back into a native
// delegation
message MsgRedeemTokensForShares {
  option (cosmos.msg.v1.signer) = "delegator_address";
  option (amino.name) = "gaia/MsgRedeemTokensForShares";

  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;

  string delegator_address = 1
      [ (gogoproto.moretags) = "yaml:\"delegator_address\"" ];
  cosmos.base.v1beta1.Coin amount = 2 [ (gogoproto.nullable) = false ];
}

// MsgRedeemTokensForSharesResponse defines the Msg/MsgRedeemTokensForShares
// response type.
message MsgRedeemTokensForSharesResponse {
  cosmos.base.v1beta1.Coin amount = 1 [ (gogoproto.nullable) = false ];
}

// MsgTransferTokenizeShareRecord transfer a tokenize share record
message MsgTransferTokenizeShareRecord {
  option (cosmos.msg.v1.signer) = "sender";
  option (amino.name) = "gaia/MsgTransferTokenizeShareRecord";

  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;

  uint64 tokenize_share_record_id = 1;
  string sender = 2;
  string new_owner = 3;
}

// MsgTransferTokenizeShareRecordResponse defines the
// Msg/MsgTransferTokenizeShareRecord response type.
message MsgTransferTokenizeShareRecordResponse {}

// MsgDisableTokenizeShares prevents the tokenization of shares for a given
// address
message MsgDisableTokenizeShares {
  option (cosmos.msg.v1.signer) = "delegator_address";
  option (amino.name) = "gaia/MsgDisableTokenizeShares";

  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;

  string delegator_address = 1
      [ (gogoproto.moretags) = "yaml:\"delegator_address\"" ];
}

// MsgDisableTokenizeSharesResponse defines the Msg/DisableTokenizeShares
// response type.
message MsgDisableTokenizeSharesResponse {}

// MsgEnableTokenizeShares re-enables tokenization of shares for a given address
message MsgEnableTokenizeShares {
  option (cosmos.msg.v1.signer) = "delegator_address";
  option (amino.name) = "gaia/MsgEnableTokenizeShares";

  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;

  string delegator_address = 1
      [ (gogoproto.moretags) = "yaml:\"delegator_address\"" ];
}

// MsgEnableTokenizeSharesResponse defines the Msg/EnableTokenizeShares response
// type.
message MsgEnableTokenizeSharesResponse {
  google.protobuf.Timestamp completion_time = 1
      [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ];
}

// MsgWithdrawTokenizeShareRecordReward withdraws tokenize share rewards for a
// specific record
message MsgWithdrawTokenizeShareRecordReward {
  option (cosmos.msg.v1.signer) = "owner_address";
  option (amino.name) = "gaia/MsgWithdrawTokenizeShareRecordReward";

  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;

  string owner_address = 1 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ];
  uint64 record_id = 2;
}

// MsgWithdrawTokenizeShareRecordReward defines the
// Msg/WithdrawTokenizeShareRecordReward response type.
message MsgWithdrawTokenizeShareRecordRewardResponse {}

// MsgWithdrawAllTokenizeShareRecordReward withdraws tokenize share rewards or
// all records owned by the designated owner
message MsgWithdrawAllTokenizeShareRecordReward {
  option (cosmos.msg.v1.signer) = "owner_address";
  option (amino.name) = "gaia/MsgWithdrawAllTokenizeShareRecordReward";

  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;

  string owner_address = 1 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ];
}

// MsgWithdrawAllTokenizeShareRecordRewardResponse defines the
// Msg/WithdrawTokenizeShareRecordReward response type.
message MsgWithdrawAllTokenizeShareRecordRewardResponse {}
