tx · 8RFuQpiea6eG7YS5jzTSJtrDdaRsF35nfPYCdc4EMfuX 3Mwx79Yi7aam4qYeULSPiDtDMpW57xziNVG: -0.05000000 Waves 2023.07.12 15:24 [2662676] smart account 3Mwx79Yi7aam4qYeULSPiDtDMpW57xziNVG > SELF 0.00000000 Waves
{ "type": 13, "id": "8RFuQpiea6eG7YS5jzTSJtrDdaRsF35nfPYCdc4EMfuX", "fee": 5000000, "feeAssetId": null, "timestamp": 1689164703429, "version": 2, "chainId": 84, "sender": "3Mwx79Yi7aam4qYeULSPiDtDMpW57xziNVG", "senderPublicKey": "G4xkNEdNaSmZ9j6HPKFT7LMyagr3h9MbMWndwjnsePsd", "proofs": [ "42HCy344BSs9PDQop4ESXyfUJ2MPzMkRoFvJFP9DHhvqMXkrHpBwRQ5H1PdjtqdFXHyhUqbfeR3PRJnnAHTTVjnk" ], "script": "base64:BgLzAQgCEgMKAQgiA1NFUCIEam9pbiICYXIiDmtleUluaXRpYWxpemVkIhVrZXlDb29yZGluYXRvckFkZHJlc3MiEmtleVZlcmlmaWVyQWRkcmVzcyIJa2V5U2lnbmVkIghfYWRkcmVzcyIFX3R4SWQiDWlzSW5pdGlhbGl6ZWQiEm11c3ROb3RJbml0aWFsaXplZCIIbXVzdFNlbGYiAWkiCHZlcmlmaWVyIgckbWF0Y2gwIgFzIgxjaGVja0FkZHJlc3MiB2FkZHJlc3MiE19jb29yZGluYXRvckFkZHJlc3MiBmNoZWNrcyICdHgiBnZlcmlmeQsAAWECAl9fAQFiAQFjCQC5CQIFAWMFAWEBAWQACQEBYgEJAMwIAgICJXMJAMwIAgILaW5pdGlhbGl6ZWQFA25pbAEBZQAJAQFiAQkAzAgCAgIlcwkAzAgCAhJjb29yZGluYXRvckFkZHJlc3MFA25pbAEBZgAJAQFiAQkAzAgCAgIlcwkAzAgCAg92ZXJpZmllckFkZHJlc3MFA25pbAEBZwIBaAFpCQEBYgEJAMwIAgIGJXMlcyVzCQDMCAICBnNpZ25lZAkAzAgCBQFoCQDMCAIFAWkFA25pbAEBagAJAQt2YWx1ZU9yRWxzZQIJAJsIAgUEdGhpcwkBAWQABwEBawADCQEBagAJAAIBAhNBbHJlYWR5IGluaXRpYWxpemVkBQR1bml0AQFsAQFtAwkBAiE9AggFAW0GY2FsbGVyBQR0aGlzCQACAQIdT25seSBzZWxmIGludm9jYXRpb24gYWxsb3dlZC4FBHVuaXQBAW4ABAFvCQCiCAEJAQFlAAMJAAECBQFvAgZTdHJpbmcEAXAFAW8JAJ0IAgkBEUBleHRyTmF0aXZlKDEwNjIpAQUBcAkBAWYAAwkAAQIFAW8CBFVuaXQFBHVuaXQJAAIBAgtNYXRjaCBlcnJvcgEBcQEBaAQBbwkApggBBQFoAwkAAQIFAW8CB0FkZHJlc3MEAXIFAW8GAwkAAQIFAW8CBFVuaXQJAAIBAg9JbnZhbGlkIGFkZHJlc3MJAAIBAgtNYXRjaCBlcnJvcgEBbQEKaW5pdGlhbGl6ZQEBcwQBdAkAzAgCCQEBbAEFAW0JAMwIAgkBAWsACQDMCAIJAQFxAQUBcwUDbmlsAwkAAAIFAXQFAXQJAMwIAgkBC1N0cmluZ0VudHJ5AgkBAWUABQFzCQDMCAIJAQxCb29sZWFuRW50cnkCCQEBZAAGBQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAXUBAXYABAFvCQEBbgADCQABAgUBbwIGU3RyaW5nBAFyBQFvCQELdmFsdWVPckVsc2UCCQCbCAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEFAXIJAQFnAgkApQgBBQR0aGlzCQDYBAEIBQF1AmlkBwkA9AMDCAUBdQlib2R5Qnl0ZXMJAJEDAggFAXUGcHJvb2ZzAAAIBQF1D3NlbmRlclB1YmxpY0tleSpj/F8=", "height": 2662676, "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 | + | func join (ar) = makeString(ar, SEP) | |
7 | + | ||
8 | + | ||
9 | + | func keyInitialized () = join(["%s", "initialized"]) | |
10 | + | ||
11 | + | ||
12 | + | func keyCoordinatorAddress () = join(["%s", "coordinatorAddress"]) | |
13 | + | ||
14 | + | ||
15 | + | func keyVerifierAddress () = join(["%s", "verifierAddress"]) | |
16 | + | ||
17 | + | ||
18 | + | func keySigned (_address,_txId) = join(["%s%s%s", "signed", _address, _txId]) | |
19 | + | ||
20 | + | ||
21 | + | func isInitialized () = valueOrElse(getBoolean(this, keyInitialized()), false) | |
22 | + | ||
23 | + | ||
24 | + | func mustNotInitialized () = if (isInitialized()) | |
25 | + | then throw("Already initialized") | |
26 | + | else unit | |
27 | + | ||
28 | + | ||
29 | + | func mustSelf (i) = if ((i.caller != this)) | |
30 | + | then throw("Only self invocation allowed.") | |
31 | + | else unit | |
32 | + | ||
33 | + | ||
34 | + | func verifier () = match getString(keyCoordinatorAddress()) { | |
35 | + | case s: String => | |
36 | + | getString(addressFromStringValue(s), keyVerifierAddress()) | |
37 | + | case _: Unit => | |
38 | + | unit | |
39 | + | case _ => | |
40 | + | throw("Match error") | |
41 | + | } | |
42 | + | ||
43 | + | ||
44 | + | func checkAddress (_address) = match addressFromString(_address) { | |
45 | + | case address: Address => | |
46 | + | true | |
47 | + | case _: Unit => | |
48 | + | throw("Invalid address") | |
49 | + | case _ => | |
50 | + | throw("Match error") | |
51 | + | } | |
52 | + | ||
53 | + | ||
54 | + | @Callable(i) | |
55 | + | func initialize (_coordinatorAddress) = { | |
56 | + | let checks = [mustSelf(i), mustNotInitialized(), checkAddress(_coordinatorAddress)] | |
57 | + | if ((checks == checks)) | |
58 | + | then [StringEntry(keyCoordinatorAddress(), _coordinatorAddress), BooleanEntry(keyInitialized(), true)] | |
59 | + | else throw("Strict value is not equal to itself.") | |
60 | + | } | |
61 | + | ||
62 | + | ||
63 | + | @Verifier(tx) | |
64 | + | func verify () = match verifier() { | |
65 | + | case address: String => | |
66 | + | valueOrElse(getBoolean(addressFromStringValue(address), keySigned(toString(this), toBase58String(tx.id))), false) | |
67 | + | case _ => | |
68 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
69 | + | } | |
70 | + |
github/deemru/w8io/026f985 13.93 ms ◑