v2: code formate + market support for calculation amount ( from taker/maker + seller/buyer )
Signed-off-by: nfel <nfilsaraee@gmail.com>
This commit is contained in:
+50
-23
@@ -6,6 +6,47 @@ import "auth/v1/msg.proto";
|
||||
import "base/v1/msg.proto";
|
||||
import "wallet/v1/msg.proto";
|
||||
|
||||
enum MarketParticipantType {
|
||||
MO_PT_UNKOWN = 0;
|
||||
MO_PT_MAKER = 1;
|
||||
MO_PT_TAKER = 2;
|
||||
}
|
||||
|
||||
enum MarketOrderSide {
|
||||
MO_UNKOWN = 0;
|
||||
MO_BUY = 1;
|
||||
MO_SELL = 2;
|
||||
}
|
||||
|
||||
enum MarketOrderStatus {
|
||||
MO_UNKOWN_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_REFUNDED = 6; // Order is refunded by platform to user due to regulation
|
||||
// MO_EXPIRED = 7; // Order is expired
|
||||
}
|
||||
|
||||
message CalcMarketReq {
|
||||
optional auth.v1.InternalIAM iam = 1; // For whitelist :')
|
||||
int64 asset_id = 2;
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
message MPHistoryFilter {}
|
||||
message MPListFilter {}
|
||||
message MarketOrder {
|
||||
@@ -29,12 +70,14 @@ message MarketOrder {
|
||||
repeated string tags = 18;
|
||||
repeated string comment = 19;
|
||||
optional MarketOrder source = 20; // purchase is done via this field
|
||||
// repeated string attachments = 14; // possible files included by seller/buyer
|
||||
// repeated string attachments = 14; // possible files included by
|
||||
// seller/buyer
|
||||
}
|
||||
|
||||
message MarketAssetListReq {
|
||||
base.v1.BaseQueryParam base = 1;
|
||||
optional auth.v1.InternalIAM iam = 2; // If not set, will returns only public orders which are limited by a white list
|
||||
optional auth.v1.InternalIAM iam = 2; // If not set, will returns only public orders which are limited by a
|
||||
// white list
|
||||
}
|
||||
|
||||
message MarketAssetList {
|
||||
@@ -47,7 +90,6 @@ message PurchaseReq {
|
||||
double amount = 3;
|
||||
optional bool accepted_contract = 4;
|
||||
optional auth.v1.TFA tfa = 5;
|
||||
|
||||
}
|
||||
message PurchaseRes {
|
||||
uint64 order_id = 1;
|
||||
@@ -65,30 +107,15 @@ message MarketOrderList {
|
||||
|
||||
message NewMarketReq {
|
||||
auth.v1.InternalIAM iam = 1;
|
||||
// wallet.v1.Asset asset = 2;
|
||||
int64 asset_id = 2;
|
||||
int64 counter_asset_id = 3;
|
||||
double amount = 4;
|
||||
double unit_price = 5;
|
||||
MarketOrderSide side = 6;
|
||||
optional auth.v1.TFA tfa = 7;
|
||||
optional bool accepted_contract = 8;
|
||||
}
|
||||
|
||||
enum MarketOrderSide {
|
||||
MO_UNKOWN = 0;
|
||||
MO_BUY = 1;
|
||||
MO_SELL = 2;
|
||||
}
|
||||
enum MarketOrderStatus {
|
||||
MO_UNKOWN_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_REFUNDED = 6; // Order is refunded by platform to user due to regulation
|
||||
// MO_EXPIRED = 7; // Order is expired
|
||||
MarketParticipantType type = 6;
|
||||
wallet.v1.BuyAssetSide req_side = 7; // For Calculation : can be from asset or irt
|
||||
MarketOrderSide side = 8;
|
||||
optional auth.v1.TFA tfa = 9;
|
||||
optional bool accepted_contract = 10;
|
||||
}
|
||||
|
||||
message OrderListFilter {
|
||||
|
||||
@@ -7,6 +7,8 @@ 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 GetMarketOrderDet(auth.v1.IdReqWithIAM) returns (MarketOrder); // details of an order by id
|
||||
|
||||
Reference in New Issue
Block a user