tx · Cr59RrNsoe1YxSZ9pyJdo373SAgKuMv5iqzEBDxuPme1 3MrUG7Sig1cnjLGxCvLdKYsTbaDW5snpb3N: -0.05000000 Waves 2023.04.25 16:41 [2550145] smart account 3MrUG7Sig1cnjLGxCvLdKYsTbaDW5snpb3N > SELF 0.00000000 Waves
{ "type": 13, "id": "Cr59RrNsoe1YxSZ9pyJdo373SAgKuMv5iqzEBDxuPme1", "fee": 5000000, "feeAssetId": null, "timestamp": 1682430121939, "version": 2, "chainId": 84, "sender": "3MrUG7Sig1cnjLGxCvLdKYsTbaDW5snpb3N", "senderPublicKey": "GXVNsUEw5Szbnwspe2ze46NBm9MZkoVUtfK23F7W3djd", "proofs": [ "2f46G1Xi6MswsWHyHDP4TDvD8VGvg9bbdBNCAev4mmELiBcUyhEPKWDVt1GSdZriBJajruGzUPUszo2w9SvRi9zw" ], "script": "base64:BgIOCAISBAoCCAgSBAoCCAhuAANTRVACAl9fAAVFTVBUWQIAAAlQUkVDSVNJT04AgKCUpY0dAAhERUNJTUFMUwCAwtcvABRERUZBVUxUX01BWF9TTElQUEFHRQkAaAIJAGkCBQlQUkVDSVNJT04AFAATAANEQVkJAGgCCQBoAgA8ADwAGAAEWUVBUgkAaAIFA0RBWQDtAgAPT1JBQ0xFX0RFQ0lNQUxTAMCEPQAISU5GSU5JVFkA//////////9/ABBNSU5fQU1PVU5UX0RFTFRBAOgHABVNQVhfUkFURV9IRUlHSFRfREVMVEEABQARTElRVUlEQVRJT05fQk9OVVMJAGgCCQBpAgUJUFJFQ0lTSU9OAGQABQAYTElRVUlEQVRJT05fUFJPVE9DT0xfRkVFCQBoAgkAaQIFCVBSRUNJU0lPTgBkAAIAFE1BWF9MSVFVSURBVElPTl9QQVJUCQBoAgkAaQIFCVBSRUNJU0lPTgBkADIADVNUQUJJTElUWV9GRUUJAGkCBQlQUkVDSVNJT04AZAAHRU5BQkxFRAIHRU5BQkxFRAAIRElTQUJMRUQCCERJU0FCTEVEABJJZHhWYXVsdEFz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h0ck5hdGl2ZSgxMDYyKQEFB2FkZHJlc3MJAQlrZXlTaWduZWQCCQClCAEFBHRoaXMJANgEAQgFAnR4AmlkBwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleb5MGA4=", "height": 2550145, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SEP = "__" | |
5 | + | ||
6 | + | let EMPTY = "" | |
7 | + | ||
8 | + | let PRECISION = 1000000000000 | |
9 | + | ||
10 | + | let DECIMALS = 100000000 | |
11 | + | ||
12 | + | let DEFAULT_MAX_SLIPPAGE = ((PRECISION / 20) * 19) | |
13 | + | ||
14 | + | let DAY = ((60 * 60) * 24) | |
15 | + | ||
16 | + | let YEAR = (DAY * 365) | |
17 | + | ||
18 | + | let ORACLE_DECIMALS = 1000000 | |
19 | + | ||
20 | + | let INFINITY = 9223372036854775807 | |
21 | + | ||
22 | + | let MIN_AMOUNT_DELTA = 1000 | |
23 | + | ||
24 | + | let MAX_RATE_HEIGHT_DELTA = 5 | |
25 | + | ||
26 | + | let LIQUIDATION_BONUS = ((PRECISION / 100) * 5) | |
27 | + | ||
28 | + | let LIQUIDATION_PROTOCOL_FEE = ((PRECISION / 100) * 2) | |
29 | + | ||
30 | + | let MAX_LIQUIDATION_PART = ((PRECISION / 100) * 50) | |
31 | + | ||
32 | + | let STABILITY_FEE = (PRECISION / 100) | |
33 | + | ||
34 | + | let ENABLED = "ENABLED" | |
35 | + | ||
36 | + | let DISABLED = "DISABLED" | |
37 | + | ||
38 | + | let IdxVaultAssetCount = 1 | |
39 | + | ||
40 | + | let IdxVaultAssetAmount = 2 | |
41 | + | ||
42 | + | let IdxVaultAssetRate = 3 | |
43 | + | ||
44 | + | let IdxVaultCount = 1 | |
45 | + | ||
46 | + | let IdxVaultEastAmount = 2 | |
47 | + | ||
48 | + | let IdxVaultTimestamp = 3 | |
49 | + | ||
50 | + | let IdxStabilityFee = 4 | |
51 | + | ||
52 | + | let IdxLastFraction = 5 | |
53 | + | ||
54 | + | let invocationError = "Invocation error" | |
55 | + | ||
56 | + | func divd (_x,_y) = fraction(_x, DECIMALS, _y, HALFEVEN) | |
57 | + | ||
58 | + | ||
59 | + | func muld (_x,_y) = fraction(_x, _y, DECIMALS, HALFEVEN) | |
60 | + | ||
61 | + | ||
62 | + | func divp (_x,_y) = fraction(_x, PRECISION, _y, HALFEVEN) | |
63 | + | ||
64 | + | ||
65 | + | func mulp (_x,_y) = fraction(_x, _y, PRECISION, HALFEVEN) | |
66 | + | ||
67 | + | ||
68 | + | func join (ar) = makeString(ar, SEP) | |
69 | + | ||
70 | + | ||
71 | + | func keyInitialized () = join(["%s", "initialized"]) | |
72 | + | ||
73 | + | ||
74 | + | func keyCoordinatorAddress () = join(["%s", "coordinatorAddress"]) | |
75 | + | ||
76 | + | ||
77 | + | func keyVerifierAddress () = join(["%s", "verifierAddress"]) | |
78 | + | ||
79 | + | ||
80 | + | func keyServiceAddress () = join(["%s", "serviceAddress"]) | |
81 | + | ||
82 | + | ||
83 | + | func keyFrontendAddress () = join(["%s", "frontendAddress"]) | |
84 | + | ||
85 | + | ||
86 | + | func keyMinterAddress () = join(["%s", "minterAddress"]) | |
87 | + | ||
88 | + | ||
89 | + | func keyTreasuryAddress () = join(["%s", "treasuryAddress"]) | |
90 | + | ||
91 | + | ||
92 | + | func keyBackendAddress () = join(["%s", "backendAddress"]) | |
93 | + | ||
94 | + | ||
95 | + | func keyEastStakingAddress () = join(["%s", "eastStakingAddress"]) | |
96 | + | ||
97 | + | ||
98 | + | func keyOracleAddress () = join(["%s", "oracleAddress"]) | |
99 | + | ||
100 | + | ||
101 | + | func keyExchangeAddress () = join(["%s", "exchangeAddress"]) | |
102 | + | ||
103 | + | ||
104 | + | func keyEastAsset () = join(["%s", "eastAsset"]) | |
105 | + | ||
106 | + | ||
107 | + | func keyStEastAsset () = join(["%s", "stEastAsset"]) | |
108 | + | ||
109 | + | ||
110 | + | func keyAAssetBalance () = "A_asset_balance" | |
111 | + | ||
112 | + | ||
113 | + | func keyBAssetBalance () = "B_asset_balance" | |
114 | + | ||
115 | + | ||
116 | + | func keyVaultAsset (address,asset) = join(["%s%s%s", "vault", address, asset]) | |
117 | + | ||
118 | + | ||
119 | + | func keyVaultData (address) = join(["%s%s", "vault", address]) | |
120 | + | ||
121 | + | ||
122 | + | func keyPrecision () = join(["%s", "precision"]) | |
123 | + | ||
124 | + | ||
125 | + | func keyBackingRatio () = join(["%s", "backingRatio"]) | |
126 | + | ||
127 | + | ||
128 | + | func keyLiquidationRatio () = join(["%s", "liquidationRatio"]) | |
129 | + | ||
130 | + | ||
131 | + | func keyLiquidationBonus () = join(["%s", "liquidationBonus"]) | |
132 | + | ||
133 | + | ||
134 | + | func keyLiquidationProtocolFee () = join(["%s", "liquidationProtocolFee"]) | |
135 | + | ||
136 | + | ||
137 | + | func keyStabilityFee () = join(["%s", "stabilityFee"]) | |
138 | + | ||
139 | + | ||
140 | + | func keyMinAmountDelta () = join(["%s", "minAmountDelta"]) | |
141 | + | ||
142 | + | ||
143 | + | func keyTicker () = join(["%s", "ticker"]) | |
144 | + | ||
145 | + | ||
146 | + | func keyMaxRateHeightDelta () = join(["%s", "maxRateHeightDelta"]) | |
147 | + | ||
148 | + | ||
149 | + | func keyContractAssetId () = join(["%s", "contractAssetId"]) | |
150 | + | ||
151 | + | ||
152 | + | func keyOracleTickerPrice (ticker) = join(["%s%s", "price", ticker]) | |
153 | + | ||
154 | + | ||
155 | + | func keyOracleTickerPriceHeight (ticker) = join(["%s%s", "lastHeight", ticker]) | |
156 | + | ||
157 | + | ||
158 | + | func keySigned (_address,_txId) = join(["%s%s%s", "signed", _address, _txId]) | |
159 | + | ||
160 | + | ||
161 | + | func keyProtocolActive () = join(["%s", "protocolActive"]) | |
162 | + | ||
163 | + | ||
164 | + | func isInitialized () = valueOrElse(getBoolean(this, keyInitialized()), false) | |
165 | + | ||
166 | + | ||
167 | + | func mustInitialized () = if (!(isInitialized())) | |
168 | + | then throw("Not initialized") | |
169 | + | else unit | |
170 | + | ||
171 | + | ||
172 | + | func mustNotInitialized () = if (isInitialized()) | |
173 | + | then throw("Already initialized") | |
174 | + | else unit | |
175 | + | ||
176 | + | ||
177 | + | func mustSelf (i) = if ((i.caller != this)) | |
178 | + | then throw("Only self invocation allowed.") | |
179 | + | else unit | |
180 | + | ||
181 | + | ||
182 | + | func coordinator () = addressFromStringValue(valueOrErrorMessage(getString(keyCoordinatorAddress()), "Coordinator is not set")) | |
183 | + | ||
184 | + | ||
185 | + | func verifier () = match getString(keyCoordinatorAddress()) { | |
186 | + | case s: String => | |
187 | + | getString(addressFromStringValue(s), keyVerifierAddress()) | |
188 | + | case _: Unit => | |
189 | + | unit | |
190 | + | case _ => | |
191 | + | throw("Match error") | |
192 | + | } | |
193 | + | ||
194 | + | ||
195 | + | func getAddress (key,err) = addressFromStringValue(valueOrErrorMessage(getString(coordinator(), key), err)) | |
196 | + | ||
197 | + | ||
198 | + | func getMinterAddress () = getAddress(keyMinterAddress(), "Minter is not set") | |
199 | + | ||
200 | + | ||
201 | + | func getFrontendAddress () = getAddress(keyFrontendAddress(), "Frontend is not set") | |
202 | + | ||
203 | + | ||
204 | + | func getTreasuryAddress () = getAddress(keyTreasuryAddress(), "Treasury is not set") | |
205 | + | ||
206 | + | ||
207 | + | func getBackendAddress () = getAddress(keyBackendAddress(), "Backend is not set") | |
208 | + | ||
209 | + | ||
210 | + | func getOracleAddress () = getAddress(keyOracleAddress(), "Oracle is not set") | |
211 | + | ||
212 | + | ||
213 | + | func getEastStakingAddress () = getAddress(keyEastStakingAddress(), "East staking is not set") | |
214 | + | ||
215 | + | ||
216 | + | func isNotTreasury (i) = (i.caller != getTreasuryAddress()) | |
217 | + | ||
218 | + | ||
219 | + | func getMinAmountDelta () = valueOrElse(getInteger(coordinator(), keyMinAmountDelta()), MIN_AMOUNT_DELTA) | |
220 | + | ||
221 | + | ||
222 | + | func getMaxRateHeightDelta () = valueOrElse(getInteger(coordinator(), keyMaxRateHeightDelta()), MAX_RATE_HEIGHT_DELTA) | |
223 | + | ||
224 | + | ||
225 | + | func getLiquidationBonus () = valueOrElse(getInteger(coordinator(), keyLiquidationBonus()), LIQUIDATION_BONUS) | |
226 | + | ||
227 | + | ||
228 | + | func getLiquidationProtocolFee () = valueOrElse(getInteger(coordinator(), keyLiquidationProtocolFee()), LIQUIDATION_PROTOCOL_FEE) | |
229 | + | ||
230 | + | ||
231 | + | func getStabilityFee () = valueOrElse(getInteger(coordinator(), keyStabilityFee()), STABILITY_FEE) | |
232 | + | ||
233 | + | ||
234 | + | func getAssetId () = getStringValue(keyContractAssetId()) | |
235 | + | ||
236 | + | ||
237 | + | func getEastAssetStr () = valueOrErrorMessage(getString(coordinator(), keyEastAsset()), "East asset is not set") | |
238 | + | ||
239 | + | ||
240 | + | func getEastAsset () = fromBase58String(getEastAssetStr()) | |
241 | + | ||
242 | + | ||
243 | + | func isActive () = valueOrElse(getBoolean(coordinator(), keyProtocolActive()), false) | |
244 | + | ||
245 | + | ||
246 | + | func mustActive () = if (if (!(isActive())) | |
247 | + | then true | |
248 | + | else !(isInitialized())) | |
249 | + | then throw("Protocol is disabled. Please contact support.") | |
250 | + | else unit | |
251 | + | ||
252 | + | ||
253 | + | func mustFrontend (i) = if ((i.caller != getFrontendAddress())) | |
254 | + | then throw("Not allowed") | |
255 | + | else unit | |
256 | + | ||
257 | + | ||
258 | + | func mustBackend (i) = if ((i.caller != getBackendAddress())) | |
259 | + | then throw("Not allowed") | |
260 | + | else unit | |
261 | + | ||
262 | + | ||
263 | + | func mustNotVaultOwner (i,address) = if ((toBase58String(i.caller.bytes) == address)) | |
264 | + | then throw("Self invocation not allowed.") | |
265 | + | else unit | |
266 | + | ||
267 | + | ||
268 | + | func mustHaveOnePayment (i) = if ((size(i.payments) != 1)) | |
269 | + | then throw("Only one payment allowed.") | |
270 | + | else unit | |
271 | + | ||
272 | + | ||
273 | + | func mustHaveNoPayment (i) = if ((size(i.payments) != 0)) | |
274 | + | then throw("No payment allowed.") | |
275 | + | else unit | |
276 | + | ||
277 | + | ||
278 | + | func hasOnePayment (i) = (size(i.payments) == 1) | |
279 | + | ||
280 | + | ||
281 | + | func isPositive (number) = if ((0 >= number)) | |
282 | + | then throw("Attribute should be positive or zero.") | |
283 | + | else unit | |
284 | + | ||
285 | + | ||
286 | + | func isNotNegative (number) = if ((0 > number)) | |
287 | + | then throw("Attribute should be positive.") | |
288 | + | else unit | |
289 | + | ||
290 | + | ||
291 | + | func getSubvault (address,asset) = getString(keyVaultAsset(address, asset)) | |
292 | + | ||
293 | + | ||
294 | + | func isSubvaultExists (address,asset) = valueOrErrorMessage(getSubvault(address, asset), "Vault not exists") | |
295 | + | ||
296 | + | ||
297 | + | func getAssetString (p) = match p.assetId { | |
298 | + | case assetId: ByteVector => | |
299 | + | toBase58String(assetId) | |
300 | + | case _: Unit => | |
301 | + | "WAVES" | |
302 | + | case _ => | |
303 | + | throw("Match error") | |
304 | + | } | |
305 | + | ||
306 | + | ||
307 | + | func getAssetIdFromString (assetId) = if ((assetId == "WAVES")) | |
308 | + | then unit | |
309 | + | else fromBase58String(assetId) | |
310 | + | ||
311 | + | ||
312 | + | func isAsset (p,checkingAsset) = { | |
313 | + | let assetId = match checkingAsset { | |
314 | + | case bv: ByteVector => | |
315 | + | bv | |
316 | + | case s: String => | |
317 | + | getAssetIdFromString(s) | |
318 | + | case _: Unit => | |
319 | + | unit | |
320 | + | case _ => | |
321 | + | throw("Match error") | |
322 | + | } | |
323 | + | match assetId { | |
324 | + | case bv: ByteVector => | |
325 | + | let name = match assetInfo(bv) { | |
326 | + | case asset: Asset => | |
327 | + | asset.name | |
328 | + | case _: Unit => | |
329 | + | throw(("Can't find asset " + toBase58String(bv))) | |
330 | + | case _ => | |
331 | + | throw("Match error") | |
332 | + | } | |
333 | + | let err = throw(("Attached payment asset is not " + name)) | |
334 | + | match p.assetId { | |
335 | + | case paymentAsset: ByteVector => | |
336 | + | if ((paymentAsset != assetId)) | |
337 | + | then err | |
338 | + | else unit | |
339 | + | case _: Unit => | |
340 | + | err | |
341 | + | case _ => | |
342 | + | throw("Match error") | |
343 | + | } | |
344 | + | case _: Unit => | |
345 | + | if ((p.assetId != unit)) | |
346 | + | then throw("Attached payment asset is not WAVES") | |
347 | + | else unit | |
348 | + | case _ => | |
349 | + | throw("Match error") | |
350 | + | } | |
351 | + | } | |
352 | + | ||
353 | + | ||
354 | + | func getBackingRatio () = valueOrErrorMessage(getInteger(keyBackingRatio()), "Backing ratio is not set") | |
355 | + | ||
356 | + | ||
357 | + | func getLiquidationRatio () = valueOrErrorMessage(getInteger(keyLiquidationRatio()), "Liquidation ratio is not set") | |
358 | + | ||
359 | + | ||
360 | + | func checkAddress (_address) = match addressFromString(_address) { | |
361 | + | case address: Address => | |
362 | + | true | |
363 | + | case _: Unit => | |
364 | + | throw("Invalid address") | |
365 | + | case _ => | |
366 | + | throw("Match error") | |
367 | + | } | |
368 | + | ||
369 | + | ||
370 | + | func checkTxId (_id) = (size(fromBase58String(_id)) == 32) | |
371 | + | ||
372 | + | ||
373 | + | func getCurrentTimestampSec () = (lastBlock.timestamp / 1000) | |
374 | + | ||
375 | + | ||
376 | + | func mustWavesPayment (i) = { | |
377 | + | let check = mustHaveOnePayment(i) | |
378 | + | if ((check == check)) | |
379 | + | then { | |
380 | + | let pmtAssetId = i.payments[0].assetId | |
381 | + | match pmtAssetId { | |
382 | + | case a: Unit => | |
383 | + | unit | |
384 | + | case _ => | |
385 | + | throw("Only WAVES accepted") | |
386 | + | } | |
387 | + | } | |
388 | + | else throw("Strict value is not equal to itself.") | |
389 | + | } | |
390 | + | ||
391 | + | ||
392 | + | func getAssetInfo (assetId) = match assetId { | |
393 | + | case id: ByteVector => | |
394 | + | let stringId = toBase58String(id) | |
395 | + | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
396 | + | $Tuple3(stringId, info.name, info.decimals) | |
397 | + | case waves: Unit => | |
398 | + | $Tuple3("WAVES", "WAVES", 8) | |
399 | + | case _ => | |
400 | + | throw("Match error") | |
401 | + | } | |
402 | + | ||
403 | + | ||
404 | + | func checkHeightDelta (priceHeight) = { | |
405 | + | let maxHeightDelta = getMaxRateHeightDelta() | |
406 | + | let currentDiff = (lastBlock.height - priceHeight) | |
407 | + | if ((maxHeightDelta >= currentDiff)) | |
408 | + | then unit | |
409 | + | else throw("Large price delta.") | |
410 | + | } | |
411 | + | ||
412 | + | ||
413 | + | func getAssetUsdPrice () = { | |
414 | + | let ticker = getStringValue(this, keyTicker()) | |
415 | + | let oracleAddress = getOracleAddress() | |
416 | + | let priceHeight = getIntegerValue(oracleAddress, keyOracleTickerPriceHeight(ticker)) | |
417 | + | let checkHeight = checkHeightDelta(priceHeight) | |
418 | + | if ((checkHeight == checkHeight)) | |
419 | + | then { | |
420 | + | let price = getIntegerValue(oracleAddress, keyOracleTickerPrice(ticker)) | |
421 | + | fraction(price, PRECISION, ORACLE_DECIMALS) | |
422 | + | } | |
423 | + | else throw("Strict value is not equal to itself.") | |
424 | + | } | |
425 | + | ||
426 | + | ||
427 | + | func keyAdmins () = join(["%s", "admins"]) | |
428 | + | ||
429 | + | ||
430 | + | func keyApprove (_address,_txId) = join(["%s%s%s", "approve", _address, _txId]) | |
431 | + | ||
432 | + | ||
433 | + | @Callable(i) | |
434 | + | func initialize (_coordinator,_admins) = { | |
435 | + | let checks = [mustNotInitialized(), mustSelf(i)] | |
436 | + | if ((checks == checks)) | |
437 | + | then { | |
438 | + | let admins = split(_admins, ",") | |
439 | + | if ((size(admins) > 10)) | |
440 | + | then throw("Too many admins") | |
441 | + | else if ((1 > size(admins))) | |
442 | + | then throw("At least 1 admin needed") | |
443 | + | else { | |
444 | + | func fold (verified,admin) = if (!(verified)) | |
445 | + | then verified | |
446 | + | else if (checkAddress(admin)) | |
447 | + | then (admin != toString(this)) | |
448 | + | else false | |
449 | + | ||
450 | + | if (({ | |
451 | + | let $l = admins | |
452 | + | let $s = size($l) | |
453 | + | let $acc0 = true | |
454 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
455 | + | then $a | |
456 | + | else fold($a, $l[$i]) | |
457 | + | ||
458 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
459 | + | then $a | |
460 | + | else throw("List size exceeds 10") | |
461 | + | ||
462 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
463 | + | } == false)) | |
464 | + | then throw(("Admin cannot be this dapp " + toString(this))) | |
465 | + | else [StringEntry(keyVerifierAddress(), toString(this)), StringEntry(keyAdmins(), join(admins)), BooleanEntry(keyInitialized(), true)] | |
466 | + | } | |
467 | + | } | |
468 | + | else throw("Strict value is not equal to itself.") | |
469 | + | } | |
470 | + | ||
471 | + | ||
472 | + | ||
473 | + | @Callable(i) | |
474 | + | func approve (_address,_txId) = { | |
475 | + | let admin = toString(i.caller) | |
476 | + | let admins = getStringValue(keyAdmins()) | |
477 | + | let adminsList = split(admins, SEP) | |
478 | + | if (!(contains(admins, admin))) | |
479 | + | then throw("Not allowed") | |
480 | + | else { | |
481 | + | let checks = [checkAddress(_address), checkTxId(_txId)] | |
482 | + | if ((checks == checks)) | |
483 | + | then { | |
484 | + | let approve = valueOrElse(getString(keyApprove(_address, _txId)), "") | |
485 | + | if (contains(approve, admin)) | |
486 | + | then throw(("Already approved by " + admin)) | |
487 | + | else { | |
488 | + | let approveCount = (1 + (if ((approve == "")) | |
489 | + | then 0 | |
490 | + | else size(split(approve, SEP)))) | |
491 | + | let approveBy = if ((approve == "")) | |
492 | + | then admin | |
493 | + | else ((approve + SEP) + admin) | |
494 | + | let status = if ((approveCount > (size(adminsList) / 2))) | |
495 | + | then true | |
496 | + | else false | |
497 | + | [StringEntry(keyApprove(_address, _txId), approveBy), BooleanEntry(keySigned(_address, _txId), status)] | |
498 | + | } | |
499 | + | } | |
500 | + | else throw("Strict value is not equal to itself.") | |
501 | + | } | |
502 | + | } | |
503 | + | ||
504 | + | ||
505 | + | @Verifier(tx) | |
506 | + | func verify () = match verifier() { | |
507 | + | case address: String => | |
508 | + | valueOrElse(getBoolean(addressFromStringValue(address), keySigned(toString(this), toBase58String(tx.id))), false) | |
509 | + | case _ => | |
510 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
511 | + | } | |
512 | + |
github/deemru/w8io/026f985 26.73 ms ◑