Compare commits
31 Commits
c102ca4055
...
fix/order
| Author | SHA1 | Date | |
|---|---|---|---|
| c61d390d38 | |||
|
dc7e4d244b
|
|||
|
e5886d2e86
|
|||
| b133fd5fed | |||
|
523093779a
|
|||
| 4f25639e98 | |||
| 39afba396d | |||
| 4a24fcb263 | |||
|
9e3c4b9ff0
|
|||
|
8c2305b8bd
|
|||
|
fe71cb20dd
|
|||
|
a2adce3670
|
|||
|
a3c15365f2
|
|||
| 099b435e09 | |||
| 0153e8a176 | |||
|
922a000214
|
|||
| df1df24852 | |||
| 431c98d9ca | |||
|
d822e8bfa7
|
|||
| fa218436a6 | |||
|
66931098a9
|
|||
| 1c6d3f3f01 | |||
| 30bec96010 | |||
| 68ade9b3af | |||
| 780638c2c6 | |||
| a19bcd544c | |||
| 219b388648 | |||
| cbc7524120 | |||
| f5a99c7adf | |||
| 4f269b9564 | |||
| 8ab8d8d0f9 |
@@ -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
@@ -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
@@ -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
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user