tx · 3Vu7UZDVo4jDzR3qBhKkPc8emgnUi4Z2YZ1dScByzDYG 3MwLuek2V6JjKybacSPjk4uo78pNkttERW1: -0.01400000 Waves 2019.09.28 00:14 [695366] smart account 3MwLuek2V6JjKybacSPjk4uo78pNkttERW1 > SELF 0.00000000 Waves
{ "type": 13, "id": "3Vu7UZDVo4jDzR3qBhKkPc8emgnUi4Z2YZ1dScByzDYG", "fee": 1400000, "feeAssetId": null, "timestamp": 1569618875821, "version": 1, "sender": "3MwLuek2V6JjKybacSPjk4uo78pNkttERW1", "senderPublicKey": "J9XYsY58fH56YchACAvg2gFhmBF95dSf8LXAJB499n1J", "proofs": [ "63H1fBFBfnubWAL7xE2ULiAkpDwN7gYkK9qFx5FuQkgUkcJSaVKy5EiP6AqXF9oxn7Z4B5pWWCtw5pYR6fQWNDnv" ], "script": "base64:AAIDAAAAAAAAAAAAAAAoAQAAABhnZXROdW1iZXJCeUFkZHJlc3NBbmRLZXkAAAACAAAAB2FkZHJlc3MAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAAHYWRkcmVzcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAABAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAABAAAADmdldFN0cmluZ0J5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWECAAAA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nkAAAACBQAAAAxPcmRlckJvb2tLZXkFAAAADG5ld09yZGVyYm9vawkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAFmdldE9yZGVyRmlsbGVkVG90YWxLZXkAAAABBQAAAAdvcmRlcklkCQAAZAAAAAIFAAAAC2ZpbGxlZFRvdGFsBQAAAAV0b3RhbAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEWdldE9yZGVyU3RhdHVzS2V5AAAAAQUAAAAHb3JkZXJJZAUAAAAGc3RhdHVzBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAApvcmRlck93bmVyBQAAAAxmaWxsZWRBbW91bnQFAAAAC2JvbmRBc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAAQbmV1dHJpbm9Db250cmFjdAUAAAAFdG90YWwFAAAAD25ldXRyaW5vQXNzZXRJZAUAAAADbmlsAAAAAAfET2o=", "chainId": 84, "height": 695366, "spentComplexity": 0 } View: original | compacted Prev: EG5dbuA4eWdeST3dQE6UDab4PRxeE3zqy5aM6Fu3MMSd Next: 8SkJwaK2qjNp7zcae2JLNFaNrPBMsB4sPuzcbULxshBa Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getNumberByAddressAndKey (address,key) = match getInteger(addressFromStringValue(address), key) { | |
5 | 5 | case a: Int => | |
6 | 6 | a | |
7 | 7 | case _ => | |
8 | 8 | 0 | |
9 | 9 | } | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func getNumberByKey (key) = match getInteger(this, key) { | |
13 | 13 | case a: Int => | |
14 | 14 | a | |
15 | 15 | case _ => | |
16 | 16 | 0 | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func getStringByKey (key) = match getString(this, key) { | |
21 | 21 | case a: String => | |
22 | 22 | a | |
23 | 23 | case _ => | |
24 | 24 | "" | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | let ORDERSPLITSYMBOL = "_" | |
29 | 29 | ||
30 | 30 | let WAVELET = 100000000 | |
31 | 31 | ||
32 | 32 | let CANCELED = "canceled" | |
33 | 33 | ||
34 | 34 | let NEW = "new" | |
35 | 35 | ||
36 | 36 | let FILLED = "filled" | |
37 | 37 | ||
38 | 38 | let OrderBookKey = "orderbook" | |
39 | 39 | ||
40 | 40 | let OrderPriceKey = "order_price_" | |
41 | 41 | ||
42 | 42 | let OrderTotalKey = "order_total_" | |
43 | 43 | ||
44 | 44 | let OrderFilledTotalKey = "order_filled_total_" | |
45 | 45 | ||
46 | 46 | let OrderOwnerKey = "order_owner_" | |
47 | 47 | ||
48 | 48 | let OrderHeightKey = "order_height_" | |
49 | 49 | ||
50 | 50 | let OrderStatusKey = "order_status_" | |
51 | 51 | ||
52 | 52 | let PriceKey = "price" | |
53 | 53 | ||
54 | 54 | let BondAssetIdKey = "bond_asset_id" | |
55 | 55 | ||
56 | 56 | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
57 | 57 | ||
58 | 58 | let NeutrinoContractKey = "neutrino_contract" | |
59 | 59 | ||
60 | 60 | func getOrderPriceKey (orderId) = (OrderPriceKey + orderId) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func getOrderTotalKey (orderId) = (OrderTotalKey + orderId) | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func getOrderOwnerKey (orderId) = (OrderOwnerKey + orderId) | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func getOrderHeightKey (orderId) = (OrderHeightKey + orderId) | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func getOrderStatusKey (orderId) = (OrderStatusKey + orderId) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func getOrderFilledTotalKey (orderId) = (OrderFilledTotalKey + orderId) | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | let neutrinoAssetId = fromBase58String(getStringByKey(NeutrinoAssetIdKey)) | |
79 | 79 | ||
80 | 80 | let bondAssetId = fromBase58String(getStringByKey(BondAssetIdKey)) | |
81 | 81 | ||
82 | 82 | let neutrinoContract = getStringByKey(NeutrinoContractKey) | |
83 | 83 | ||
84 | 84 | let price = getNumberByAddressAndKey(neutrinoContract, PriceKey) | |
85 | 85 | ||
86 | 86 | let orderbook = getStringByKey(OrderBookKey) | |
87 | 87 | ||
88 | 88 | let reserve = wavesBalance(addressFromStringValue(neutrinoContract)) | |
89 | 89 | ||
90 | 90 | let neutrinoSupply = { | |
91 | 91 | let info = extract(assetInfo(neutrinoAssetId)) | |
92 | 92 | (info.quantity - assetBalance(addressFromStringValue(neutrinoContract), neutrinoAssetId)) | |
93 | 93 | } | |
94 | 94 | ||
95 | 95 | func getOrderPrice (id) = getNumberByKey(getOrderPriceKey(id)) | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id)) | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id)) | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id)) | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id)) | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func getOrderElementById (id) = (id + ORDERSPLITSYMBOL) | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func addOrder (orderId,position) = { | |
114 | 114 | let orders = split(orderbook, ORDERSPLITSYMBOL) | |
115 | 115 | let newOrder = getOrderElementById(orderId) | |
116 | 116 | if ((position == 0)) | |
117 | 117 | then (newOrder + orderbook) | |
118 | 118 | else if ((position >= (size(orders) - 1))) | |
119 | 119 | then (orderbook + newOrder) | |
120 | 120 | else { | |
121 | 121 | let parts = split(orderbook, getOrderElementById(orders[position])) | |
122 | 122 | (((parts[0] + newOrder) + getOrderElementById(orders[position])) + parts[1]) | |
123 | 123 | } | |
124 | 124 | } | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func dropOrder (orderId) = { | |
128 | 128 | let parts = split(orderbook, getOrderElementById(orderId)) | |
129 | 129 | (parts[0] + parts[1]) | |
130 | 130 | } | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | @Callable(i) | |
134 | 134 | func setOrder (price,position) = { | |
135 | 135 | let pmt = extract(i.payment) | |
136 | 136 | let newOrderId = toBase58String(keccak256((((toBytes(price) + toBytes(pmt.amount)) + i.caller.bytes) + toBytes(height)))) | |
137 | 137 | if ((pmt.assetId != neutrinoAssetId)) | |
138 | 138 | then throw("can use neutrino only") | |
139 | 139 | else if ((0 >= price)) | |
140 | 140 | then throw("price less zero") | |
141 | 141 | else if ((getOrderOwner(newOrderId) != "")) | |
142 | 142 | then throw("order exists") | |
143 | 143 | else { | |
144 | 144 | let orders = split(orderbook, ORDERSPLITSYMBOL) | |
145 | 145 | let nextOrderId = if ((position == 0)) | |
146 | 146 | then "" | |
147 | 147 | else orders[(position - 1)] | |
148 | 148 | let nextOrderPrice = getOrderPrice(nextOrderId) | |
149 | 149 | let isNextOrderError = if (if ((nextOrderId != "")) | |
150 | 150 | then (price > nextOrderPrice) | |
151 | 151 | else false) | |
152 | 152 | then true | |
153 | 153 | else false | |
154 | 154 | let prevOrderId = orders[position] | |
155 | 155 | let prevOrderPrice = getOrderPrice(prevOrderId) | |
156 | 156 | let isPrevOrderError = if ((prevOrderPrice >= price)) | |
157 | 157 | then true | |
158 | 158 | else false | |
159 | 159 | if (if (isNextOrderError) | |
160 | 160 | then true | |
161 | 161 | else isPrevOrderError) | |
162 | 162 | then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError))) | |
163 | 163 | else WriteSet([DataEntry(OrderBookKey, addOrder(newOrderId, position)), DataEntry(getOrderPriceKey(newOrderId), price), DataEntry(getOrderTotalKey(newOrderId), pmt.amount), DataEntry(getOrderOwnerKey(newOrderId), toString(i.caller)), DataEntry(getOrderHeightKey(newOrderId), height), DataEntry(getOrderStatusKey(newOrderId), NEW)]) | |
164 | 164 | } | |
165 | 165 | } | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | ||
169 | 169 | @Callable(i) | |
170 | 170 | func cancelOrder (orderId) = { | |
171 | 171 | let owner = getOrderOwner(orderId) | |
172 | 172 | let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId)) | |
173 | 173 | if ((owner != toString(i.caller))) | |
174 | 174 | then throw("permission denied") | |
175 | 175 | else ScriptResult(WriteSet([DataEntry(OrderBookKey, dropOrder(orderId)), DataEntry(getOrderStatusKey(orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, neutrinoAssetId)])) | |
176 | 176 | } | |
177 | 177 | ||
178 | 178 | ||
179 | 179 | ||
180 | 180 | @Callable(i) | |
181 | 181 | func executeOrder () = { | |
182 | 182 | let bondBalance = assetBalance(this, bondAssetId) | |
183 | 183 | let deficit = ((neutrinoSupply - ((reserve * price) / 100)) / WAVELET) | |
184 | 184 | let deficitPositive = if ((0 >= deficit)) | |
185 | 185 | then 0 | |
186 | 186 | else deficit | |
187 | 187 | let bondAmount = if ((deficitPositive >= bondBalance)) | |
188 | 188 | then bondBalance | |
189 | 189 | else deficitPositive | |
190 | 190 | let returnAmount = if ((deficitPositive >= bondBalance)) | |
191 | 191 | then 0 | |
192 | 192 | else (bondBalance - deficitPositive) | |
193 | 193 | if ((bondAmount == 0)) | |
194 | 194 | then TransferSet([ScriptTransfer(addressFromStringValue(neutrinoContract), returnAmount, bondAssetId)]) | |
195 | 195 | else { | |
196 | 196 | let orderId = split(orderbook, ORDERSPLITSYMBOL)[0] | |
197 | 197 | let filledTotal = getOrderFilledTotal(orderId) | |
198 | 198 | let orderTotal = getOrderTotal(orderId) | |
199 | 199 | let orderPrice = getOrderPrice(orderId) | |
200 | 200 | let orderOwner = getOrderOwner(orderId) | |
201 | 201 | let amount = ((((orderTotal - filledTotal) * 100) / orderPrice) / WAVELET) | |
202 | 202 | let newOrderbook = if ((bondAmount >= amount)) | |
203 | 203 | then dropOrder(orderId) | |
204 | 204 | else orderbook | |
205 | 205 | let filledAmount = if ((bondAmount >= amount)) | |
206 | 206 | then amount | |
207 | 207 | else bondAmount | |
208 | 208 | let total = (((filledAmount * orderPrice) / 100) * WAVELET) | |
209 | 209 | let status = if ((bondAmount >= amount)) | |
210 | 210 | then FILLED | |
211 | 211 | else NEW | |
212 | 212 | ScriptResult(WriteSet([DataEntry(OrderBookKey, newOrderbook), DataEntry(getOrderFilledTotalKey(orderId), (filledTotal + total)), DataEntry(getOrderStatusKey(orderId), status)]), TransferSet([ScriptTransfer(addressFromStringValue(orderOwner), filledAmount, bondAssetId), ScriptTransfer(addressFromStringValue(neutrinoContract), total, neutrinoAssetId)])) | |
213 | 213 | } | |
214 | 214 | } | |
215 | 215 | ||
216 | 216 |
github/deemru/w8io/026f985 27.62 ms ◑