tx · 7ib7q42TFXW558nKYQh6sBRzhboEFcXwPij2wocAhD61

3MxbR7b3gHF4XdQKNTT5aQMRiazHvrVWC8N:  -0.02000000 Waves

2021.01.22 19:16 [1364903] smart account 3MxbR7b3gHF4XdQKNTT5aQMRiazHvrVWC8N > SELF 0.00000000 Waves

{ "type": 13, "id": "7ib7q42TFXW558nKYQh6sBRzhboEFcXwPij2wocAhD61", "fee": 2000000, "feeAssetId": null, "timestamp": 1611332173954, "version": 1, "sender": "3MxbR7b3gHF4XdQKNTT5aQMRiazHvrVWC8N", "senderPublicKey": "4bj7YXaphTC4Ldx7DqqMmrTjNshRtw1yNsej2XXZcAzS", "proofs": [ "37nsoknN6BqYbVdFTjQmDKrfmJifCswGWjMzNY9uY5sZSkxHAaRRdLqxLdhtEE63YVsHSo6gQMbr4HjjmMmywvYP", "2T2hmJfih59hX8jevUrxJHjDNL3ZT5ingZLhDqLTNM7QjYvEDYF1DjF2jv1sA6WK2aMTDW9chY7xd8LAqQ7nXSef", "5EznK9R5BtUspQwx3Vmco31Ti9u7qUcU2R3djEDoef6NeJz2Dqkm5UQmUPcmkG3MGGu11V4sCWv6maNsr8Yt3vDv" ], "script": "base64:AAIEAAAAAAAAAAkIAhIAEgMKAQgAAABKAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5CQEAAAALdmFsdWVPckVsc2UAAAACCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQAAAAAAAAAAAAEAAAAOZ2V0U3RyaW5nQnlLZXkAAAABAAAAA2tleQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkCAAAAAAEAAAAWZ2V0Qm9vbEJ5QWRkcmVzc0FuZEtleQAAAAIAAAAHYWRkcmVzcwAAAANrZXkJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQbAAAAAgUAAAAHYWRkcmVzcwUAAAADa2V5BwEAAAAYZ2V0U3RyaW5nQnlBZGRyZXNzQW5kS2V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keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAIJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAACAAAAAAAAAAABAAAAAAAAAAAAAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAMJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAADAAAAAAAAAAACAAAAAAAAAAAACQAAZwAAAAIFAAAABWNvdW50AAAAAAAAAAAD2/UC0g==", "chainId": 84, "height": 1364903, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Er48URK6xZ8SZK2657Gw37FNVN1WN4Ptgk2up7Jk7HNa Next: none Diff:
OldNewDifferences
4040
4141 let PriceKey = "price"
4242
43-let BondAssetIdKey = "bond_asset_id"
43+let NsbtAssetIdKey = "bond_asset_id"
4444
4545 let NeutrinoAssetIdKey = "neutrino_asset_id"
4646
9999
100100 let neutrinoAssetId = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT'
101101
102-let bondAssetId = base58'BGhPYquXSK6UYjnPLEn94gFhetp4Jvf7toekEY4x1VDH'
102+let nsbtAssetId = base58'BGhPYquXSK6UYjnPLEn94gFhetp4Jvf7toekEY4x1VDH'
103103
104104 let isBlocked = getBoolByAddressAndKey(controlContract, "is_blocked")
105105
121121
122122 let firstOrder = getStringByKey(FirstOrderKey)
123123
124-let issuedNsbt = valueOrElse(getInteger(this, "tmp_issuedNsbt_2"), 0)
124+let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
125125
126-let nsbtMax = ((2850 * 1000) * PAULI)
127-
128-let nsbtCurrent = (((1850 * 1000) * PAULI) + issuedNsbt)
126+let nsbtSupply = (nsbtSupplyMAX - assetBalance(this, nsbtAssetId))
129127
130128 func getOrderPrice (id) = getNumberByKey(getOrderPriceKey(id))
131129
158156
159157
160158 func orderData (orderId,totalWavelets,filledWavelets,owner,status,roi,price) = [IntegerEntry(getOrderPriceKey(orderId), price), IntegerEntry(getOrderTotalKey(orderId), totalWavelets), IntegerEntry(getOrderFilledTotalKey(orderId), filledWavelets), StringEntry(getOrderOwnerKey(orderId), owner), IntegerEntry(getOrderHeightKey(orderId), height), StringEntry(getOrderStatusKey(orderId), status), IntegerEntry(("debug_order_currentPrice_" + orderId), currentPrice), IntegerEntry(getRoiByOrderIdKey(orderId), roi)]
161-
162-
163-func internalSellBond (pFirstOrder,pNextOrder,pFilledTotal,pRoi,pPrice,pPaymentWavelets,orderOwnerAddress,instantOrder) = {
164- let priceWavesByBondCents = getPriceForRoi(pRoi)
165- let remainedTotal = (pPaymentWavelets - pFilledTotal)
166- let fillableOrderAmount = convertWavesToBond(remainedTotal, priceWavesByBondCents)
167- let totalOrderWaveletesRequired = convertBondToWaves(fillableOrderAmount, priceWavesByBondCents)
168- let nbTokensSellCondition = (currentMaxRoi >= pRoi)
169- if (!(nbTokensSellCondition))
170- then throw(("innapropriate roi: " + toString(pRoi)))
171- else if ((totalOrderWaveletesRequired == 0))
172- then throw("cannot fill order at the moment")
173- else {
174- let changeWavelets = (remainedTotal - totalOrderWaveletesRequired)
175- let writeSetData = if (instantOrder)
176- then orderData(pFirstOrder, pPaymentWavelets, (pFilledTotal + totalOrderWaveletesRequired), toBase58String(orderOwnerAddress.bytes), FILLED, pRoi, currentPrice)
177- else [IntegerEntry(getOrderFilledTotalKey(pFirstOrder), (pFilledTotal + totalOrderWaveletesRequired)), StringEntry(getOrderStatusKey(pFirstOrder), FILLED), StringEntry(getPrevOrderKey(pNextOrder), ""), StringEntry(FirstOrderKey, pNextOrder)]
178- (writeSetData ++ [ScriptTransfer(orderOwnerAddress, fillableOrderAmount, bondAssetId), ScriptTransfer(neutrinoContract, totalOrderWaveletesRequired, unit), ScriptTransfer(orderOwnerAddress, changeWavelets, unit)])
179- }
180- }
181-
182-
183-func internalAddBuyBondOrder (roi,price,prevOrder,inv,instantOrder) = {
184- let pmt = value(inv.payments[0])
185- let newOrderId = toBase58String(inv.transactionId)
186- if (isBlocked)
187- then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
188- else if ((MINORDERTOTAL > pmt.amount))
189- then throw(("min order total equals " + toString(MINORDERTOTAL)))
190- else if ((roi > MAXROI))
191- then throw("max setOrder ROI is 95%")
192- else if ((0 > roi))
193- then throw("can't place order with negative roi")
194- else if ((roi == 0))
195- then throw("roi should not be equal to 0")
196- else if (isDefined(pmt.assetId))
197- then throw("can use waves only")
198- else if ((getOrderOwner(newOrderId) != ""))
199- then throw("order exists")
200- else if (if ((prevOrder != ""))
201- then (getOrderStatus(prevOrder) != NEW)
202- else false)
203- then throw("prev order status is not new")
204- else {
205- let isNewOrderAtFirstPosition = (prevOrder == "")
206- let owner = toString(inv.caller)
207- let nextOrder = if (isNewOrderAtFirstPosition)
208- then firstOrder
209- else getNextOrder(prevOrder)
210- let nextOrderRoi = getNumberByKey(getRoiByOrderIdKey(nextOrder))
211- let isNextOrderError = if (if ((nextOrder != ""))
212- then (roi >= nextOrderRoi)
213- else false)
214- then true
215- else false
216- let prevOrderRoi = getNumberByKey(getRoiByOrderIdKey(prevOrder))
217- let isPrevOrderError = if (if ((prevOrder != ""))
218- then (prevOrderRoi > roi)
219- else false)
220- then true
221- else false
222- if (if (isNextOrderError)
223- then true
224- else isPrevOrderError)
225- then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError)))
226- else if (if (isNewOrderAtFirstPosition)
227- then (currentMaxRoi >= roi)
228- else false)
229- then internalSellBond(newOrderId, nextOrder, 0, roi, price, pmt.amount, inv.caller, true)
230- else if (instantOrder)
231- then throw("Instant order couldn't be added into waiting queue")
232- else ([StringEntry(getPrevOrderKey(newOrderId), prevOrder), StringEntry(getNextOrderKey(newOrderId), nextOrder), StringEntry(getNextOrderKey(prevOrder), if ((prevOrder == ""))
233- then ""
234- else newOrderId), StringEntry(getPrevOrderKey(nextOrder), if ((nextOrder == ""))
235- then ""
236- else newOrderId), StringEntry(FirstOrderKey, if (if ((firstOrder == ""))
237- then true
238- else (firstOrder == nextOrder))
239- then newOrderId
240- else firstOrder)] ++ orderData(newOrderId, pmt.amount, 0, owner, NEW, roi, price))
241- }
242- }
243159
244160
245161 let IdxA = 0
286202 func toStr (name,curveResult) = (((((((((((((((((((((((((((((((((((((((name + "[nsbtAmountRaw=") + toString(curveResult[0])) + " usdnPayment=") + toString(curveResult[1])) + " wRaw=") + toString(curveResult[2])) + " uRaw=") + toString(curveResult[3])) + " mRaw=") + toString(curveResult[4])) + " sRaw=") + toString(curveResult[5])) + " nsbtCurveParam_a=") + toString(curveResult[6])) + " nsbtCurveParam_b=") + toString(curveResult[7])) + " wReservesInUsdn=") + toString(curveResult[8])) + " price=") + toString(curveResult[9])) + " multBR=") + toString(curveResult[10])) + " multPower=") + toString(curveResult[11])) + " multExpInPower=") + toString(curveResult[12])) + " multK=") + toString(curveResult[13])) + " multStepM1=") + toString(curveResult[14])) + " multStep2=") + toString(curveResult[15])) + " multStepM3=") + toString(curveResult[16])) + " multStep4=") + toString(curveResult[17])) + " stepM5=") + toString(curveResult[18])) + "]")
287203
288204
289-func bigComplexity (i) = if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (!(isDefined(transferTransactionById(fromBase58String("PdLw5JK5ppfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k")))))
290- then !(isDefined(transferTransactionById(fromBase58String("adLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
291- else false)
292- then !(isDefined(transferTransactionById(fromBase58String("sdLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
293- else false)
294- then !(isDefined(transferTransactionById(fromBase58String("ddLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
295- else false)
296- then !(isDefined(transferTransactionById(fromBase58String("fdLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
297- else false)
298- then !(isDefined(transferTransactionById(fromBase58String("gdLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
299- else false)
300- then !(isDefined(transferTransactionById(fromBase58String("hdLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
301- else false)
302- then !(isDefined(transferTransactionById(fromBase58String("jdLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
303- else false)
304- then !(isDefined(transferTransactionById(fromBase58String("kdLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
305- else false)
306- then !(isDefined(transferTransactionById(fromBase58String("rdLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
307- else false)
308- then !(isDefined(transferTransactionById(fromBase58String("tdLq5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
309- else false)
310- then !(isDefined(transferTransactionById(fromBase58String("tdLy5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
311- else false)
312- then !(isDefined(transferTransactionById(fromBase58String("tdLu5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
313- else false)
314- then !(isDefined(transferTransactionById(fromBase58String("tdLh5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
315- else false)
316- then !(isDefined(transferTransactionById(fromBase58String("1dL4JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
317- else false)
318- then !(isDefined(transferTransactionById(fromBase58String("2dL25JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
319- else false)
320- then !(isDefined(transferTransactionById(fromBase58String("3dL95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
321- else false)
322- then !(isDefined(transferTransactionById(fromBase58String("4dL95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
323- else false)
324- then !(isDefined(transferTransactionById(fromBase58String("5dL95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
325- else false)
326- then !(isDefined(transferTransactionById(fromBase58String("6dL95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
327- else false)
328- then !(isDefined(transferTransactionById(fromBase58String("7dL95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
329- else false)
330- then !(isDefined(transferTransactionById(fromBase58String("8dL95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
331- else false)
332- then !(isDefined(transferTransactionById(fromBase58String("91L95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
333- else false)
334- then !(isDefined(transferTransactionById(fromBase58String("92L95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
335- else false)
336- then !(isDefined(transferTransactionById(fromBase58String("93L95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
337- else false)
338- then !(isDefined(transferTransactionById(fromBase58String("94L95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
339- else false
340-
341-
342-func privateNsbtPriceREST () = {
343- let kCalcArray = calculateK(reserve, neutrinoSupply, currentPrice, nsbtMax, nsbtCurrent)
344- let multK = kCalcArray[IdxMultK]
345- let multStep1 = fraction(nsbtMax, MULT, (nsbtMax - nsbtCurrent))
346- let multStep2 = fraction(multStep1, multStep1, MULT)
347- let multNsbt2usdnPrice = fraction(multK, multStep2, MULT)
348- let nsbt2usdnPrice = fraction(multNsbt2usdnPrice, PAULI, MULT)
349- let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, currentPrice)
350- $Tuple2(IntegerEntry("nsbt2usdnPrice", nsbt2usdnPrice), IntegerEntry("nsbt2wavesPrice", nsbt2wavesPrice))
351- }
352-
353-
354-@Callable(i)
355-func nsbtPriceREST () = {
356- let nsbtPriceTuple = privateNsbtPriceREST()
357- let nsbt2usdnPrice = nsbtPriceTuple._1.value
358- let nsbt2wavesPrice = nsbtPriceTuple._2.value
359- let restData = makeString(["startNsbtPriceREST", toString(nsbt2usdnPrice), toString(nsbt2wavesPrice), "endNsbtPriceREST"], "__")
360- throw(restData)
361- }
362-
363-
364-
365205 @Callable(i)
366206 func buyNsbt () = {
367207 let pmt = value(i.payments[0])
375215 else if (((10 * WAVELET) > pmtAmount))
376216 then throw("min 10 waves expected")
377217 else {
378- let curveResult = curveFunction(reserve, neutrinoSupply, currentPrice, nsbtMax, nsbtCurrent, wavesPay)
218+ let curveResult = curveFunction(reserve, neutrinoSupply, currentPrice, nsbtSupplyMAX, nsbtSupply, wavesPay)
379219 let nsbtAmount = curveResult[0]
380- let nsbt2WavesPriceRaw = calcNsbt2WavesPriceRaw(wavesPay, nsbtAmount)
381- let roi = (fraction(getReversePrice(nsbt2WavesPriceRaw), 100, currentPrice) - 100)
382- (orderData(toBase58String(i.transactionId), pmtAmount, pmtAmount, toString(ownerAddress), FILLED, roi, nsbt2WavesPriceRaw) ++ [ScriptTransfer(ownerAddress, nsbtAmount, bondAssetId), ScriptTransfer(neutrinoContract, wavesPay, unit), StringEntry("debug_curveResult", toStr("curveResult", curveResult)), IntegerEntry("tmp_issuedNsbt_2", (issuedNsbt + nsbtAmount))])
220+ if ((0 >= nsbtAmount))
221+ then throw("nsbtAmount <= 0")
222+ else {
223+ let nsbt2WavesPriceRaw = calcNsbt2WavesPriceRaw(wavesPay, nsbtAmount)
224+ let roi = 0
225+ (orderData(toBase58String(i.transactionId), pmtAmount, pmtAmount, toString(ownerAddress), FILLED, roi, nsbt2WavesPriceRaw) ++ [ScriptTransfer(ownerAddress, nsbtAmount, nsbtAssetId), ScriptTransfer(neutrinoContract, wavesPay, unit), StringEntry("debug_curveResult", toStr("curveResult", curveResult))])
226+ }
383227 }
384- }
385-
386-
387-
388-@Callable(i)
389-func instantBuyNsbtOrFail (noLessThenRoi) = {
390- let pmt = value(i.payments[0])
391- let roi = currentMaxRoi
392- if ((noLessThenRoi > roi))
393- then throw(((("Current maxRoi=" + toString(roi)) + " is less then passed parameter noLessThenRoi=") + toString(noLessThenRoi)))
394- else {
395- let priceWavesByBondCents = getPriceForRoi(roi)
396- internalAddBuyBondOrder(roi, getReversePrice(priceWavesByBondCents), "", i, true)
397- }
398- }
399-
400-
401-
402-@Callable(i)
403-func addBuyBondOrder (price,prevOrder) = {
404- let pmt = value(i.payments[0])
405- let priceWavesByBondCents = getReversePrice(price)
406- if ((0 >= price))
407- then throw("price less zero")
408- else internalAddBuyBondOrder(fraction((priceWavesByBondCents - currentPrice), 100, currentPrice), price, prevOrder, i, false)
409228 }
410229
411230
417236 let caller = toString(i.caller)
418237 let nextOrder = getNextOrder(orderId)
419238 let prevOrder = getPrevOrder(orderId)
420- if (isBlocked)
421- then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
422- else if ((owner != caller))
423- then throw("permission denied")
424- else if ((getOrderStatus(orderId) != NEW))
425- then throw("invalid order status")
426- else [StringEntry(FirstOrderKey, if ((firstOrder == orderId))
427- then nextOrder
428- else firstOrder), StringEntry(getNextOrderKey(prevOrder), nextOrder), StringEntry(getPrevOrderKey(nextOrder), prevOrder), StringEntry(getOrderStatusKey(orderId), CANCELED), ScriptTransfer(i.caller, amount, unit)]
239+ if ((getOrderStatus(orderId) != NEW))
240+ then throw("invalid order status")
241+ else [StringEntry(FirstOrderKey, if ((firstOrder == orderId))
242+ then nextOrder
243+ else firstOrder), StringEntry(getNextOrderKey(prevOrder), nextOrder), StringEntry(getPrevOrderKey(nextOrder), prevOrder), StringEntry(getOrderStatusKey(orderId), CANCELED), ScriptTransfer(i.caller, amount, unit)]
429244 }
430-
431-
432-
433-@Callable(i)
434-func sellBond () = if (isBlocked)
435- then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
436- else if ((firstOrder == ""))
437- then throw("empty orderbook")
438- else {
439- let nextOrder = getNextOrder(firstOrder)
440- let filledTotal = getOrderFilledTotal(firstOrder)
441- let orderPrice = getOrderPrice(firstOrder)
442- let roi = getNumberByKey(getRoiByOrderIdKey(firstOrder))
443- let paymentWavelets = getOrderTotal(firstOrder)
444- let orderOwnerAddress = Address(fromBase58String(getOrderOwner(firstOrder)))
445- internalSellBond(firstOrder, nextOrder, filledTotal, roi, orderPrice, paymentWavelets, orderOwnerAddress, false)
446- }
447245
448246
449247 @Verifier(tx)
450248 func verify () = {
451- let pubKeyAdminsList = ["GXxmZaCigPgJsT6d1cLr8nUXA65nGX8V7FuAzzrY8wQE", "3xumx4hrPpeeoo79HLGbZCgfz95L39ZFdxxwWeSUC2Pu", "D4CqtK5fBsnzRo33ZMhrM7niLseDH2uRoK6weBq2JQ3A", "5WRXFSjwcTbNfKcJs8ZqXmSSWYsSVJUtMvMqZj5hH4Nc"]
249+ let pubKeyAdminsList = ["GJdLSaLiv5K7xuejac8mcRcHoyo3dPrESrvktG3a6MAR", "3xumx4hrPpeeoo79HLGbZCgfz95L39ZFdxxwWeSUC2Pu", "D4CqtK5fBsnzRo33ZMhrM7niLseDH2uRoK6weBq2JQ3A", "5WRXFSjwcTbNfKcJs8ZqXmSSWYsSVJUtMvMqZj5hH4Nc"]
452250 let count = ((((if (sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(pubKeyAdminsList[0])))
453251 then 1
454252 else 0) + (if (sigVerify(tx.bodyBytes, tx.proofs[1], fromBase58String(pubKeyAdminsList[1])))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func getNumberByKey (key) = valueOrElse(getInteger(this, key), 0)
55
66
77 func getStringByKey (key) = valueOrElse(getString(this, key), "")
88
99
1010 func getBoolByAddressAndKey (address,key) = valueOrElse(getBoolean(address, key), false)
1111
1212
1313 func getStringByAddressAndKey (address,key) = valueOrElse(getString(address, key), "")
1414
1515
1616 func getNumberByAddressAndKey (address,key) = valueOrElse(getInteger(address, key), 0)
1717
1818
1919 let WAVELET = 100000000
2020
2121 let PAULI = 1000000
2222
2323 let PAULISCALE = 6
2424
2525 let PRICELET = 1000000
2626
2727 let MULT = 100000000
2828
2929 let MULTSCALE = 8
3030
3131 let MINORDERTOTAL = (10 * WAVELET)
3232
3333 let MAXROI = 95
3434
3535 let CANCELED = "canceled"
3636
3737 let NEW = "new"
3838
3939 let FILLED = "filled"
4040
4141 let PriceKey = "price"
4242
43-let BondAssetIdKey = "bond_asset_id"
43+let NsbtAssetIdKey = "bond_asset_id"
4444
4545 let NeutrinoAssetIdKey = "neutrino_asset_id"
4646
4747 let BalanceLockedkKey = "balance_lock_"
4848
4949 let WavesLockedBalanceKey = (BalanceLockedkKey + "waves")
5050
5151 let NeutrinoLockedBalanceKey = (BalanceLockedkKey + "neutrino")
5252
5353 let FirstOrderKey = "order_first"
5454
5555 func getRoiByOrderIdKey (orderId) = ("debug_order_roi_" + orderId)
5656
5757
5858 func getOrderPriceKey (orderId) = ("order_price_" + orderId)
5959
6060
6161 func getOrderTotalKey (orderId) = ("order_total_" + orderId)
6262
6363
6464 func getOrderOwnerKey (orderId) = ("order_owner_" + orderId)
6565
6666
6767 func getOrderHeightKey (orderId) = ("order_height_" + orderId)
6868
6969
7070 func getOrderStatusKey (orderId) = ("order_status_" + orderId)
7171
7272
7373 func getOrderFilledTotalKey (orderId) = ("order_filled_total_" + orderId)
7474
7575
7676 func getPrevOrderKey (orderId) = ("order_prev_" + orderId)
7777
7878
7979 func getNextOrderKey (orderId) = ("order_next_" + orderId)
8080
8181
8282 func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, PRICELET, price), WAVELET, PAULI)
8383
8484
8585 func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, PRICELET), PAULI, WAVELET)
8686
8787
8888 func convertWavesToBond (amount,price) = convertWavesToNeutrino(amount, price)
8989
9090
9191 func convertBondToWaves (amount,price) = convertNeutrinoToWaves(amount, price)
9292
9393
9494 let neutrinoContract = Address(base58'3Mzbx34Ex5rRbn39vUHx9kiwh3nneF8S5we')
9595
9696 let controlContract = Address(base58'3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx')
9797
9898 let liquidationContract = Address(base58'3N5nmMvMH8o3RPEyCKCaoWahBTYTexnZy62')
9999
100100 let neutrinoAssetId = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT'
101101
102-let bondAssetId = base58'BGhPYquXSK6UYjnPLEn94gFhetp4Jvf7toekEY4x1VDH'
102+let nsbtAssetId = base58'BGhPYquXSK6UYjnPLEn94gFhetp4Jvf7toekEY4x1VDH'
103103
104104 let isBlocked = getBoolByAddressAndKey(controlContract, "is_blocked")
105105
106106 let currentPrice = getNumberByAddressAndKey(controlContract, PriceKey)
107107
108108 let neutrinoLockedBalance = getNumberByAddressAndKey(neutrinoContract, NeutrinoLockedBalanceKey)
109109
110110 let reserve = (wavesBalance(neutrinoContract).regular - getNumberByAddressAndKey(neutrinoContract, WavesLockedBalanceKey))
111111
112112 let reservesInUsdn = convertWavesToNeutrino(reserve, currentPrice)
113113
114114 let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId))
115115
116116 let deficit = (neutrinoSupply - reservesInUsdn)
117117
118118 let currentMaxRoi = fraction(deficit, 100, neutrinoSupply)
119119
120120 let currentBrMult = fraction(reservesInUsdn, MULT, neutrinoSupply)
121121
122122 let firstOrder = getStringByKey(FirstOrderKey)
123123
124-let issuedNsbt = valueOrElse(getInteger(this, "tmp_issuedNsbt_2"), 0)
124+let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
125125
126-let nsbtMax = ((2850 * 1000) * PAULI)
127-
128-let nsbtCurrent = (((1850 * 1000) * PAULI) + issuedNsbt)
126+let nsbtSupply = (nsbtSupplyMAX - assetBalance(this, nsbtAssetId))
129127
130128 func getOrderPrice (id) = getNumberByKey(getOrderPriceKey(id))
131129
132130
133131 func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id))
134132
135133
136134 func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id))
137135
138136
139137 func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id))
140138
141139
142140 func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id))
143141
144142
145143 func getPrevOrder (id) = getStringByKey(getPrevOrderKey(id))
146144
147145
148146 func getNextOrder (id) = getStringByKey(getNextOrderKey(id))
149147
150148
151149 func getPriceForRoi (roiPercents) = fraction((100 + roiPercents), currentPrice, 100)
152150
153151
154152 func getReversePrice (price) = ((PRICELET * PRICELET) / price)
155153
156154
157155 func calcNsbt2WavesPriceRaw (spentWavesRaw,receivedNsbtRaw) = fraction(spentWavesRaw, (PAULI * PRICELET), receivedNsbtRaw)
158156
159157
160158 func orderData (orderId,totalWavelets,filledWavelets,owner,status,roi,price) = [IntegerEntry(getOrderPriceKey(orderId), price), IntegerEntry(getOrderTotalKey(orderId), totalWavelets), IntegerEntry(getOrderFilledTotalKey(orderId), filledWavelets), StringEntry(getOrderOwnerKey(orderId), owner), IntegerEntry(getOrderHeightKey(orderId), height), StringEntry(getOrderStatusKey(orderId), status), IntegerEntry(("debug_order_currentPrice_" + orderId), currentPrice), IntegerEntry(getRoiByOrderIdKey(orderId), roi)]
161-
162-
163-func internalSellBond (pFirstOrder,pNextOrder,pFilledTotal,pRoi,pPrice,pPaymentWavelets,orderOwnerAddress,instantOrder) = {
164- let priceWavesByBondCents = getPriceForRoi(pRoi)
165- let remainedTotal = (pPaymentWavelets - pFilledTotal)
166- let fillableOrderAmount = convertWavesToBond(remainedTotal, priceWavesByBondCents)
167- let totalOrderWaveletesRequired = convertBondToWaves(fillableOrderAmount, priceWavesByBondCents)
168- let nbTokensSellCondition = (currentMaxRoi >= pRoi)
169- if (!(nbTokensSellCondition))
170- then throw(("innapropriate roi: " + toString(pRoi)))
171- else if ((totalOrderWaveletesRequired == 0))
172- then throw("cannot fill order at the moment")
173- else {
174- let changeWavelets = (remainedTotal - totalOrderWaveletesRequired)
175- let writeSetData = if (instantOrder)
176- then orderData(pFirstOrder, pPaymentWavelets, (pFilledTotal + totalOrderWaveletesRequired), toBase58String(orderOwnerAddress.bytes), FILLED, pRoi, currentPrice)
177- else [IntegerEntry(getOrderFilledTotalKey(pFirstOrder), (pFilledTotal + totalOrderWaveletesRequired)), StringEntry(getOrderStatusKey(pFirstOrder), FILLED), StringEntry(getPrevOrderKey(pNextOrder), ""), StringEntry(FirstOrderKey, pNextOrder)]
178- (writeSetData ++ [ScriptTransfer(orderOwnerAddress, fillableOrderAmount, bondAssetId), ScriptTransfer(neutrinoContract, totalOrderWaveletesRequired, unit), ScriptTransfer(orderOwnerAddress, changeWavelets, unit)])
179- }
180- }
181-
182-
183-func internalAddBuyBondOrder (roi,price,prevOrder,inv,instantOrder) = {
184- let pmt = value(inv.payments[0])
185- let newOrderId = toBase58String(inv.transactionId)
186- if (isBlocked)
187- then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
188- else if ((MINORDERTOTAL > pmt.amount))
189- then throw(("min order total equals " + toString(MINORDERTOTAL)))
190- else if ((roi > MAXROI))
191- then throw("max setOrder ROI is 95%")
192- else if ((0 > roi))
193- then throw("can't place order with negative roi")
194- else if ((roi == 0))
195- then throw("roi should not be equal to 0")
196- else if (isDefined(pmt.assetId))
197- then throw("can use waves only")
198- else if ((getOrderOwner(newOrderId) != ""))
199- then throw("order exists")
200- else if (if ((prevOrder != ""))
201- then (getOrderStatus(prevOrder) != NEW)
202- else false)
203- then throw("prev order status is not new")
204- else {
205- let isNewOrderAtFirstPosition = (prevOrder == "")
206- let owner = toString(inv.caller)
207- let nextOrder = if (isNewOrderAtFirstPosition)
208- then firstOrder
209- else getNextOrder(prevOrder)
210- let nextOrderRoi = getNumberByKey(getRoiByOrderIdKey(nextOrder))
211- let isNextOrderError = if (if ((nextOrder != ""))
212- then (roi >= nextOrderRoi)
213- else false)
214- then true
215- else false
216- let prevOrderRoi = getNumberByKey(getRoiByOrderIdKey(prevOrder))
217- let isPrevOrderError = if (if ((prevOrder != ""))
218- then (prevOrderRoi > roi)
219- else false)
220- then true
221- else false
222- if (if (isNextOrderError)
223- then true
224- else isPrevOrderError)
225- then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError)))
226- else if (if (isNewOrderAtFirstPosition)
227- then (currentMaxRoi >= roi)
228- else false)
229- then internalSellBond(newOrderId, nextOrder, 0, roi, price, pmt.amount, inv.caller, true)
230- else if (instantOrder)
231- then throw("Instant order couldn't be added into waiting queue")
232- else ([StringEntry(getPrevOrderKey(newOrderId), prevOrder), StringEntry(getNextOrderKey(newOrderId), nextOrder), StringEntry(getNextOrderKey(prevOrder), if ((prevOrder == ""))
233- then ""
234- else newOrderId), StringEntry(getPrevOrderKey(nextOrder), if ((nextOrder == ""))
235- then ""
236- else newOrderId), StringEntry(FirstOrderKey, if (if ((firstOrder == ""))
237- then true
238- else (firstOrder == nextOrder))
239- then newOrderId
240- else firstOrder)] ++ orderData(newOrderId, pmt.amount, 0, owner, NEW, roi, price))
241- }
242- }
243159
244160
245161 let IdxA = 0
246162
247163 let IdxPaulB = 1
248164
249165 let IdxWResAsUsdn = 2
250166
251167 let IdxMultBR = 3
252168
253169 let IdxMultPower = 4
254170
255171 let IdxMultExpInPower = 5
256172
257173 let IdxMultK = 6
258174
259175 func calculateK (wRaw,uRaw,price,mRaw,sRaw) = {
260176 let EXP = 271828100
261177 let a = valueOrElse(getInteger(this, "nsbtCurveParam_a"), 3)
262178 let paulB = valueOrElse(getInteger(this, "nsbtCurveParam_b"), ((3 * PAULI) / 10))
263179 let wReservesInUsdn = convertWavesToNeutrino(wRaw, price)
264180 let multBR = fraction(wReservesInUsdn, MULT, uRaw)
265181 let multPower = (a * (multBR - (1 * MULT)))
266182 let multExpInPower = pow(EXP, MULTSCALE, multPower, MULTSCALE, MULTSCALE, DOWN)
267183 let multK = fraction(paulB, multExpInPower, PAULI)
268184 [a, paulB, wReservesInUsdn, multBR, multPower, multExpInPower, multK]
269185 }
270186
271187
272188 func curveFunction (wRaw,uRaw,price,mRaw,sRaw,wavesPayRaw) = {
273189 let kCalcArray = calculateK(wRaw, uRaw, price, mRaw, sRaw)
274190 let multK = kCalcArray[IdxMultK]
275191 let usdnPay = convertWavesToNeutrino(wavesPayRaw, price)
276192 let multStepM1 = fraction(multK, mRaw, PAULI)
277193 let multStep2 = fraction(multStepM1, PAULI, (mRaw - sRaw))
278194 let multStepM3 = (fraction(usdnPay, MULT, PAULI) + fraction(multStep2, mRaw, PAULI))
279195 let multStep4 = fraction(multStepM1, MULT, multStepM3)
280196 let stepM5 = fraction(multStep4, mRaw, MULT)
281197 let nsbtAmountRaw = ((mRaw - sRaw) - stepM5)
282198 [nsbtAmountRaw, usdnPay, wRaw, uRaw, mRaw, sRaw, kCalcArray[IdxA], kCalcArray[IdxPaulB], kCalcArray[IdxWResAsUsdn], price, kCalcArray[IdxMultBR], kCalcArray[IdxMultPower], kCalcArray[IdxMultExpInPower], multK, multStepM1, multStep2, multStepM3, multStep4, stepM5]
283199 }
284200
285201
286202 func toStr (name,curveResult) = (((((((((((((((((((((((((((((((((((((((name + "[nsbtAmountRaw=") + toString(curveResult[0])) + " usdnPayment=") + toString(curveResult[1])) + " wRaw=") + toString(curveResult[2])) + " uRaw=") + toString(curveResult[3])) + " mRaw=") + toString(curveResult[4])) + " sRaw=") + toString(curveResult[5])) + " nsbtCurveParam_a=") + toString(curveResult[6])) + " nsbtCurveParam_b=") + toString(curveResult[7])) + " wReservesInUsdn=") + toString(curveResult[8])) + " price=") + toString(curveResult[9])) + " multBR=") + toString(curveResult[10])) + " multPower=") + toString(curveResult[11])) + " multExpInPower=") + toString(curveResult[12])) + " multK=") + toString(curveResult[13])) + " multStepM1=") + toString(curveResult[14])) + " multStep2=") + toString(curveResult[15])) + " multStepM3=") + toString(curveResult[16])) + " multStep4=") + toString(curveResult[17])) + " stepM5=") + toString(curveResult[18])) + "]")
287203
288204
289-func bigComplexity (i) = if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (!(isDefined(transferTransactionById(fromBase58String("PdLw5JK5ppfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k")))))
290- then !(isDefined(transferTransactionById(fromBase58String("adLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
291- else false)
292- then !(isDefined(transferTransactionById(fromBase58String("sdLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
293- else false)
294- then !(isDefined(transferTransactionById(fromBase58String("ddLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
295- else false)
296- then !(isDefined(transferTransactionById(fromBase58String("fdLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
297- else false)
298- then !(isDefined(transferTransactionById(fromBase58String("gdLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
299- else false)
300- then !(isDefined(transferTransactionById(fromBase58String("hdLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
301- else false)
302- then !(isDefined(transferTransactionById(fromBase58String("jdLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
303- else false)
304- then !(isDefined(transferTransactionById(fromBase58String("kdLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
305- else false)
306- then !(isDefined(transferTransactionById(fromBase58String("rdLw5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
307- else false)
308- then !(isDefined(transferTransactionById(fromBase58String("tdLq5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
309- else false)
310- then !(isDefined(transferTransactionById(fromBase58String("tdLy5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
311- else false)
312- then !(isDefined(transferTransactionById(fromBase58String("tdLu5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
313- else false)
314- then !(isDefined(transferTransactionById(fromBase58String("tdLh5JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
315- else false)
316- then !(isDefined(transferTransactionById(fromBase58String("1dL4JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
317- else false)
318- then !(isDefined(transferTransactionById(fromBase58String("2dL25JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
319- else false)
320- then !(isDefined(transferTransactionById(fromBase58String("3dL95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
321- else false)
322- then !(isDefined(transferTransactionById(fromBase58String("4dL95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
323- else false)
324- then !(isDefined(transferTransactionById(fromBase58String("5dL95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
325- else false)
326- then !(isDefined(transferTransactionById(fromBase58String("6dL95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
327- else false)
328- then !(isDefined(transferTransactionById(fromBase58String("7dL95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
329- else false)
330- then !(isDefined(transferTransactionById(fromBase58String("8dL95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
331- else false)
332- then !(isDefined(transferTransactionById(fromBase58String("91L95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
333- else false)
334- then !(isDefined(transferTransactionById(fromBase58String("92L95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
335- else false)
336- then !(isDefined(transferTransactionById(fromBase58String("93L95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
337- else false)
338- then !(isDefined(transferTransactionById(fromBase58String("94L95JKdpqfSEqvmFJvchejorAkzd4BrWLvoFwvMGu5k"))))
339- else false
340-
341-
342-func privateNsbtPriceREST () = {
343- let kCalcArray = calculateK(reserve, neutrinoSupply, currentPrice, nsbtMax, nsbtCurrent)
344- let multK = kCalcArray[IdxMultK]
345- let multStep1 = fraction(nsbtMax, MULT, (nsbtMax - nsbtCurrent))
346- let multStep2 = fraction(multStep1, multStep1, MULT)
347- let multNsbt2usdnPrice = fraction(multK, multStep2, MULT)
348- let nsbt2usdnPrice = fraction(multNsbt2usdnPrice, PAULI, MULT)
349- let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, currentPrice)
350- $Tuple2(IntegerEntry("nsbt2usdnPrice", nsbt2usdnPrice), IntegerEntry("nsbt2wavesPrice", nsbt2wavesPrice))
351- }
352-
353-
354-@Callable(i)
355-func nsbtPriceREST () = {
356- let nsbtPriceTuple = privateNsbtPriceREST()
357- let nsbt2usdnPrice = nsbtPriceTuple._1.value
358- let nsbt2wavesPrice = nsbtPriceTuple._2.value
359- let restData = makeString(["startNsbtPriceREST", toString(nsbt2usdnPrice), toString(nsbt2wavesPrice), "endNsbtPriceREST"], "__")
360- throw(restData)
361- }
362-
363-
364-
365205 @Callable(i)
366206 func buyNsbt () = {
367207 let pmt = value(i.payments[0])
368208 let pmtAmount = pmt.amount
369209 let wavesPay = pmtAmount
370210 let ownerAddress = i.caller
371211 if (isBlocked)
372212 then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
373213 else if (isDefined(pmt.assetId))
374214 then throw("can use waves only")
375215 else if (((10 * WAVELET) > pmtAmount))
376216 then throw("min 10 waves expected")
377217 else {
378- let curveResult = curveFunction(reserve, neutrinoSupply, currentPrice, nsbtMax, nsbtCurrent, wavesPay)
218+ let curveResult = curveFunction(reserve, neutrinoSupply, currentPrice, nsbtSupplyMAX, nsbtSupply, wavesPay)
379219 let nsbtAmount = curveResult[0]
380- let nsbt2WavesPriceRaw = calcNsbt2WavesPriceRaw(wavesPay, nsbtAmount)
381- let roi = (fraction(getReversePrice(nsbt2WavesPriceRaw), 100, currentPrice) - 100)
382- (orderData(toBase58String(i.transactionId), pmtAmount, pmtAmount, toString(ownerAddress), FILLED, roi, nsbt2WavesPriceRaw) ++ [ScriptTransfer(ownerAddress, nsbtAmount, bondAssetId), ScriptTransfer(neutrinoContract, wavesPay, unit), StringEntry("debug_curveResult", toStr("curveResult", curveResult)), IntegerEntry("tmp_issuedNsbt_2", (issuedNsbt + nsbtAmount))])
220+ if ((0 >= nsbtAmount))
221+ then throw("nsbtAmount <= 0")
222+ else {
223+ let nsbt2WavesPriceRaw = calcNsbt2WavesPriceRaw(wavesPay, nsbtAmount)
224+ let roi = 0
225+ (orderData(toBase58String(i.transactionId), pmtAmount, pmtAmount, toString(ownerAddress), FILLED, roi, nsbt2WavesPriceRaw) ++ [ScriptTransfer(ownerAddress, nsbtAmount, nsbtAssetId), ScriptTransfer(neutrinoContract, wavesPay, unit), StringEntry("debug_curveResult", toStr("curveResult", curveResult))])
226+ }
383227 }
384- }
385-
386-
387-
388-@Callable(i)
389-func instantBuyNsbtOrFail (noLessThenRoi) = {
390- let pmt = value(i.payments[0])
391- let roi = currentMaxRoi
392- if ((noLessThenRoi > roi))
393- then throw(((("Current maxRoi=" + toString(roi)) + " is less then passed parameter noLessThenRoi=") + toString(noLessThenRoi)))
394- else {
395- let priceWavesByBondCents = getPriceForRoi(roi)
396- internalAddBuyBondOrder(roi, getReversePrice(priceWavesByBondCents), "", i, true)
397- }
398- }
399-
400-
401-
402-@Callable(i)
403-func addBuyBondOrder (price,prevOrder) = {
404- let pmt = value(i.payments[0])
405- let priceWavesByBondCents = getReversePrice(price)
406- if ((0 >= price))
407- then throw("price less zero")
408- else internalAddBuyBondOrder(fraction((priceWavesByBondCents - currentPrice), 100, currentPrice), price, prevOrder, i, false)
409228 }
410229
411230
412231
413232 @Callable(i)
414233 func cancelOrder (orderId) = {
415234 let owner = getOrderOwner(orderId)
416235 let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId))
417236 let caller = toString(i.caller)
418237 let nextOrder = getNextOrder(orderId)
419238 let prevOrder = getPrevOrder(orderId)
420- if (isBlocked)
421- then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
422- else if ((owner != caller))
423- then throw("permission denied")
424- else if ((getOrderStatus(orderId) != NEW))
425- then throw("invalid order status")
426- else [StringEntry(FirstOrderKey, if ((firstOrder == orderId))
427- then nextOrder
428- else firstOrder), StringEntry(getNextOrderKey(prevOrder), nextOrder), StringEntry(getPrevOrderKey(nextOrder), prevOrder), StringEntry(getOrderStatusKey(orderId), CANCELED), ScriptTransfer(i.caller, amount, unit)]
239+ if ((getOrderStatus(orderId) != NEW))
240+ then throw("invalid order status")
241+ else [StringEntry(FirstOrderKey, if ((firstOrder == orderId))
242+ then nextOrder
243+ else firstOrder), StringEntry(getNextOrderKey(prevOrder), nextOrder), StringEntry(getPrevOrderKey(nextOrder), prevOrder), StringEntry(getOrderStatusKey(orderId), CANCELED), ScriptTransfer(i.caller, amount, unit)]
429244 }
430-
431-
432-
433-@Callable(i)
434-func sellBond () = if (isBlocked)
435- then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
436- else if ((firstOrder == ""))
437- then throw("empty orderbook")
438- else {
439- let nextOrder = getNextOrder(firstOrder)
440- let filledTotal = getOrderFilledTotal(firstOrder)
441- let orderPrice = getOrderPrice(firstOrder)
442- let roi = getNumberByKey(getRoiByOrderIdKey(firstOrder))
443- let paymentWavelets = getOrderTotal(firstOrder)
444- let orderOwnerAddress = Address(fromBase58String(getOrderOwner(firstOrder)))
445- internalSellBond(firstOrder, nextOrder, filledTotal, roi, orderPrice, paymentWavelets, orderOwnerAddress, false)
446- }
447245
448246
449247 @Verifier(tx)
450248 func verify () = {
451- let pubKeyAdminsList = ["GXxmZaCigPgJsT6d1cLr8nUXA65nGX8V7FuAzzrY8wQE", "3xumx4hrPpeeoo79HLGbZCgfz95L39ZFdxxwWeSUC2Pu", "D4CqtK5fBsnzRo33ZMhrM7niLseDH2uRoK6weBq2JQ3A", "5WRXFSjwcTbNfKcJs8ZqXmSSWYsSVJUtMvMqZj5hH4Nc"]
249+ let pubKeyAdminsList = ["GJdLSaLiv5K7xuejac8mcRcHoyo3dPrESrvktG3a6MAR", "3xumx4hrPpeeoo79HLGbZCgfz95L39ZFdxxwWeSUC2Pu", "D4CqtK5fBsnzRo33ZMhrM7niLseDH2uRoK6weBq2JQ3A", "5WRXFSjwcTbNfKcJs8ZqXmSSWYsSVJUtMvMqZj5hH4Nc"]
452250 let count = ((((if (sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(pubKeyAdminsList[0])))
453251 then 1
454252 else 0) + (if (sigVerify(tx.bodyBytes, tx.proofs[1], fromBase58String(pubKeyAdminsList[1])))
455253 then 1
456254 else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[2], fromBase58String(pubKeyAdminsList[2])))
457255 then 1
458256 else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[3], fromBase58String(pubKeyAdminsList[3])))
459257 then 2
460258 else 0))
461259 (count >= 3)
462260 }
463261

github/deemru/w8io/169f3d6 
77.61 ms