syntax = "proto3";

package elys.amm;
import "gogoproto/gogo.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "elys/amm/pool_asset.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/elys-network/elys/x/amm/types";

enum FilterType {
  FILTER_ALL = 0;
  FILTER_PERPETUAL = 1;
  FILTER_FIXED_WEIGHT = 2;
  FILTER_DYNAMIC_WEIGHT = 3;
  FILTER_LEVERAGE = 4;
}

message QueryEarnPoolRequest {
  repeated uint64 pool_ids = 1;
  FilterType filter_type = 2;
  cosmos.base.query.v1beta1.PageRequest pagination = 3;
}

message EarnPool {
  uint64 pool_id = 1;
  repeated PoolAsset assets = 2 [ (gogoproto.nullable) = false ];
  string pool_ratio = 3;
  string rewards_apr = 4 [
    (cosmos_proto.scalar) = "cosmos.Dec",
    (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
    (gogoproto.nullable) = false
  ];
  string borrow_apr = 5 [
    (cosmos_proto.scalar) = "cosmos.Dec",
    (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
    (gogoproto.nullable) = false
  ];
  string leverage_lp = 6 [
    (cosmos_proto.scalar) = "cosmos.Dec",
    (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
    (gogoproto.nullable) = false
  ];
  string perpetual = 7 [
    (cosmos_proto.scalar) = "cosmos.Dec",
    (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
    (gogoproto.nullable) = false
  ];
  string tvl = 8 [
    (cosmos_proto.scalar) = "cosmos.Dec",
    (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
    (gogoproto.nullable) = false
  ];
  string lp_token_price = 9 [
    (cosmos_proto.scalar) = "cosmos.Dec",
    (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
    (gogoproto.nullable) = false
  ];
  string rewards_usd = 10 [
    (cosmos_proto.scalar) = "cosmos.Dec",
    (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
    (gogoproto.nullable) = false
  ];
  repeated cosmos.base.v1beta1.Coin reward_coins = 11 [
    (gogoproto.nullable) = false,
    (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
  ];
  cosmos.base.v1beta1.Coin total_shares = 12 [
    (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Coin",
    (gogoproto.nullable) = false
  ];
  string swap_fee = 13 [
    (cosmos_proto.scalar) = "cosmos.Dec",
    (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
    (gogoproto.nullable) = false
  ];
  string fee_denom = 14;
  bool use_oracle = 15;
  bool is_leveragelp = 16;
}

message QueryEarnPoolResponse {
  repeated EarnPool pools = 1 [ (gogoproto.nullable) = false ];
}
