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