tx · 55tTXqErqwjBKRGrwM5AXWAFqjf3Ps8PsGJJgSRvJmuL

3N5NAftzfcw3gAt8nc35bNr9UdPTVgC81fd:  -0.01400000 Waves

2022.03.03 20:41 [1948107] smart account 3N5NAftzfcw3gAt8nc35bNr9UdPTVgC81fd > SELF 0.00000000 Waves

{ "type": 13, "id": "55tTXqErqwjBKRGrwM5AXWAFqjf3Ps8PsGJJgSRvJmuL", "fee": 1400000, "feeAssetId": null, "timestamp": 1646329323554, "version": 1, "sender": "3N5NAftzfcw3gAt8nc35bNr9UdPTVgC81fd", "senderPublicKey": "CdnTmMHxT68Qa4MtHEnAiUhsdKTi2YkHPGn92ThinVNt", "proofs": [ "4KBE6LKPGq8KEiMP1PfVkVdn8q8YmjiEZ7wZ477LWviFnsh5U9aKum9rPvK8eoNJ6WBg2MBduiLwvPgUWrVKGGnA", "Lf3cF94EKDQhHejrfvoBFXgG5SbpExQjx1ekbRc3rtUfgMuzxTPdzx2HZM5us1RZni45aiEbG6ifFUQJRzkS9hd", "2nPA6ccj576huDHs9Ry7T1DuFHbqBSqD9RpTyEevjVHv3cGqgYxbeWxyyTGSxBsHLwjAC9bvjGygaWDmaHL7rZ3i" ], "script": "base64:AAIFAAAAAAAAAAsIAhIAEgASAwoBCAAAAEEBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AAAAAAAAAAAAAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5CQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQIAAAAAAQAAABZnZXRCb29sQnlBZGRyZXNzQW5kS2V5AAAAAgAAAAdhZGRyZXNzAAAAA2tleQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBsAAAACBQAAAAdhZGRyZXNzBQAAAANrZXkHAQAAABhnZXRTdHJpbmdCeUFkZHJlc3NBbm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c0xpc3QAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAEAAAAAAAAAAAEAAAAAAAAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAgkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAIAAAAAAAAAAAEAAAAAAAAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAwkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAMAAAAAAAAAAAIAAAAAAAAAAAAJAABnAAAAAgUAAAAFY291bnQAAAAAAAAAAAM7OEQs", "chainId": 84, "height": 1948107, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EAWBESPVWVrG6ZnmYRcgBJfuq1dAHLFc2wUR69FJGdJD Next: tR842EtG18pM3FDw9LX9n9exxroMzjMsgxs4o6JJnQP Diff:
OldNewDifferences
135135
136136 let liquidationContract = Address(base58'3N24ZPUAMhFm76N3vbNiiDtFqfUnmBHTc5N')
137137
138-let mathContract = getStringByKey(MathContractKey)
138+let mathContract = addressFromStringValue(getStringByKey(MathContractKey))
139139
140140 let neutrinoAssetId = base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ'
141141
177177 func orderData (orderId,totalWavelets,filledWavelets,owner,status,roi,price,currentPrice) = [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)]
178178
179179
180-func toStr (name,curveResult) = (((((((((((((((((((((((((((((((((((name + "[nsbtAmountRaw=") + toString(asInt(curveResult[0]))) + " usdnPayment=") + toString(asInt(curveResult[1]))) + " wRaw=") + toString(asInt(curveResult[2]))) + " uRaw=") + toString(asInt(curveResult[3]))) + " mRaw=") + toString(asInt(curveResult[4]))) + " sRaw=") + toString(asInt(curveResult[5]))) + " nsbtCurveParam_a=") + toString(asInt(curveResult[6]))) + " nsbtCurveParam_b=") + toString(asInt(curveResult[7]))) + " wReservesInUsdn=") + toString(asInt(curveResult[8]))) + " price=") + toString(asInt(curveResult[9]))) + " multBR=") + toString(asInt(curveResult[10]))) + " multPower=") + toString(asInt(curveResult[11]))) + " multExpInPower=") + asString(curveResult[12])) + " multK=") + asString(curveResult[13])) + " step1=") + asString(curveResult[14])) + " step2=") + asString(curveResult[15])) + " step3=") + asString(curveResult[16])) + "]")
180+func toStr (name,curveResult) = (((((((((((((((((((((((((((((((((((name + "[nsbtAmountRaw=") + toString(asInt(curveResult[0]))) + " usdnPayment=") + toString(asInt(curveResult[1]))) + " wRaw=") + toString(asInt(curveResult[2]))) + " uRaw=") + toString(asInt(curveResult[3]))) + " mRaw=") + toString(asInt(curveResult[4]))) + " sRaw=") + toString(asInt(curveResult[5]))) + " nsbtCurveParam_a=") + toString(asInt(curveResult[6]))) + " nsbtCurveParam_b=") + toString(asInt(curveResult[7]))) + " wReservesInUsdn=") + toString(asInt(curveResult[8]))) + " price=") + toString(asInt(curveResult[9]))) + " multBR=") + toString(asInt(curveResult[10]))) + " multPower=") + toString(asInt(curveResult[11]))) + " multExpInPower=") + asString(curveResult[12])) + " multK=") + asString(curveResult[13])) + " step1=") + asString(curveResult[14])) + " step2=") + asString(curveResult[15])) + " step3=") + toString(asInt(curveResult[16]))) + "]")
181181
182182
183183 @Callable(i)
193193 then throw((("min " + toString(minWavesAmountNsbtBuy)) + " waves expected"))
194194 else {
195195 let ownerAddress = i.caller
196- let neutrinoMetrics = asAnyList(invoke(addressFromStringValue(mathContract), "calcNeutinoMetricsMATH", nil, nil))
196+ let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsMATH", nil, nil))
197197 if ((neutrinoMetrics == neutrinoMetrics))
198198 then {
199199 let currentPrice = asInt(neutrinoMetrics[0])
201201 let neutrinoSupply = asInt(neutrinoMetrics[5])
202202 let nsbtSupply = asInt(neutrinoMetrics[9])
203203 let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
204- let curveResult = asAnyList(invoke(addressFromStringValue(mathContract), "curveFunctionMATH", [reserve, neutrinoSupply, currentPrice, nsbtSupplyMAX, nsbtSupply, wavesPay], nil))
204+ let curveResult = asAnyList(invoke(mathContract, "curveFunctionMATH", [reserve, neutrinoSupply, currentPrice, nsbtSupplyMAX, nsbtSupply, wavesPay], nil))
205205 if ((curveResult == curveResult))
206206 then {
207207 let nsbtAmount = asInt(curveResult[0])
223223 else throw("Strict value is not equal to itself.")
224224 }
225225 }
226+
227+
228+
229+@Callable(i)
230+func sellNsbt () = if (isBlocked)
231+ then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
232+ else {
233+ let pmt = value(i.payments[0])
234+ let pmtAmount = pmt.amount
235+ if ((pmt.assetId != nsbtAssetId))
236+ then throw("can use NSBT only")
237+ else {
238+ let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsMATH", nil, nil))
239+ if ((neutrinoMetrics == neutrinoMetrics))
240+ then {
241+ let nsbtSupply = asInt(neutrinoMetrics[10])
242+ let newPrice = asInt(asAnyList(invoke(mathContract, "calcContractNsbtPriceBySupplyMATH", [(nsbtSupply - pmtAmount)], nil))[0])
243+ if ((newPrice == newPrice))
244+ then if ((PAULI > newPrice))
245+ then throw((("resulting nsbt price would be < 1 (" + toString(newPrice)) + " usdn"))
246+ else {
247+ let transf = invoke(neutrinoContract, "transferUsdnToUser", [pmtAmount, toString(i.caller)], nil)
248+ if ((transf == transf))
249+ then $Tuple2(nil, newPrice)
250+ else throw("Strict value is not equal to itself.")
251+ }
252+ else throw("Strict value is not equal to itself.")
253+ }
254+ else throw("Strict value is not equal to itself.")
255+ }
256+ }
226257
227258
228259
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
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 func asAnyList (val) = match val {
2020 case valAnyLyst: List[Any] =>
2121 valAnyLyst
2222 case _ =>
2323 throw("fail to cast into List[Any]")
2424 }
2525
2626
2727 func asString (val) = match val {
2828 case valStr: String =>
2929 valStr
3030 case _ =>
3131 throw("fail to cast into String")
3232 }
3333
3434
3535 func asInt (val) = match val {
3636 case valInt: Int =>
3737 valInt
3838 case _ =>
3939 throw("fail to cast into Int")
4040 }
4141
4242
4343 let WAVELET = 100000000
4444
4545 let PAULI = 1000000
4646
4747 let BIGPAULI = toBigInt(1000000)
4848
4949 let PRICELET = 1000000
5050
5151 let MULT = 100000000
5252
5353 let BIGMULT16 = toBigInt(10000000000000000)
5454
5555 let SCALE8 = 8
5656
5757 let SCALE16 = 16
5858
5959 let MINORDERTOTAL = (10 * WAVELET)
6060
6161 let MAXROI = 95
6262
6363 let CANCELED = "canceled"
6464
6565 let NEW = "new"
6666
6767 let FILLED = "filled"
6868
6969 let PriceKey = "price"
7070
7171 let NsbtAssetIdKey = "bond_asset_id"
7272
7373 let NeutrinoAssetIdKey = "neutrino_asset_id"
7474
7575 let BalanceLockedkKey = "balance_lock_"
7676
7777 let WavesLockedBalanceKey = (BalanceLockedkKey + "waves")
7878
7979 let NeutrinoLockedBalanceKey = (BalanceLockedkKey + "neutrino")
8080
8181 let FirstOrderKey = "order_first"
8282
8383 let MathContractKey = "math_contract"
8484
8585 let MinWavesForNsbtBuyKey = "min_waves_nsbt_buy"
8686
8787 func getRoiByOrderIdKey (orderId) = ("debug_order_roi_" + orderId)
8888
8989
9090 func getOrderPriceKey (orderId) = ("order_price_" + orderId)
9191
9292
9393 func getOrderTotalKey (orderId) = ("order_total_" + orderId)
9494
9595
9696 func getOrderOwnerKey (orderId) = ("order_owner_" + orderId)
9797
9898
9999 func getOrderHeightKey (orderId) = ("order_height_" + orderId)
100100
101101
102102 func getOrderStatusKey (orderId) = ("order_status_" + orderId)
103103
104104
105105 func getOrderFilledTotalKey (orderId) = ("order_filled_total_" + orderId)
106106
107107
108108 func getPrevOrderKey (orderId) = ("order_prev_" + orderId)
109109
110110
111111 func getNextOrderKey (orderId) = ("order_next_" + orderId)
112112
113113
114114 func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, PRICELET, price), WAVELET, PAULI)
115115
116116
117117 func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, PRICELET), PAULI, WAVELET)
118118
119119
120120 func convertWavesToBond (amount,price) = convertWavesToNeutrino(amount, price)
121121
122122
123123 func convertBondToWaves (amount,price) = convertNeutrinoToWaves(amount, price)
124124
125125
126126 func toX16 (origVal,origScaleMult) = fraction(toBigInt(origVal), BIGMULT16, toBigInt(origScaleMult))
127127
128128
129129 func fromX16 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), BIGMULT16))
130130
131131
132132 let neutrinoContract = Address(base58'3N9be2mwrA52WJho6DiesZkk4351GvpnWuj')
133133
134134 let controlContract = Address(base58'3MrwvfA9VRYwhHy4NuWPQGdxCtZdhH4LMMa')
135135
136136 let liquidationContract = Address(base58'3N24ZPUAMhFm76N3vbNiiDtFqfUnmBHTc5N')
137137
138-let mathContract = getStringByKey(MathContractKey)
138+let mathContract = addressFromStringValue(getStringByKey(MathContractKey))
139139
140140 let neutrinoAssetId = base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ'
141141
142142 let nsbtAssetId = base58'F3iaxzruFeKujfVfYSZEkejpjh67wmRfPCRHiNmWKp3Z'
143143
144144 let isBlocked = getBoolByAddressAndKey(controlContract, "is_blocked")
145145
146146 let minWavesAmountNsbtBuy = valueOrElse(getInteger(this, MinWavesForNsbtBuyKey), 10)
147147
148148 let firstOrder = getStringByKey(FirstOrderKey)
149149
150150 func getOrderPrice (id) = getNumberByKey(getOrderPriceKey(id))
151151
152152
153153 func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id))
154154
155155
156156 func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id))
157157
158158
159159 func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id))
160160
161161
162162 func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id))
163163
164164
165165 func getPrevOrder (id) = getStringByKey(getPrevOrderKey(id))
166166
167167
168168 func getNextOrder (id) = getStringByKey(getNextOrderKey(id))
169169
170170
171171 func getReversePrice (price) = ((PRICELET * PRICELET) / price)
172172
173173
174174 func calcNsbt2WavesPriceRaw (spentWavesRaw,receivedNsbtRaw) = fraction(spentWavesRaw, (PAULI * PRICELET), receivedNsbtRaw)
175175
176176
177177 func orderData (orderId,totalWavelets,filledWavelets,owner,status,roi,price,currentPrice) = [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)]
178178
179179
180-func toStr (name,curveResult) = (((((((((((((((((((((((((((((((((((name + "[nsbtAmountRaw=") + toString(asInt(curveResult[0]))) + " usdnPayment=") + toString(asInt(curveResult[1]))) + " wRaw=") + toString(asInt(curveResult[2]))) + " uRaw=") + toString(asInt(curveResult[3]))) + " mRaw=") + toString(asInt(curveResult[4]))) + " sRaw=") + toString(asInt(curveResult[5]))) + " nsbtCurveParam_a=") + toString(asInt(curveResult[6]))) + " nsbtCurveParam_b=") + toString(asInt(curveResult[7]))) + " wReservesInUsdn=") + toString(asInt(curveResult[8]))) + " price=") + toString(asInt(curveResult[9]))) + " multBR=") + toString(asInt(curveResult[10]))) + " multPower=") + toString(asInt(curveResult[11]))) + " multExpInPower=") + asString(curveResult[12])) + " multK=") + asString(curveResult[13])) + " step1=") + asString(curveResult[14])) + " step2=") + asString(curveResult[15])) + " step3=") + asString(curveResult[16])) + "]")
180+func toStr (name,curveResult) = (((((((((((((((((((((((((((((((((((name + "[nsbtAmountRaw=") + toString(asInt(curveResult[0]))) + " usdnPayment=") + toString(asInt(curveResult[1]))) + " wRaw=") + toString(asInt(curveResult[2]))) + " uRaw=") + toString(asInt(curveResult[3]))) + " mRaw=") + toString(asInt(curveResult[4]))) + " sRaw=") + toString(asInt(curveResult[5]))) + " nsbtCurveParam_a=") + toString(asInt(curveResult[6]))) + " nsbtCurveParam_b=") + toString(asInt(curveResult[7]))) + " wReservesInUsdn=") + toString(asInt(curveResult[8]))) + " price=") + toString(asInt(curveResult[9]))) + " multBR=") + toString(asInt(curveResult[10]))) + " multPower=") + toString(asInt(curveResult[11]))) + " multExpInPower=") + asString(curveResult[12])) + " multK=") + asString(curveResult[13])) + " step1=") + asString(curveResult[14])) + " step2=") + asString(curveResult[15])) + " step3=") + toString(asInt(curveResult[16]))) + "]")
181181
182182
183183 @Callable(i)
184184 func buyNsbt () = {
185185 let pmt = value(i.payments[0])
186186 let pmtAmount = pmt.amount
187187 let wavesPay = pmtAmount
188188 if (isBlocked)
189189 then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
190190 else if (isDefined(pmt.assetId))
191191 then throw("can use waves only")
192192 else if (((minWavesAmountNsbtBuy * WAVELET) > pmtAmount))
193193 then throw((("min " + toString(minWavesAmountNsbtBuy)) + " waves expected"))
194194 else {
195195 let ownerAddress = i.caller
196- let neutrinoMetrics = asAnyList(invoke(addressFromStringValue(mathContract), "calcNeutinoMetricsMATH", nil, nil))
196+ let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsMATH", nil, nil))
197197 if ((neutrinoMetrics == neutrinoMetrics))
198198 then {
199199 let currentPrice = asInt(neutrinoMetrics[0])
200200 let reserve = asInt(neutrinoMetrics[3])
201201 let neutrinoSupply = asInt(neutrinoMetrics[5])
202202 let nsbtSupply = asInt(neutrinoMetrics[9])
203203 let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
204- let curveResult = asAnyList(invoke(addressFromStringValue(mathContract), "curveFunctionMATH", [reserve, neutrinoSupply, currentPrice, nsbtSupplyMAX, nsbtSupply, wavesPay], nil))
204+ let curveResult = asAnyList(invoke(mathContract, "curveFunctionMATH", [reserve, neutrinoSupply, currentPrice, nsbtSupplyMAX, nsbtSupply, wavesPay], nil))
205205 if ((curveResult == curveResult))
206206 then {
207207 let nsbtAmount = asInt(curveResult[0])
208208 if ((0 >= nsbtAmount))
209209 then throw("nsbtAmount <= 0")
210210 else if ((wavesPay > (nsbtAmount * 9223372)))
211211 then throw(((("Nsbt2Waves price exceeds MAX_INT: " + toString(wavesPay)) + "/") + toString(nsbtAmount)))
212212 else {
213213 let nsbt2WavesPriceRaw = calcNsbt2WavesPriceRaw(wavesPay, nsbtAmount)
214214 let roi = 0
215215 let amountLeased = invoke(neutrinoContract, "acceptWaves", nil, i.payments)
216216 if ((amountLeased == amountLeased))
217217 then $Tuple2((orderData(toBase58String(i.transactionId), pmtAmount, pmtAmount, toString(ownerAddress), FILLED, roi, nsbt2WavesPriceRaw, currentPrice) ++ [ScriptTransfer(ownerAddress, nsbtAmount, nsbtAssetId), StringEntry("debug_curveResult", toStr("curveResult", curveResult))]), nsbtAmount)
218218 else throw("Strict value is not equal to itself.")
219219 }
220220 }
221221 else throw("Strict value is not equal to itself.")
222222 }
223223 else throw("Strict value is not equal to itself.")
224224 }
225225 }
226+
227+
228+
229+@Callable(i)
230+func sellNsbt () = if (isBlocked)
231+ then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles")
232+ else {
233+ let pmt = value(i.payments[0])
234+ let pmtAmount = pmt.amount
235+ if ((pmt.assetId != nsbtAssetId))
236+ then throw("can use NSBT only")
237+ else {
238+ let neutrinoMetrics = asAnyList(invoke(mathContract, "calcNeutinoMetricsMATH", nil, nil))
239+ if ((neutrinoMetrics == neutrinoMetrics))
240+ then {
241+ let nsbtSupply = asInt(neutrinoMetrics[10])
242+ let newPrice = asInt(asAnyList(invoke(mathContract, "calcContractNsbtPriceBySupplyMATH", [(nsbtSupply - pmtAmount)], nil))[0])
243+ if ((newPrice == newPrice))
244+ then if ((PAULI > newPrice))
245+ then throw((("resulting nsbt price would be < 1 (" + toString(newPrice)) + " usdn"))
246+ else {
247+ let transf = invoke(neutrinoContract, "transferUsdnToUser", [pmtAmount, toString(i.caller)], nil)
248+ if ((transf == transf))
249+ then $Tuple2(nil, newPrice)
250+ else throw("Strict value is not equal to itself.")
251+ }
252+ else throw("Strict value is not equal to itself.")
253+ }
254+ else throw("Strict value is not equal to itself.")
255+ }
256+ }
226257
227258
228259
229260 @Callable(i)
230261 func cancelOrder (orderId) = {
231262 let owner = getOrderOwner(orderId)
232263 let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId))
233264 let caller = toString(i.caller)
234265 let nextOrder = getNextOrder(orderId)
235266 let prevOrder = getPrevOrder(orderId)
236267 if ((getOrderStatus(orderId) != NEW))
237268 then throw("invalid order status")
238269 else [StringEntry(FirstOrderKey, if ((firstOrder == orderId))
239270 then nextOrder
240271 else firstOrder), StringEntry(getNextOrderKey(prevOrder), nextOrder), StringEntry(getPrevOrderKey(nextOrder), prevOrder), StringEntry(getOrderStatusKey(orderId), CANCELED), ScriptTransfer(i.caller, amount, unit)]
241272 }
242273
243274
244275 @Verifier(tx)
245276 func verify () = {
246277 let pubKeyAdminsList = ["ExtEEK19nmKj9mCpnWyvEEJFYATLMcVEMvohhUHkyHNm", "Ev5py5FfBQX9cZpYKnfQrTB49Byf8QmpZWeDVRim4yV7", "DUuuLjXu98nBwZc7fqwCTjtA3nnRwgTbkMSr5SU2NmDR", "5WRXFSjwcTbNfKcJs8ZqXmSSWYsSVJUtMvMqZj5hH4Nc"]
247278 let count = ((((if (sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(pubKeyAdminsList[0])))
248279 then 1
249280 else 0) + (if (sigVerify(tx.bodyBytes, tx.proofs[1], fromBase58String(pubKeyAdminsList[1])))
250281 then 1
251282 else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[2], fromBase58String(pubKeyAdminsList[2])))
252283 then 1
253284 else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[3], fromBase58String(pubKeyAdminsList[3])))
254285 then 2
255286 else 0))
256287 (count >= 3)
257288 }
258289

github/deemru/w8io/026f985 
87.97 ms