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