tx · 2iENBcQDdDGtr3rHVfWZUoNYGF4WqLPB1xSVRjpcrsvd

3MvrXJVzDMDcshazxn88FybxHV2JvWQBxTc:  -0.01100000 Waves

2022.11.30 17:16 [2339943] smart account 3MvrXJVzDMDcshazxn88FybxHV2JvWQBxTc > SELF 0.00000000 Waves

{ "type": 13, "id": "2iENBcQDdDGtr3rHVfWZUoNYGF4WqLPB1xSVRjpcrsvd", "fee": 1100000, "feeAssetId": null, "timestamp": 1669817773500, "version": 2, "chainId": 84, "sender": "3MvrXJVzDMDcshazxn88FybxHV2JvWQBxTc", "senderPublicKey": "Fq8P5ctrS7PNTX37bWWxvnwoB7C2FaNySZWnRmgPUaDH", "proofs": [ "65a4M45kxzvcTMBpGhj854Q8VM5aV7u5rGryxcpVek55CoXQRyCpwvceLWYbEgrxfemSo7wFhcyWCap1wb7CCCs6" ], "script": "base64:AAIFAAAAAAAAAC4IAhIDCgEBEgMKAQgSAwoBCBIDCgEIEgMKAQgSBQoDCAgfEgUKAwgIARIDCgEIAAAAJQEAAAAKa2V5X2VudGl0eQAAAAMAAAAEbmFtZQAAAAJwawAAAAhwcm9wZXJ0eQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAARuYW1lAgAAAAFfBQAAAAJwawIAAAABXwUAAAAIcHJvcGVydHkBAAAADmtleV9Ub2tlbl9uYW1lAAAAAQAAAAd0b2tlbklkCQEAAAAKa2V5X2VudGl0eQAAAAMCAAAABVRva2VuBQAAAAd0b2tlbklkAgAAAARuYW1lAQAAAA5rZXlfTmFtZV90b2tlbgAAAAEAAAAEbmFtZQkBAAAACmtleV9lbnRpdHkAAAADAgAAAAROYW1lBQAAAARuYW1lAgAAAAV0b2tlbgEAAAAOa2V5X05hbWVfb3duZXIAAAABAAAABG5hbWUJAQAAAAprZXlfZW50aXR5AAAAAwIAAAAETmFtZQUAAAAEbmFtZQIAAAAFb3duZXIBAAAAEWtleV9OYW1lX3Jlc29sdmVyAAAAAQAAAARuYW1lCQ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XJBZGRyZXNzAAAAAIux30k=", "height": 2339943, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9gPhBgF8CucDsXS1nJwWsSW9W7ACDPx9VSHefMsiGpAz Next: none Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-func getStringOrThrow (address,key) = valueOrErrorMessage(getString(address, key), ((("Can't read '" + key) + "' at address ") + toString(address)))
5-
6-
7-func getIntegerOrThrow (address,key) = valueOrErrorMessage(getInteger(address, key), ((("Can't read '" + key) + "' at address ") + toString(address)))
8-
9-
10-func parseAddressOrThrow (maybeAddress) = valueOrErrorMessage(addressFromString(maybeAddress), (("Can't parse address from '" + maybeAddress) + "'"))
11-
12-
134 func key_entity (name,pk,property) = ((((name + "_") + pk) + "_") + property)
145
156
2011
2112
2213 func key_Name_owner (name) = key_entity("Name", name, "owner")
23-
24-
25-func key_Name_registrar (name) = key_entity("Name", name, "registrar")
2614
2715
2816 func key_Name_resolver (name) = key_entity("Name", name, "resolver")
4432 func _getOwner (name) = getString(this, key_Name_owner(name))
4533
4634
47-func _setRegistrar (name,registrar) = [StringEntry(key_Name_registrar(name), registrar)]
48-
49-
50-func _getRegistrar (name) = getString(this, key_Name_registrar(name))
51-
52-
53-func _setResolver (name,resolver) = [StringEntry(key_Name_resolver(name), resolver)]
54-
55-
5635 func _getResolver (name) = getString(this, key_Name_resolver(name))
5736
5837
6544 func _getExpiresAt (name) = getInteger(this, key_Name_expiresAt(name))
6645
6746
68-func _getControllers () = getString(this, key_controllers)
69-
70-
71-let controllers = match _getControllers() {
47+let controllers = match getString(this, key_controllers) {
7248 case repr: String =>
7349 split(repr, ",")
7450 case _ =>
7551 nil
7652 }
7753
78-let nameTTL = getIntegerOrThrow(this, key_nameTTL)
54+let nameTTL = value(getInteger(this, key_nameTTL))
55+
56+let isInitialized = isDefined(getInteger(this, key_nameTTL))
7957
8058 func isRegisteredName (name) = isDefined(getString(this, key_Name_token(name)))
8159
10482 then contains(symbols, char)
10583 else false
10684
107- if (if (if (if (if ((size(name) > 0))
85+ if (if (if (if (if ((size(name) > 3))
10886 then (63 >= size(name))
10987 else false)
11088 then (indexOf(name, "--") != 2)
132110
133111
134112 func isAvailableName (name) = if (isValidName(name))
135- then if (!(isRegisteredName(name)))
136- then true
137- else isExpiredName(name)
113+ then !(isActiveName(name))
138114 else false
139115
140116
144120 func isAdmin (inv) = (inv.caller == this)
145121
146122
147-func isOwner (inv,name) = (toString(inv.caller) == valueOrElse(_getOwner(name), ""))
123+func isOwner (inv,name) = (toString(inv.originCaller) == valueOrElse(_getOwner(name), ""))
148124
149125
150126 func isController (address) = containsElement(controllers, address)
170146 func _restoreNameWithToken (name,tokenId) = [StringEntry(key_Name_token(name), tokenId), StringEntry(key_Token_name(tokenId), name)]
171147
172148
173-func _transferTokenToOwner (tokenId,owner) = [ScriptTransfer(parseAddressOrThrow(owner), 1, fromBase58String(tokenId))]
149+func _transferTokenToOwner (tokenId,owner) = [ScriptTransfer(addressFromStringValue(owner), 1, fromBase58String(tokenId))]
174150
175151
176152 func modifiers (validations) = unit
188164 else throw("Permission denied")
189165
190166
191-func onlyOwner (inv,name) = if (if (isAdmin(inv))
192- then true
193- else isOwner(inv, name))
167+func onlyInitialized () = if (isInitialized)
194168 then unit
195- else throw("Permission denied")
196-
197-
198-func _callSupportedInterface (registrant,interfaceId,restLabels) = match invoke(registrant, "supportsInterface", [interfaceId], nil) {
199- case supportsInterface: Boolean =>
200- if (!(supportsInterface))
201- then unit
202- else match invoke(registrant, interfaceId, [restLabels], nil) {
203- case maybeString: String =>
204- maybeString
205- case maybeInt: Int =>
206- maybeInt
207- case _ =>
208- unit
209- }
210- case _ =>
211- unit
212-}
169+ else throw("Contract is not initialized")
213170
214171
215172 @Callable(inv)
216173 func init (nameTTL) = valueOrElse(modifiers([onlyAdmin(inv), if ((nameTTL > 0))
217174 then unit
218- else throw("TTL cannot be negative")]), [IntegerEntry(key_nameTTL, nameTTL)])
219-
220-
221-
222-@Callable(inv)
223-func supportsInterface (interfaceId) = $Tuple2(nil, containsElement(["owner", "registrar", "resolver", "nameCreated", "nameExpires"], interfaceId))
175+ else throw("TTL cannot be negative"), if (!(isInitialized))
176+ then unit
177+ else throw("Contract has already been initialized")]), [IntegerEntry(key_nameTTL, nameTTL)])
224178
225179
226180
244198
245199
246200 @Callable(inv)
247-func validate (name) = $Tuple2(nil, isValidName(name))
201+func isValid (name) = $Tuple2(nil, isValidName(name))
248202
249203
250204
251205 @Callable(inv)
252-func available (name) = $Tuple2(nil, isAvailableName(name))
206+func isAvailable (name) = $Tuple2(nil, isAvailableName(name))
253207
254208
255209
256210 @Callable(inv)
257-func owner (name) = {
258- let $t079157962 = _splitLastLabel(name)
259- let label = $t079157962._1
260- let restLabels = $t079157962._2
261- let ownerAddress = _getOwner(label)
262- let registrarAddress = _getRegistrar(label)
263- let registrar = value(addressFromString(value(registrarAddress)))
264- $Tuple2(nil, if (if ((size(restLabels) == 0))
265- then true
266- else !(isDefined(registrarAddress)))
267- then ownerAddress
268- else match _callSupportedInterface(registrar, "owner", restLabels) {
269- case maybeOwner: String =>
270- if (isValidAddress(maybeOwner))
271- then maybeOwner
272- else unit
273- case _ =>
274- unit
275- })
211+func resolve (name,interfaceId,args) = {
212+ let $t065586605 = _splitLastLabel(name)
213+ let label = $t065586605._1
214+ let restLabels = $t065586605._2
215+ let owner = _getOwner(label)
216+ $Tuple2(nil, if ((size(restLabels) != 0))
217+ then unit
218+ else if (containsElement(controllers, owner))
219+ then unit
220+ else match interfaceId {
221+ case _ =>
222+ if (("owner" == $match0))
223+ then owner
224+ else if (("resolver" == $match0))
225+ then _getResolver(label)
226+ else if (("createdAt" == $match0))
227+ then _getCreatedAt(label)
228+ else if (("expiresAt" == $match0))
229+ then _getExpiresAt(label)
230+ else if (("tokenId" == $match0))
231+ then _getToken(label)
232+ else unit
233+ })
276234 }
277235
278236
279237
280238 @Callable(inv)
281-func registrar (name) = {
282- let $t085918638 = _splitLastLabel(name)
283- let label = $t085918638._1
284- let restLabels = $t085918638._2
285- let registrarAddress = match _getRegistrar(label) {
286- case maybeRegistrar: String =>
287- if (isValidAddress(maybeRegistrar))
288- then maybeRegistrar
289- else unit
290- case _ =>
291- unit
292- }
293- let registrar = value(addressFromString(value(registrarAddress)))
294- $Tuple2(nil, if (if ((size(restLabels) == 0))
295- then true
296- else !(isDefined(registrarAddress)))
297- then registrarAddress
298- else match _callSupportedInterface(registrar, "registrar", restLabels) {
299- case maybeRegistrar: String =>
300- if (isValidAddress(maybeRegistrar))
301- then maybeRegistrar
302- else unit
303- case _ =>
304- unit
305- })
306- }
307-
308-
309-
310-@Callable(inv)
311-func setRegistrar (name,registrar) = valueOrElse(modifiers([if (isActiveName(name))
312- then unit
313- else throw("Name expired or not registered"), onlyOwner(inv, name), if (isValidAddress(registrar))
314- then unit
315- else throw("Registrar must be a valid contract address")]), _setRegistrar(name, registrar))
316-
317-
318-
319-@Callable(inv)
320-func resolver (name) = {
321- let $t097969843 = _splitLastLabel(name)
322- let label = $t097969843._1
323- let restLabels = $t097969843._2
324- let resolverAddress = _getResolver(label)
325- let registrarAddress = _getRegistrar(label)
326- let registrar = value(addressFromString(value(registrarAddress)))
327- $Tuple2(nil, if (if ((size(restLabels) == 0))
328- then true
329- else !(isDefined(registrarAddress)))
330- then resolverAddress
331- else match _callSupportedInterface(registrar, "resolver", restLabels) {
332- case maybeResolver: String =>
333- if (isValidAddress(maybeResolver))
334- then maybeResolver
335- else unit
336- case _ =>
337- unit
338- })
339- }
340-
341-
342-
343-@Callable(inv)
344-func setResolver (name,resolver) = valueOrElse(modifiers([if (isActiveName(name))
345- then unit
346- else throw("Name expired or not registered"), onlyOwner(inv, name), if (isValidAddress(resolver))
347- then unit
348- else throw("Resolver must be a valid contract address")]), _setResolver(name, resolver))
349-
350-
351-
352-@Callable(inv)
353-func nameCreated (name) = {
354- let $t01088110928 = _splitLastLabel(name)
355- let label = $t01088110928._1
356- let restLabels = $t01088110928._2
357- let nameCreated = _getCreatedAt(label)
358- let registrarAddress = _getRegistrar(label)
359- let registrar = value(addressFromString(value(registrarAddress)))
360- $Tuple2(nil, if (if ((size(restLabels) == 0))
361- then true
362- else !(isDefined(registrarAddress)))
363- then nameCreated
364- else match _callSupportedInterface(registrar, "nameCreated", restLabels) {
365- case maybeCreated: Int =>
366- if (if ((maybeCreated > 0))
367- then (lastBlock.timestamp > maybeCreated)
368- else false)
369- then maybeCreated
370- else unit
371- case _ =>
372- unit
373- })
374- }
375-
376-
377-
378-@Callable(inv)
379-func nameExpires (name) = {
380- let $t01159611643 = _splitLastLabel(name)
381- let label = $t01159611643._1
382- let restLabels = $t01159611643._2
383- let nameExpires = _getExpiresAt(label)
384- let registrarAddress = _getRegistrar(label)
385- let registrar = value(addressFromString(value(registrarAddress)))
386- $Tuple2(nil, if (if ((size(restLabels) == 0))
387- then true
388- else !(isDefined(registrarAddress)))
389- then nameExpires
390- else match _callSupportedInterface(registrar, "nameExpires", restLabels) {
391- case maybeExpires: Int =>
392- if ((maybeExpires > 0))
393- then maybeExpires
394- else unit
395- case _ =>
396- unit
397- })
398- }
399-
400-
401-
402-@Callable(inv)
403-func register (name,owner,createdAt) = valueOrElse(modifiers([onlyController(inv), if (isAvailableName(name))
239+func register (name,owner,createdAt) = valueOrElse(modifiers([onlyInitialized(), onlyController(inv), if (isAvailableName(name))
404240 then unit
405241 else throw((("`" + name) + "` cannot be registered")), if (isValidAddress(owner))
406242 then unit
407243 else throw("Owner must be a valid address"), if ((createdAt > 0))
408244 then unit
409- else throw("CreatedAt cannot be negative"), if ((lastBlock.timestamp >= createdAt))
245+ else throw("CreatedAt must be positive"), if ((lastBlock.timestamp >= createdAt))
410246 then unit
411247 else throw("CreatedAt cannot be in the future")]), {
412248 let issueNameToken = _issueNameToken(name)
421257
422258
423259 @Callable(inv)
424-func reclaim (name) = valueOrElse(modifiers([if (isActiveName(name))
260+func reclaim (name) = valueOrElse(modifiers([onlyInitialized(), if (isActiveName(name))
425261 then unit
426262 else throw((("`" + name) + "` is not active"))]), {
427- let newOwner = inv.caller
263+ let newOwner = inv.originCaller
428264 let newOwnerAddress = toString(newOwner)
429265 let tokenStr = valueOrErrorMessage(_getToken(name), (("No token is issued for `" + name) + "`"))
430266 let tokenId = fromBase58String(tokenStr)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-func getStringOrThrow (address,key) = valueOrErrorMessage(getString(address, key), ((("Can't read '" + key) + "' at address ") + toString(address)))
5-
6-
7-func getIntegerOrThrow (address,key) = valueOrErrorMessage(getInteger(address, key), ((("Can't read '" + key) + "' at address ") + toString(address)))
8-
9-
10-func parseAddressOrThrow (maybeAddress) = valueOrErrorMessage(addressFromString(maybeAddress), (("Can't parse address from '" + maybeAddress) + "'"))
11-
12-
134 func key_entity (name,pk,property) = ((((name + "_") + pk) + "_") + property)
145
156
167 func key_Token_name (tokenId) = key_entity("Token", tokenId, "name")
178
189
1910 func key_Name_token (name) = key_entity("Name", name, "token")
2011
2112
2213 func key_Name_owner (name) = key_entity("Name", name, "owner")
23-
24-
25-func key_Name_registrar (name) = key_entity("Name", name, "registrar")
2614
2715
2816 func key_Name_resolver (name) = key_entity("Name", name, "resolver")
2917
3018
3119 func key_Name_expiresAt (name) = key_entity("Name", name, "expiresAt")
3220
3321
3422 func key_Name_createdAt (name) = key_entity("Name", name, "createdAt")
3523
3624
3725 let key_nameTTL = "nameTTL"
3826
3927 let key_controllers = "controllers"
4028
4129 func _setOwner (name,owner) = [StringEntry(key_Name_owner(name), owner)]
4230
4331
4432 func _getOwner (name) = getString(this, key_Name_owner(name))
4533
4634
47-func _setRegistrar (name,registrar) = [StringEntry(key_Name_registrar(name), registrar)]
48-
49-
50-func _getRegistrar (name) = getString(this, key_Name_registrar(name))
51-
52-
53-func _setResolver (name,resolver) = [StringEntry(key_Name_resolver(name), resolver)]
54-
55-
5635 func _getResolver (name) = getString(this, key_Name_resolver(name))
5736
5837
5938 func _getToken (name) = getString(this, key_Name_token(name))
6039
6140
6241 func _getCreatedAt (name) = getInteger(this, key_Name_createdAt(name))
6342
6443
6544 func _getExpiresAt (name) = getInteger(this, key_Name_expiresAt(name))
6645
6746
68-func _getControllers () = getString(this, key_controllers)
69-
70-
71-let controllers = match _getControllers() {
47+let controllers = match getString(this, key_controllers) {
7248 case repr: String =>
7349 split(repr, ",")
7450 case _ =>
7551 nil
7652 }
7753
78-let nameTTL = getIntegerOrThrow(this, key_nameTTL)
54+let nameTTL = value(getInteger(this, key_nameTTL))
55+
56+let isInitialized = isDefined(getInteger(this, key_nameTTL))
7957
8058 func isRegisteredName (name) = isDefined(getString(this, key_Name_token(name)))
8159
8260
8361 func isCreatedName (name) = isDefined(_getCreatedAt(name))
8462
8563
8664 func isExpiredName (name) = match _getExpiresAt(name) {
8765 case expiresAt: Int =>
8866 (lastBlock.timestamp > expiresAt)
8967 case _ =>
9068 false
9169 }
9270
9371
9472 func isActiveName (name) = if (if (isRegisteredName(name))
9573 then isCreatedName(name)
9674 else false)
9775 then !(isExpiredName(name))
9876 else false
9977
10078
10179 func isValidName (name) = {
10280 let symbols = "abcdefghijklmnopqrstuvwxyz1234567890-"
10381 func validateChars (isValid,char) = if (isValid)
10482 then contains(symbols, char)
10583 else false
10684
107- if (if (if (if (if ((size(name) > 0))
85+ if (if (if (if (if ((size(name) > 3))
10886 then (63 >= size(name))
10987 else false)
11088 then (indexOf(name, "--") != 2)
11189 else false)
11290 then (indexOf(name, "-") != 0)
11391 else false)
11492 then (lastIndexOf(name, "-") != (size(name) - 1))
11593 else false)
11694 then {
11795 let $l = split(name, "")
11896 let $s = size($l)
11997 let $acc0 = true
12098 func $f0_1 ($a,$i) = if (($i >= $s))
12199 then $a
122100 else validateChars($a, $l[$i])
123101
124102 func $f0_2 ($a,$i) = if (($i >= $s))
125103 then $a
126104 else throw("List size exceeds 63")
127105
128106 $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)
129107 }
130108 else false
131109 }
132110
133111
134112 func isAvailableName (name) = if (isValidName(name))
135- then if (!(isRegisteredName(name)))
136- then true
137- else isExpiredName(name)
113+ then !(isActiveName(name))
138114 else false
139115
140116
141117 func isValidAddress (maybeAddress) = isDefined(addressFromString(maybeAddress))
142118
143119
144120 func isAdmin (inv) = (inv.caller == this)
145121
146122
147-func isOwner (inv,name) = (toString(inv.caller) == valueOrElse(_getOwner(name), ""))
123+func isOwner (inv,name) = (toString(inv.originCaller) == valueOrElse(_getOwner(name), ""))
148124
149125
150126 func isController (address) = containsElement(controllers, address)
151127
152128
153129 func _splitLastLabel (name) = {
154130 let labels = split(name, ".")
155131 let lastIndex = (size(labels) - 1)
156132 let lastLabel = labels[lastIndex]
157133 let restLabels = makeString(removeByIndex(labels, lastIndex), ".")
158134 $Tuple2(lastLabel, restLabels)
159135 }
160136
161137
162138 func _issueNameToken (name) = [Issue(if ((size(name) > 16))
163139 then (take(name, 15) + "~")
164140 else take(name, 16), (name + ".waves"), 1, 0, false)]
165141
166142
167143 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))]
168144
169145
170146 func _restoreNameWithToken (name,tokenId) = [StringEntry(key_Name_token(name), tokenId), StringEntry(key_Token_name(tokenId), name)]
171147
172148
173-func _transferTokenToOwner (tokenId,owner) = [ScriptTransfer(parseAddressOrThrow(owner), 1, fromBase58String(tokenId))]
149+func _transferTokenToOwner (tokenId,owner) = [ScriptTransfer(addressFromStringValue(owner), 1, fromBase58String(tokenId))]
174150
175151
176152 func modifiers (validations) = unit
177153
178154
179155 func onlyAdmin (inv) = if (isAdmin(inv))
180156 then unit
181157 else throw("Permission denied")
182158
183159
184160 func onlyController (inv) = if (if (isAdmin(inv))
185161 then true
186162 else isController(toString(inv.caller)))
187163 then unit
188164 else throw("Permission denied")
189165
190166
191-func onlyOwner (inv,name) = if (if (isAdmin(inv))
192- then true
193- else isOwner(inv, name))
167+func onlyInitialized () = if (isInitialized)
194168 then unit
195- else throw("Permission denied")
196-
197-
198-func _callSupportedInterface (registrant,interfaceId,restLabels) = match invoke(registrant, "supportsInterface", [interfaceId], nil) {
199- case supportsInterface: Boolean =>
200- if (!(supportsInterface))
201- then unit
202- else match invoke(registrant, interfaceId, [restLabels], nil) {
203- case maybeString: String =>
204- maybeString
205- case maybeInt: Int =>
206- maybeInt
207- case _ =>
208- unit
209- }
210- case _ =>
211- unit
212-}
169+ else throw("Contract is not initialized")
213170
214171
215172 @Callable(inv)
216173 func init (nameTTL) = valueOrElse(modifiers([onlyAdmin(inv), if ((nameTTL > 0))
217174 then unit
218- else throw("TTL cannot be negative")]), [IntegerEntry(key_nameTTL, nameTTL)])
219-
220-
221-
222-@Callable(inv)
223-func supportsInterface (interfaceId) = $Tuple2(nil, containsElement(["owner", "registrar", "resolver", "nameCreated", "nameExpires"], interfaceId))
175+ else throw("TTL cannot be negative"), if (!(isInitialized))
176+ then unit
177+ else throw("Contract has already been initialized")]), [IntegerEntry(key_nameTTL, nameTTL)])
224178
225179
226180
227181 @Callable(inv)
228182 func addController (address) = valueOrElse(modifiers([onlyAdmin(inv), if (isValidAddress(address))
229183 then unit
230184 else throw("Controller must be a valid address"), if (!(isController(address)))
231185 then unit
232186 else throw((("Controller `" + address) + "` is already registered"))]), [StringEntry(key_controllers, makeString((controllers :+ address), ","))])
233187
234188
235189
236190 @Callable(inv)
237191 func removeController (address) = valueOrElse(modifiers([onlyAdmin(inv), if (isController(address))
238192 then unit
239193 else throw((("Controller `" + address) + "` is not registered"))]), {
240194 let controllerIndex = value(indexOf(controllers, address))
241195 [StringEntry(key_controllers, makeString(removeByIndex(controllers, controllerIndex), ","))]
242196 })
243197
244198
245199
246200 @Callable(inv)
247-func validate (name) = $Tuple2(nil, isValidName(name))
201+func isValid (name) = $Tuple2(nil, isValidName(name))
248202
249203
250204
251205 @Callable(inv)
252-func available (name) = $Tuple2(nil, isAvailableName(name))
206+func isAvailable (name) = $Tuple2(nil, isAvailableName(name))
253207
254208
255209
256210 @Callable(inv)
257-func owner (name) = {
258- let $t079157962 = _splitLastLabel(name)
259- let label = $t079157962._1
260- let restLabels = $t079157962._2
261- let ownerAddress = _getOwner(label)
262- let registrarAddress = _getRegistrar(label)
263- let registrar = value(addressFromString(value(registrarAddress)))
264- $Tuple2(nil, if (if ((size(restLabels) == 0))
265- then true
266- else !(isDefined(registrarAddress)))
267- then ownerAddress
268- else match _callSupportedInterface(registrar, "owner", restLabels) {
269- case maybeOwner: String =>
270- if (isValidAddress(maybeOwner))
271- then maybeOwner
272- else unit
273- case _ =>
274- unit
275- })
211+func resolve (name,interfaceId,args) = {
212+ let $t065586605 = _splitLastLabel(name)
213+ let label = $t065586605._1
214+ let restLabels = $t065586605._2
215+ let owner = _getOwner(label)
216+ $Tuple2(nil, if ((size(restLabels) != 0))
217+ then unit
218+ else if (containsElement(controllers, owner))
219+ then unit
220+ else match interfaceId {
221+ case _ =>
222+ if (("owner" == $match0))
223+ then owner
224+ else if (("resolver" == $match0))
225+ then _getResolver(label)
226+ else if (("createdAt" == $match0))
227+ then _getCreatedAt(label)
228+ else if (("expiresAt" == $match0))
229+ then _getExpiresAt(label)
230+ else if (("tokenId" == $match0))
231+ then _getToken(label)
232+ else unit
233+ })
276234 }
277235
278236
279237
280238 @Callable(inv)
281-func registrar (name) = {
282- let $t085918638 = _splitLastLabel(name)
283- let label = $t085918638._1
284- let restLabels = $t085918638._2
285- let registrarAddress = match _getRegistrar(label) {
286- case maybeRegistrar: String =>
287- if (isValidAddress(maybeRegistrar))
288- then maybeRegistrar
289- else unit
290- case _ =>
291- unit
292- }
293- let registrar = value(addressFromString(value(registrarAddress)))
294- $Tuple2(nil, if (if ((size(restLabels) == 0))
295- then true
296- else !(isDefined(registrarAddress)))
297- then registrarAddress
298- else match _callSupportedInterface(registrar, "registrar", restLabels) {
299- case maybeRegistrar: String =>
300- if (isValidAddress(maybeRegistrar))
301- then maybeRegistrar
302- else unit
303- case _ =>
304- unit
305- })
306- }
307-
308-
309-
310-@Callable(inv)
311-func setRegistrar (name,registrar) = valueOrElse(modifiers([if (isActiveName(name))
312- then unit
313- else throw("Name expired or not registered"), onlyOwner(inv, name), if (isValidAddress(registrar))
314- then unit
315- else throw("Registrar must be a valid contract address")]), _setRegistrar(name, registrar))
316-
317-
318-
319-@Callable(inv)
320-func resolver (name) = {
321- let $t097969843 = _splitLastLabel(name)
322- let label = $t097969843._1
323- let restLabels = $t097969843._2
324- let resolverAddress = _getResolver(label)
325- let registrarAddress = _getRegistrar(label)
326- let registrar = value(addressFromString(value(registrarAddress)))
327- $Tuple2(nil, if (if ((size(restLabels) == 0))
328- then true
329- else !(isDefined(registrarAddress)))
330- then resolverAddress
331- else match _callSupportedInterface(registrar, "resolver", restLabels) {
332- case maybeResolver: String =>
333- if (isValidAddress(maybeResolver))
334- then maybeResolver
335- else unit
336- case _ =>
337- unit
338- })
339- }
340-
341-
342-
343-@Callable(inv)
344-func setResolver (name,resolver) = valueOrElse(modifiers([if (isActiveName(name))
345- then unit
346- else throw("Name expired or not registered"), onlyOwner(inv, name), if (isValidAddress(resolver))
347- then unit
348- else throw("Resolver must be a valid contract address")]), _setResolver(name, resolver))
349-
350-
351-
352-@Callable(inv)
353-func nameCreated (name) = {
354- let $t01088110928 = _splitLastLabel(name)
355- let label = $t01088110928._1
356- let restLabels = $t01088110928._2
357- let nameCreated = _getCreatedAt(label)
358- let registrarAddress = _getRegistrar(label)
359- let registrar = value(addressFromString(value(registrarAddress)))
360- $Tuple2(nil, if (if ((size(restLabels) == 0))
361- then true
362- else !(isDefined(registrarAddress)))
363- then nameCreated
364- else match _callSupportedInterface(registrar, "nameCreated", restLabels) {
365- case maybeCreated: Int =>
366- if (if ((maybeCreated > 0))
367- then (lastBlock.timestamp > maybeCreated)
368- else false)
369- then maybeCreated
370- else unit
371- case _ =>
372- unit
373- })
374- }
375-
376-
377-
378-@Callable(inv)
379-func nameExpires (name) = {
380- let $t01159611643 = _splitLastLabel(name)
381- let label = $t01159611643._1
382- let restLabels = $t01159611643._2
383- let nameExpires = _getExpiresAt(label)
384- let registrarAddress = _getRegistrar(label)
385- let registrar = value(addressFromString(value(registrarAddress)))
386- $Tuple2(nil, if (if ((size(restLabels) == 0))
387- then true
388- else !(isDefined(registrarAddress)))
389- then nameExpires
390- else match _callSupportedInterface(registrar, "nameExpires", restLabels) {
391- case maybeExpires: Int =>
392- if ((maybeExpires > 0))
393- then maybeExpires
394- else unit
395- case _ =>
396- unit
397- })
398- }
399-
400-
401-
402-@Callable(inv)
403-func register (name,owner,createdAt) = valueOrElse(modifiers([onlyController(inv), if (isAvailableName(name))
239+func register (name,owner,createdAt) = valueOrElse(modifiers([onlyInitialized(), onlyController(inv), if (isAvailableName(name))
404240 then unit
405241 else throw((("`" + name) + "` cannot be registered")), if (isValidAddress(owner))
406242 then unit
407243 else throw("Owner must be a valid address"), if ((createdAt > 0))
408244 then unit
409- else throw("CreatedAt cannot be negative"), if ((lastBlock.timestamp >= createdAt))
245+ else throw("CreatedAt must be positive"), if ((lastBlock.timestamp >= createdAt))
410246 then unit
411247 else throw("CreatedAt cannot be in the future")]), {
412248 let issueNameToken = _issueNameToken(name)
413249 let tokenId = calculateAssetId(issueNameToken[0])
414250 let tokenStr = toBase58String(tokenId)
415251 let registerNameWithToken = _registerNameWithToken(name, tokenStr, createdAt)
416252 let transferTokenToOwner = _transferTokenToOwner(tokenStr, owner)
417253 let setOwnership = _setOwner(name, owner)
418254 (((issueNameToken ++ registerNameWithToken) ++ transferTokenToOwner) ++ setOwnership)
419255 })
420256
421257
422258
423259 @Callable(inv)
424-func reclaim (name) = valueOrElse(modifiers([if (isActiveName(name))
260+func reclaim (name) = valueOrElse(modifiers([onlyInitialized(), if (isActiveName(name))
425261 then unit
426262 else throw((("`" + name) + "` is not active"))]), {
427- let newOwner = inv.caller
263+ let newOwner = inv.originCaller
428264 let newOwnerAddress = toString(newOwner)
429265 let tokenStr = valueOrErrorMessage(_getToken(name), (("No token is issued for `" + name) + "`"))
430266 let tokenId = fromBase58String(tokenStr)
431267 let hasToken = (assetBalance(newOwner, tokenId) == 1)
432268 let isTokenOwner = isOwner(inv, name)
433269 let isTokenExists = match assetInfo(tokenId) {
434270 case token: Asset =>
435271 (token.quantity == 1)
436272 case _ =>
437273 false
438274 }
439275 if (if (isTokenOwner)
440276 then !(isTokenExists)
441277 else false)
442278 then {
443279 let issueNewToken = _issueNameToken(name)
444280 let newTokenId = calculateAssetId(issueNewToken[0])
445281 let newTokenStr = toBase58String(newTokenId)
446282 let restoreNameWithNewToken = _restoreNameWithToken(name, newTokenStr)
447283 let transferNewTokenToOwner = _transferTokenToOwner(newTokenStr, newOwnerAddress)
448284 ((issueNewToken ++ restoreNameWithNewToken) ++ transferNewTokenToOwner)
449285 }
450286 else if (if (isTokenOwner)
451287 then hasToken
452288 else false)
453289 then throw("You already own a name token")
454290 else if (!(hasToken))
455291 then throw("You don't have a name token")
456292 else _setOwner(name, newOwnerAddress)
457293 })
458294
459295

github/deemru/w8io/026f985 
63.83 ms