syntax = "proto3";
package kava.router.v1beta1;

import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/kava-labs/kava/x/router/types";
option (gogoproto.goproto_getters_all) = false;

// Msg defines the router Msg service.
service Msg {
  // MintDeposit converts a delegation into staking derivatives and deposits it all into an earn vault.
  rpc MintDeposit(MsgMintDeposit) returns (MsgMintDepositResponse);

  // DelegateMintDeposit delegates tokens to a validator, then converts them into staking derivatives,
  // then deposits to an earn vault.
  rpc DelegateMintDeposit(MsgDelegateMintDeposit) returns (MsgDelegateMintDepositResponse);

  // WithdrawBurn removes staking derivatives from an earn vault and converts them back to a staking delegation.
  rpc WithdrawBurn(MsgWithdrawBurn) returns (MsgWithdrawBurnResponse);

  // WithdrawBurnUndelegate removes staking derivatives from an earn vault, converts them to a staking delegation,
  // then undelegates them from their validator.
  rpc WithdrawBurnUndelegate(MsgWithdrawBurnUndelegate) returns (MsgWithdrawBurnUndelegateResponse);
}

// MsgMintDeposit converts a delegation into staking derivatives and deposits it all into an earn vault.
message MsgMintDeposit {
  // depositor represents the owner of the delegation to convert
  string depositor = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
  // validator is the validator for the depositor's delegation
  string validator = 2;
  // amount is the delegation balance to convert
  cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false];
}

// MsgMintDepositResponse defines the Msg/MsgMintDeposit response type.
message MsgMintDepositResponse {}

// MsgDelegateMintDeposit delegates tokens to a validator, then converts them into staking derivatives,
// then deposits to an earn vault.
message MsgDelegateMintDeposit {
  // depositor represents the owner of the tokens to delegate
  string depositor = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
  // validator is the address of the validator to delegate to
  string validator = 2;
  // amount is the tokens to delegate
  cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false];
}

// MsgDelegateMintDepositResponse defines the Msg/MsgDelegateMintDeposit response type.
message MsgDelegateMintDepositResponse {}

// MsgWithdrawBurn removes staking derivatives from an earn vault and converts them back to a staking delegation.
message MsgWithdrawBurn {
  // from is the owner of the earn vault to withdraw from
  string from = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
  // validator is the address to select the derivative denom to withdraw
  string validator = 2;
  // amount is the staked token equivalent to withdraw
  cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false];
}

// MsgWithdrawBurnResponse defines the Msg/MsgWithdrawBurn response type.
message MsgWithdrawBurnResponse {}

// MsgWithdrawBurnUndelegate removes staking derivatives from an earn vault, converts them to a staking delegation,
// then undelegates them from their validator.
message MsgWithdrawBurnUndelegate {
  // from is the owner of the earn vault to withdraw from
  string from = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
  // validator is the address to select the derivative denom to withdraw
  string validator = 2;
  // amount is the staked token equivalent to withdraw
  cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false];
}

// MsgWithdrawBurnUndelegateResponse defines the Msg/MsgWithdrawBurnUndelegate response type.
message MsgWithdrawBurnUndelegateResponse {}