tx · GtW3gBibgPQcnsSgmknLb4U5k9D5tBemAfGF3V925YfL 3MxbR7b3gHF4XdQKNTT5aQMRiazHvrVWC8N: -0.02000000 Waves 2020.05.26 20:53 [1015632] smart account 3MxbR7b3gHF4XdQKNTT5aQMRiazHvrVWC8N > SELF 0.00000000 Waves
{ "type": 13, "id": "GtW3gBibgPQcnsSgmknLb4U5k9D5tBemAfGF3V925YfL", "fee": 2000000, "feeAssetId": null, "timestamp": 1590515679734, "version": 1, "sender": "3MxbR7b3gHF4XdQKNTT5aQMRiazHvrVWC8N", "senderPublicKey": "4bj7YXaphTC4Ldx7DqqMmrTjNshRtw1yNsej2XXZcAzS", "proofs": [ "FhEuomYrRg27Fqi8f5RGLjwXM3peyURMDWskkNDX7W3ci3F5astCyuurykHXezGPd7H7LoxYNdbJx2qBJixh9dm", "3X22FA2mZUjFeENrjfJeqsKqm1hjKYEBAqtSQgYpcogCzi7jTWTcYL9RiZGK7v5vAkDmLLtBiCQ2USsJgfVrZ3rH", "2EVmkd3SVgVmqnQMrQqhzuQCQdKUUs2gyNZC9QP7xsbSCbmLi67Q8QPvgnbpeGaFRASjTF6B7QkZaV6TwhGdjucX" ], "script": "base64:AAIDAAAAAAAAABYIARIDCgEBEgQKAgEIEgMKAQgSABIAAAAAOAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAEAAAAOZ2V0U3RyaW5nQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAAAQAAABZnZXRCb29sQnlBZGRyZXNzQW5kS2V5AAAAAgAA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5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAIJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAACAAAAAAAAAAABAAAAAAAAAAAAAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAMJAAJZAAAAAQkAAZEAAAACBQAAABBwdWJLZXlBZG1pbnNMaXN0AAAAAAAAAAADAAAAAAAAAAACAAAAAAAAAAAACQAAZwAAAAIFAAAABWNvdW50AAAAAAAAAAADbT7EMg==", "chainId": 84, "height": 1015632, "spentComplexity": 0 } View: original | compacted Prev: 3xvBfT2e68aAGGFdZFWpMKzVBbPW1Rm8rs8RkWjWMhTQ Next: H8wCYZ6UZPhzUhg9Jo3zNPj77upM4U8N4cJ8qEBWhJAk Diff:
Old | New | Differences | |
---|---|---|---|
250 | 250 | ||
251 | 251 | ||
252 | 252 | @Callable(i) | |
253 | - | func instantBuyNsbtOrFail (roi | |
253 | + | func instantBuyNsbtOrFail (roi) = { | |
254 | 254 | let pmt = extract(i.payment) | |
255 | - | internalAddBuyBondOrder(roi, | |
255 | + | internalAddBuyBondOrder(roi, "", i, true) | |
256 | 256 | } | |
257 | 257 | ||
258 | 258 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getNumberByKey (key) = match getInteger(this, key) { | |
5 | 5 | case a: Int => | |
6 | 6 | a | |
7 | 7 | case _ => | |
8 | 8 | 0 | |
9 | 9 | } | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func getStringByKey (key) = match getString(this, key) { | |
13 | 13 | case a: String => | |
14 | 14 | a | |
15 | 15 | case _ => | |
16 | 16 | "" | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func getBoolByAddressAndKey (address,key) = match getBoolean(address, key) { | |
21 | 21 | case a: Boolean => | |
22 | 22 | a | |
23 | 23 | case _ => | |
24 | 24 | false | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func getStringByAddressAndKey (address,key) = match getString(address, key) { | |
29 | 29 | case a: String => | |
30 | 30 | a | |
31 | 31 | case _ => | |
32 | 32 | "" | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func getNumberByAddressAndKey (address,key) = match getInteger(address, key) { | |
37 | 37 | case a: Int => | |
38 | 38 | a | |
39 | 39 | case _ => | |
40 | 40 | 0 | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | let WAVELET = 100000000 | |
45 | 45 | ||
46 | 46 | let PAULI = 1000000 | |
47 | 47 | ||
48 | 48 | let MINORDERTOTAL = (10 * WAVELET) | |
49 | 49 | ||
50 | 50 | let MAXROI = 95 | |
51 | 51 | ||
52 | 52 | let CANCELED = "canceled" | |
53 | 53 | ||
54 | 54 | let NEW = "new" | |
55 | 55 | ||
56 | 56 | let FILLED = "filled" | |
57 | 57 | ||
58 | 58 | let NeutrinoContractKey = "neutrino_contract" | |
59 | 59 | ||
60 | 60 | let PriceKey = "price" | |
61 | 61 | ||
62 | 62 | let BondAssetIdKey = "bond_asset_id" | |
63 | 63 | ||
64 | 64 | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
65 | 65 | ||
66 | 66 | let ControlContractKey = "control_contract" | |
67 | 67 | ||
68 | 68 | let BalanceLockedkKey = "balance_lock_" | |
69 | 69 | ||
70 | 70 | let WavesLockedBalanceKey = (BalanceLockedkKey + "waves") | |
71 | 71 | ||
72 | 72 | let NeutrinoLockedBalanceKey = (BalanceLockedkKey + "neutrino") | |
73 | 73 | ||
74 | 74 | let LiquidationContractKey = "liquidation_contract" | |
75 | 75 | ||
76 | 76 | let FirstOrderKey = "order_first" | |
77 | 77 | ||
78 | 78 | func getRoiByOrderIdKey (orderId) = ("debug_order_roi_" + orderId) | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func getOrderPriceKey (orderId) = ("order_price_" + orderId) | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func getOrderTotalKey (orderId) = ("order_total_" + orderId) | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func getOrderOwnerKey (orderId) = ("order_owner_" + orderId) | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func getOrderHeightKey (orderId) = ("order_height_" + orderId) | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func getOrderStatusKey (orderId) = ("order_status_" + orderId) | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func getOrderFilledTotalKey (orderId) = ("order_filled_total_" + orderId) | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func getPrevOrderKey (orderId) = ("order_prev_" + orderId) | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func getNextOrderKey (orderId) = ("order_next_" + orderId) | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, 100, price), WAVELET, PAULI) | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, 100), PAULI, WAVELET) | |
109 | 109 | ||
110 | 110 | ||
111 | 111 | func convertWavesToBond (amount,price) = convertWavesToNeutrino(amount, price) | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | func convertBondToWaves (amount,price) = convertNeutrinoToWaves(amount, price) | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | let neutrinoContract = Address(base58'3Mzbx34Ex5rRbn39vUHx9kiwh3nneF8S5we') | |
118 | 118 | ||
119 | 119 | let controlContract = Address(base58'3N4NS7d4Jo9a6F14LiFUKKYVdUkkf2eP4Zx') | |
120 | 120 | ||
121 | 121 | let liquidationContract = Address(base58'3N5nmMvMH8o3RPEyCKCaoWahBTYTexnZy62') | |
122 | 122 | ||
123 | 123 | let neutrinoAssetId = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT' | |
124 | 124 | ||
125 | 125 | let bondAssetId = base58'BGhPYquXSK6UYjnPLEn94gFhetp4Jvf7toekEY4x1VDH' | |
126 | 126 | ||
127 | 127 | let isBlocked = getBoolByAddressAndKey(controlContract, "is_blocked") | |
128 | 128 | ||
129 | 129 | let currentPrice = getNumberByAddressAndKey(controlContract, PriceKey) | |
130 | 130 | ||
131 | 131 | let neutrinoLockedBalance = getNumberByAddressAndKey(neutrinoContract, NeutrinoLockedBalanceKey) | |
132 | 132 | ||
133 | 133 | let reserve = (wavesBalance(neutrinoContract) - getNumberByAddressAndKey(neutrinoContract, WavesLockedBalanceKey)) | |
134 | 134 | ||
135 | 135 | let neutrinoSupply = (((neutrinoLockedBalance + extract(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId)) | |
136 | 136 | ||
137 | 137 | let deficit = (neutrinoSupply - convertWavesToNeutrino(reserve, currentPrice)) | |
138 | 138 | ||
139 | 139 | let firstOrder = getStringByKey(FirstOrderKey) | |
140 | 140 | ||
141 | 141 | func getOrderPrice (id) = getNumberByKey(getOrderPriceKey(id)) | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id)) | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id)) | |
148 | 148 | ||
149 | 149 | ||
150 | 150 | func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id)) | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id)) | |
154 | 154 | ||
155 | 155 | ||
156 | 156 | func getPrevOrder (id) = getStringByKey(getPrevOrderKey(id)) | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | func getNextOrder (id) = getStringByKey(getNextOrderKey(id)) | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | func internalSellBond (pFirstOrder,pNextOrder,pFilledTotal,pRoi,pPaymentWavelets,orderOwnerAddress) = if ((pFirstOrder == "")) | |
163 | 163 | then throw("empty orderbook") | |
164 | 164 | else { | |
165 | 165 | let priceWavesByBondCents = fraction((100 + pRoi), currentPrice, 100) | |
166 | 166 | let remainedTotal = (pPaymentWavelets - pFilledTotal) | |
167 | 167 | let fillableOrderAmount = convertWavesToBond(remainedTotal, priceWavesByBondCents) | |
168 | 168 | let totalOrderWaveletesRequired = convertBondToWaves(fillableOrderAmount, priceWavesByBondCents) | |
169 | 169 | let nbTokensSellCondition = (fraction(deficit, 100, neutrinoSupply) >= pRoi) | |
170 | 170 | if (!(nbTokensSellCondition)) | |
171 | 171 | then throw(("innapropriate roi: " + toString(pRoi))) | |
172 | 172 | else if ((totalOrderWaveletesRequired == 0)) | |
173 | 173 | then throw("cannot fill order at the moment") | |
174 | 174 | else { | |
175 | 175 | let changeWavelets = (remainedTotal - totalOrderWaveletesRequired) | |
176 | 176 | let commonWriteSetData = [DataEntry(getOrderFilledTotalKey(firstOrder), (pFilledTotal + totalOrderWaveletesRequired)), DataEntry(getOrderStatusKey(firstOrder), FILLED)] | |
177 | 177 | let commonTransfers = [ScriptTransfer(orderOwnerAddress, fillableOrderAmount, bondAssetId), ScriptTransfer(neutrinoContract, totalOrderWaveletesRequired, unit), ScriptTransfer(orderOwnerAddress, changeWavelets, unit)] | |
178 | 178 | let writeSetData = if ((pFirstOrder == firstOrder)) | |
179 | 179 | then [DataEntry(getPrevOrderKey(pNextOrder), ""), DataEntry(FirstOrderKey, pNextOrder)] :: commonWriteSetData | |
180 | 180 | else commonWriteSetData | |
181 | 181 | ScriptResult(WriteSet(writeSetData), TransferSet(commonTransfers)) | |
182 | 182 | } | |
183 | 183 | } | |
184 | 184 | ||
185 | 185 | ||
186 | 186 | func internalAddBuyBondOrder (roi,prevOrder,inv,instant) = { | |
187 | 187 | let pmt = extract(inv.payment) | |
188 | 188 | let newOrderId = toBase58String(inv.transactionId) | |
189 | 189 | if (isBlocked) | |
190 | 190 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
191 | 191 | else if ((MINORDERTOTAL > pmt.amount)) | |
192 | 192 | then throw(("min order total equals " + toString(MINORDERTOTAL))) | |
193 | 193 | else if ((roi > MAXROI)) | |
194 | 194 | then throw("max setOrder ROI is 95%") | |
195 | 195 | else if (if ((deficit > 0)) | |
196 | 196 | then (0 > roi) | |
197 | 197 | else false) | |
198 | 198 | then throw("can't place order with negative roi during deficit") | |
199 | 199 | else if ((-(MAXROI) > roi)) | |
200 | 200 | then throw("min setOrder ROI is -95%") | |
201 | 201 | else if ((roi == 0)) | |
202 | 202 | then throw("roi should not be equal to 0") | |
203 | 203 | else if (isDefined(pmt.assetId)) | |
204 | 204 | then throw("can use waves only") | |
205 | 205 | else if ((getOrderOwner(newOrderId) != "")) | |
206 | 206 | then throw("order exists") | |
207 | 207 | else if (if ((prevOrder != "")) | |
208 | 208 | then (getOrderStatus(prevOrder) != NEW) | |
209 | 209 | else false) | |
210 | 210 | then throw("prev order status is not new") | |
211 | 211 | else { | |
212 | 212 | let isNewOrderAtFirstPosition = (prevOrder == "") | |
213 | 213 | let owner = toString(inv.caller) | |
214 | 214 | let nextOrder = if (isNewOrderAtFirstPosition) | |
215 | 215 | then firstOrder | |
216 | 216 | else getNextOrder(prevOrder) | |
217 | 217 | let nextOrderRoi = getNumberByKey(getRoiByOrderIdKey(nextOrder)) | |
218 | 218 | let isNextOrderError = if (if ((nextOrder != "")) | |
219 | 219 | then (roi >= nextOrderRoi) | |
220 | 220 | else false) | |
221 | 221 | then true | |
222 | 222 | else false | |
223 | 223 | let prevOrderRoi = getNumberByKey(getRoiByOrderIdKey(prevOrder)) | |
224 | 224 | let isPrevOrderError = if (if ((prevOrder != "")) | |
225 | 225 | then (prevOrderRoi > roi) | |
226 | 226 | else false) | |
227 | 227 | then true | |
228 | 228 | else false | |
229 | 229 | if (if (isNextOrderError) | |
230 | 230 | then true | |
231 | 231 | else isPrevOrderError) | |
232 | 232 | then throw(((("invalid order isPrevOrderError:" + toString(isPrevOrderError)) + " isNextOrderError:") + toString(isNextOrderError))) | |
233 | 233 | else if (if (isNewOrderAtFirstPosition) | |
234 | 234 | then instant | |
235 | 235 | else false) | |
236 | 236 | then internalSellBond(newOrderId, nextOrder, 0, roi, pmt.amount, inv.caller) | |
237 | 237 | else if (instant) | |
238 | 238 | then throw("Instant order couldn't be added into waiting queue") | |
239 | 239 | else WriteSet([DataEntry(getPrevOrderKey(newOrderId), prevOrder), DataEntry(getNextOrderKey(newOrderId), nextOrder), DataEntry(getNextOrderKey(prevOrder), if ((prevOrder == "")) | |
240 | 240 | then "" | |
241 | 241 | else newOrderId), DataEntry(getPrevOrderKey(nextOrder), if ((nextOrder == "")) | |
242 | 242 | then "" | |
243 | 243 | else newOrderId), DataEntry(FirstOrderKey, if (if ((firstOrder == "")) | |
244 | 244 | then true | |
245 | 245 | else (firstOrder == nextOrder)) | |
246 | 246 | then newOrderId | |
247 | 247 | else firstOrder), DataEntry(getOrderTotalKey(newOrderId), pmt.amount), DataEntry(getOrderOwnerKey(newOrderId), owner), DataEntry(getOrderHeightKey(newOrderId), height), DataEntry(getOrderStatusKey(newOrderId), NEW), DataEntry(("debug_order_currentPrice_" + newOrderId), currentPrice), DataEntry(getRoiByOrderIdKey(newOrderId), roi)]) | |
248 | 248 | } | |
249 | 249 | } | |
250 | 250 | ||
251 | 251 | ||
252 | 252 | @Callable(i) | |
253 | - | func instantBuyNsbtOrFail (roi | |
253 | + | func instantBuyNsbtOrFail (roi) = { | |
254 | 254 | let pmt = extract(i.payment) | |
255 | - | internalAddBuyBondOrder(roi, | |
255 | + | internalAddBuyBondOrder(roi, "", i, true) | |
256 | 256 | } | |
257 | 257 | ||
258 | 258 | ||
259 | 259 | ||
260 | 260 | @Callable(i) | |
261 | 261 | func addBuyBondOrder (price,prevOrder) = { | |
262 | 262 | let pmt = extract(i.payment) | |
263 | 263 | let priceWavesByBondCents = fraction(100, 100, price) | |
264 | 264 | let roi = fraction((priceWavesByBondCents - currentPrice), 100, currentPrice) | |
265 | 265 | if ((0 >= price)) | |
266 | 266 | then throw("price less zero") | |
267 | 267 | else internalAddBuyBondOrder(roi, prevOrder, i, false) | |
268 | 268 | } | |
269 | 269 | ||
270 | 270 | ||
271 | 271 | ||
272 | 272 | @Callable(i) | |
273 | 273 | func cancelOrder (orderId) = { | |
274 | 274 | let owner = getOrderOwner(orderId) | |
275 | 275 | let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId)) | |
276 | 276 | let caller = toString(i.caller) | |
277 | 277 | let nextOrder = getNextOrder(orderId) | |
278 | 278 | let prevOrder = getPrevOrder(orderId) | |
279 | 279 | if (isBlocked) | |
280 | 280 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
281 | 281 | else if ((owner != caller)) | |
282 | 282 | then throw("permission denied") | |
283 | 283 | else if ((getOrderStatus(orderId) != NEW)) | |
284 | 284 | then throw("invalid order status") | |
285 | 285 | else ScriptResult(WriteSet([DataEntry(FirstOrderKey, if ((firstOrder == orderId)) | |
286 | 286 | then nextOrder | |
287 | 287 | else firstOrder), DataEntry(getNextOrderKey(prevOrder), nextOrder), DataEntry(getPrevOrderKey(nextOrder), prevOrder), DataEntry(getOrderStatusKey(orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) | |
288 | 288 | } | |
289 | 289 | ||
290 | 290 | ||
291 | 291 | ||
292 | 292 | @Callable(i) | |
293 | 293 | func sellBond () = if (isBlocked) | |
294 | 294 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions until reactivation by emergency oracles") | |
295 | 295 | else if ((firstOrder == "")) | |
296 | 296 | then throw("empty orderbook") | |
297 | 297 | else { | |
298 | 298 | let nextOrder = getNextOrder(firstOrder) | |
299 | 299 | let filledTotal = getOrderFilledTotal(firstOrder) | |
300 | 300 | let orderPrice = getOrderPrice(firstOrder) | |
301 | 301 | let roi = getNumberByKey(getRoiByOrderIdKey(firstOrder)) | |
302 | 302 | let paymentWavelets = getOrderTotal(firstOrder) | |
303 | 303 | let orderOwnerAddress = Address(fromBase58String(getOrderOwner(firstOrder))) | |
304 | 304 | internalSellBond(firstOrder, nextOrder, filledTotal, roi, paymentWavelets, orderOwnerAddress) | |
305 | 305 | } | |
306 | 306 | ||
307 | 307 | ||
308 | 308 | ||
309 | 309 | @Callable(i) | |
310 | 310 | func updateReservesAndNeutrinoSupply () = { | |
311 | 311 | func getNumberByKeyInternal (key) = match getInteger(this, key) { | |
312 | 312 | case a: Int => | |
313 | 313 | a | |
314 | 314 | case _ => | |
315 | 315 | 0 | |
316 | 316 | } | |
317 | 317 | ||
318 | 318 | let idx = getNumberByKeyInternal("updateReservesAndNeutrinoSupplyIdx") | |
319 | 319 | let newIdx = (idx + 1) | |
320 | 320 | WriteSet([DataEntry("updateReservesAndNeutrinoSupplyIdx", newIdx), DataEntry("reserve", reserve), DataEntry("neutrinoSupply", neutrinoSupply), DataEntry("deficit", deficit)]) | |
321 | 321 | } | |
322 | 322 | ||
323 | 323 | ||
324 | 324 | @Verifier(tx) | |
325 | 325 | func verify () = { | |
326 | 326 | let pubKeyAdminsList = ["GXxmZaCigPgJsT6d1cLr8nUXA65nGX8V7FuAzzrY8wQE", "3xumx4hrPpeeoo79HLGbZCgfz95L39ZFdxxwWeSUC2Pu", "D4CqtK5fBsnzRo33ZMhrM7niLseDH2uRoK6weBq2JQ3A", "5WRXFSjwcTbNfKcJs8ZqXmSSWYsSVJUtMvMqZj5hH4Nc"] | |
327 | 327 | let count = ((((if (sigVerify(tx.bodyBytes, tx.proofs[0], fromBase58String(pubKeyAdminsList[0]))) | |
328 | 328 | then 1 | |
329 | 329 | else 0) + (if (sigVerify(tx.bodyBytes, tx.proofs[1], fromBase58String(pubKeyAdminsList[1]))) | |
330 | 330 | then 1 | |
331 | 331 | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[2], fromBase58String(pubKeyAdminsList[2]))) | |
332 | 332 | then 1 | |
333 | 333 | else 0)) + (if (sigVerify(tx.bodyBytes, tx.proofs[3], fromBase58String(pubKeyAdminsList[3]))) | |
334 | 334 | then 2 | |
335 | 335 | else 0)) | |
336 | 336 | (count >= 3) | |
337 | 337 | } | |
338 | 338 |
github/deemru/w8io/169f3d6 56.91 ms ◑