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