tx · 9mtoGRrmmz573QRFkui8M5Hs8GAQSQs1hWSR8esvfum 3MrF6QFGLaSKfoNPMd8L3u7KYNm7cE43Ydw: -0.00300000 Waves 2022.10.09 18:44 [2264987] smart account 3MrF6QFGLaSKfoNPMd8L3u7KYNm7cE43Ydw > SELF 0.00000000 Waves
{ "type": 13, "id": "9mtoGRrmmz573QRFkui8M5Hs8GAQSQs1hWSR8esvfum", "fee": 300000, "feeAssetId": null, "timestamp": 1665330283243, "version": 2, "chainId": 84, "sender": "3MrF6QFGLaSKfoNPMd8L3u7KYNm7cE43Ydw", "senderPublicKey": "6NSakbUsm1WyESQ8yj3qpc1kQUfHWNd5C6CHVpbs4X7c", "proofs": [ "5mCphqrawgcfXnYczDYZc2EtQqQ2UsQXrYZeVU2yPg8qd4bAT9PDQZj9hTpYYGNL4LGXAVbwyoPS8pn3SmF4hcuY" ], "script": "base64:AAIFAAAAAAAAABYIAhIDCgEIEgMKAQgSAwoBCBIDCgEIAAAACAEAAAAQZ2V0U3RyaW5nT3JUaHJvdwAAAAIAAAAHYWRkcmVzcwAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAADENhbid0IHJlYWQgJwUAAAADa2V5AgAAAA0nIGF0IGFkZHJlc3MgCQAEJQAAAAEFAAAAB2FkZHJlc3MBAAAAE3BhcnNlQWRkcmVzc09yVGhyb3cAAAABAAAADG1heWJlQWRkcmVzcwkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEJgAAAAEFAAAADG1heWJlQWRkcmVzcwkAASwAAAACCQABLAAAAAICAAAAGkNhbid0IHBhcnNlIGFkZHJlc3MgZnJvbSAnBQAAAAxtYXliZUFkZHJlc3MCAAAAAScAAAAADGtleV9yZWdpc3RyeQIAAAAIcmVnaXN0cnkAAAAACHJlZ2lzdHJ5CQEAAAATcGFyc2V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1hdGNoMAkAA/wAAAAEBQAAAAhyZWdpc3RyeQIAAAALbmFtZUV4cGlyZXMJAARMAAAAAgUAAAAJbGFzdExhYmVsBQAAAANuaWwFAAAAA25pbAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAlleHBpcmVzQXQFAAAAByRtYXRjaDAFAAAACWV4cGlyZXNBdAUAAAAEdW5pdAQAAAAKbmFtZVN0YXR1cwQAAAAHJG1hdGNoMAkAA/wAAAAEBQAAAAhyZWdpc3RyeQIAAAAKbmFtZVN0YXR1cwkABEwAAAACBQAAAAlsYXN0TGFiZWwFAAAAA25pbAUAAAADbmlsAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAABnN0YXR1cwUAAAAHJG1hdGNoMAUAAAAGc3RhdHVzBQAAAAR1bml0AwkBAAAAASEAAAABCQEAAAAJaXNEZWZpbmVkAAAAAQUAAAAKcmVnaXN0cmFudAkABRQAAAACBQAAAANuaWwFAAAABHVuaXQJAAUUAAAAAgUAAAADbmlsCQAFFwAAAAUFAAAACnJlZ2lzdHJhbnQFAAAACHJlc29sdmVyBQAAAAtuYW1lQ3JlYXRlZAUAAAALbmFtZUV4cGlyZXMFAAAACm5hbWVTdGF0dXMAAAAAg7ibjg==", "height": 2264987, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: eRxGEJS7CwTN94owiyWe2ntedNWegeJxrf9DaU29xFE Next: B2VJNE7Vs1kbvCwCLkVhZoQHHauJKiUkCu13EKduzfkH Diff:
Old | New | Differences | |
---|---|---|---|
45 | 45 | let labels = if ((size(name) == 0)) | |
46 | 46 | then throw("Name cannot be empty") | |
47 | 47 | else split(name, ".") | |
48 | - | let levels = size(labels) | |
49 | - | let label = labels[(levels - 1)] | |
50 | - | $Tuple2(nil, _addr(label)) | |
48 | + | let lastLabel = labels[(size(labels) - 1)] | |
49 | + | $Tuple2(nil, _addr(lastLabel)) | |
51 | 50 | } | |
51 | + | ||
52 | + | ||
53 | + | ||
54 | + | @Callable(inv) | |
55 | + | func whoIs (name) = valueOrElse(modifiers([if ((size(name) > 0)) | |
56 | + | then unit | |
57 | + | else throw("Name cannot be empty")]), { | |
58 | + | let labels = split(name, ".") | |
59 | + | let lastLabel = labels[(size(labels) - 1)] | |
60 | + | let registrant = match invoke(registry, "owner", [lastLabel], nil) { | |
61 | + | case owner: String => | |
62 | + | owner | |
63 | + | case _ => | |
64 | + | unit | |
65 | + | } | |
66 | + | let resolver = unit | |
67 | + | let nameCreated = match invoke(registry, "nameCreated", [lastLabel], nil) { | |
68 | + | case createdAt: Int => | |
69 | + | createdAt | |
70 | + | case _ => | |
71 | + | unit | |
72 | + | } | |
73 | + | let nameExpires = match invoke(registry, "nameExpires", [lastLabel], nil) { | |
74 | + | case expiresAt: Int => | |
75 | + | expiresAt | |
76 | + | case _ => | |
77 | + | unit | |
78 | + | } | |
79 | + | let nameStatus = match invoke(registry, "nameStatus", [lastLabel], nil) { | |
80 | + | case status: Int => | |
81 | + | status | |
82 | + | case _ => | |
83 | + | unit | |
84 | + | } | |
85 | + | if (!(isDefined(registrant))) | |
86 | + | then $Tuple2(nil, unit) | |
87 | + | else $Tuple2(nil, $Tuple5(registrant, resolver, nameCreated, nameExpires, nameStatus)) | |
88 | + | }) | |
52 | 89 | ||
53 | 90 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getStringOrThrow (address,key) = valueOrErrorMessage(getString(address, key), ((("Can't read '" + key) + "' at address ") + toString(address))) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func parseAddressOrThrow (maybeAddress) = valueOrErrorMessage(addressFromString(maybeAddress), (("Can't parse address from '" + maybeAddress) + "'")) | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | let key_registry = "registry" | |
11 | 11 | ||
12 | 12 | let registry = parseAddressOrThrow(getStringOrThrow(this, key_registry)) | |
13 | 13 | ||
14 | 14 | func isAdmin (inv) = (inv.caller == this) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func modifiers (validations) = unit | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func onlyAdmin (inv) = if (isAdmin(inv)) | |
21 | 21 | then unit | |
22 | 22 | else throw("Permission denied") | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func _addr (label) = match invoke(registry, "owner", [label], nil) { | |
26 | 26 | case owner: String => | |
27 | 27 | owner | |
28 | 28 | case _ => | |
29 | 29 | unit | |
30 | 30 | } | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | @Callable(inv) | |
34 | 34 | func init (registryAddress) = valueOrElse(modifiers([onlyAdmin(inv)]), [StringEntry(key_registry, registryAddress)]) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | ||
38 | 38 | @Callable(inv) | |
39 | 39 | func addr (label) = $Tuple2(nil, _addr(label)) | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | ||
43 | 43 | @Callable(inv) | |
44 | 44 | func resolve (name) = { | |
45 | 45 | let labels = if ((size(name) == 0)) | |
46 | 46 | then throw("Name cannot be empty") | |
47 | 47 | else split(name, ".") | |
48 | - | let levels = size(labels) | |
49 | - | let label = labels[(levels - 1)] | |
50 | - | $Tuple2(nil, _addr(label)) | |
48 | + | let lastLabel = labels[(size(labels) - 1)] | |
49 | + | $Tuple2(nil, _addr(lastLabel)) | |
51 | 50 | } | |
51 | + | ||
52 | + | ||
53 | + | ||
54 | + | @Callable(inv) | |
55 | + | func whoIs (name) = valueOrElse(modifiers([if ((size(name) > 0)) | |
56 | + | then unit | |
57 | + | else throw("Name cannot be empty")]), { | |
58 | + | let labels = split(name, ".") | |
59 | + | let lastLabel = labels[(size(labels) - 1)] | |
60 | + | let registrant = match invoke(registry, "owner", [lastLabel], nil) { | |
61 | + | case owner: String => | |
62 | + | owner | |
63 | + | case _ => | |
64 | + | unit | |
65 | + | } | |
66 | + | let resolver = unit | |
67 | + | let nameCreated = match invoke(registry, "nameCreated", [lastLabel], nil) { | |
68 | + | case createdAt: Int => | |
69 | + | createdAt | |
70 | + | case _ => | |
71 | + | unit | |
72 | + | } | |
73 | + | let nameExpires = match invoke(registry, "nameExpires", [lastLabel], nil) { | |
74 | + | case expiresAt: Int => | |
75 | + | expiresAt | |
76 | + | case _ => | |
77 | + | unit | |
78 | + | } | |
79 | + | let nameStatus = match invoke(registry, "nameStatus", [lastLabel], nil) { | |
80 | + | case status: Int => | |
81 | + | status | |
82 | + | case _ => | |
83 | + | unit | |
84 | + | } | |
85 | + | if (!(isDefined(registrant))) | |
86 | + | then $Tuple2(nil, unit) | |
87 | + | else $Tuple2(nil, $Tuple5(registrant, resolver, nameCreated, nameExpires, nameStatus)) | |
88 | + | }) | |
52 | 89 | ||
53 | 90 |
github/deemru/w8io/169f3d6 35.69 ms ◑