From 68ade9b3af05a4dc8d9865cd3c5900dbe268bfd7 Mon Sep 17 00:00:00 2001 From: AmirMahdi Qiasvand Date: Fri, 1 Aug 2025 23:38:58 +0330 Subject: [PATCH 1/8] --wip-- [skip ci] --- market/v1/msg.proto | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/market/v1/msg.proto b/market/v1/msg.proto index 6765495..e5e07ed 100644 --- a/market/v1/msg.proto +++ b/market/v1/msg.proto @@ -161,10 +161,11 @@ message OrderListFilter { /* Contract */ message ContractMarketRes { string link = 1; - uint64 agreement_id = 2; - uint64 transaction_id = 3; - string contract_hash = 4; - string contract_content = 5; + uint64 asset_id = 2; + uint64 agreement_id = 3; + uint64 transaction_id = 4; + string contract_hash = 5; + string contract_content = 6; } message DeclineMarketContractReq { -- 2.47.2 From 30bec96010ae45bb312ebb6c8e5dc8481ea66a1b Mon Sep 17 00:00:00 2001 From: AmirMahdi Qiasvand Date: Fri, 1 Aug 2025 23:50:05 +0330 Subject: [PATCH 2/8] --wip-- [skip ci] --- market/v1/msg.proto | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/market/v1/msg.proto b/market/v1/msg.proto index e5e07ed..0b9ac17 100644 --- a/market/v1/msg.proto +++ b/market/v1/msg.proto @@ -175,7 +175,8 @@ message DeclineMarketContractReq { message MarketContractReq { auth.v1.InternalIAM iam = 1; - uint64 order_id = 2; // Maker OrderID - double amount = 3; - wallet.v1.BuyAssetSide req_side = 4; + uint64 asset_id = 2; + uint64 order_id = 3; // Maker OrderID + double amount = 4; + wallet.v1.BuyAssetSide req_side = 5; } -- 2.47.2 From 1c6d3f3f0103e68f4dc06f4362f3af93e6884237 Mon Sep 17 00:00:00 2001 From: AmirMahdi Qiasvand Date: Sat, 2 Aug 2025 12:10:32 +0330 Subject: [PATCH 3/8] ref: change purchase to NewTakerOrder --- market/v1/srv.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/market/v1/srv.proto b/market/v1/srv.proto index b062304..f79f321 100644 --- a/market/v1/srv.proto +++ b/market/v1/srv.proto @@ -18,7 +18,7 @@ service MarketplaceSrv { rpc NewMarketOrder(NewMarketReq) returns (MarketOrder); // insert new buy order to market - rpc Purchase(PurchaseReq) returns (PurchaseRes); // purchase from an order + rpc NewTakerOrder(PurchaseReq) returns (PurchaseRes); // purchase from an order rpc CancelOrder(auth.v1.IdReqWithIAMAndTFA) returns (base.v1.StatusRes); // cancel an order -- 2.47.2 From fa218436a67fb90d4e18145e33b9f9da911bfe7c Mon Sep 17 00:00:00 2001 From: AmirMahdi Qiasvand Date: Sat, 2 Aug 2025 12:21:51 +0330 Subject: [PATCH 4/8] ref: add ParticipantType to market orderOut schema --- market/v1/msg.proto | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/market/v1/msg.proto b/market/v1/msg.proto index 0b9ac17..d1d8158 100644 --- a/market/v1/msg.proto +++ b/market/v1/msg.proto @@ -59,17 +59,18 @@ message MarketOrder { MarketOrderSide side = 8; MarketOrderStatus status = 9; int64 from = 10; - auth.v1.UserIdentityBasic from_identity = 11; - wallet.v1.Commission commission = 12; - double completed_amount = 13; - double available_amount = 14; - string created_at = 15; - string updated_at = 16; - bool is_public = 17; - wallet.v1.TransactionList trx = 18; - repeated string tags = 19; - repeated string comment = 20; - optional MarketOrder source = 21; // purchase is done via this field + MarketParticipantType participant_type = 11; + auth.v1.UserIdentityBasic from_identity = 12; + wallet.v1.Commission commission = 13; + double completed_amount = 14; + double available_amount = 15; + string created_at = 16; + string updated_at = 17; + bool is_public = 18; + wallet.v1.TransactionList trx = 19; + repeated string tags = 20; + repeated string comment = 21; + optional MarketOrder source = 22; // purchase is done via this field // repeated string attachments = 14; // possible files included by // seller/buyer } -- 2.47.2 From d822e8bfa7fafd691dccb199e2d56e07989ba41d Mon Sep 17 00:00:00 2001 From: nfel Date: Sat, 2 Aug 2025 12:52:16 +0330 Subject: [PATCH 5/8] Added Market new flow --- market/v1/msg.proto | 44 ++++++++++++++++++++++++++++---------------- market/v1/srv.proto | 14 +++++--------- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/market/v1/msg.proto b/market/v1/msg.proto index d1d8158..70f4ba6 100644 --- a/market/v1/msg.proto +++ b/market/v1/msg.proto @@ -19,11 +19,11 @@ enum MarketOrderSide { enum MarketOrderStatus { MO_UNKNOWN_MP_STATUS = 0; // Unknown - MO_CREATED = 1; // Order is just created and awaits confirmation - MO_OPEN = 2; // Order is open and waiting to be completed - MO_CANCEL = 3; // Cancelled by user - MO_COMPLETED = 4; // Order is completed - MO_FAILED = 5; // Order is failed - bad trx , etc. + MO_CREATED = 1; // Order is just created and awaits confirmation + MO_OPEN = 2; // Order is open and waiting to be completed + MO_CANCEL = 3; // Cancelled by user + MO_COMPLETED = 4; // Order is completed + MO_FAILED = 5; // Order is failed - bad trx , etc. MO_REFUNDED = 6; // Order is refunded by platform to user due to regulation // MO_EXPIRED = 7; // Order is expired } @@ -35,7 +35,8 @@ message CalcMarketReq { double amount = 4; double unit_price = 5; MarketParticipantType type = 6; - wallet.v1.BuyAssetSide req_side = 7; // For Calculation : can be from asset or irt + wallet.v1.BuyAssetSide req_side = + 7; // For Calculation : can be from asset or irt } message CalcMarketRes { @@ -43,7 +44,8 @@ message CalcMarketRes { double calculated_asset_amount = 2; wallet.v1.EffectiveCommission commission = 3; MarketParticipantType type = 4; - wallet.v1.BuyAssetSide req_side = 5; // For Calculation : can be from asset or irt + wallet.v1.BuyAssetSide req_side = + 5; // For Calculation : can be from asset or irt } message MPHistoryFilter {} @@ -76,7 +78,8 @@ message MarketOrder { } message MarketAssetListReq { - optional auth.v1.InternalIAM iam = 1; // If not set, will returns only public orders which are limited by a + optional auth.v1.InternalIAM iam = + 1; // If not set, will returns only public orders which are limited by a optional uint32 page_no = 2; optional uint32 page_size = 3; } @@ -92,7 +95,8 @@ message PurchaseReq { auth.v1.InternalIAM iam = 1; uint64 order_id = 2; double amount = 3; - wallet.v1.BuyAssetSide req_side = 7; // For Calculation : can be from asset or irt + wallet.v1.BuyAssetSide req_side = + 7; // For Calculation : can be from asset or irt optional bool accepted_contract = 4; optional auth.v1.TFA tfa = 5; } @@ -118,11 +122,13 @@ message NewMarketReq { int64 counter_asset_id = 3; double amount = 4; double unit_price = 5; + // TODO: Change name MarketParticipantType type = 6; - wallet.v1.BuyAssetSide req_side = 7; // For Calculation : can be from asset or irt + // For Calculation : can be from asset or irt + wallet.v1.BuyAssetSide req_side = 7; MarketOrderSide side = 8; - optional auth.v1.TFA tfa = 9; - optional bool accepted_contract = 10; + // TODO: maker market order as optional + } enum MarketOrdersSortBy { @@ -174,10 +180,16 @@ message DeclineMarketContractReq { uint64 agreement_id = 2; } +message ConfirmMarketContractReq{ + auth.v1.InternalIAM iam = 1; + uint64 agreement_id = 2; + optional auth.v1.TFA tfa = 3; +} + message MarketContractReq { auth.v1.InternalIAM iam = 1; - uint64 asset_id = 2; - uint64 order_id = 3; // Maker OrderID - double amount = 4; - wallet.v1.BuyAssetSide req_side = 5; + // uint64 asset_id = 2; + uint64 order_id = 2; // Maker OrderID + // double amount = 4; + // wallet.v1.BuyAssetSide req_side = 5; } diff --git a/market/v1/srv.proto b/market/v1/srv.proto index f79f321..26f6b3b 100644 --- a/market/v1/srv.proto +++ b/market/v1/srv.proto @@ -7,24 +7,20 @@ import "base/v1/msg.proto"; import "market/v1/msg.proto"; service MarketplaceSrv { - rpc CalcMarketOrder(CalcMarketReq) returns (CalcMarketRes); rpc MarketplaceSrvHealth(base.v1.Empty) returns (base.v1.StatusRes); + rpc GetMarketPubHistory(OrderListFilter) returns (MarketOrderList); // This is for public market + rpc GetUserMarketHistory(OrderListFilter) returns (MarketOrderList); // list of order + purchase related to buying an asset rpc GetMarketOrderDet(auth.v1.IdReqWithIAM) returns (MarketOrder); // details of an order by id rpc GetAllOrderList(OrderListFilter) returns (MarketOrderList); // list of all orders (seller and buyer combined) - rpc GetMarketAssetList(MarketAssetListReq) returns (MarketAssetList); // assets that can be listed in marketplace - rpc NewMarketOrder(NewMarketReq) returns (MarketOrder); // insert new buy order to market - - rpc NewTakerOrder(PurchaseReq) returns (PurchaseRes); // purchase from an order + rpc CalcMarketOrder(CalcMarketReq) returns (CalcMarketRes); rpc CancelOrder(auth.v1.IdReqWithIAMAndTFA) returns (base.v1.StatusRes); // cancel an order - rpc GetMarketPubHistory(OrderListFilter) returns (MarketOrderList); // This is for public market - rpc GetUserMarketHistory(OrderListFilter) returns (MarketOrderList); // list of order + purchase related to buying an asset - - // Contract + rpc NewMarketOrder(NewMarketReq) returns (MarketOrder); // insert new buy order to market rpc GenerateMarketContract(MarketContractReq) returns (ContractMarketRes); + rpc ConfirmMarketContract(ConfirmMarketContractReq) returns (base.v1.StatusRes); } -- 2.47.2 From 431c98d9cabd24fabf1415221357e45c953ddd6b Mon Sep 17 00:00:00 2001 From: AmirMahdi Qiasvand Date: Sat, 2 Aug 2025 16:04:44 +0330 Subject: [PATCH 6/8] fix: change Type to ParticipantType --- market/v1/msg.proto | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/market/v1/msg.proto b/market/v1/msg.proto index 70f4ba6..60e75fb 100644 --- a/market/v1/msg.proto +++ b/market/v1/msg.proto @@ -19,11 +19,11 @@ enum MarketOrderSide { enum MarketOrderStatus { MO_UNKNOWN_MP_STATUS = 0; // Unknown - MO_CREATED = 1; // Order is just created and awaits confirmation - MO_OPEN = 2; // Order is open and waiting to be completed - MO_CANCEL = 3; // Cancelled by user - MO_COMPLETED = 4; // Order is completed - MO_FAILED = 5; // Order is failed - bad trx , etc. + MO_CREATED = 1; // Order is just created and awaits confirmation + MO_OPEN = 2; // Order is open and waiting to be completed + MO_CANCEL = 3; // Cancelled by user + MO_COMPLETED = 4; // Order is completed + MO_FAILED = 5; // Order is failed - bad trx , etc. MO_REFUNDED = 6; // Order is refunded by platform to user due to regulation // MO_EXPIRED = 7; // Order is expired } @@ -34,18 +34,16 @@ message CalcMarketReq { int64 counter_asset_id = 3; double amount = 4; double unit_price = 5; - MarketParticipantType type = 6; - wallet.v1.BuyAssetSide req_side = - 7; // For Calculation : can be from asset or irt + MarketParticipantType participant_type = 6; + wallet.v1.BuyAssetSide req_side = 7; // For Calculation : can be from asset or irt } message CalcMarketRes { double calculated_irt_amount = 1; double calculated_asset_amount = 2; wallet.v1.EffectiveCommission commission = 3; - MarketParticipantType type = 4; - wallet.v1.BuyAssetSide req_side = - 5; // For Calculation : can be from asset or irt + MarketParticipantType participant_type = 4; + wallet.v1.BuyAssetSide req_side = 5; // For Calculation : can be from asset or irt } message MPHistoryFilter {} @@ -78,8 +76,7 @@ message MarketOrder { } message MarketAssetListReq { - optional auth.v1.InternalIAM iam = - 1; // If not set, will returns only public orders which are limited by a + optional auth.v1.InternalIAM iam = 1; // If not set, will returns only public orders which are limited by a optional uint32 page_no = 2; optional uint32 page_size = 3; } @@ -95,8 +92,7 @@ message PurchaseReq { auth.v1.InternalIAM iam = 1; uint64 order_id = 2; double amount = 3; - wallet.v1.BuyAssetSide req_side = - 7; // For Calculation : can be from asset or irt + wallet.v1.BuyAssetSide req_side = 7; // For Calculation : can be from asset or irt optional bool accepted_contract = 4; optional auth.v1.TFA tfa = 5; } @@ -123,12 +119,11 @@ message NewMarketReq { double amount = 4; double unit_price = 5; // TODO: Change name - MarketParticipantType type = 6; + MarketParticipantType participant_type = 6; // For Calculation : can be from asset or irt wallet.v1.BuyAssetSide req_side = 7; MarketOrderSide side = 8; // TODO: maker market order as optional - } enum MarketOrdersSortBy { @@ -180,7 +175,7 @@ message DeclineMarketContractReq { uint64 agreement_id = 2; } -message ConfirmMarketContractReq{ +message ConfirmMarketContractReq { auth.v1.InternalIAM iam = 1; uint64 agreement_id = 2; optional auth.v1.TFA tfa = 3; -- 2.47.2 From df1df24852f2564af0dfc9c0d93d57f9407a447e Mon Sep 17 00:00:00 2001 From: AmirMahdi Qiasvand Date: Sat, 2 Aug 2025 16:04:44 +0330 Subject: [PATCH 7/8] ref: change Type to ParticipantType --- market/v1/msg.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/market/v1/msg.proto b/market/v1/msg.proto index 60e75fb..7349b1d 100644 --- a/market/v1/msg.proto +++ b/market/v1/msg.proto @@ -35,7 +35,7 @@ message CalcMarketReq { double amount = 4; double unit_price = 5; MarketParticipantType participant_type = 6; - wallet.v1.BuyAssetSide req_side = 7; // For Calculation : can be from asset or irt + optional wallet.v1.BuyAssetSide req_side = 7; // For Calculation : can be from asset or irt } message CalcMarketRes { -- 2.47.2 From 922a00021466d8e586e5a919c4ee9fce292d5918 Mon Sep 17 00:00:00 2001 From: nfel Date: Sat, 2 Aug 2025 17:28:05 +0330 Subject: [PATCH 8/8] Market Filter -> asset type changed --- market/v1/msg.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/market/v1/msg.proto b/market/v1/msg.proto index 7349b1d..c717b7b 100644 --- a/market/v1/msg.proto +++ b/market/v1/msg.proto @@ -147,7 +147,7 @@ message OrderListFilter { repeated string to = 7; optional double starting_price = 8; optional double ending_price = 9; - repeated wallet.v1.Asset asset = 10; + repeated uint64 asset = 10; optional uint64 order_id = 11; optional uint64 trx_id = 12; optional bool is_public = 13; -- 2.47.2