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

import "gogoproto/gogo.proto";

import "amino/amino.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";

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

// Params defines the parameters for the x/liquid module.
message Params {
  option (amino.name) = "gaia/x/liquid/Params";
  option (gogoproto.equal) = true;

  // global_liquid_staking_cap represents a cap on the portion of stake that
  // comes from liquid staking providers
  string global_liquid_staking_cap = 8 [
    (gogoproto.moretags) = "yaml:\"global_liquid_staking_cap\"",
    (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
    (gogoproto.nullable) = false,
    (amino.dont_omitempty) = true,
    (cosmos_proto.scalar) = "cosmos.Dec"
  ];
  // validator_liquid_staking_cap represents a cap on the portion of stake that
  // comes from liquid staking providers for a specific validator
  string validator_liquid_staking_cap = 9 [
    (gogoproto.moretags) = "yaml:\"validator_liquid_staking_cap\"",
    (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
    (gogoproto.nullable) = false,
    (amino.dont_omitempty) = true,
    (cosmos_proto.scalar) = "cosmos.Dec"
  ];
}

// TokenizeShareRecord represents a tokenized delegation
message TokenizeShareRecord {
  option (gogoproto.equal) = true;

  uint64 id = 1;
  string owner = 2;
  string module_account = 3; // module account take the role of delegator
  string validator =
      4; // validator delegated to for tokenize share record creation
}

// PendingTokenizeShareAuthorizations stores a list of addresses that have their
// tokenize share enablement in progress
message PendingTokenizeShareAuthorizations { repeated string addresses = 1; }

// TokenizeShareLockStatus indicates whether the address is able to tokenize
// shares
enum TokenizeShareLockStatus {
  option (gogoproto.goproto_enum_prefix) = false;

  // UNSPECIFIED defines an empty tokenize share lock status
  TOKENIZE_SHARE_LOCK_STATUS_UNSPECIFIED = 0;
  // LOCKED indicates the account is locked and cannot tokenize shares
  TOKENIZE_SHARE_LOCK_STATUS_LOCKED = 1;
  // UNLOCKED indicates the account is unlocked and can tokenize shares
  TOKENIZE_SHARE_LOCK_STATUS_UNLOCKED = 2;
  // LOCK_EXPIRING indicates the account is unable to tokenize shares, but
  // will be able to tokenize shortly (after 1 unbonding period)
  TOKENIZE_SHARE_LOCK_STATUS_LOCK_EXPIRING = 3;
}

// TokenizeShareRecordReward represents the properties of tokenize share
message TokenizeShareRecordReward {
  option (gogoproto.goproto_getters) = false;
  option (gogoproto.goproto_stringer) = true;

  uint64 record_id = 1;

  repeated cosmos.base.v1beta1.DecCoin reward = 2 [
    (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins",
    (gogoproto.nullable) = false
  ];
}

// LiquidValidator is the storage layout for details about a validator's liquid
// stake.
message LiquidValidator {
  option (gogoproto.goproto_getters) = false;
  option (gogoproto.goproto_stringer) = true;

  // operator_address defines the address of the validator's operator; bech
  // encoded in JSON.
  string operator_address = 1
      [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

  // Number of shares either tokenized or owned by a liquid staking provider
  string liquid_shares = 3 [
    (gogoproto.moretags) = "yaml:\"liquid_shares\"",
    (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
    (gogoproto.nullable) = false
  ];
}