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