Compare commits

...

31 Commits

Author SHA1 Message Date
VQIVS c61d390d38 --wip-- [skip ci] 2025-08-05 14:56:42 +03:30
nfel dc7e4d244b v2: errors ( MARKET_ORDER_UNSUPPORTED_PARTICIPANT_TYPE )
Signed-off-by: nfel <nfilsaraee@gmail.com>
2025-08-05 14:29:32 +03:30
nfel e5886d2e86 v2: fix
Signed-off-by: nfel <nfilsaraee@gmail.com>
2025-08-05 12:46:46 +03:30
nfel b133fd5fed Merge pull request 'fix: market order req side type' (#29) from ref/match_order into v2
Reviewed-on: #29
2025-08-05 08:51:23 +00:00
nfel 523093779a maker order id as optional in newmarketorder + typo
Signed-off-by: nfel <nfilsaraee@gmail.com>
2025-08-05 12:20:53 +03:30
VQIVS 4f25639e98 fix: market order req side type 2025-08-05 12:05:48 +03:30
nfel 39afba396d Merge pull request 'fix: order confirmation req, res naming' (#28) from ref/match_order into v2
Reviewed-on: #28
2025-08-04 08:05:26 +00:00
VQIVS 4a24fcb263 fix: order confirmation req, res naming
Please enter the commit message for your changes. Lines starting
2025-08-03 16:47:56 +03:30
nfel 9e3c4b9ff0 Reapply "Can Trade added to asset filter"
This reverts commit fe71cb20dd.
2025-08-03 15:56:50 +03:30
nfel 8c2305b8bd Revert "market filter - source removed in favour of type and maker_order_id"
This reverts commit a2adce3670.
2025-08-03 14:48:44 +03:30
nfel fe71cb20dd Revert "Can Trade added to asset filter"
This reverts commit a3c15365f2.
2025-08-03 14:44:58 +03:30
nfel a2adce3670 market filter - source removed in favour of type and maker_order_id
Signed-off-by: nfel <nfilsaraee@gmail.com>
2025-08-03 13:36:38 +03:30
nfel a3c15365f2 Can Trade added to asset filter 2025-08-02 17:34:38 +03:30
nfel 099b435e09 Merge pull request 'Market Contract proto changes' (#27) from market/contract into v2
Reviewed-on: #27
2025-08-02 13:59:09 +00:00
nfel 0153e8a176 Merge branch 'v2' into market/contract 2025-08-02 13:58:55 +00:00
nfel 922a000214 Market Filter -> asset type changed 2025-08-02 17:28:05 +03:30
VQIVS df1df24852 ref: change Type to ParticipantType 2025-08-02 16:14:23 +03:30
VQIVS 431c98d9ca fix: change Type to ParticipantType 2025-08-02 16:04:44 +03:30
nfel d822e8bfa7 Added Market new flow 2025-08-02 12:52:16 +03:30
VQIVS fa218436a6 ref: add ParticipantType to market orderOut schema 2025-08-02 12:21:51 +03:30
nfel 66931098a9 Removed Asset.buy_unit_price
Renamed AssetPrice.platform -> AssetPrice.ico_price
2025-08-02 12:13:10 +03:30
VQIVS 1c6d3f3f01 ref: change purchase to NewTakerOrder 2025-08-02 12:10:32 +03:30
VQIVS 30bec96010 --wip-- [skip ci] 2025-08-01 23:50:05 +03:30
VQIVS 68ade9b3af --wip-- [skip ci] 2025-08-01 23:38:58 +03:30
VQIVS 780638c2c6 feat: add market contract req message 2025-07-30 15:53:35 +03:30
VQIVS a19bcd544c feat: add market contract req message 2025-07-30 13:53:12 +03:30
VQIVS 219b388648 ref: contract messages and rpc 2025-07-29 16:13:07 +03:30
VQIVS cbc7524120 feat: add market contract rpc 2025-07-29 14:54:11 +03:30
VQIVS f5a99c7adf feat: add market contract rpc 2025-07-29 11:56:51 +03:30
mapoofano 4f269b9564 Merge pull request 'chore: remove location from asset property' (#25) from chore-remove-location into v2
Reviewed-on: #25
2025-07-26 11:52:54 +00:00
mapoofano 8ab8d8d0f9 chore: remove location from asset property 2025-07-26 15:21:56 +03:30
4 changed files with 103 additions and 62 deletions
+1
View File
@@ -83,6 +83,7 @@ enum ErrCode {
MARKET_ORDER_CANCELED = 7023; MARKET_ORDER_CANCELED = 7023;
MARKET_ORDER_FAILED = 7024; MARKET_ORDER_FAILED = 7024;
MARKET_ORDER_UNKNOWN = 7025; MARKET_ORDER_UNKNOWN = 7025;
MARKET_ORDER_UNSUPPORTED_PARTICIPANT_TYPE = 7045;
ASSET_CAN_NOT_BUY = 7026; ASSET_CAN_NOT_BUY = 7026;
ASSET_BUY_PRICE_IS_ZERO = 7019; ASSET_BUY_PRICE_IS_ZERO = 7019;
MARKET_ORDER_MATCHING_ERR_REFUND = 7128; MARKET_ORDER_MATCHING_ERR_REFUND = 7128;
+67 -34
View File
@@ -19,11 +19,11 @@ enum MarketOrderSide {
enum MarketOrderStatus { enum MarketOrderStatus {
MO_UNKNOWN_MP_STATUS = 0; // Unknown MO_UNKNOWN_MP_STATUS = 0; // Unknown
MO_CREATED = 1; // Order is just created and awaits confirmation MO_CREATED = 1; // Order is just created and awaits confirmation
MO_OPEN = 2; // Order is open and waiting to be completed MO_OPEN = 2; // Order is open and waiting to be completed
MO_CANCEL = 3; // Cancelled by user MO_CANCEL = 3; // Cancelled by user
MO_COMPLETED = 4; // Order is completed MO_COMPLETED = 4; // Order is completed
MO_FAILED = 5; // Order is failed - bad trx , etc. MO_FAILED = 5; // Order is failed - bad trx , etc.
MO_REFUNDED = 6; // Order is refunded by platform to user due to regulation MO_REFUNDED = 6; // Order is refunded by platform to user due to regulation
// MO_EXPIRED = 7; // Order is expired // MO_EXPIRED = 7; // Order is expired
} }
@@ -34,18 +34,16 @@ message CalcMarketReq {
int64 counter_asset_id = 3; int64 counter_asset_id = 3;
double amount = 4; double amount = 4;
double unit_price = 5; double unit_price = 5;
MarketParticipantType type = 6; MarketParticipantType participant_type = 6;
wallet.v1.BuyAssetSide req_side = wallet.v1.BuyAssetSide req_side = 7; // For Calculation : can be from asset or irt
7; // For Calculation : can be from asset or irt
} }
message CalcMarketRes { message CalcMarketRes {
double calculated_irt_amount = 1; double calculated_irt_amount = 1;
double calculated_asset_amount = 2; double calculated_asset_amount = 2;
wallet.v1.EffectiveCommission commission = 3; wallet.v1.EffectiveCommission commission = 3;
MarketParticipantType type = 4; MarketParticipantType participant_type = 4;
wallet.v1.BuyAssetSide req_side = wallet.v1.BuyAssetSide req_side = 5; // For Calculation : can be from asset or irt
5; // For Calculation : can be from asset or irt
} }
message MPHistoryFilter {} message MPHistoryFilter {}
@@ -61,24 +59,25 @@ message MarketOrder {
MarketOrderSide side = 8; MarketOrderSide side = 8;
MarketOrderStatus status = 9; MarketOrderStatus status = 9;
int64 from = 10; int64 from = 10;
auth.v1.UserIdentityBasic from_identity = 11; MarketParticipantType participant_type = 11;
wallet.v1.Commission commission = 12; auth.v1.UserIdentityBasic from_identity = 12;
double completed_amount = 13; wallet.v1.Commission commission = 13;
double available_amount = 14; double completed_amount = 14;
string created_at = 15; double available_amount = 15;
string updated_at = 16; string created_at = 16;
bool is_public = 17; string updated_at = 17;
wallet.v1.TransactionList trx = 18; bool is_public = 18;
repeated string tags = 19; wallet.v1.TransactionList trx = 19;
repeated string comment = 20; repeated string tags = 20;
optional MarketOrder source = 21; // purchase is done via this field repeated string comment = 21;
optional MarketOrder source = 22; // purchase is done via this field
optional uint64 maker_order_id = 23;
// repeated string attachments = 14; // possible files included by // repeated string attachments = 14; // possible files included by
// seller/buyer // seller/buyer
} }
message MarketAssetListReq { message MarketAssetListReq {
optional auth.v1.InternalIAM iam = optional auth.v1.InternalIAM iam = 1; // If not set, will returns only public orders which are limited by a
1; // If not set, will returns only public orders which are limited by a
optional uint32 page_no = 2; optional uint32 page_no = 2;
optional uint32 page_size = 3; optional uint32 page_size = 3;
} }
@@ -90,17 +89,16 @@ message MarketAssetList {
uint32 total_count = 4; uint32 total_count = 4;
} }
message PurchaseReq { message MatchOrderReq {
auth.v1.InternalIAM iam = 1; auth.v1.InternalIAM iam = 1;
uint64 order_id = 2; uint64 order_id = 2;
double amount = 3; double amount = 3;
wallet.v1.BuyAssetSide req_side = wallet.v1.BuyAssetSide req_side = 7; // For Calculation : can be from asset or irt
7; // For Calculation : can be from asset or irt
optional bool accepted_contract = 4; optional bool accepted_contract = 4;
optional auth.v1.TFA tfa = 5; optional auth.v1.TFA tfa = 5;
} }
message PurchaseRes { message MatchOrderRes {
uint64 order_id = 1; uint64 order_id = 1;
double calculated_irt_amount = 2; double calculated_irt_amount = 2;
double calculated_asset_amount = 3; double calculated_asset_amount = 3;
@@ -115,18 +113,24 @@ message MarketOrderList {
uint32 total_count = 4; uint32 total_count = 4;
} }
/*
* participant_type: IS Maker/Taker
* side: IS Buying/Selling
* req_side: IS input (amount) in irt/asset
* */
message NewMarketReq { message NewMarketReq {
auth.v1.InternalIAM iam = 1; auth.v1.InternalIAM iam = 1;
int64 asset_id = 2; int64 asset_id = 2;
int64 counter_asset_id = 3; int64 counter_asset_id = 3;
double amount = 4; double amount = 4;
double unit_price = 5; double unit_price = 5;
MarketParticipantType type = 6; // TODO: Change name
wallet.v1.BuyAssetSide req_side = MarketParticipantType participant_type = 6;
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; MarketOrderSide side = 8;
optional auth.v1.TFA tfa = 9; // TODO: maker market order as optional
optional bool accepted_contract = 10; optional uint64 maker_order_id = 9;
} }
enum MarketOrdersSortBy { enum MarketOrdersSortBy {
@@ -150,7 +154,7 @@ message OrderListFilter {
repeated string to = 7; repeated string to = 7;
optional double starting_price = 8; optional double starting_price = 8;
optional double ending_price = 9; optional double ending_price = 9;
repeated wallet.v1.Asset asset = 10; repeated uint64 asset = 10;
optional uint64 order_id = 11; optional uint64 order_id = 11;
optional uint64 trx_id = 12; optional uint64 trx_id = 12;
optional bool is_public = 13; optional bool is_public = 13;
@@ -162,3 +166,32 @@ message OrderListFilter {
optional uint32 page_no = 19; optional uint32 page_no = 19;
optional uint32 page_size = 20; optional uint32 page_size = 20;
} }
/* Contract */
message ContractMarketRes {
string link = 1;
uint64 asset_id = 2;
uint64 agreement_id = 3;
uint64 transaction_id = 4;
string contract_hash = 5;
string contract_content = 6;
}
message DeclineMarketContractReq {
auth.v1.InternalIAM iam = 1;
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 = 2; // Maker OrderID
// double amount = 4;
// wallet.v1.BuyAssetSide req_side = 5;
}
+6 -7
View File
@@ -7,21 +7,20 @@ import "base/v1/msg.proto";
import "market/v1/msg.proto"; import "market/v1/msg.proto";
service MarketplaceSrv { service MarketplaceSrv {
rpc CalcMarketOrder(CalcMarketReq) returns (CalcMarketRes);
rpc MarketplaceSrvHealth(base.v1.Empty) returns (base.v1.StatusRes); 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 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 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 GetMarketAssetList(MarketAssetListReq) returns (MarketAssetList); // assets that can be listed in marketplace
rpc NewMarketOrder(NewMarketReq) returns (MarketOrder); // insert new buy order to market rpc CalcMarketOrder(CalcMarketReq) returns (CalcMarketRes);
rpc Purchase(PurchaseReq) returns (PurchaseRes); // purchase from an order
rpc CancelOrder(auth.v1.IdReqWithIAMAndTFA) returns (base.v1.StatusRes); // cancel an order rpc CancelOrder(auth.v1.IdReqWithIAMAndTFA) returns (base.v1.StatusRes); // cancel an order
rpc GetMarketPubHistory(OrderListFilter) returns (MarketOrderList); // This is for public market rpc NewMarketOrder(NewMarketReq) returns (MarketOrder); // insert new buy order to market
rpc GetUserMarketHistory(OrderListFilter) returns (MarketOrderList); // list of order + purchase related to buying an asset rpc GenerateMarketContract(MarketContractReq) returns (ContractMarketRes);
rpc ConfirmMarketContract(ConfirmMarketContractReq) returns (base.v1.StatusRes);
} }
+29 -21
View File
@@ -9,7 +9,9 @@ import "base/v1/msg.proto";
INTERNAL DATA INTERNAL DATA
*/ */
message InternalTransactionData { int64 transaction_id = 1; } message InternalTransactionData {
int64 transaction_id = 1;
}
/* /*
Federation Federation
@@ -99,7 +101,7 @@ message Asset {
string image = 8; string image = 8;
string description = 9; string description = 9;
string url = 10; string url = 10;
int64 buy_unit_price = 11; // int64 buy_unit_price = 11;
double buy_min_amount = 12; double buy_min_amount = 12;
double buy_max_amount = 13; double buy_max_amount = 13;
bool is_active = 20; bool is_active = 20;
@@ -155,7 +157,7 @@ message AssetList {
message AssetFilter { message AssetFilter {
repeated int64 ids = 1; repeated int64 ids = 1;
repeated AssetType type = 2; // AssetType repeated AssetType type = 2; // AssetType
repeated AssetType token_type = 3; // AssetType repeated AssetType token_type = 3; // AssetType
repeated AssetStatus status = 4; repeated AssetStatus status = 4;
repeated string name = 5; repeated string name = 5;
@@ -163,8 +165,9 @@ message AssetFilter {
optional bool can_sell = 7; optional bool can_sell = 7;
optional bool can_deposit = 8; optional bool can_deposit = 8;
optional bool can_withdraw = 9; optional bool can_withdraw = 9;
optional bool is_active = 10; optional bool can_trade = 10;
optional string search = 11; // Not yet implemented ! optional bool is_active = 11;
optional string search = 12; // Not yet implemented !
} }
message AssetDiscountReq { message AssetDiscountReq {
@@ -181,15 +184,14 @@ message AssetDiscountRes {
double static_amount = 4; double static_amount = 4;
double percentage = 5; double percentage = 5;
double max_amount = 6; double max_amount = 6;
double effective_amount = double effective_amount = 7; // based of asset price and discount amount in req
7; // based of asset price and discount amount in req
optional int64 supported_asset = 8; optional int64 supported_asset = 8;
} }
message AssetPrice { message AssetPrice {
string updated_at = 1; string updated_at = 1;
double market_price = 2; double market_price = 2;
double platform_price = 3; double ico_price = 3;
} }
message GetAssetReq { message GetAssetReq {
@@ -197,7 +199,9 @@ message GetAssetReq {
optional string code = 3; optional string code = 3;
} }
message AssetMeta { PropertyMeta property = 1; } message AssetMeta {
PropertyMeta property = 1;
}
message PropertyMeta { message PropertyMeta {
string description = 1; string description = 1;
@@ -211,15 +215,14 @@ message PropertyMeta {
string usage_type = 9; string usage_type = 9;
string completion_date = 10; string completion_date = 10;
string user_agreement_url = 11; string user_agreement_url = 11;
string location = 12; float lat = 12;
float lat = 13; float lng = 13;
float lng = 14; string map_link = 14;
string map_link = 15; PropertyDetail detail = 15;
PropertyDetail detail = 16;
} }
message PropertyDetail { message PropertyDetail {
repeated Content badge = 1; // 2> repeated Content badge = 1; // 2>
repeated Content content = 2; // 4> repeated Content content = 2; // 4>
} }
@@ -292,8 +295,7 @@ message UserBNPLReq {
optional float amount = 7; optional float amount = 7;
optional PaymentPeriodInfo payment_period = 8; optional PaymentPeriodInfo payment_period = 8;
optional bool has_agreed_contract = 9; optional bool has_agreed_contract = 9;
optional int32 current_step = optional int32 current_step = 10; // Can be useful for admin to change the current step
10; // Can be useful for admin to change the current step
optional int64 asset_id = 11; optional int64 asset_id = 11;
} }
@@ -481,7 +483,9 @@ message NationalIDReq {
string national_id = 2; string national_id = 2;
} }
message PubKeyRes { string pub_key = 1; } message PubKeyRes {
string pub_key = 1;
}
/* /*
Network Details Network Details
@@ -609,7 +613,9 @@ message IPGConfirmReq {
string final_amount = 7; string final_amount = 7;
} }
message IPGConfirmRes { string receipt_link = 1; } message IPGConfirmRes {
string receipt_link = 1;
}
message SaleManualReq { message SaleManualReq {
auth.v1.InternalIAM iam = 1; auth.v1.InternalIAM iam = 1;
@@ -658,7 +664,7 @@ message DeclineBuyContractReq {
message ConfirmBuyAssetReq { message ConfirmBuyAssetReq {
auth.v1.InternalIAM iam = 1; auth.v1.InternalIAM iam = 1;
uint64 agreement_id = 2; // Only in asset that require agreement contract uint64 agreement_id = 2; // Only in asset that require agreement contract
optional auth.v1.TFA tfa = 3; // This might be used in the future optional auth.v1.TFA tfa = 3; // This might be used in the future
} }
@@ -684,9 +690,11 @@ message BuyAssetRes {
/* Contract */ /* Contract */
enum ContractType { enum ContractType {
CONTRACT_TYPE_ICO = 0; CONTRACT_TYPE_ICO = 0;
CONTRACT_TYPE_MARKET = 1; CONTRACT_TYPE_MARKET = 1; //FIXME: Please remove this :)
CONTRACT_TYPE_BNPL = 2; CONTRACT_TYPE_BNPL = 2;
CONTRACT_TYPE_REDEEM = 3; CONTRACT_TYPE_REDEEM = 3;
CONTRACT_TYPE_MARKET_MAKER = 4;
CONTRACT_TYPE_MARKET_TAKER = 5;
} }
// agreement_id // agreement_id