tx · 9aM4hswQByZT2pPYHopHtcjR9ZWwRPYjkbZMPstUHujj

3N3KGW7Gbu5krHUEpi51GTFvTTEVyYvt1vM:  -0.10000000 Waves

2020.04.01 09:07 [934690] smart account 3N3KGW7Gbu5krHUEpi51GTFvTTEVyYvt1vM > SELF 0.00000000 Waves

{ "type": 13, "id": "9aM4hswQByZT2pPYHopHtcjR9ZWwRPYjkbZMPstUHujj", "fee": 10000000, "feeAssetId": null, "timestamp": 1585721293374, "version": 1, "sender": "3N3KGW7Gbu5krHUEpi51GTFvTTEVyYvt1vM", "senderPublicKey": "BSLyTW7cVFUAbFbgLdob7BDLUP4VSSnB3guBg4Gss9yM", "proofs": [ "5RcARbq2Pk2xqLW5AWTS7RxpWicFMCU8wRBKfzJ9GCyDYjpmX1eG6yiS8DGWkge1VFM3WMzvsmd3sNp4hmZQYA39" ], "script": "base64:AAIDAAAAAAAAAA8IARIECgIBCBIDCgEIEgAAAAA3AQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAgAAAAABAAAAFmdldEJvb2xCeUFkZHJlc3NBbmRLZXkAAAACAAAAB2FkZHJlc3MAAAADa2V5BAAAAAckbWF0Y2gwCQAEGwAAAAIFAAAAB2FkZHJlc3MFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAHQm9vbGVhbgQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQcBAAAAGGdldFN0cmluZ0J5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dE9yZGVyBQAAAApmaXJzdE9yZGVyCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAWZ2V0T3JkZXJGaWxsZWRUb3RhbEtleQAAAAEFAAAACmZpcnN0T3JkZXIJAABkAAAAAgUAAAALZmlsbGVkVG90YWwFAAAAG3RvdGFsT3JkZXJXYXZlbGV0ZXNSZXF1aXJlZAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEWdldE9yZGVyU3RhdHVzS2V5AAAAAQUAAAAKZmlyc3RPcmRlcgUAAAAJbmV3U3RhdHVzBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABCQEAAAANZ2V0T3JkZXJPd25lcgAAAAEFAAAACmZpcnN0T3JkZXIFAAAAE2ZpbGxhYmxlT3JkZXJBbW91bnQFAAAAC2JvbmRBc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAEG5ldXRyaW5vQ29udHJhY3QFAAAAG3RvdGFsT3JkZXJXYXZlbGV0ZXNSZXF1aXJlZAUAAAAEdW5pdAUAAAADbmlsAAAAAFBZGt0=", "chainId": 84, "height": 934690, "spentComplexity": 0 } View: original | compacted Prev: F57FaoH26uVUG6VawjFPBiC6jnT8sK5qiYkc2bUntJ8C Next: CJQyypAkXbbjcH5jVGjqRpjqdBitA8aZ193Jpwbn9frM Diff:
OldNewDifferences
169169 let roi = fraction((priceWavesByBondCents - currentPrice), 100, currentPrice)
170170 if (isBlocked)
171171 then throw("contract is blocked by EMERGENCY SHUTDOWN actions untill reactivation by emergency oracles")
172- else if ((0 >= deficit))
173- then throw("there is no ability to add order during proficit")
174- else if ((MINORDERTOTAL > pmt.amount))
175- then throw(("min order total equals " + toString(MINORDERTOTAL)))
176- else if ((roi > MAXROI))
177- then throw("max setOrder ROI is 100%")
178- else if ((0 >= roi))
179- then throw("min setOrder ROI is more than 0%")
180- else if (isDefined(pmt.assetId))
181- then throw("can use waves only")
182- else if ((0 >= price))
183- then throw("price less zero")
184- else if ((getOrderOwner(orderId) != ""))
185- then throw("order exists")
186- else if (if ((prevOrder != ""))
187- then (getOrderStatus(prevOrder) != NEW)
188- else false)
189- then throw("prev order status is not new")
190- else {
191- let owner = toString(i.caller)
192- let nextOrder = if ((prevOrder == ""))
193- then firstOrder
194- else getNextOrder(prevOrder)
195- let nextOrderRoi = getNumberByKey(getRoiByOrderIdKey(nextOrder))
196- let isNextOrderError = if (if ((nextOrder != ""))
197- then (roi >= nextOrderRoi)
198- else false)
172+ else if ((MINORDERTOTAL > pmt.amount))
173+ then throw(("min order total equals " + toString(MINORDERTOTAL)))
174+ else if ((roi > MAXROI))
175+ then throw("max setOrder ROI is 100%")
176+ else if ((0 >= roi))
177+ then throw("min setOrder ROI is more than 0%")
178+ else if (isDefined(pmt.assetId))
179+ then throw("can use waves only")
180+ else if ((0 >= price))
181+ then throw("price less zero")
182+ else if ((getOrderOwner(orderId) != ""))
183+ then throw("order exists")
184+ else if (if ((prevOrder != ""))
185+ then (getOrderStatus(prevOrder) != NEW)
186+ else false)
187+ then throw("prev order status is not new")
188+ else {
189+ let owner = toString(i.caller)
190+ let nextOrder = if ((prevOrder == ""))
191+ then firstOrder
192+ else getNextOrder(prevOrder)
193+ let nextOrderRoi = getNumberByKey(getRoiByOrderIdKey(nextOrder))
194+ let isNextOrderError = if (if ((nextOrder != ""))
195+ then (roi >= nextOrderRoi)
196+ else false)
197+ then true
198+ else false
199+ let prevOrderRoi = getNumberByKey(getRoiByOrderIdKey(prevOrder))
200+ let isPrevOrderError = if (if ((prevOrder != ""))
201+ then (prevOrderRoi > roi)
202+ else false)
203+ then true
204+ else false
205+ if (if (isNextOrderError)
206+ then true
207+ else isPrevOrderError)
208+ then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError)))
209+ else WriteSet([DataEntry(getPrevOrderKey(orderId), prevOrder), DataEntry(getNextOrderKey(orderId), nextOrder), DataEntry(getNextOrderKey(prevOrder), if ((prevOrder == ""))
210+ then ""
211+ else orderId), DataEntry(getPrevOrderKey(nextOrder), if ((nextOrder == ""))
212+ then ""
213+ else orderId), DataEntry(FirstOrderKey, if (if ((firstOrder == ""))
199214 then true
200- else false
201- let prevOrderRoi = getNumberByKey(getRoiByOrderIdKey(prevOrder))
202- let isPrevOrderError = if (if ((prevOrder != ""))
203- then (prevOrderRoi > roi)
204- else false)
205- then true
206- else false
207- if (if (isNextOrderError)
208- then true
209- else isPrevOrderError)
210- then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError)))
211- else WriteSet([DataEntry(getPrevOrderKey(orderId), prevOrder), DataEntry(getNextOrderKey(orderId), nextOrder), DataEntry(getNextOrderKey(prevOrder), if ((prevOrder == ""))
212- then ""
213- else orderId), DataEntry(getPrevOrderKey(nextOrder), if ((nextOrder == ""))
214- then ""
215- else orderId), DataEntry(FirstOrderKey, if (if ((firstOrder == ""))
216- then true
217- else (firstOrder == nextOrder))
218- then orderId
219- else firstOrder), DataEntry(getOrderPriceKey(orderId), price), DataEntry(getOrderTotalKey(orderId), pmt.amount), DataEntry(getOrderOwnerKey(orderId), owner), DataEntry(getOrderHeightKey(orderId), height), DataEntry(getOrderStatusKey(orderId), NEW), DataEntry(("debug_order_currentPrice_" + orderId), currentPrice), DataEntry(getRoiByOrderIdKey(orderId), roi)])
220- }
215+ else (firstOrder == nextOrder))
216+ then orderId
217+ else firstOrder), DataEntry(getOrderPriceKey(orderId), price), DataEntry(getOrderTotalKey(orderId), pmt.amount), DataEntry(getOrderOwnerKey(orderId), owner), DataEntry(getOrderHeightKey(orderId), height), DataEntry(getOrderStatusKey(orderId), NEW), DataEntry(("debug_order_currentPrice_" + orderId), currentPrice), DataEntry(getRoiByOrderIdKey(orderId), roi)])
218+ }
221219 }
222220
223221
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func getNumberByKey (key) = match getInteger(this, key) {
55 case a: Int =>
66 a
77 case _ =>
88 0
99 }
1010
1111
1212 func getStringByKey (key) = match getString(this, key) {
1313 case a: String =>
1414 a
1515 case _ =>
1616 ""
1717 }
1818
1919
2020 func getBoolByAddressAndKey (address,key) = match getBoolean(address, key) {
2121 case a: Boolean =>
2222 a
2323 case _ =>
2424 false
2525 }
2626
2727
2828 func getStringByAddressAndKey (address,key) = match getString(address, key) {
2929 case a: String =>
3030 a
3131 case _ =>
3232 ""
3333 }
3434
3535
3636 func getNumberByAddressAndKey (address,key) = match getInteger(address, key) {
3737 case a: Int =>
3838 a
3939 case _ =>
4040 0
4141 }
4242
4343
4444 let WAVELET = 100000000
4545
4646 let PAULI = 1000000
4747
4848 let PERCENTACCURACY = 1000
4949
5050 let MINORDERTOTAL = (10 * WAVELET)
5151
5252 let MAXROI = 100
5353
5454 let CANCELED = "canceled"
5555
5656 let NEW = "new"
5757
5858 let FILLED = "filled"
5959
6060 let NeutrinoContractKey = "neutrino_contract"
6161
6262 let PriceKey = "price"
6363
6464 let BondAssetIdKey = "bond_asset_id"
6565
6666 let NeutrinoAssetIdKey = "neutrino_asset_id"
6767
6868 let ControlContractKey = "control_contract"
6969
7070 let BalanceLockedkKey = "balance_lock_"
7171
7272 let WavesLockedBalanceKey = (BalanceLockedkKey + "waves")
7373
7474 let NeutrinoLockedBalanceKey = (BalanceLockedkKey + "neutrino")
7575
7676 let LiquidationContractKey = "liquidation_contract"
7777
7878 let FirstOrderKey = "order_first"
7979
8080 func getRoiByOrderIdKey (orderId) = ("debug_order_roi_" + orderId)
8181
8282
8383 func getOrderPriceKey (orderId) = ("order_price_" + orderId)
8484
8585
8686 func getOrderTotalKey (orderId) = ("order_total_" + orderId)
8787
8888
8989 func getOrderOwnerKey (orderId) = ("order_owner_" + orderId)
9090
9191
9292 func getOrderHeightKey (orderId) = ("order_height_" + orderId)
9393
9494
9595 func getOrderStatusKey (orderId) = ("order_status_" + orderId)
9696
9797
9898 func getOrderFilledTotalKey (orderId) = ("order_filled_total_" + orderId)
9999
100100
101101 func getPrevOrderKey (orderId) = ("order_prev_" + orderId)
102102
103103
104104 func getNextOrderKey (orderId) = ("order_next_" + orderId)
105105
106106
107107 func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, 100, price), WAVELET, PAULI)
108108
109109
110110 func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, 100), PAULI, WAVELET)
111111
112112
113113 func convertWavesToBond (amount,price) = convertWavesToNeutrino(amount, price)
114114
115115
116116 func convertBondToWaves (amount,price) = convertNeutrinoToWaves(amount, price)
117117
118118
119119 let neutrinoContract = addressFromStringValue("3MydqRdWHFcvU4ZogmgkGNHt8fqYiCRazbn")
120120
121121 let controlContract = addressFromStringValue("3MqY3tM5bgwds1ugNQGJziL8VJVvjTiNccH")
122122
123123 let liquidationContract = addressFromStringValue("3MyiJb9yZnpyXJADhdEoNk3MT3FHKmbYRJX")
124124
125125 let neutrinoAssetId = fromBase58String("4EUBRLwFstXZhMHWJPk9ZnyhHT4VVFCSZb6p6K5hySjd")
126126
127127 let bondAssetId = fromBase58String("Qh28HvUAcFboD1GsAcyURQjNW6mdpuGvXVgFS9e3CzC")
128128
129129 let isBlocked = getBoolByAddressAndKey(controlContract, "is_blocked")
130130
131131 let currentPrice = getNumberByAddressAndKey(controlContract, PriceKey)
132132
133133 let neutrinoLockedBalance = getNumberByAddressAndKey(neutrinoContract, NeutrinoLockedBalanceKey)
134134
135135 let reserve = (wavesBalance(neutrinoContract) - getNumberByAddressAndKey(neutrinoContract, WavesLockedBalanceKey))
136136
137137 let neutrinoSupply = (((neutrinoLockedBalance + extract(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId))
138138
139139 let deficit = (neutrinoSupply - convertWavesToNeutrino(reserve, currentPrice))
140140
141141 let firstOrder = getStringByKey(FirstOrderKey)
142142
143143 func getOrderPrice (id) = getNumberByKey(getOrderPriceKey(id))
144144
145145
146146 func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id))
147147
148148
149149 func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id))
150150
151151
152152 func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id))
153153
154154
155155 func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id))
156156
157157
158158 func getPrevOrder (id) = getStringByKey(getPrevOrderKey(id))
159159
160160
161161 func getNextOrder (id) = getStringByKey(getNextOrderKey(id))
162162
163163
164164 @Callable(i)
165165 func addBuyBondOrder (price,prevOrder) = {
166166 let pmt = extract(i.payment)
167167 let orderId = toBase58String(keccak256(((((toBytes(price) + toBytes(pmt.amount)) + i.caller.bytes) + toBytes(height)) + i.transactionId)))
168168 let priceWavesByBondCents = fraction(100, 100, price)
169169 let roi = fraction((priceWavesByBondCents - currentPrice), 100, currentPrice)
170170 if (isBlocked)
171171 then throw("contract is blocked by EMERGENCY SHUTDOWN actions untill reactivation by emergency oracles")
172- else if ((0 >= deficit))
173- then throw("there is no ability to add order during proficit")
174- else if ((MINORDERTOTAL > pmt.amount))
175- then throw(("min order total equals " + toString(MINORDERTOTAL)))
176- else if ((roi > MAXROI))
177- then throw("max setOrder ROI is 100%")
178- else if ((0 >= roi))
179- then throw("min setOrder ROI is more than 0%")
180- else if (isDefined(pmt.assetId))
181- then throw("can use waves only")
182- else if ((0 >= price))
183- then throw("price less zero")
184- else if ((getOrderOwner(orderId) != ""))
185- then throw("order exists")
186- else if (if ((prevOrder != ""))
187- then (getOrderStatus(prevOrder) != NEW)
188- else false)
189- then throw("prev order status is not new")
190- else {
191- let owner = toString(i.caller)
192- let nextOrder = if ((prevOrder == ""))
193- then firstOrder
194- else getNextOrder(prevOrder)
195- let nextOrderRoi = getNumberByKey(getRoiByOrderIdKey(nextOrder))
196- let isNextOrderError = if (if ((nextOrder != ""))
197- then (roi >= nextOrderRoi)
198- else false)
172+ else if ((MINORDERTOTAL > pmt.amount))
173+ then throw(("min order total equals " + toString(MINORDERTOTAL)))
174+ else if ((roi > MAXROI))
175+ then throw("max setOrder ROI is 100%")
176+ else if ((0 >= roi))
177+ then throw("min setOrder ROI is more than 0%")
178+ else if (isDefined(pmt.assetId))
179+ then throw("can use waves only")
180+ else if ((0 >= price))
181+ then throw("price less zero")
182+ else if ((getOrderOwner(orderId) != ""))
183+ then throw("order exists")
184+ else if (if ((prevOrder != ""))
185+ then (getOrderStatus(prevOrder) != NEW)
186+ else false)
187+ then throw("prev order status is not new")
188+ else {
189+ let owner = toString(i.caller)
190+ let nextOrder = if ((prevOrder == ""))
191+ then firstOrder
192+ else getNextOrder(prevOrder)
193+ let nextOrderRoi = getNumberByKey(getRoiByOrderIdKey(nextOrder))
194+ let isNextOrderError = if (if ((nextOrder != ""))
195+ then (roi >= nextOrderRoi)
196+ else false)
197+ then true
198+ else false
199+ let prevOrderRoi = getNumberByKey(getRoiByOrderIdKey(prevOrder))
200+ let isPrevOrderError = if (if ((prevOrder != ""))
201+ then (prevOrderRoi > roi)
202+ else false)
203+ then true
204+ else false
205+ if (if (isNextOrderError)
206+ then true
207+ else isPrevOrderError)
208+ then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError)))
209+ else WriteSet([DataEntry(getPrevOrderKey(orderId), prevOrder), DataEntry(getNextOrderKey(orderId), nextOrder), DataEntry(getNextOrderKey(prevOrder), if ((prevOrder == ""))
210+ then ""
211+ else orderId), DataEntry(getPrevOrderKey(nextOrder), if ((nextOrder == ""))
212+ then ""
213+ else orderId), DataEntry(FirstOrderKey, if (if ((firstOrder == ""))
199214 then true
200- else false
201- let prevOrderRoi = getNumberByKey(getRoiByOrderIdKey(prevOrder))
202- let isPrevOrderError = if (if ((prevOrder != ""))
203- then (prevOrderRoi > roi)
204- else false)
205- then true
206- else false
207- if (if (isNextOrderError)
208- then true
209- else isPrevOrderError)
210- then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError)))
211- else WriteSet([DataEntry(getPrevOrderKey(orderId), prevOrder), DataEntry(getNextOrderKey(orderId), nextOrder), DataEntry(getNextOrderKey(prevOrder), if ((prevOrder == ""))
212- then ""
213- else orderId), DataEntry(getPrevOrderKey(nextOrder), if ((nextOrder == ""))
214- then ""
215- else orderId), DataEntry(FirstOrderKey, if (if ((firstOrder == ""))
216- then true
217- else (firstOrder == nextOrder))
218- then orderId
219- else firstOrder), DataEntry(getOrderPriceKey(orderId), price), DataEntry(getOrderTotalKey(orderId), pmt.amount), DataEntry(getOrderOwnerKey(orderId), owner), DataEntry(getOrderHeightKey(orderId), height), DataEntry(getOrderStatusKey(orderId), NEW), DataEntry(("debug_order_currentPrice_" + orderId), currentPrice), DataEntry(getRoiByOrderIdKey(orderId), roi)])
220- }
215+ else (firstOrder == nextOrder))
216+ then orderId
217+ else firstOrder), DataEntry(getOrderPriceKey(orderId), price), DataEntry(getOrderTotalKey(orderId), pmt.amount), DataEntry(getOrderOwnerKey(orderId), owner), DataEntry(getOrderHeightKey(orderId), height), DataEntry(getOrderStatusKey(orderId), NEW), DataEntry(("debug_order_currentPrice_" + orderId), currentPrice), DataEntry(getRoiByOrderIdKey(orderId), roi)])
218+ }
221219 }
222220
223221
224222
225223 @Callable(i)
226224 func cancelOrder (orderId) = {
227225 let owner = getOrderOwner(orderId)
228226 let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId))
229227 let caller = toString(i.caller)
230228 let nextOrder = getNextOrder(orderId)
231229 let prevOrder = getPrevOrder(orderId)
232230 if (isBlocked)
233231 then throw("contract is blocked by EMERGENCY SHUTDOWN actions untill reactivation by emergency oracles")
234232 else if ((owner != caller))
235233 then throw("permission denied")
236234 else if ((getOrderStatus(orderId) != NEW))
237235 then throw("invalid order status")
238236 else ScriptResult(WriteSet([DataEntry(FirstOrderKey, if ((firstOrder == orderId))
239237 then nextOrder
240238 else firstOrder), DataEntry(getNextOrderKey(prevOrder), nextOrder), DataEntry(getPrevOrderKey(nextOrder), prevOrder), DataEntry(getOrderStatusKey(orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, unit)]))
241239 }
242240
243241
244242
245243 @Callable(i)
246244 func sellBond () = {
247245 let bondBalance = assetBalance(this, bondAssetId)
248246 let deficitPositive = if ((0 >= deficit))
249247 then 0
250248 else deficit
251249 let bondAmount = if ((deficitPositive >= bondBalance))
252250 then bondBalance
253251 else deficitPositive
254252 let returnAmount = if ((deficitPositive >= bondBalance))
255253 then 0
256254 else (bondBalance - deficitPositive)
257255 if (if ((deficitPositive == 0))
258256 then (bondBalance == 0)
259257 else false)
260258 then throw("without deficit")
261259 else if ((bondBalance == 0))
262260 then throw("without bonds to sell")
263261 else if ((returnAmount > 0))
264262 then TransferSet([ScriptTransfer(neutrinoContract, returnAmount, bondAssetId)])
265263 else if ((firstOrder == ""))
266264 then throw("empty orderbook")
267265 else {
268266 let nextOrder = getNextOrder(firstOrder)
269267 let filledTotal = getOrderFilledTotal(firstOrder)
270268 let orderPrice = getOrderPrice(firstOrder)
271269 let priceWavesByBondCents = fraction(100, 100, orderPrice)
272270 let roi = getNumberByKey(getRoiByOrderIdKey(firstOrder))
273271 let remainedTotal = (getOrderTotal(firstOrder) - filledTotal)
274272 let amountToExecuteOrder = convertWavesToBond(remainedTotal, priceWavesByBondCents)
275273 let fillOrderCondition = (bondAmount >= amountToExecuteOrder)
276274 let fillableOrderAmount = if (fillOrderCondition)
277275 then amountToExecuteOrder
278276 else bondAmount
279277 let totalOrderWaveletesRequired = convertBondToWaves(fillableOrderAmount, priceWavesByBondCents)
280278 if (if ((roi > fraction(deficit, 100, neutrinoSupply)))
281279 then true
282280 else (0 >= deficitPositive))
283281 then throw(("deficit should be higther or equal than roi: " + toString(roi)))
284282 else if ((amountToExecuteOrder == 0))
285283 then ScriptResult(WriteSet([DataEntry(FirstOrderKey, nextOrder), DataEntry(getPrevOrderKey(nextOrder), ""), DataEntry(FirstOrderKey, nextOrder), DataEntry(getOrderStatusKey(firstOrder), FILLED)]), TransferSet([ScriptTransfer(addressFromStringValue(getOrderOwner(firstOrder)), remainedTotal, unit)]))
286284 else if ((totalOrderWaveletesRequired == 0))
287285 then throw("cannot fill order at the moment")
288286 else {
289287 let newStatus = if (if (fillOrderCondition)
290288 then (remainedTotal == 0)
291289 else false)
292290 then FILLED
293291 else NEW
294292 ScriptResult(WriteSet([DataEntry(getPrevOrderKey(nextOrder), if ((newStatus == FILLED))
295293 then ""
296294 else firstOrder), DataEntry(FirstOrderKey, if ((newStatus == FILLED))
297295 then nextOrder
298296 else firstOrder), DataEntry(getOrderFilledTotalKey(firstOrder), (filledTotal + totalOrderWaveletesRequired)), DataEntry(getOrderStatusKey(firstOrder), newStatus)]), TransferSet([ScriptTransfer(addressFromStringValue(getOrderOwner(firstOrder)), fillableOrderAmount, bondAssetId), ScriptTransfer(neutrinoContract, totalOrderWaveletesRequired, unit)]))
299297 }
300298 }
301299 }
302300
303301

github/deemru/w8io/169f3d6 
89.76 ms