Skip to content

Commit

Permalink
Merge pull request #174 from comdex-official/testdev-wasm
Browse files Browse the repository at this point in the history
Testdev wasm
  • Loading branch information
dheerajkd30 authored Jun 1, 2022
2 parents 9dcca8e + ac995b8 commit eec5328
Show file tree
Hide file tree
Showing 26 changed files with 2,587 additions and 694 deletions.
4 changes: 2 additions & 2 deletions proto/comdex/asset/v1beta1/extendedPairVault.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ message ExtendedPairVault {

string pair_name = 14 [ (gogoproto.moretags) = "yaml:\"pair_name\"" ];
bool asset_out_oracle_price = 15 [ (gogoproto.moretags) = "yaml:\"asset_out_oracle_price\"" ];
uint64 assset_out_price = 16 [
(gogoproto.moretags) = "yaml:\"assset_out_price\"" ];
uint64 asset_out_price = 16 [
(gogoproto.moretags) = "yaml:\"asset_out_price\"" ];

}
12 changes: 8 additions & 4 deletions proto/comdex/collector/v1beta1/collector.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ message AssetIdToFeeCollected {
}
message AppIdToAssetCollectorMapping {
uint64 app_id = 1 [(gogoproto.moretags) = "yaml:\"app_id\""];
repeated AssetIdCollectorMappping asset_collector = 2 [(gogoproto.moretags) = "yaml:\"asset_collector\""];
repeated AssetIdCollectorMapping asset_collector = 2 [(gogoproto.moretags) = "yaml:\"asset_collector\""];
}

message AssetIdCollectorMappping {
message AssetIdCollectorMapping {
uint64 asset_id = 1 [(gogoproto.moretags) = "yaml:\"asset_id\""];
CollectorData collector = 2 [
(gogoproto.nullable) = false,
Expand All @@ -71,11 +71,13 @@ message CollectorLookupTable {
uint64 debt_threshold = 5 [
(gogoproto.moretags) = "yaml:\"debt_threshold\""];
string locker_saving_rate = 6 [
(gogoproto.moretags) = "yaml:\"locker_saving_rate\"",
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"locker_saving_rate\"",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"];
uint64 lot_size = 7 [
(gogoproto.moretags) = "yaml:\"lot_size\""];
string bid_factor = 8 [
(gogoproto.nullable) = false,
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"bid_factor\""
];
Expand Down Expand Up @@ -121,5 +123,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 asset_out_price = 16 [
(gogoproto.moretags) = "yaml:\"asset_out_price\"" ];
}
2 changes: 1 addition & 1 deletion proto/comdex/liquidation/v1beta1/locked_vault.proto
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ message LockedVault {
(gogoproto.moretags) = "yaml:\"current_collateralisation_ratio\""];

string collateral_to_be_auctioned = 15 [
(gogoproto.nullable) = false,
(gogoproto.customname) = "CollateralToBeAuctioned",
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.nullable) = true,
(gogoproto.moretags) = "yaml:\"collateral_to_be_auctioned\""];

google.protobuf.Timestamp liquidation_timestamp = 16 [
Expand Down
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
6 changes: 3 additions & 3 deletions x/asset/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ func NewCmdSubmitAddAssetMapingProposal() *cobra.Command {

func NewCmdSubmitAddExtendedPairsVaultProposal() *cobra.Command {
cmd := &cobra.Command{
Use: "add-pairs-vault [app_mapping_id] [pair_id] [liquidation_ratio] [stability_fee] [closing_fee] [liquidation_penalty] [draw_down_fee] [is_vault_active] [debt_cieling] [debt_floor] [is_psm_pair] [min_cr] [pair_name] [asset_out_oracle_price] [assset_out_price]",
Use: "add-pairs-vault [app_mapping_id] [pair_id] [liquidation_ratio] [stability_fee] [closing_fee] [liquidation_penalty] [draw_down_fee] [is_vault_active] [debt_cieling] [debt_floor] [is_psm_pair] [min_cr] [pair_name] [asset_out_oracle_price] [asset_out_price]",
Args: cobra.ExactArgs(15),
Short: "Add pairs vault",
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -949,7 +949,7 @@ func NewCmdSubmitAddExtendedPairsVaultProposal() *cobra.Command {
return err
}

assset_out_price, err := ParseUint64SliceFromString(args[14], ",")
asset_out_price, err := ParseUint64SliceFromString(args[14], ",")
if err != nil {
return err
}
Expand Down Expand Up @@ -1021,7 +1021,7 @@ func NewCmdSubmitAddExtendedPairsVaultProposal() *cobra.Command {
MinCr: newmin_cr,
PairName: pair_name[i],
AssetOutOraclePrice: newasset_out_oracle_price,
AsssetOutPrice: assset_out_price[i],
AssetOutPrice: asset_out_price[i],
})
}

Expand Down
6 changes: 3 additions & 3 deletions x/asset/keeper/pairs_vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (k *Keeper) AddExtendedPairsVaultRecords(ctx sdk.Context, records ...types.
MinCr: msg.MinCr,
PairName: msg.PairName,
AssetOutOraclePrice: msg.AssetOutOraclePrice,
AsssetOutPrice: msg.AsssetOutPrice,
AssetOutPrice: msg.AssetOutPrice,
}

k.SetPairsVaultID(ctx, app.Id)
Expand Down Expand Up @@ -221,7 +221,7 @@ func (k *Keeper) WasmAddExtendedPairsVaultRecords(ctx sdk.Context, AppMappingId,
MinCr: MinCr,
PairName: PairName,
AssetOutOraclePrice: AssetOutOraclePrice,
AsssetOutPrice: AssetOutPrice,
AssetOutPrice: AssetOutPrice,
}

k.SetPairsVaultID(ctx, app.Id)
Expand Down Expand Up @@ -295,7 +295,7 @@ func (k *Keeper) WasmUpdateLsrInPairsVault(ctx sdk.Context, app_id, ex_pair_id u
ExtPairVaultData.MinCr = min_cr
ExtPairVaultData.PairName = data.PairName
ExtPairVaultData.AssetOutOraclePrice = data.AssetOutOraclePrice
ExtPairVaultData.AsssetOutPrice = data.AsssetOutPrice
ExtPairVaultData.AssetOutPrice = data.AssetOutPrice
}
}
if count == 0 {
Expand Down
Loading

0 comments on commit eec5328

Please sign in to comment.