-
Notifications
You must be signed in to change notification settings - Fork 1
/
IFlexAPI.sol
121 lines (102 loc) · 4.89 KB
/
IFlexAPI.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
pragma ton-solidity >=0.47.0;
//it is record at order book
//can contain multiple orders
struct OrderBookRow {
string price;
string buyVolume;
string sellVolume;
}
struct TradeData {
string price;
string volume;
}
struct TradeDataUint {
uint128 price;
uint128 volume;
}
struct Candlestick {
string open;
string close;
string high;
string low;
string volume;
}
struct Tip3Tip3PairInfo {
string symbolMajor;
uint8 decimalsMajor;
string symbolMinor;
uint8 decimalsMinor;
address xchgTradingPair;
}
struct Tip3TonPairInfo {
string symbol;
uint8 decimals;
address tradingPair;
}
interface IFlexAPI {
//listing
function getPairs() external;// returns (Tip3Tip3PairInfo[] tip3tip3Pairs, Tip3TonPairInfo[] tip3tonPairs);
//order books
function getOrderBook(address tradingPair) external;// returns (OrderBookRow[] orderBook);
function getXchgOrderBook(address xchgTradingPair) external;// returns (XchgOrderBookRow[] orderBook);
//collect messages for
//notify_addr_(Grams(tons_cfg_.send_notify.get()), IGNORE_ACTION_ERRORS).onDealCompleted(tip3root_, price_, deal_amount);
//mapping(timestamp=>TradeData[])
function getPriceTickHistory(address tradingPair, uint32 startTime) external;// returns (mapping(uint32=>TradeData[]) history);
//collect messages for
//notify_addr_(Grams(tons_cfg_.send_notify.get())).onXchgDealCompleted(tip3root_sell_, tip3root_buy_, price_.numerator(), price_.denominator(), deal_amount);
//mapping(timestamp=>XchgTradeData[])
function getXchgPriceTickHistory(address xchgTradingPair, uint32 startTime) external;// returns (mapping(uint32=>XchgTradeData[]) history);
//Candlestick chart
function getCandlestickChart(address tradingPair, uint32 startTime, uint32 endTime, uint32 stepTime) external;// returns (mapping(uint32=>Candlestick) candles);
function getXchgCandlestickChart(address xchgTradingPair, uint32 startTime, uint32 endTime, uint32 stepTime) external;// returns (mapping(uint32=>Candlestick) candles);
//linear chart
function getLinearChart(address tradingPair, uint32 startTime, uint32 endTime, uint32 stepTime) external;// returns (mapping(uint32=>TradeData) prices);
function getXchgLinearChart(address xchgTradingPair, uint32 startTime, uint32 endTime, uint32 stepTime) external;// returns (mapping(uint32=>XchgTradeData) prices);
//buy order msg
function getBuyOrderMsg(address tradingPair, uint128 price, uint128 volume) external;
//sell order msg
function getSellOrderMsg(address tradingPair, uint128 price, uint128 volume) external;
}
interface IFlexAPIOnGetPairs {
function onGetPairs(Tip3Tip3PairInfo[] tip3tip3Pairs, Tip3TonPairInfo[] tip3tonPairs) external;
}
interface IFlexAPIOnGetOrderBook {
function onGetOrderBook(OrderBookRow[] orderBook) external;
function onGetXchgOrderBook(OrderBookRow[] orderBook) external;
}
interface IFlexAPIOnGetPriceTickHistory {
function onGetPriceTickHistory(mapping(uint32=>TradeData[]) history) external;
function onGetXchgPriceTickHistory(mapping(uint32=>TradeData[]) history) external;
}
interface IFlexAPIOnGetCandlestickChart {
function onGetCandlestickChart(mapping(uint32=>Candlestick) candles) external;
function onGetXchgCandlestickChart(mapping(uint32=>Candlestick) candles) external;
}
interface IFlexAPIOnGetLinearChart {
function onGetLinearChart(mapping(uint32=>TradeData) prices) external;
function onGetXchgLinearChart(mapping(uint32=>TradeData) prices) external;
}
interface IFlexAPIOnGetOrderMsg {
function onGetBuyOrderMsg(TvmCell message) external;
function onGetSellOrderMsg(TvmCell message) external;
}
contract ResponseABI is IFlexAPIOnGetPairs,
IFlexAPIOnGetOrderBook,
IFlexAPIOnGetPriceTickHistory,
IFlexAPIOnGetCandlestickChart,
IFlexAPIOnGetLinearChart,
IFlexAPIOnGetOrderMsg
{
function onGetPairs(Tip3Tip3PairInfo[] tip3tip3Pairs, Tip3TonPairInfo[] tip3tonPairs) external override {}
function onGetOrderBook(OrderBookRow[] orderBook) external override {}
function onGetXchgOrderBook(OrderBookRow[] orderBook) external override {}
function onGetPriceTickHistory(mapping(uint32=>TradeData[]) history) external override {}
function onGetXchgPriceTickHistory(mapping(uint32=>TradeData[]) history) external override {}
function onGetCandlestickChart(mapping(uint32=>Candlestick) candles) external override {}
function onGetXchgCandlestickChart(mapping(uint32=>Candlestick) candles) external override {}
function onGetLinearChart(mapping(uint32=>TradeData) prices) external override {}
function onGetXchgLinearChart(mapping(uint32=>TradeData) prices) external override {}
function onGetBuyOrderMsg(TvmCell message) external override {}
function onGetSellOrderMsg(TvmCell message) external override {}
}