tx · 4HcKbwHerwF6HA3rsE78oVSLUPBQ6m77mdpgWv7Sc4Ya 3MvrXJVzDMDcshazxn88FybxHV2JvWQBxTc: -0.01200000 Waves 2022.10.15 11:30 [2273218] smart account 3MvrXJVzDMDcshazxn88FybxHV2JvWQBxTc > SELF 0.00000000 Waves
{ "type": 13, "id": "4HcKbwHerwF6HA3rsE78oVSLUPBQ6m77mdpgWv7Sc4Ya", "fee": 1200000, "feeAssetId": null, "timestamp": 1665822626072, "version": 2, "chainId": 84, "sender": "3MvrXJVzDMDcshazxn88FybxHV2JvWQBxTc", "senderPublicKey": "Fq8P5ctrS7PNTX37bWWxvnwoB7C2FaNySZWnRmgPUaDH", "proofs": [ "3yxPonyNvfsNoEfgydzhL3vJFM1zA9nSYgZmLnUCs4Ardts1RzTyM2s7hEFP7vC2XiHLfSXsU3CK2va1dE5WmYy7" ], "script": "base64:AAIFAAAAAAAAAEEIAhIDCgEBEgMKAQgSAwoBCBIDCgEIEgMKAQgSAwoBCBIDCgEIEgQKAggIEgMKAQgSAwoBCBIFCgMICAESAwoBCAAAACgBAAAAEGdldFN0cmluZ09yVGhyb3cAAAACAAAAB2FkZHJlc3MAAAADa2V5CQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQdAAAAAgUAAAAHYWRkcmVzcwUAAAADa2V5CQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAxDYW4ndCByZWFkICcFAAAAA2tleQIAAAANJyBhdCBhZGRyZXNzIAkABCUAAAABBQAAAAdhZGRyZXNzAQAAABFnZXRJbnRlZ2VyT3JUaHJvdwAAAAIAAAAHYWRkcmVzcwAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABBoAAAACBQAAAAdhZGRyZXNzBQAAAANrZXkJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAADENhbid0IHJlYWQgJwUAAAADa2V5AgAAAA0nIGF0IGFkZHJlc3MgCQAEJQAAAAEFAAAAB2FkZHJ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AAAByRtYXRjaDAJAAAAAAAAAggFAAAABXRva2VuAAAACHF1YW50aXR5AAAAAAAAAAABBwMDBQAAAAxpc1Rva2VuT3duZXIJAQAAAAEhAAAAAQUAAAANaXNUb2tlbkV4aXN0cwcEAAAADWlzc3VlTmV3VG9rZW4JAQAAAA9faXNzdWVOYW1lVG9rZW4AAAABBQAAAARuYW1lBAAAAApuZXdUb2tlbklkCQAEOAAAAAEJAAGRAAAAAgUAAAANaXNzdWVOZXdUb2tlbgAAAAAAAAAAAAQAAAALbmV3VG9rZW5TdHIJAAJYAAAAAQUAAAAKbmV3VG9rZW5JZAQAAAAXcmVzdG9yZU5hbWVXaXRoTmV3VG9rZW4JAQAAABVfcmVzdG9yZU5hbWVXaXRoVG9rZW4AAAACBQAAAARuYW1lBQAAAAtuZXdUb2tlblN0cgQAAAAXdHJhbnNmZXJOZXdUb2tlblRvT3duZXIJAQAAABVfdHJhbnNmZXJUb2tlblRvT3duZXIAAAACBQAAAAtuZXdUb2tlblN0cgUAAAAPbmV3T3duZXJBZGRyZXNzCQAETgAAAAIJAAROAAAAAgUAAAANaXNzdWVOZXdUb2tlbgUAAAAXcmVzdG9yZU5hbWVXaXRoTmV3VG9rZW4FAAAAF3RyYW5zZmVyTmV3VG9rZW5Ub093bmVyAwMFAAAADGlzVG9rZW5Pd25lcgUAAAAIaGFzVG9rZW4HCQAAAgAAAAECAAAAHFlvdSBhbHJlYWR5IG93biBhIG5hbWUgdG9rZW4DCQEAAAABIQAAAAEFAAAACGhhc1Rva2VuCQAAAgAAAAECAAAAG1lvdSBkb24ndCBoYXZlIGEgbmFtZSB0b2tlbgkBAAAACV9zZXRPd25lcgAAAAIFAAAABG5hbWUFAAAAD25ld093bmVyQWRkcmVzcwAAAACP78eD", "height": 2273218, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CtLvok2QfLh1TUBRBbvxEobx52uviprNERr3FcoH6cXE Next: 2Tos2KTP37vdukdQFH3wQRau7AVXikiZcb4pxxGFbALc Diff:
Old | New | Differences | |
---|---|---|---|
227 | 227 | ||
228 | 228 | ||
229 | 229 | @Callable(inv) | |
230 | - | func resolver (name) = $Tuple2(nil, _getResolver( | |
230 | + | func resolver (name) = $Tuple2(nil, _getResolver(name)) | |
231 | 231 | ||
232 | 232 | ||
233 | 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_Token_name (tokenId) = key_entity("Token", tokenId, "name") | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func key_Name_token (name) = key_entity("Name", name, "token") | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func key_Name_owner (name) = key_entity("Name", name, "owner") | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func key_Name_resolver (name) = key_entity("Name", name, "resolver") | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func key_Name_expiresAt (name) = key_entity("Name", name, "expiresAt") | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func key_Name_createdAt (name) = key_entity("Name", name, "createdAt") | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | let key_nameTTL = "nameTTL" | |
35 | 35 | ||
36 | 36 | let key_controllers = "controllers" | |
37 | 37 | ||
38 | 38 | func _setOwner (name,owner) = [StringEntry(key_Name_owner(name), owner)] | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func _getOwner (name) = getString(this, key_Name_owner(name)) | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func _setResolver (name,resolver) = [StringEntry(key_Name_resolver(name), resolver)] | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func _getResolver (name) = getString(this, key_Name_resolver(name)) | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func _getToken (name) = getString(this, key_Name_token(name)) | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | func _getCreatedAt (name) = getInteger(this, key_Name_createdAt(name)) | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func _getExpiresAt (name) = getInteger(this, key_Name_expiresAt(name)) | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func _getControllers () = getString(this, key_controllers) | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | let controllers = match _getControllers() { | |
63 | 63 | case repr: String => | |
64 | 64 | split(repr, ",") | |
65 | 65 | case _ => | |
66 | 66 | nil | |
67 | 67 | } | |
68 | 68 | ||
69 | 69 | let nameTTL = getIntegerOrThrow(this, key_nameTTL) | |
70 | 70 | ||
71 | 71 | func isRegisteredName (name) = isDefined(getString(this, key_Name_token(name))) | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func isCreatedName (name) = isDefined(_getCreatedAt(name)) | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func isExpiredName (name) = match _getExpiresAt(name) { | |
78 | 78 | case expiresAt: Int => | |
79 | 79 | (lastBlock.timestamp > expiresAt) | |
80 | 80 | case _ => | |
81 | 81 | false | |
82 | 82 | } | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func isActiveName (name) = if (if (isRegisteredName(name)) | |
86 | 86 | then isCreatedName(name) | |
87 | 87 | else false) | |
88 | 88 | then !(isExpiredName(name)) | |
89 | 89 | else false | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func isAvailableName (name) = { | |
93 | 93 | let symbols = "abcdefghijklmnopqrstuvwxyz1234567890-" | |
94 | 94 | func validateChars (isValid,char) = if (isValid) | |
95 | 95 | then contains(symbols, char) | |
96 | 96 | else false | |
97 | 97 | ||
98 | 98 | let isValidName = if (if (if (if (if ((size(name) > 0)) | |
99 | 99 | then (63 >= size(name)) | |
100 | 100 | else false) | |
101 | 101 | then (indexOf(name, "--") != 2) | |
102 | 102 | else false) | |
103 | 103 | then (indexOf(name, "-") != 0) | |
104 | 104 | else false) | |
105 | 105 | then (lastIndexOf(name, "-") != (size(name) - 1)) | |
106 | 106 | else false) | |
107 | 107 | then { | |
108 | 108 | let $l = split(name, "") | |
109 | 109 | let $s = size($l) | |
110 | 110 | let $acc0 = true | |
111 | 111 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
112 | 112 | then $a | |
113 | 113 | else validateChars($a, $l[$i]) | |
114 | 114 | ||
115 | 115 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
116 | 116 | then $a | |
117 | 117 | else throw("List size exceeds 63") | |
118 | 118 | ||
119 | 119 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($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), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63) | |
120 | 120 | } | |
121 | 121 | else false | |
122 | 122 | let inUse = if (isRegisteredName(name)) | |
123 | 123 | then !(isExpiredName(name)) | |
124 | 124 | else false | |
125 | 125 | if (!(inUse)) | |
126 | 126 | then isValidName | |
127 | 127 | else false | |
128 | 128 | } | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | func isAdmin (inv) = (inv.caller == this) | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | func isOwner (inv,name) = (toString(inv.caller) == valueOrElse(_getOwner(name), "")) | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func isController (address) = containsElement(controllers, address) | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | func _splitLastLabel (name) = { | |
141 | 141 | let labels = split(name, ".") | |
142 | 142 | let lastIndex = (size(labels) - 1) | |
143 | 143 | let lastLabel = labels[lastIndex] | |
144 | 144 | let restLabels = makeString(removeByIndex(labels, lastIndex), ".") | |
145 | 145 | $Tuple2(lastLabel, restLabels) | |
146 | 146 | } | |
147 | 147 | ||
148 | 148 | ||
149 | 149 | func _issueNameToken (name) = [Issue(if ((size(name) > 16)) | |
150 | 150 | then (take(name, 15) + "~") | |
151 | 151 | else take(name, 16), (name + ".waves"), 1, 0, false)] | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | func _registerNameWithToken (name,tokenId,createdAt) = [StringEntry(key_Name_token(name), tokenId), StringEntry(key_Token_name(tokenId), name), IntegerEntry(key_Name_createdAt(name), createdAt), IntegerEntry(key_Name_expiresAt(name), (createdAt + nameTTL))] | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | func _restoreNameWithToken (name,tokenId) = [StringEntry(key_Name_token(name), tokenId), StringEntry(key_Token_name(tokenId), name)] | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | func _transferTokenToOwner (tokenId,owner) = [ScriptTransfer(parseAddressOrThrow(owner), 1, fromBase58String(tokenId))] | |
161 | 161 | ||
162 | 162 | ||
163 | 163 | func modifiers (validations) = unit | |
164 | 164 | ||
165 | 165 | ||
166 | 166 | func onlyAdmin (inv) = if (isAdmin(inv)) | |
167 | 167 | then unit | |
168 | 168 | else throw("Permission denied") | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func onlyController (inv) = if (if (isAdmin(inv)) | |
172 | 172 | then true | |
173 | 173 | else isController(toString(inv.caller))) | |
174 | 174 | then unit | |
175 | 175 | else throw("Permission denied") | |
176 | 176 | ||
177 | 177 | ||
178 | 178 | func onlyOwner (inv,name) = if (if (isAdmin(inv)) | |
179 | 179 | then true | |
180 | 180 | else isOwner(inv, name)) | |
181 | 181 | then unit | |
182 | 182 | else throw("Permission denied") | |
183 | 183 | ||
184 | 184 | ||
185 | 185 | func validAddress (address) = if (isDefined(addressFromString(address))) | |
186 | 186 | then unit | |
187 | 187 | else throw("The address must be valid") | |
188 | 188 | ||
189 | 189 | ||
190 | 190 | @Callable(inv) | |
191 | 191 | func init (nameTTL) = valueOrElse(modifiers([onlyAdmin(inv), if ((nameTTL > 0)) | |
192 | 192 | then unit | |
193 | 193 | else throw("TTL cannot be negative")]), [IntegerEntry(key_nameTTL, nameTTL)]) | |
194 | 194 | ||
195 | 195 | ||
196 | 196 | ||
197 | 197 | @Callable(inv) | |
198 | 198 | func supportsInterface (interfaceId) = $Tuple2(nil, containsElement(["owner", "resolver", "nameCreated", "nameExpires"], interfaceId)) | |
199 | 199 | ||
200 | 200 | ||
201 | 201 | ||
202 | 202 | @Callable(inv) | |
203 | 203 | func addController (address) = valueOrElse(modifiers([onlyAdmin(inv), validAddress(address), if (!(isController(address))) | |
204 | 204 | then unit | |
205 | 205 | else throw((("Controller `" + address) + "` is already registered"))]), [StringEntry(key_controllers, makeString((controllers :+ address), ","))]) | |
206 | 206 | ||
207 | 207 | ||
208 | 208 | ||
209 | 209 | @Callable(inv) | |
210 | 210 | func removeController (address) = valueOrElse(modifiers([onlyAdmin(inv), validAddress(address), if (isController(address)) | |
211 | 211 | then unit | |
212 | 212 | else throw((("Controller `" + address) + "` is not registered"))]), { | |
213 | 213 | let controllerIndex = value(indexOf(controllers, address)) | |
214 | 214 | [StringEntry(key_controllers, makeString(removeByIndex(controllers, controllerIndex), ","))] | |
215 | 215 | }) | |
216 | 216 | ||
217 | 217 | ||
218 | 218 | ||
219 | 219 | @Callable(inv) | |
220 | 220 | func available (name) = $Tuple2(nil, isAvailableName(name)) | |
221 | 221 | ||
222 | 222 | ||
223 | 223 | ||
224 | 224 | @Callable(inv) | |
225 | 225 | func owner (name) = $Tuple2(nil, _getOwner(_splitLastLabel(name)._1)) | |
226 | 226 | ||
227 | 227 | ||
228 | 228 | ||
229 | 229 | @Callable(inv) | |
230 | - | func resolver (name) = $Tuple2(nil, _getResolver( | |
230 | + | func resolver (name) = $Tuple2(nil, _getResolver(name)) | |
231 | 231 | ||
232 | 232 | ||
233 | 233 | ||
234 | 234 | @Callable(inv) | |
235 | 235 | func setResolver (name,resolver) = valueOrElse(modifiers([if (isActiveName(name)) | |
236 | 236 | then unit | |
237 | 237 | else throw("Name expired or not registered"), onlyOwner(inv, name), if (isDefined(addressFromString(resolver))) | |
238 | 238 | then unit | |
239 | 239 | else throw("Resolver must be a valid contract address")]), $Tuple2(nil, _setResolver(name, resolver))) | |
240 | 240 | ||
241 | 241 | ||
242 | 242 | ||
243 | 243 | @Callable(inv) | |
244 | 244 | func nameCreated (name) = $Tuple2(nil, _getCreatedAt(_splitLastLabel(name)._1)) | |
245 | 245 | ||
246 | 246 | ||
247 | 247 | ||
248 | 248 | @Callable(inv) | |
249 | 249 | func nameExpires (name) = $Tuple2(nil, _getExpiresAt(_splitLastLabel(name)._1)) | |
250 | 250 | ||
251 | 251 | ||
252 | 252 | ||
253 | 253 | @Callable(inv) | |
254 | 254 | func register (name,owner,createdAt) = valueOrElse(modifiers([onlyController(inv), if (isAvailableName(name)) | |
255 | 255 | then unit | |
256 | 256 | else throw((("`" + name) + "` cannot be registered")), validAddress(owner), if ((createdAt > 0)) | |
257 | 257 | then unit | |
258 | 258 | else throw("CreatedAt cannot be negative"), if ((lastBlock.timestamp >= createdAt)) | |
259 | 259 | then unit | |
260 | 260 | else throw("CreatedAt cannot be in the future")]), { | |
261 | 261 | let issueNameToken = _issueNameToken(name) | |
262 | 262 | let tokenId = calculateAssetId(issueNameToken[0]) | |
263 | 263 | let tokenStr = toBase58String(tokenId) | |
264 | 264 | let registerNameWithToken = _registerNameWithToken(name, tokenStr, createdAt) | |
265 | 265 | let transferTokenToOwner = _transferTokenToOwner(tokenStr, owner) | |
266 | 266 | let setOwnership = _setOwner(name, owner) | |
267 | 267 | (((issueNameToken ++ registerNameWithToken) ++ transferTokenToOwner) ++ setOwnership) | |
268 | 268 | }) | |
269 | 269 | ||
270 | 270 | ||
271 | 271 | ||
272 | 272 | @Callable(inv) | |
273 | 273 | func reclaim (name) = valueOrElse(modifiers([if (isActiveName(name)) | |
274 | 274 | then unit | |
275 | 275 | else throw((("`" + name) + "` is not active"))]), { | |
276 | 276 | let newOwner = inv.caller | |
277 | 277 | let newOwnerAddress = toString(newOwner) | |
278 | 278 | let tokenStr = valueOrErrorMessage(_getToken(name), (("No token is issued for `" + name) + "`")) | |
279 | 279 | let tokenId = fromBase58String(tokenStr) | |
280 | 280 | let hasToken = (assetBalance(newOwner, tokenId) == 1) | |
281 | 281 | let isTokenOwner = isOwner(inv, name) | |
282 | 282 | let isTokenExists = match assetInfo(tokenId) { | |
283 | 283 | case token: Asset => | |
284 | 284 | (token.quantity == 1) | |
285 | 285 | case _ => | |
286 | 286 | false | |
287 | 287 | } | |
288 | 288 | if (if (isTokenOwner) | |
289 | 289 | then !(isTokenExists) | |
290 | 290 | else false) | |
291 | 291 | then { | |
292 | 292 | let issueNewToken = _issueNameToken(name) | |
293 | 293 | let newTokenId = calculateAssetId(issueNewToken[0]) | |
294 | 294 | let newTokenStr = toBase58String(newTokenId) | |
295 | 295 | let restoreNameWithNewToken = _restoreNameWithToken(name, newTokenStr) | |
296 | 296 | let transferNewTokenToOwner = _transferTokenToOwner(newTokenStr, newOwnerAddress) | |
297 | 297 | ((issueNewToken ++ restoreNameWithNewToken) ++ transferNewTokenToOwner) | |
298 | 298 | } | |
299 | 299 | else if (if (isTokenOwner) | |
300 | 300 | then hasToken | |
301 | 301 | else false) | |
302 | 302 | then throw("You already own a name token") | |
303 | 303 | else if (!(hasToken)) | |
304 | 304 | then throw("You don't have a name token") | |
305 | 305 | else _setOwner(name, newOwnerAddress) | |
306 | 306 | }) | |
307 | 307 | ||
308 | 308 |
github/deemru/w8io/026f985 46.60 ms ◑