tx · 2QG8r1ieF2eKvUXT467wyJyZHis3y9AZC5VE9VXJjQva 3MxquWQhzpqXgbqunnFqHFJXTjasEznd1tN: -0.01000000 Waves 2022.10.20 08:23 [2280287] smart account 3MxquWQhzpqXgbqunnFqHFJXTjasEznd1tN > SELF 0.00000000 Waves
{ "type": 13, "id": "2QG8r1ieF2eKvUXT467wyJyZHis3y9AZC5VE9VXJjQva", "fee": 1000000, "feeAssetId": null, "timestamp": 1666243412716, "version": 2, "chainId": 84, "sender": "3MxquWQhzpqXgbqunnFqHFJXTjasEznd1tN", "senderPublicKey": "GDjexdefwEhShjRTvHgazn3gTrDo74eHpJCAz14cAEeh", "proofs": [ "V4j58KnXEXEN9V6Svw7PJv8qVVGckEbpjxgFaYhoNa6JATFNZTbdmqhpLBXpkodupW1UW8vD1qRMdfHQERTjNMW" ], "script": "base64:AAIFAAAAAAAAAC4IAhIDCgEIEgQKAggIEgMKAQgSAwoBCBIECgIICBIDCgEIEgUKAwgICBIDCgEIAAAAFgEAAAAQZ2V0U3RyaW5nT3JUaHJvdwAAAAIAAAAHYWRkcmVzcwAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAADENhbid0IHJlYWQgJwUAAAADa2V5AgAAAA0nIGF0IGFkZHJlc3MgCQAEJQAAAAEFAAAAB2FkZHJlc3MBAAAAEWdldEludGVnZXJPclRocm93AAAAAgAAAAdhZGRyZXNzAAAAA2tleQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEGgAAAAIFAAAAB2FkZHJlc3MFAAAAA2tleQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAMQ2FuJ3QgcmVhZCAnBQAAAANrZXkCAAAADScgYXQgYWRkcmVzcyAJAAQlAAAAAQUAAAAHYWRkcmVzcwEAAAATcGFyc2VBZGRyZXNzT3JUaHJvdw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AQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAALbmFtZUNyZWF0ZWQFAAAAByRtYXRjaDAFAAAAC25hbWVDcmVhdGVkBQAAAA1wYXJlbnRDcmVhdGVkBQAAAAtuYW1lRXhwaXJlcwAAAADiskDl", "height": 2280287, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CbobkH99ae7vcVdNwXg2Rmp12nsUv8akiZH9w8zDcd9b Next: 9qMS9ASYKcTdxtrPwHbxMfgxZyQeDZKMr8oLfTPKmxZb Diff:
Old | New | Differences | |
---|---|---|---|
212 | 212 | owner | |
213 | 213 | case _ => | |
214 | 214 | parentOwnerAddress | |
215 | - | }, registrar, resolver, nameCreated, nameExpires)) | |
215 | + | }, match registrar { | |
216 | + | case registrar: String => | |
217 | + | registrar | |
218 | + | case _ => | |
219 | + | parentRegistrarAddress | |
220 | + | }, match resolver { | |
221 | + | case resolver: String => | |
222 | + | resolver | |
223 | + | case _ => | |
224 | + | parentResolver | |
225 | + | }, match nameCreated { | |
226 | + | case nameCreated: Int => | |
227 | + | nameCreated | |
228 | + | case _ => | |
229 | + | parentCreated | |
230 | + | }, nameExpires)) | |
216 | 231 | }) | |
217 | 232 | ||
218 | 233 |
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 getIntegerOrThrow (address,key) = valueOrErrorMessage(getInteger(address, key), ((("Can't read '" + key) + "' at address ") + toString(address))) | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | func parseAddressOrThrow (maybeAddress) = valueOrErrorMessage(addressFromString(maybeAddress), (("Can't parse address from '" + maybeAddress) + "'")) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func key_entity (name,pk,property) = ((((name + "_") + pk) + "_") + property) | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func key_Name_owner (node) = key_entity("Name", node, "owner") | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func key_Name_resolver (node) = key_entity("Name", node, "resolver") | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func key_Name_createdAt (node) = key_entity("Name", node, "createdAt") | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func _getOwner (node) = getString(this, key_Name_owner(node)) | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func _setOwner (node,owner) = [StringEntry(key_Name_owner(node), owner)] | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func _getRegistrar (node) = getString(this, key_Name_owner(node)) | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func _getResolver (node) = getString(this, key_Name_resolver(node)) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func _setResolver (node,resolver) = [StringEntry(key_Name_resolver(node), resolver)] | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func _getCreatedAt (node) = getInteger(this, key_Name_createdAt(node)) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func _setCreatedAt (node,createdAt) = [IntegerEntry(key_Name_createdAt(node), createdAt)] | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func isAdmin (inv) = (inv.caller == this) | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func isOwner (inv,node) = (toString(inv.caller) == valueOrElse(_getOwner(node), "")) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func isValidAddress (maybeAddress) = isDefined(addressFromString(maybeAddress)) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func _splitTLD (name) = { | |
56 | 56 | let labels = split(name, ".") | |
57 | 57 | let lastIndex = (size(labels) - 1) | |
58 | 58 | let lastLabel = labels[lastIndex] | |
59 | 59 | let restLabels = makeString(removeByIndex(labels, lastIndex), ".") | |
60 | 60 | $Tuple2(lastLabel, restLabels) | |
61 | 61 | } | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func _callSupportedInterface (registrant,interfaceId,restLabels) = match invoke(registrant, "supportsInterface", [interfaceId], nil) { | |
65 | 65 | case supportsInterface: Boolean => | |
66 | 66 | if (!(supportsInterface)) | |
67 | 67 | then unit | |
68 | 68 | else match invoke(value(registrant), interfaceId, [restLabels], nil) { | |
69 | 69 | case maybeString: String => | |
70 | 70 | maybeString | |
71 | 71 | case maybeInt: Int => | |
72 | 72 | maybeInt | |
73 | 73 | case _ => | |
74 | 74 | unit | |
75 | 75 | } | |
76 | 76 | case _ => | |
77 | 77 | unit | |
78 | 78 | } | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func modifiers (validations) = unit | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func onlyAdmin (inv) = if (isAdmin(inv)) | |
85 | 85 | then unit | |
86 | 86 | else throw("Permission denied") | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func onlyOwner (inv,node) = if (if (isAdmin(inv)) | |
90 | 90 | then true | |
91 | 91 | else isOwner(inv, node)) | |
92 | 92 | then unit | |
93 | 93 | else throw("Permission denied") | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | @Callable(inv) | |
97 | 97 | func owner (node) = $Tuple2(nil, _getOwner(node)) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | ||
101 | 101 | @Callable(inv) | |
102 | 102 | func setOwner (node,owner) = valueOrElse(modifiers([onlyOwner(inv, node), if (isValidAddress(owner)) | |
103 | 103 | then unit | |
104 | 104 | else throw("Owner must be a valid address")]), _setOwner(node, owner)) | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | ||
108 | 108 | @Callable(inv) | |
109 | 109 | func registrar (node) = $Tuple2(nil, _getRegistrar(node)) | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | ||
113 | 113 | @Callable(inv) | |
114 | 114 | func resolver (node) = $Tuple2(nil, _getResolver(node)) | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | ||
118 | 118 | @Callable(inv) | |
119 | 119 | func setResolver (node,resolver) = valueOrElse(modifiers([onlyOwner(inv, node), if (isValidAddress(resolver)) | |
120 | 120 | then unit | |
121 | 121 | else throw("Resolver must be a valid contract address")]), _setResolver(node, resolver)) | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | ||
125 | 125 | @Callable(inv) | |
126 | 126 | func nameCreated (node) = $Tuple2(nil, _getCreatedAt(node)) | |
127 | 127 | ||
128 | 128 | ||
129 | 129 | ||
130 | 130 | @Callable(inv) | |
131 | 131 | func setRecord (node,owner,resolver) = valueOrElse(modifiers([onlyAdmin(inv)]), ((_setOwner(node, owner) ++ _setResolver(node, resolver)) ++ _setCreatedAt(node, lastBlock.timestamp))) | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | ||
135 | 135 | @Callable(inv) | |
136 | 136 | func whoIs (name) = valueOrElse(modifiers([if ((size(name) > 0)) | |
137 | 137 | then unit | |
138 | 138 | else throw("Name cannot be empty")]), { | |
139 | 139 | let $t044844525 = _splitTLD(name) | |
140 | 140 | let label = $t044844525._1 | |
141 | 141 | let restLabels = $t044844525._2 | |
142 | 142 | let parentOwnerAddress = match _getOwner(label) { | |
143 | 143 | case owner: String => | |
144 | 144 | if (isValidAddress(owner)) | |
145 | 145 | then owner | |
146 | 146 | else unit | |
147 | 147 | case _ => | |
148 | 148 | unit | |
149 | 149 | } | |
150 | 150 | let parentRegistrarAddress = match _getRegistrar(label) { | |
151 | 151 | case registrar: String => | |
152 | 152 | if (isValidAddress(registrar)) | |
153 | 153 | then registrar | |
154 | 154 | else unit | |
155 | 155 | case _ => | |
156 | 156 | unit | |
157 | 157 | } | |
158 | 158 | let parentRegistrar = value(addressFromString(value(parentRegistrarAddress))) | |
159 | 159 | let parentResolver = _getResolver(label) | |
160 | 160 | let parentCreated = _getCreatedAt(label) | |
161 | 161 | let owner = match _callSupportedInterface(parentRegistrar, "owner", restLabels) { | |
162 | 162 | case owner: String => | |
163 | 163 | if (isValidAddress(owner)) | |
164 | 164 | then owner | |
165 | 165 | else unit | |
166 | 166 | case _ => | |
167 | 167 | unit | |
168 | 168 | } | |
169 | 169 | let registrar = match _callSupportedInterface(parentRegistrar, "registrar", restLabels) { | |
170 | 170 | case registrar: String => | |
171 | 171 | if (isValidAddress(registrar)) | |
172 | 172 | then registrar | |
173 | 173 | else unit | |
174 | 174 | case _ => | |
175 | 175 | unit | |
176 | 176 | } | |
177 | 177 | let resolver = match _callSupportedInterface(parentRegistrar, "resolver", restLabels) { | |
178 | 178 | case resolver: String => | |
179 | 179 | if (isValidAddress(resolver)) | |
180 | 180 | then resolver | |
181 | 181 | else unit | |
182 | 182 | case _ => | |
183 | 183 | unit | |
184 | 184 | } | |
185 | 185 | let nameCreated = match _callSupportedInterface(parentRegistrar, "nameCreated", restLabels) { | |
186 | 186 | case nameCreated: Int => | |
187 | 187 | if (if ((nameCreated > 0)) | |
188 | 188 | then (lastBlock.timestamp > nameCreated) | |
189 | 189 | else false) | |
190 | 190 | then nameCreated | |
191 | 191 | else unit | |
192 | 192 | case _ => | |
193 | 193 | unit | |
194 | 194 | } | |
195 | 195 | let nameExpires = match _callSupportedInterface(parentRegistrar, "nameExpires", restLabels) { | |
196 | 196 | case nameExpires: Int => | |
197 | 197 | if ((nameExpires > 0)) | |
198 | 198 | then nameExpires | |
199 | 199 | else unit | |
200 | 200 | case _ => | |
201 | 201 | unit | |
202 | 202 | } | |
203 | 203 | let isRootName = if ((size(label) > 0)) | |
204 | 204 | then (size(restLabels) == 0) | |
205 | 205 | else false | |
206 | 206 | if (if (isRootName) | |
207 | 207 | then true | |
208 | 208 | else !(isDefined(parentRegistrarAddress))) | |
209 | 209 | then $Tuple2(nil, $Tuple5(parentRegistrarAddress, parentOwnerAddress, parentResolver, parentCreated, unit)) | |
210 | 210 | else $Tuple2(nil, $Tuple5( match owner { | |
211 | 211 | case owner: String => | |
212 | 212 | owner | |
213 | 213 | case _ => | |
214 | 214 | parentOwnerAddress | |
215 | - | }, registrar, resolver, nameCreated, nameExpires)) | |
215 | + | }, match registrar { | |
216 | + | case registrar: String => | |
217 | + | registrar | |
218 | + | case _ => | |
219 | + | parentRegistrarAddress | |
220 | + | }, match resolver { | |
221 | + | case resolver: String => | |
222 | + | resolver | |
223 | + | case _ => | |
224 | + | parentResolver | |
225 | + | }, match nameCreated { | |
226 | + | case nameCreated: Int => | |
227 | + | nameCreated | |
228 | + | case _ => | |
229 | + | parentCreated | |
230 | + | }, nameExpires)) | |
216 | 231 | }) | |
217 | 232 | ||
218 | 233 |
github/deemru/w8io/026f985 33.57 ms ◑