tx · 7qLMYXMXjpehaResukaezEZutB2qqVVBeWV2aVbShZjZ 3MrF6QFGLaSKfoNPMd8L3u7KYNm7cE43Ydw: -0.01000000 Waves 2022.10.17 13:55 [2276277] smart account 3MrF6QFGLaSKfoNPMd8L3u7KYNm7cE43Ydw > SELF 0.00000000 Waves
{ "type": 13, "id": "7qLMYXMXjpehaResukaezEZutB2qqVVBeWV2aVbShZjZ", "fee": 1000000, "feeAssetId": null, "timestamp": 1666004174834, "version": 2, "chainId": 84, "sender": "3MrF6QFGLaSKfoNPMd8L3u7KYNm7cE43Ydw", "senderPublicKey": "6NSakbUsm1WyESQ8yj3qpc1kQUfHWNd5C6CHVpbs4X7c", "proofs": [ "5iLCbg7J7byvCZD5ArAuivckKaLGrZMp3GRdqvqCSfXYkEcLTD3MjHkZgZBPsyjP2n9JDmScdm4pGkW7ZAjxYwKF" ], "script": "base64:AAIFAAAAAAAAABcIAhIDCgEIEgMKAQgSAwoBCBIECgIICAAAABEBAAAAEGdldFN0cmluZ09yVGhyb3cAAAACAAAAB2FkZHJlc3MAAAADa2V5CQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQdAAAAAgUAAAAHYWRkcmVzcwUAAAADa2V5CQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAxDYW4ndCByZWFkICcFAAAAA2tleQIAAAANJyBhdCBhZGRyZXNzIAkABCUAAAABBQAAAAdhZGRyZXNzAQAAABNwYXJzZUFkZHJlc3NPclRocm93AAAAAQAAAAxtYXliZUFkZHJlc3MJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABCYAAAABBQAAAAxtYXliZUFkZHJlc3MJAAEsAAAAAgkAASwAAAACAgAAABpDYW4ndCBwYXJzZSBhZGRyZXNzIGZyb20gJwUAAAAMbWF5YmVBZGRyZXNzAgAAAAEnAQAAAA1rZXlfTmFtZV9hZGRyAAAAAQAAAARuYW1lCQABLAAAAAIJAAEsAAAAAgIAAAAFTmFtZV8FAAAAB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AgAAAARhZGRyAAAAA2ludgEAAAAEYWRkcgAAAAEAAAAEbmFtZQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkBAAAACW1vZGlmaWVycwAAAAEJAARMAAAAAgMJAABmAAAAAgkAATEAAAABBQAAAARuYW1lAAAAAAAAAAAABQAAAAR1bml0CQAAAgAAAAECAAAAFE5hbWUgY2Fubm90IGJlIGVtcHR5BQAAAANuaWwJAAUUAAAAAgUAAAADbmlsCQEAAAAIX3Jlc29sdmUAAAACBQAAAARuYW1lAgAAAARhZGRyAAAAA2ludgEAAAAHc2V0QWRkcgAAAAIAAAAEbmFtZQAAAAdhZGRyZXNzCQEAAAALdmFsdWVPckVsc2UAAAACCQEAAAAJbW9kaWZpZXJzAAAAAQkABEwAAAACAwkAAGYAAAACCQABMQAAAAEFAAAABG5hbWUAAAAAAAAAAAAFAAAABHVuaXQJAAACAAAAAQIAAAAUTmFtZSBjYW5ub3QgYmUgZW1wdHkJAARMAAAAAgkBAAAACW9ubHlPd25lcgAAAAIFAAAAA2ludgUAAAAEbmFtZQkABEwAAAACAwkBAAAACWlzRGVmaW5lZAAAAAEJAAQmAAAAAQUAAAAHYWRkcmVzcwUAAAAEdW5pdAkAAAIAAAABAgAAABVBZGRyZXNzIG11c3QgYmUgdmFsaWQFAAAAA25pbAkBAAAACF9zZXRBZGRyAAAAAgUAAAAEbmFtZQUAAAAHYWRkcmVzcwAAAAD3kIoY", "height": 2276277, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Gdsc7XwZzoKPRENzieaFGcczf27XDvtadgU4W9XM9vm Next: none Diff:
Old | New | Differences | |
---|---|---|---|
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | - | func _getAddr (name) = valueOrElse(getString(this, key_Name_addr(name)), _getOwner( | |
34 | + | func _getAddr (name) = valueOrElse(getString(this, key_Name_addr(name)), _getOwner(name)) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func _setAddr (name,address) = [StringEntry(key_Name_addr(name), address)] | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func _findResolver (name) = { | |
65 | - | let $ | |
66 | - | let lastLabel = $ | |
67 | - | let restLabels = $ | |
65 | + | let $t019331984 = _splitLastLabel(name) | |
66 | + | let lastLabel = $t019331984._1 | |
67 | + | let restLabels = $t019331984._2 | |
68 | 68 | if ((size(restLabels) == 0)) | |
69 | 69 | then $Tuple3(unit, lastLabel, restLabels) | |
70 | 70 | else match invoke(registry, "resolver", [lastLabel], nil) { | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func _resolve (name,callData) = { | |
80 | - | let $ | |
81 | - | let resolver = $ | |
82 | - | let label = $ | |
83 | - | let restLabels = $ | |
84 | - | let $ | |
80 | + | let $t024072462 = _findResolver(name) | |
81 | + | let resolver = $t024072462._1 | |
82 | + | let label = $t024072462._2 | |
83 | + | let restLabels = $t024072462._3 | |
84 | + | let $t024682645 = match callData { | |
85 | 85 | case _ => | |
86 | 86 | if (("addr" == $match0)) | |
87 | 87 | then $Tuple3("addr", [value(restLabels)], _getAddr(label)) | |
88 | 88 | else $Tuple3(unit, unit, unit) | |
89 | 89 | } | |
90 | - | let callFunction = $ | |
91 | - | let callArgs = $ | |
92 | - | let returnsDefault = $ | |
90 | + | let callFunction = $t024682645._1 | |
91 | + | let callArgs = $t024682645._2 | |
92 | + | let returnsDefault = $t024682645._3 | |
93 | 93 | let supportsInterface = match invoke(value(resolver), "supportsInterface", [callData], nil) { | |
94 | 94 | case supportsInterface: Boolean => | |
95 | 95 | supportsInterface |
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 | func key_Name_addr (name) = (("Name_" + name) + "_addr") | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | let key_registry = "registry" | |
14 | 14 | ||
15 | 15 | let registry = parseAddressOrThrow(getStringOrThrow(this, key_registry)) | |
16 | 16 | ||
17 | 17 | func _splitLastLabel (name) = { | |
18 | 18 | let labels = split(name, ".") | |
19 | 19 | let lastIndex = (size(labels) - 1) | |
20 | 20 | let lastLabel = labels[lastIndex] | |
21 | 21 | let restLabels = makeString(removeByIndex(labels, lastIndex), ".") | |
22 | 22 | $Tuple2(lastLabel, restLabels) | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func _getOwner (name) = match invoke(registry, "owner", [name], nil) { | |
27 | 27 | case owner: String => | |
28 | 28 | owner | |
29 | 29 | case _ => | |
30 | 30 | unit | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | - | func _getAddr (name) = valueOrElse(getString(this, key_Name_addr(name)), _getOwner( | |
34 | + | func _getAddr (name) = valueOrElse(getString(this, key_Name_addr(name)), _getOwner(name)) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func _setAddr (name,address) = [StringEntry(key_Name_addr(name), address)] | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func isAdmin (inv) = (inv.caller == this) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func isOwner (inv,name) = (toString(inv.caller) == valueOrElse(_getOwner(name), "")) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func isValidAddress (maybeAddress) = isDefined(addressFromString(maybeAddress)) | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func modifiers (validations) = unit | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func onlyAdmin (inv) = if (isAdmin(inv)) | |
53 | 53 | then unit | |
54 | 54 | else throw("Permission denied") | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func onlyOwner (inv,name) = if (if (isAdmin(inv)) | |
58 | 58 | then true | |
59 | 59 | else isOwner(inv, name)) | |
60 | 60 | then unit | |
61 | 61 | else throw("Permission denied") | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func _findResolver (name) = { | |
65 | - | let $ | |
66 | - | let lastLabel = $ | |
67 | - | let restLabels = $ | |
65 | + | let $t019331984 = _splitLastLabel(name) | |
66 | + | let lastLabel = $t019331984._1 | |
67 | + | let restLabels = $t019331984._2 | |
68 | 68 | if ((size(restLabels) == 0)) | |
69 | 69 | then $Tuple3(unit, lastLabel, restLabels) | |
70 | 70 | else match invoke(registry, "resolver", [lastLabel], nil) { | |
71 | 71 | case resolverAddress: String => | |
72 | 72 | $Tuple3(addressFromString(resolverAddress), lastLabel, restLabels) | |
73 | 73 | case _ => | |
74 | 74 | $Tuple3(unit, lastLabel, restLabels) | |
75 | 75 | } | |
76 | 76 | } | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func _resolve (name,callData) = { | |
80 | - | let $ | |
81 | - | let resolver = $ | |
82 | - | let label = $ | |
83 | - | let restLabels = $ | |
84 | - | let $ | |
80 | + | let $t024072462 = _findResolver(name) | |
81 | + | let resolver = $t024072462._1 | |
82 | + | let label = $t024072462._2 | |
83 | + | let restLabels = $t024072462._3 | |
84 | + | let $t024682645 = match callData { | |
85 | 85 | case _ => | |
86 | 86 | if (("addr" == $match0)) | |
87 | 87 | then $Tuple3("addr", [value(restLabels)], _getAddr(label)) | |
88 | 88 | else $Tuple3(unit, unit, unit) | |
89 | 89 | } | |
90 | - | let callFunction = $ | |
91 | - | let callArgs = $ | |
92 | - | let returnsDefault = $ | |
90 | + | let callFunction = $t024682645._1 | |
91 | + | let callArgs = $t024682645._2 | |
92 | + | let returnsDefault = $t024682645._3 | |
93 | 93 | let supportsInterface = match invoke(value(resolver), "supportsInterface", [callData], nil) { | |
94 | 94 | case supportsInterface: Boolean => | |
95 | 95 | supportsInterface | |
96 | 96 | case _ => | |
97 | 97 | false | |
98 | 98 | } | |
99 | 99 | if (!(isDefined(resolver))) | |
100 | 100 | then returnsDefault | |
101 | 101 | else if (!(supportsInterface)) | |
102 | 102 | then unit | |
103 | 103 | else match invoke(value(resolver), value(callFunction), value(callArgs), nil) { | |
104 | 104 | case maybeAddr: String => | |
105 | 105 | if (isValidAddress(maybeAddr)) | |
106 | 106 | then maybeAddr | |
107 | 107 | else unit | |
108 | 108 | case _ => | |
109 | 109 | unit | |
110 | 110 | } | |
111 | 111 | } | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | @Callable(inv) | |
115 | 115 | func init (registryAddress) = valueOrElse(modifiers([onlyAdmin(inv)]), [StringEntry(key_registry, registryAddress)]) | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | ||
119 | 119 | @Callable(inv) | |
120 | 120 | func supportsInterface (interfaceId) = $Tuple2(nil, (interfaceId == "addr")) | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | ||
124 | 124 | @Callable(inv) | |
125 | 125 | func addr (name) = valueOrElse(modifiers([if ((size(name) > 0)) | |
126 | 126 | then unit | |
127 | 127 | else throw("Name cannot be empty")]), $Tuple2(nil, _resolve(name, "addr"))) | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | ||
131 | 131 | @Callable(inv) | |
132 | 132 | func setAddr (name,address) = valueOrElse(modifiers([if ((size(name) > 0)) | |
133 | 133 | then unit | |
134 | 134 | else throw("Name cannot be empty"), onlyOwner(inv, name), if (isDefined(addressFromString(address))) | |
135 | 135 | then unit | |
136 | 136 | else throw("Address must be valid")]), _setAddr(name, address)) | |
137 | 137 | ||
138 | 138 |
github/deemru/w8io/169f3d6 39.71 ms ◑