tx · DjgXQEdjyvnGZLBFERUEAmXmeD3PdpeRbbk9sDGot72x 3N1SXpSHeCeqSewbXS79otbnmP89uKUkWyf: -0.01000000 Waves 2020.06.10 18:06 [1037477] smart account 3N1SXpSHeCeqSewbXS79otbnmP89uKUkWyf > SELF 0.00000000 Waves
{ "type": 13, "id": "DjgXQEdjyvnGZLBFERUEAmXmeD3PdpeRbbk9sDGot72x", "fee": 1000000, "feeAssetId": null, "timestamp": 1591801599899, "version": 1, "sender": "3N1SXpSHeCeqSewbXS79otbnmP89uKUkWyf", "senderPublicKey": "GHUE94wSngxjR6mgyfWLqmuf8wJPJaQypJAwPKGHYoAn", "proofs": [ "4Pbz6qfrfikpr9pNGvN3vE5YXNDuz4zqZxf2DPevkQc3gs5S4vpvo2JdkD57pQ83SJU7Bi1yCnnzdTvR3y3Wa7R4" ], "script": "base64:AAIDAAAAAAAAABMIARIECgIBCBIAEgMKAQgSABIAAAAAOQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAEAAAAOZ2V0U3RyaW5nQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAAAQAAABZnZXRCb29sQnlBZGRyZXNzQW5kS2V5AAAAAgAAAAdhZGRyZXNzAAAAA2tleQQAAAAHJG1hdGNoMAkABBsAAAACBQAAAAdhZGRyZXNzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAB0Jvb2xlYW4EAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEHAQAAABhnZXRTdHJpbmdCeUFkZHJlc3N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AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAEAAAAAAAAAAAEAAAAAAAAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAgkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAIAAAAAAAAAAAEAAAAAAAAAAAADCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAwkAAlkAAAABCQABkQAAAAIFAAAAEHB1YktleUFkbWluc0xpc3QAAAAAAAAAAAMAAAAAAAAAAAIAAAAAAAAAAAAJAABnAAAAAgUAAAAFY291bnQAAAAAAAAAAAMh6hSd", "chainId": 84, "height": 1037477, "spentComplexity": 0 } View: original | compacted Prev: none Next: F9KfmYNC57KHts2JyXkPAoSq3m3XAxaN3Ctp6nfMWGiY Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func getNumberByKey (key) = match getInteger(this, key) { | |
5 | + | case a: Int => | |
6 | + | a | |
7 | + | case _ => | |
8 | + | 0 | |
9 | + | } | |
10 | + | ||
11 | + | ||
12 | + | func getStringByKey (key) = match getString(this, key) { | |
13 | + | case a: String => | |
14 | + | a | |
15 | + | case _ => | |
16 | + | "" | |
17 | + | } | |
18 | + | ||
19 | + | ||
20 | + | func getBoolByAddressAndKey (address,key) = match getBoolean(address, key) { | |
21 | + | case a: Boolean => | |
22 | + | a | |
23 | + | case _ => | |
24 | + | false | |
25 | + | } | |
26 | + | ||
27 | + | ||
28 | + | func getStringByAddressAndKey (address,key) = match getString(address, key) { | |
29 | + | case a: String => | |
30 | + | a | |
31 | + | case _ => | |
32 | + | "" | |
33 | + | } | |
34 | + | ||
35 | + | ||
36 | + | func getNumberByAddressAndKey (address,key) = match getInteger(address, key) { | |
37 | + | case a: Int => | |
38 | + | a | |
39 | + | case _ => | |
40 | + | 0 | |
41 | + | } | |
42 | + | ||
43 | + | ||
44 | + | let WAVELET = 100000000 | |
45 | + | ||
46 | + | let PAULI = 1000000 | |
47 | + | ||
48 | + | let PRICELET = 1000000 | |
49 | + | ||
50 | + | let CANCELED = "canceled" | |
51 | + | ||
52 | + | let NEW = "new" | |
53 | + | ||
54 | + | let FILLED = "filled" | |
55 | + | ||
56 | + | let NeutrinoContractKey = "neutrino_contract" | |
57 | + | ||
58 | + | let PriceKey = "price" | |
59 | + | ||
60 | + | let BondAssetIdKey = "bond_asset_id" | |
61 | + | ||
62 | + | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
63 | + | ||
64 | + | let ControlContractKey = "control_contract" | |
65 | + | ||
66 | + | let BalanceLockedkKey = "balance_lock_" | |
67 | + | ||
68 | + | let WavesLockedBalanceKey = (BalanceLockedkKey + "waves") | |
69 | + | ||
70 | + | let NeutrinoLockedBalanceKey = (BalanceLockedkKey + "neutrino") | |
71 | + | ||
72 | + | let FirstOrderKey = "order_first" | |
73 | + | ||
74 | + | let CurrentDefaultOrderKey = "order_default" | |
75 | + | ||
76 | + | func getOrderPriceKey (orderId) = ("order_price_" + orderId) | |
77 | + | ||
78 | + | ||
79 | + | func getOrderTotalKey (orderId) = ("order_total_" + orderId) | |
80 | + | ||
81 | + | ||
82 | + | func getOrderOwnerKey (orderId) = ("order_owner_" + orderId) | |
83 | + | ||
84 | + | ||
85 | + | func getOrderHeightKey (orderId) = ("order_height_" + orderId) | |
86 | + | ||
87 | + | ||
88 | + | func getOrderStatusKey (orderId) = ("order_status_" + orderId) | |
89 | + | ||
90 | + | ||
91 | + | func getOrderFilledTotalKey (orderId) = ("order_filled_total_" + orderId) | |
92 | + | ||
93 | + | ||
94 | + | func getPrevOrderKey (orderId) = ("order_prev_" + orderId) | |
95 | + | ||
96 | + | ||
97 | + | func getNextOrderKey (orderId) = ("order_next_" + orderId) | |
98 | + | ||
99 | + | ||
100 | + | func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, PRICELET, price), WAVELET, PAULI) | |
101 | + | ||
102 | + | ||
103 | + | func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, PRICELET), PAULI, WAVELET) | |
104 | + | ||
105 | + | ||
106 | + | func convertWavesToBond (amount,price) = convertWavesToNeutrino(amount, price) | |
107 | + | ||
108 | + | ||
109 | + | let neutrinoContract = addressFromStringValue(getStringByKey(NeutrinoContractKey)) | |
110 | + | ||
111 | + | let controlContract = addressFromStringValue(getStringByAddressAndKey(neutrinoContract, ControlContractKey)) | |
112 | + | ||
113 | + | let liquidationContract = this | |
114 | + | ||
115 | + | let neutrinoAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, NeutrinoAssetIdKey)) | |
116 | + | ||
117 | + | let bondAssetId = fromBase58String("91QmVf3hZQJeUX11nurBX76Quf94kQgVMDesqALsjQFN") | |
118 | + | ||
119 | + | let firstOrder = getStringByKey(FirstOrderKey) | |
120 | + | ||
121 | + | let isBlocked = getBoolByAddressAndKey(controlContract, "is_blocked") | |
122 | + | ||
123 | + | let currentPrice = getNumberByAddressAndKey(controlContract, PriceKey) | |
124 | + | ||
125 | + | let neutrinoLockedBalance = getNumberByAddressAndKey(neutrinoContract, NeutrinoLockedBalanceKey) | |
126 | + | ||
127 | + | let wavesLockedBalance = getNumberByAddressAndKey(neutrinoContract, WavesLockedBalanceKey) | |
128 | + | ||
129 | + | let reserve = (wavesBalance(neutrinoContract) - wavesLockedBalance) | |
130 | + | ||
131 | + | let neutrinoSupply = (((neutrinoLockedBalance + extract(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId)) | |
132 | + | ||
133 | + | let surplus = (convertWavesToNeutrino(reserve, currentPrice) - neutrinoSupply) | |
134 | + | ||
135 | + | func getOrderPrice (id) = getNumberByKey(getOrderPriceKey(id)) | |
136 | + | ||
137 | + | ||
138 | + | func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id)) | |
139 | + | ||
140 | + | ||
141 | + | func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id)) | |
142 | + | ||
143 | + | ||
144 | + | func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id)) | |
145 | + | ||
146 | + | ||
147 | + | func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id)) | |
148 | + | ||
149 | + | ||
150 | + | func getOrderHeight (id) = getNumberByKey(getOrderHeightKey(id)) | |
151 | + | ||
152 | + | ||
153 | + | func getPrevOrder (id) = getStringByKey(getPrevOrderKey(id)) | |
154 | + | ||
155 | + | ||
156 | + | func getNextOrder (id) = getStringByKey(getNextOrderKey(id)) | |
157 | + | ||
158 | + | ||
159 | + | let currentDefaultOrder = getStringByKey(CurrentDefaultOrderKey) | |
160 | + | ||
161 | + | func generateDataEntryToAddOrder (price,newOrderId,i,prevOrder,nextOrder,firstOrder) = { | |
162 | + | let amount = extract(i.payment).amount | |
163 | + | let isOneForOneOrder = (price == 100) | |
164 | + | let isFirstOrderEmty = (firstOrder == "") | |
165 | + | let isNewOrderPriceLowerThanCurrentFirstOrder = (getOrderPrice(firstOrder) > price) | |
166 | + | let newFirstOrder = if (isFirstOrderEmty) | |
167 | + | then newOrderId | |
168 | + | else if (isNewOrderPriceLowerThanCurrentFirstOrder) | |
169 | + | then newOrderId | |
170 | + | else firstOrder | |
171 | + | [DataEntry(getPrevOrderKey(newOrderId), prevOrder), DataEntry(getNextOrderKey(newOrderId), nextOrder), DataEntry(getNextOrderKey(prevOrder), if ((prevOrder == "")) | |
172 | + | then prevOrder | |
173 | + | else newOrderId), DataEntry(getPrevOrderKey(nextOrder), if ((nextOrder == "")) | |
174 | + | then nextOrder | |
175 | + | else newOrderId), DataEntry(FirstOrderKey, newFirstOrder), DataEntry(getOrderPriceKey(newOrderId), price), DataEntry(getOrderTotalKey(newOrderId), amount), DataEntry(getOrderOwnerKey(newOrderId), toString(i.caller)), DataEntry(getOrderHeightKey(newOrderId), height), DataEntry(getOrderStatusKey(newOrderId), NEW), DataEntry(CurrentDefaultOrderKey, if (isOneForOneOrder) | |
176 | + | then newOrderId | |
177 | + | else currentDefaultOrder)] | |
178 | + | } | |
179 | + | ||
180 | + | ||
181 | + | func internalAddLiquidationOrder (i,price,prevOrder) = { | |
182 | + | let pmt = extract(i.payment) | |
183 | + | let newOrderId = toBase58String(keccak256((((toBytes(pmt.amount) + i.caller.bytes) + toBytes(height)) + i.transactionId))) | |
184 | + | let owner = toString(i.caller) | |
185 | + | let isEmptyPrevOrder = (prevOrder == "") | |
186 | + | let isEmptyFirstOrder = (firstOrder == "") | |
187 | + | if (isBlocked) | |
188 | + | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
189 | + | else if ((PAULI > pmt.amount)) | |
190 | + | then throw("order amount should be higher than 1 NSBT") | |
191 | + | else if ((100 > price)) | |
192 | + | then throw(("price should be equal or higher than 1 nsbt for 1 usdn. i.e. >= 100; price: " + toString(price))) | |
193 | + | else if ((pmt.assetId != bondAssetId)) | |
194 | + | then throw("can use appropriate neutrino base tokens (nsbt) only") | |
195 | + | else if ((getOrderOwner(newOrderId) != "")) | |
196 | + | then throw("the order already exists") | |
197 | + | else if (if (!(isEmptyPrevOrder)) | |
198 | + | then (getOrderStatus(prevOrder) != NEW) | |
199 | + | else false) | |
200 | + | then throw("prev order status is not new") | |
201 | + | else if (if (isEmptyFirstOrder) | |
202 | + | then !(isEmptyPrevOrder) | |
203 | + | else false) | |
204 | + | then throw("wrong prev order parameter") | |
205 | + | else { | |
206 | + | let nextOrder = if (isEmptyPrevOrder) | |
207 | + | then firstOrder | |
208 | + | else getNextOrder(prevOrder) | |
209 | + | let isEmptyNextOrder = (nextOrder == "") | |
210 | + | if (isEmptyFirstOrder) | |
211 | + | then WriteSet(generateDataEntryToAddOrder(price, newOrderId, i, prevOrder, nextOrder, firstOrder)) | |
212 | + | else { | |
213 | + | let nextOrderPrice = getNumberByKey(getOrderPriceKey(nextOrder)) | |
214 | + | let prevOrderPrice = getNumberByKey(getOrderPriceKey(prevOrder)) | |
215 | + | let isNextOrderError = if (!(isEmptyNextOrder)) | |
216 | + | then (price >= nextOrderPrice) | |
217 | + | else false | |
218 | + | let isPrevOrderError = if (!(isEmptyPrevOrder)) | |
219 | + | then (prevOrderPrice > price) | |
220 | + | else false | |
221 | + | if (if (isNextOrderError) | |
222 | + | then true | |
223 | + | else isPrevOrderError) | |
224 | + | then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError))) | |
225 | + | else WriteSet(generateDataEntryToAddOrder(price, newOrderId, i, prevOrder, nextOrder, firstOrder)) | |
226 | + | } | |
227 | + | } | |
228 | + | } | |
229 | + | ||
230 | + | ||
231 | + | func computeCurrentDefaultOrder (id) = if ((id != currentDefaultOrder)) | |
232 | + | then currentDefaultOrder | |
233 | + | else "" | |
234 | + | ||
235 | + | ||
236 | + | @Callable(i) | |
237 | + | func addLiquidationOrderWithPrice (price,prevOrder) = internalAddLiquidationOrder(i, price, prevOrder) | |
238 | + | ||
239 | + | ||
240 | + | ||
241 | + | @Callable(i) | |
242 | + | func addLiquidationOrder () = internalAddLiquidationOrder(i, 100, currentDefaultOrder) | |
243 | + | ||
244 | + | ||
245 | + | ||
246 | + | @Callable(i) | |
247 | + | func cancelOrder (orderId) = { | |
248 | + | let owner = getOrderOwner(orderId) | |
249 | + | let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId)) | |
250 | + | let caller = toString(i.caller) | |
251 | + | let nextOrder = getNextOrder(orderId) | |
252 | + | let prevOrder = getPrevOrder(orderId) | |
253 | + | let isDefaultOrder = (orderId == currentDefaultOrder) | |
254 | + | let isPrevCanBecomeDefault = (getOrderStatus(prevOrder) == NEW) | |
255 | + | let newDefaultOrder = if (isDefaultOrder) | |
256 | + | then if (isPrevCanBecomeDefault) | |
257 | + | then prevOrder | |
258 | + | else "" | |
259 | + | else currentDefaultOrder | |
260 | + | if (isBlocked) | |
261 | + | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
262 | + | else if ((owner != caller)) | |
263 | + | then throw("permission denied") | |
264 | + | else if ((getOrderStatus(orderId) != NEW)) | |
265 | + | then throw("invalid order status") | |
266 | + | else ScriptResult(WriteSet([DataEntry(CurrentDefaultOrderKey, newDefaultOrder), DataEntry(FirstOrderKey, if ((firstOrder == orderId)) | |
267 | + | then nextOrder | |
268 | + | else firstOrder), DataEntry(getNextOrderKey(prevOrder), nextOrder), DataEntry(getPrevOrderKey(nextOrder), prevOrder), DataEntry(getOrderStatusKey(orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, bondAssetId)])) | |
269 | + | } | |
270 | + | ||
271 | + | ||
272 | + | ||
273 | + | @Callable(i) | |
274 | + | func liquidateBond () = { | |
275 | + | let liquidationBalance = assetBalance(this, neutrinoAssetId) | |
276 | + | let surplusPositive = if ((0 >= surplus)) | |
277 | + | then 0 | |
278 | + | else surplus | |
279 | + | let usdnAmount = if ((surplusPositive >= liquidationBalance)) | |
280 | + | then liquidationBalance | |
281 | + | else surplusPositive | |
282 | + | let returnAmount = if ((surplusPositive >= liquidationBalance)) | |
283 | + | then 0 | |
284 | + | else (liquidationBalance - surplusPositive) | |
285 | + | if (isBlocked) | |
286 | + | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
287 | + | else if ((liquidationBalance == 0)) | |
288 | + | then throw("without base tokens to liquidate") | |
289 | + | else if ((returnAmount > 0)) | |
290 | + | then TransferSet([ScriptTransfer(neutrinoContract, returnAmount, neutrinoAssetId)]) | |
291 | + | else if ((firstOrder == "")) | |
292 | + | then throw("empty orderbook") | |
293 | + | else { | |
294 | + | let nextOrder = getNextOrder(firstOrder) | |
295 | + | let filledTotal = getOrderFilledTotal(firstOrder) | |
296 | + | let nsbt2UsdnPrice = getOrderPrice(firstOrder) | |
297 | + | let remainedTotal = (getOrderTotal(firstOrder) - filledTotal) | |
298 | + | let totalUSDNRequiredToFillOrder = fraction(remainedTotal, nsbt2UsdnPrice, 100) | |
299 | + | let isOrderFullyFilable = (usdnAmount >= totalUSDNRequiredToFillOrder) | |
300 | + | let fillableOrderAmount = if (isOrderFullyFilable) | |
301 | + | then totalUSDNRequiredToFillOrder | |
302 | + | else usdnAmount | |
303 | + | let finalNBTFillable = fraction(fillableOrderAmount, 100, nsbt2UsdnPrice) | |
304 | + | let nbTokensLiquidateCondition = (fraction((surplus + neutrinoSupply), 100, neutrinoSupply) >= nsbt2UsdnPrice) | |
305 | + | if (!(nbTokensLiquidateCondition)) | |
306 | + | then throw(("innapropriate surplus: " + toString(surplus))) | |
307 | + | else { | |
308 | + | let isNothingToFillNow = (remainedTotal == 0) | |
309 | + | let isNothingToFillAtAll = ((filledTotal + finalNBTFillable) == getOrderTotal(firstOrder)) | |
310 | + | let newStatus = if (if (isOrderFullyFilable) | |
311 | + | then if (isNothingToFillNow) | |
312 | + | then true | |
313 | + | else isNothingToFillAtAll | |
314 | + | else false) | |
315 | + | then FILLED | |
316 | + | else NEW | |
317 | + | ScriptResult(WriteSet([DataEntry(getPrevOrderKey(nextOrder), if ((newStatus == FILLED)) | |
318 | + | then "" | |
319 | + | else firstOrder), DataEntry(FirstOrderKey, if ((newStatus == FILLED)) | |
320 | + | then nextOrder | |
321 | + | else firstOrder), DataEntry(getOrderFilledTotalKey(firstOrder), (filledTotal + finalNBTFillable)), DataEntry(getOrderStatusKey(firstOrder), newStatus), DataEntry(CurrentDefaultOrderKey, computeCurrentDefaultOrder(firstOrder))]), TransferSet([ScriptTransfer(addressFromStringValue(getOrderOwner(firstOrder)), fillableOrderAmount, neutrinoAssetId), ScriptTransfer(neutrinoContract, finalNBTFillable, bondAssetId)])) | |
322 | + | } | |
323 | + | } | |
324 | + | } | |
325 | + | ||
326 | + | ||
327 | + | ||
328 | + | @Callable(i) | |
329 | + | func updateReservesAndNeutrinoSupply () = { | |
330 | + | func getNumberByKeyInternal (key) = match getInteger(this, key) { | |
331 | + | case a: Int => | |
332 | + | a | |
333 | + | case _ => | |
334 | + | 0 | |
335 | + | } | |
336 | + | ||
337 | + | let idx = getNumberByKeyInternal("updateReservesAndNeutrinoSupplyIdx") | |
338 | + | let newIdx = (idx + 1) | |
339 | + | WriteSet([DataEntry("updateReservesAndNeutrinoSupplyIdx", newIdx), DataEntry("reserve", reserve), DataEntry("neutrinoSupply", neutrinoSupply), DataEntry("surplus", surplus)]) | |
340 | + | } | |
341 | + | ||
342 | + | ||
343 | + | @Verifier(tx) | |
344 | + | func verify () = { | |
345 | + | let pubKeyAdminsList = ["D96T5UoL7E2FERaEwov9Frx8XFVPNGqZ4TyDiWvn1urJ", "Fk2zgbrRA8KytTVMVy6Df5i4tTEsKaqg6ybh6x6Hehjj", "37f1yE54FyMKwEkg413peq5Gbze9sBavASVeTYbQLTvJ", "5WRXFSjwcTbNfKcJs8ZqXmSSWYsSVJUtMvMqZj5hH4Nc"] | |
346 | + | let count = ((((if (sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(pubKeyAdminsList[0]))) | |
347 | + | then 1 | |
348 | + | else 0) + (if (sigVerify(tx.bodyBytes, tx.proofs[1], fromBase58String(pubKeyAdminsList[1]))) | |
349 | + | then 1 | |
350 | + | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[2], fromBase58String(pubKeyAdminsList[2]))) | |
351 | + | then 1 | |
352 | + | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[3], fromBase58String(pubKeyAdminsList[3]))) | |
353 | + | then 2 | |
354 | + | else 0)) | |
355 | + | (count >= 3) | |
356 | + | } | |
357 | + |
github/deemru/w8io/169f3d6 26.19 ms ◑