Skip to content

Commit

Permalink
locker,vault query added
Browse files Browse the repository at this point in the history
  • Loading branch information
Chandragupta Singh authored and Chandragupta Singh committed Jun 1, 2022
1 parent 9dcca8e commit 5ec981e
Show file tree
Hide file tree
Showing 14 changed files with 2,371 additions and 462 deletions.
4 changes: 3 additions & 1 deletion proto/comdex/collector/v1beta1/collector.proto
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,7 @@ message AssetIdToAuctionLookupTable {
bool is_surplus_auction = 2 [(gogoproto.moretags) = "yaml:\"is_surplus_auction\""];
bool is_debt_auction = 3 [(gogoproto.moretags) = "yaml:\"is_debt_auction\""];
bool is_auction_active = 4 [(gogoproto.moretags) = "yaml:\"is_auction_active\""];

bool asset_out_oracle_price = 15 [ (gogoproto.moretags) = "yaml:\"asset_out_oracle_price\"" ];
uint64 assset_out_price = 16 [
(gogoproto.moretags) = "yaml:\"assset_out_price\"" ];
}
31 changes: 31 additions & 0 deletions proto/comdex/locker/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,18 @@ service Query {
option (google.api.http).get = "/comdex/locker/v1beta1/owner_locker_info_by_all_product_owner/{owner}";
};

rpc QueryOwnerTxDetailsLockerOfProductbyOwner(QueryOwnerTxDetailsLockerOfProductbyOwnerRequest) returns (QueryOwnerTxDetailsLockerOfProductbyOwnerResponse) {
option (google.api.http).get = "/comdex/locker/v1beta1/owner_locker_tx-details_by_product/{product_id}/{owner}";
};

rpc QueryOwnerLockerByProductToAssetIDbyOwner(QueryOwnerLockerByProductToAssetIDbyOwnerRequest) returns (QueryOwnerLockerByProductToAssetIDbyOwnerResponse) {
option (google.api.http).get = "/comdex/locker/v1beta1/owner_locker_info_product_asset_id_owner/{product_id}/{asset_id}/{owner}";
};

rpc QueryLockerByProductbyOwner(QueryLockerByProductbyOwnerRequest) returns (QueryLockerByProductbyOwnerResponse) {
option (google.api.http).get = "/comdex/locker/v1beta1/locker_info_product_owner/{product_id}/{owner}";
};

rpc QueryLockerCountByProductID(QueryLockerCountByProductIDRequest) returns (QueryLockerCountByProductIDResponse) {
option (google.api.http).get = "/comdex/locker/v1beta1/total_locker_product_id/{product_id}";
};
Expand Down Expand Up @@ -134,6 +142,16 @@ message QueryOwnerLockerOfAllProductbyOwnerResponse {
repeated string locker_ids = 1 [ (gogoproto.moretags) = "yaml:\"locker_ids\"" ];
}

message QueryOwnerTxDetailsLockerOfProductbyOwnerRequest {
uint64 product_id = 1 [ (gogoproto.moretags) = "yaml:\"product_id\"" ];
string owner = 2 [ (gogoproto.moretags) = "yaml:\"owner\"" ];
}

message QueryOwnerTxDetailsLockerOfProductbyOwnerResponse {
repeated UserTxData userTxData = 1 [ (gogoproto.moretags) = "yaml:\"userTxData\"",
(gogoproto.nullable) = false ];
}

message QueryOwnerLockerByProductToAssetIDbyOwnerRequest {
uint64 product_id = 1 [ (gogoproto.moretags) = "yaml:\"product_id\"" ];
uint64 asset_id = 2 [ (gogoproto.moretags) = "yaml:\"asset_id\"" ];
Expand All @@ -148,6 +166,19 @@ message QueryOwnerLockerByProductToAssetIDbyOwnerResponse {
];
}

message QueryLockerByProductbyOwnerRequest {
uint64 product_id = 1 [ (gogoproto.moretags) = "yaml:\"product_id\"" ];
string owner = 2 [ (gogoproto.moretags) = "yaml:\"owner\"" ];
}

message QueryLockerByProductbyOwnerResponse {
repeated Locker lockerInfo = 1[
(gogoproto.customname) = "LockerInfo",
(gogoproto.moretags) = "yaml:\"lockerInfo\"",
(gogoproto.nullable) = false
];
}

message QueryLockerCountByProductIDRequest {
uint64 product_id = 1 [ (gogoproto.moretags) = "yaml:\"product_id\"" ];
}
Expand Down
19 changes: 18 additions & 1 deletion proto/comdex/vault/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ message QueryVaultInfoResponse {
];
}

message QueryVaultInfoByOwnerRequest {
string owner = 1 [ (gogoproto.moretags) = "yaml:\"owner\"" ];
}

message QueryVaultInfoByOwnerResponse {
repeated VaultInfo vaultsInfo = 1 [
(gogoproto.customname) = "VaultsInfo",
(gogoproto.moretags) = "yaml:\"vaultsInfo\"",
(gogoproto.nullable) = false
];
}

message QueryAllVaultsRequest {
cosmos.base.query.v1beta1.PageRequest pagination = 1
[ (gogoproto.moretags) = "yaml:\"pagination\"" ];
Expand Down Expand Up @@ -275,7 +287,8 @@ message QueryTVLlockedByAppRequest {
}

message QueryTVLlockedByAppResponse {
repeated TvlLockedDataMap tvldata = 1 [ (gogoproto.moretags) = "yaml:\"tvldata\"" ];
repeated TvlLockedDataMap tvldata = 1 [ (gogoproto.moretags) = "yaml:\"tvldata\"",
(gogoproto.nullable) = false ];
}


Expand All @@ -288,6 +301,10 @@ service Query {
option (google.api.http).get = "/comdex/vault/v1beta1/vaultsInfo/{id}";
};

rpc QueryVaultInfoByOwner(QueryVaultInfoByOwnerRequest) returns (QueryVaultInfoByOwnerResponse) {
option (google.api.http).get = "/comdex/vault/v1beta1/vaultsInfoByOwner/{owner}";
};

rpc QueryAllVaults(QueryAllVaultsRequest) returns (QueryAllVaultsResponse) {
option (google.api.http).get = "/comdex/vault/v1beta1/vaults";
};
Expand Down
20 changes: 18 additions & 2 deletions x/collector/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ func NewCmdLookupTableParams() *cobra.Command {
// NewCmdAuctionControlProposal cmd to update controls for auction params
func NewCmdAuctionControlProposal() *cobra.Command {
cmd := &cobra.Command{
Use: "auction-control [app-id] [asset_id] [surplus_auction] [debt_auction]",
Args: cobra.ExactArgs(4),
Use: "auction-control [app-id] [asset_id] [surplus_auction] [debt_auction] [asset_out_oracle_price] [assset_out_price]",
Args: cobra.ExactArgs(6),
Short: "Set auction control",
RunE: func(cmd *cobra.Command, args []string) error {

Expand All @@ -180,6 +180,16 @@ func NewCmdAuctionControlProposal() *cobra.Command {
return err
}

asset_out_oracle_price, err := ParseStringFromString(args[4], ",")
if err != nil {
return err
}

assset_out_price, err := ParseUint64SliceFromString(args[5], ",")
if err != nil {
return err
}

clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
Expand All @@ -195,11 +205,17 @@ func NewCmdAuctionControlProposal() *cobra.Command {
if err != nil {
return err
}
newasset_out_oracle_price, err := strconv.ParseBool(asset_out_oracle_price[i])
if err != nil {
return err
}
collectorAuctionLookupRecords.AppId = appId
var AssetIdToAuctionLookup types.AssetIdToAuctionLookupTable
AssetIdToAuctionLookup.AssetId = assetId[i]
AssetIdToAuctionLookup.IsSurplusAuction = newSurplusAuction
AssetIdToAuctionLookup.IsDebtAuction = newDebtAuction
AssetIdToAuctionLookup.AssetOutOraclePrice = newasset_out_oracle_price
AssetIdToAuctionLookup.AsssetOutPrice = assset_out_price[i]
collectorAuctionLookupRecords.AssetIdToAuctionLookup = append(collectorAuctionLookupRecords.AssetIdToAuctionLookup, AssetIdToAuctionLookup)
}

Expand Down
Loading

0 comments on commit 5ec981e

Please sign in to comment.