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