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