tx · 8arh3xcfxxBAzKWsZEe3ckPLHqpmbsGk74WAYUCWpQoJ 3NA73oUXjqp7SpudXWV1yMFuKm9awPbqsVz: -0.01500000 Waves 2024.04.14 15:32 [3062453] smart account 3NA73oUXjqp7SpudXWV1yMFuKm9awPbqsVz > SELF 0.00000000 Waves
{ "type": 13, "id": "8arh3xcfxxBAzKWsZEe3ckPLHqpmbsGk74WAYUCWpQoJ", "fee": 1500000, "feeAssetId": null, "timestamp": 1713098036683, "version": 2, "chainId": 84, "sender": "3NA73oUXjqp7SpudXWV1yMFuKm9awPbqsVz", "senderPublicKey": "2mHW72YTfnxJ1M8WsdUQjgpp3a2SUbt9mbAiePGiuJok", "proofs": [ "29epifDsrzbQPBFUKZBm8FBVYL72AL6FiuUiH9KRHf3yb6cxyqnrzk2dBBcCC8pBNGvtogqrav33VgwXpgZSnXEE" ], "script": "base64:AAIFAAAAAAAAAD4IAhIDCgEBEgMKAQgSAwoBCBIDCgEIEgMKAQgSAwoBCBIFCgMICB8SBQoDCAgBEgMKAQgSAwoBCBIECgIIAQAAAC8BAAAAEWdldEludGVnZXJPclRocm93AAAAAgAAAAdhZGRyZXNzAAAAA2tleQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEGgAAAAIFAAAAB2FkZHJlc3MFAAAAA2tleQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAMQ2FuJ3QgcmVhZCAnBQAAAANrZXkCAAAADScgYXQgYWRkcmVzcyAJAAQlAAAAAQUAAAAHYWRkcmVzcwEAAAAQZ2V0U3RyaW5nT3JUaHJvdwAAAAIAAAAHYWRkcmVzcwAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAADENhbid0IHJlYWQgJwUAAAADa2V5AgAAAA0nIGF0IGFkZHJlc3MgCQAEJQAAAAEFAAAAB2FkZH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FAAAAEGN1cnJlbnRFeHBpcmVzQXQJAABoAAAAAgUAAAAFeWVhcnMFAAAAB25hbWVUVEwJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAJY29sbGVjdG9yCAUAAAADcG10AAAABmFtb3VudAgFAAAAA3BtdAAAAAdhc3NldElkBQAAAANuaWwAAAAAGEHoMQ==", "height": 3062453, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8dwEKgTphEGqTWAkYF93rRNR3oUcJQ3dWHEnpEQg1J3 Next: HUEkPdLnKsK6SPxe7xA8oidH5PVrJCBF1JngFZmG8ycz Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func getIntegerOrThrow (address,key) = valueOrErrorMessage(getInteger(address, key), ((("Can't read '" + key) + "' at address ") + toString(address))) | |
5 | + | ||
6 | + | ||
7 | + | func getStringOrThrow (address,key) = valueOrErrorMessage(getString(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 | + | ||
4 | 13 | func key_entity (name,pk,property) = ((((name + "_") + pk) + "_") + property) | |
5 | 14 | ||
6 | 15 | ||
22 | 31 | func key_Name_createdAt (name) = key_entity("Name", name, "createdAt") | |
23 | 32 | ||
24 | 33 | ||
25 | - | func key_Name_content (name) = key_entity("Name", name, "content") | |
26 | - | ||
27 | - | ||
28 | 34 | let key_nameTTL = "nameTTL" | |
29 | 35 | ||
30 | 36 | let key_controllers = "controllers" | |
37 | + | ||
38 | + | let key_renewalPrice = "renewalPrice" | |
39 | + | ||
40 | + | let key_collectorAddress = "collectorAddress" | |
31 | 41 | ||
32 | 42 | func _setOwner (name,owner) = [StringEntry(key_Name_owner(name), owner)] | |
33 | 43 | ||
47 | 57 | func _getExpiresAt (name) = getInteger(this, key_Name_expiresAt(name)) | |
48 | 58 | ||
49 | 59 | ||
50 | - | func _ | |
60 | + | func _getTokenName (tokenId) = getString(this, key_Token_name(tokenId)) | |
51 | 61 | ||
52 | 62 | ||
53 | - | func _getControllers () = getString(this, key_controllers) | |
54 | - | ||
55 | - | ||
56 | - | let controllers = match _getControllers() { | |
63 | + | let controllers = match getString(this, key_controllers) { | |
57 | 64 | case repr: String => | |
58 | 65 | split(repr, ",") | |
59 | 66 | case _ => | |
62 | 69 | ||
63 | 70 | let nameTTL = value(getInteger(this, key_nameTTL)) | |
64 | 71 | ||
72 | + | let renewalPrice = getIntegerOrThrow(this, key_renewalPrice) | |
73 | + | ||
74 | + | let collectorAddress = getStringOrThrow(this, key_collectorAddress) | |
75 | + | ||
76 | + | let collector = parseAddressOrThrow(collectorAddress) | |
77 | + | ||
65 | 78 | let isInitialized = isDefined(getInteger(this, key_nameTTL)) | |
66 | 79 | ||
67 | - | func isRegisteredName (name) = isDefined( | |
80 | + | func isRegisteredName (name) = isDefined(_getToken(name)) | |
68 | 81 | ||
69 | 82 | ||
70 | 83 | func isCreatedName (name) = isDefined(_getCreatedAt(name)) | |
195 | 208 | ||
196 | 209 | ||
197 | 210 | @Callable(inv) | |
198 | - | func supportsInterface (interfaceId) = $Tuple2(nil, containsElement(["owner", "resolver", "createdAt", "expiresAt", "tokenId", "content"], interfaceId)) | |
199 | - | ||
200 | - | ||
201 | - | ||
202 | - | @Callable(inv) | |
203 | - | func setContent (name,content) = valueOrElse(modifiers([onlyInitialized(), onlyOwner(inv, name), if (if ((size(content) == 0)) | |
204 | - | then true | |
205 | - | else if ((size(content) == 53)) | |
206 | - | then (take(content, 4) == "ipfs") | |
207 | - | else false) | |
208 | - | then unit | |
209 | - | else throw("Incorrect content string")]), { | |
210 | - | let cid = takeRight(content, 46) | |
211 | - | let checkHash = fromBase58String(cid) | |
212 | - | if ((checkHash == checkHash)) | |
213 | - | then if ((size(content) > 0)) | |
214 | - | then [StringEntry(key_Name_content(name), content)] | |
215 | - | else [DeleteEntry(key_Name_content(name))] | |
216 | - | else throw("Strict value is not equal to itself.") | |
217 | - | }) | |
218 | - | ||
219 | - | ||
220 | - | ||
221 | - | @Callable(inv) | |
222 | 211 | func addController (address) = valueOrElse(modifiers([onlyAdmin(inv), if (isValidAddress(address)) | |
223 | 212 | then unit | |
224 | 213 | else throw("Controller must be a valid address"), if (!(isController(address))) | |
248 | 237 | ||
249 | 238 | ||
250 | 239 | @Callable(inv) | |
240 | + | func isActive (name) = $Tuple2(nil, isActiveName(name)) | |
241 | + | ||
242 | + | ||
243 | + | ||
244 | + | @Callable(inv) | |
251 | 245 | func resolve (name,interfaceId,args) = { | |
252 | - | let $t075927639 = _splitLastLabel(name) | |
253 | - | let label = $t075927639._1 | |
254 | - | let restLabels = $t075927639._2 | |
255 | - | $Tuple2(nil, match interfaceId { | |
256 | - | case _ => | |
257 | - | if (("owner" == $match0)) | |
258 | - | then _getOwner(label) | |
259 | - | else if (("resolver" == $match0)) | |
260 | - | then _getResolver(label) | |
261 | - | else if (("createdAt" == $match0)) | |
262 | - | then _getCreatedAt(label) | |
263 | - | else if (("expiresAt" == $match0)) | |
264 | - | then _getExpiresAt(label) | |
265 | - | else if (("tokenId" == $match0)) | |
266 | - | then _getToken(label) | |
267 | - | else if (("content" == $match0)) | |
268 | - | then _getContent(label) | |
269 | - | else unit | |
270 | - | }) | |
246 | + | let $t074267473 = _splitLastLabel(name) | |
247 | + | let label = $t074267473._1 | |
248 | + | let restLabels = $t074267473._2 | |
249 | + | let owner = _getOwner(label) | |
250 | + | $Tuple2(nil, if ((size(restLabels) != 0)) | |
251 | + | then unit | |
252 | + | else if (containsElement(controllers, owner)) | |
253 | + | then unit | |
254 | + | else match interfaceId { | |
255 | + | case _ => | |
256 | + | if (("owner" == $match0)) | |
257 | + | then owner | |
258 | + | else if (("resolver" == $match0)) | |
259 | + | then _getResolver(label) | |
260 | + | else if (("createdAt" == $match0)) | |
261 | + | then _getCreatedAt(label) | |
262 | + | else if (("expiresAt" == $match0)) | |
263 | + | then _getExpiresAt(label) | |
264 | + | else if (("tokenId" == $match0)) | |
265 | + | then _getToken(label) | |
266 | + | else unit | |
267 | + | }) | |
271 | 268 | } | |
272 | 269 | ||
273 | 270 | ||
330 | 327 | }) | |
331 | 328 | ||
332 | 329 | ||
330 | + | ||
331 | + | @Callable(inv) | |
332 | + | func transfer (recipient) = valueOrElse(modifiers([onlyInitialized(), if (isValidAddress(recipient)) | |
333 | + | then unit | |
334 | + | else throw("Recipient must be a valid address")]), { | |
335 | + | let attachedTokenId = if ((size(inv.payments) != 1)) | |
336 | + | then throw("Only single payment required") | |
337 | + | else toBase58String(valueOrErrorMessage(inv.payments[0].assetId, "Payment must contain name token")) | |
338 | + | let attachedName = valueOrErrorMessage(_getTokenName(attachedTokenId), "Payment must contain name token") | |
339 | + | let lastRegisteredTokenId = value(_getToken(attachedName)) | |
340 | + | if (if ((attachedTokenId != lastRegisteredTokenId)) | |
341 | + | then true | |
342 | + | else !(isActiveName(attachedName))) | |
343 | + | then throw((("Ownership of `" + attachedName) + "` for this token is expired")) | |
344 | + | else (_transferTokenToOwner(attachedTokenId, recipient) ++ _setOwner(attachedName, recipient)) | |
345 | + | }) | |
346 | + | ||
347 | + | ||
348 | + | ||
349 | + | @Callable(inv) | |
350 | + | func renew (name,years) = valueOrElse(modifiers([onlyInitialized(), onlyOwner(inv, name), if (isActiveName(name)) | |
351 | + | then unit | |
352 | + | else throw((("Name '" + name) + "' is expired or it doesn't exist")), if ((years > 0)) | |
353 | + | then unit | |
354 | + | else throw("Amount of years must be positive integer number")]), { | |
355 | + | let pmt = if (if ((size(inv.payments) == 1)) | |
356 | + | then (inv.payments[0].assetId == unit) | |
357 | + | else false) | |
358 | + | then inv.payments[0] | |
359 | + | else throw("Single Waves payment required") | |
360 | + | let expectedPayment = (years * renewalPrice) | |
361 | + | if ((pmt.amount != expectedPayment)) | |
362 | + | then throw((((((((("Attached payment '" + toString(pmt.amount)) + "' is not equal to expected '") + toString(expectedPayment)) + "' for '") + toString(years)) + "' years. Diff: '") + toString((pmt.amount - expectedPayment))) + "'")) | |
363 | + | else { | |
364 | + | let currentExpiresAt = valueOrErrorMessage(_getExpiresAt(name), (("Can't read expiration data for name '" + name) + "'")) | |
365 | + | [IntegerEntry(key_Name_expiresAt(name), (currentExpiresAt + (years * nameTTL))), ScriptTransfer(collector, pmt.amount, pmt.assetId)] | |
366 | + | } | |
367 | + | }) | |
368 | + | ||
369 | + |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func getIntegerOrThrow (address,key) = valueOrErrorMessage(getInteger(address, key), ((("Can't read '" + key) + "' at address ") + toString(address))) | |
5 | + | ||
6 | + | ||
7 | + | func getStringOrThrow (address,key) = valueOrErrorMessage(getString(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 | + | ||
4 | 13 | func key_entity (name,pk,property) = ((((name + "_") + pk) + "_") + property) | |
5 | 14 | ||
6 | 15 | ||
7 | 16 | func key_Token_name (tokenId) = key_entity("Token", tokenId, "name") | |
8 | 17 | ||
9 | 18 | ||
10 | 19 | func key_Name_token (name) = key_entity("Name", name, "token") | |
11 | 20 | ||
12 | 21 | ||
13 | 22 | func key_Name_owner (name) = key_entity("Name", name, "owner") | |
14 | 23 | ||
15 | 24 | ||
16 | 25 | func key_Name_resolver (name) = key_entity("Name", name, "resolver") | |
17 | 26 | ||
18 | 27 | ||
19 | 28 | func key_Name_expiresAt (name) = key_entity("Name", name, "expiresAt") | |
20 | 29 | ||
21 | 30 | ||
22 | 31 | func key_Name_createdAt (name) = key_entity("Name", name, "createdAt") | |
23 | 32 | ||
24 | 33 | ||
25 | - | func key_Name_content (name) = key_entity("Name", name, "content") | |
26 | - | ||
27 | - | ||
28 | 34 | let key_nameTTL = "nameTTL" | |
29 | 35 | ||
30 | 36 | let key_controllers = "controllers" | |
37 | + | ||
38 | + | let key_renewalPrice = "renewalPrice" | |
39 | + | ||
40 | + | let key_collectorAddress = "collectorAddress" | |
31 | 41 | ||
32 | 42 | func _setOwner (name,owner) = [StringEntry(key_Name_owner(name), owner)] | |
33 | 43 | ||
34 | 44 | ||
35 | 45 | func _getOwner (name) = getString(this, key_Name_owner(name)) | |
36 | 46 | ||
37 | 47 | ||
38 | 48 | func _getResolver (name) = getString(this, key_Name_resolver(name)) | |
39 | 49 | ||
40 | 50 | ||
41 | 51 | func _getToken (name) = getString(this, key_Name_token(name)) | |
42 | 52 | ||
43 | 53 | ||
44 | 54 | func _getCreatedAt (name) = getInteger(this, key_Name_createdAt(name)) | |
45 | 55 | ||
46 | 56 | ||
47 | 57 | func _getExpiresAt (name) = getInteger(this, key_Name_expiresAt(name)) | |
48 | 58 | ||
49 | 59 | ||
50 | - | func _ | |
60 | + | func _getTokenName (tokenId) = getString(this, key_Token_name(tokenId)) | |
51 | 61 | ||
52 | 62 | ||
53 | - | func _getControllers () = getString(this, key_controllers) | |
54 | - | ||
55 | - | ||
56 | - | let controllers = match _getControllers() { | |
63 | + | let controllers = match getString(this, key_controllers) { | |
57 | 64 | case repr: String => | |
58 | 65 | split(repr, ",") | |
59 | 66 | case _ => | |
60 | 67 | nil | |
61 | 68 | } | |
62 | 69 | ||
63 | 70 | let nameTTL = value(getInteger(this, key_nameTTL)) | |
64 | 71 | ||
72 | + | let renewalPrice = getIntegerOrThrow(this, key_renewalPrice) | |
73 | + | ||
74 | + | let collectorAddress = getStringOrThrow(this, key_collectorAddress) | |
75 | + | ||
76 | + | let collector = parseAddressOrThrow(collectorAddress) | |
77 | + | ||
65 | 78 | let isInitialized = isDefined(getInteger(this, key_nameTTL)) | |
66 | 79 | ||
67 | - | func isRegisteredName (name) = isDefined( | |
80 | + | func isRegisteredName (name) = isDefined(_getToken(name)) | |
68 | 81 | ||
69 | 82 | ||
70 | 83 | func isCreatedName (name) = isDefined(_getCreatedAt(name)) | |
71 | 84 | ||
72 | 85 | ||
73 | 86 | func isExpiredName (name) = match _getExpiresAt(name) { | |
74 | 87 | case expiresAt: Int => | |
75 | 88 | (lastBlock.timestamp > expiresAt) | |
76 | 89 | case _ => | |
77 | 90 | false | |
78 | 91 | } | |
79 | 92 | ||
80 | 93 | ||
81 | 94 | func isActiveName (name) = if (if (isRegisteredName(name)) | |
82 | 95 | then isCreatedName(name) | |
83 | 96 | else false) | |
84 | 97 | then !(isExpiredName(name)) | |
85 | 98 | else false | |
86 | 99 | ||
87 | 100 | ||
88 | 101 | func isValidName (name) = { | |
89 | 102 | let symbols = "abcdefghijklmnopqrstuvwxyz1234567890-" | |
90 | 103 | func validateChars (isValid,char) = if (isValid) | |
91 | 104 | then contains(symbols, char) | |
92 | 105 | else false | |
93 | 106 | ||
94 | 107 | if (if (if (if (if ((size(name) > 3)) | |
95 | 108 | then (63 >= size(name)) | |
96 | 109 | else false) | |
97 | 110 | then (indexOf(name, "--") != 2) | |
98 | 111 | else false) | |
99 | 112 | then (indexOf(name, "-") != 0) | |
100 | 113 | else false) | |
101 | 114 | then (lastIndexOf(name, "-") != (size(name) - 1)) | |
102 | 115 | else false) | |
103 | 116 | then { | |
104 | 117 | let $l = split(name, "") | |
105 | 118 | let $s = size($l) | |
106 | 119 | let $acc0 = true | |
107 | 120 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
108 | 121 | then $a | |
109 | 122 | else validateChars($a, $l[$i]) | |
110 | 123 | ||
111 | 124 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
112 | 125 | then $a | |
113 | 126 | else throw("List size exceeds 63") | |
114 | 127 | ||
115 | 128 | $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) | |
116 | 129 | } | |
117 | 130 | else false | |
118 | 131 | } | |
119 | 132 | ||
120 | 133 | ||
121 | 134 | func isAvailableName (name) = if (isValidName(name)) | |
122 | 135 | then !(isActiveName(name)) | |
123 | 136 | else false | |
124 | 137 | ||
125 | 138 | ||
126 | 139 | func isValidAddress (maybeAddress) = isDefined(addressFromString(maybeAddress)) | |
127 | 140 | ||
128 | 141 | ||
129 | 142 | func isAdmin (inv) = (inv.caller == this) | |
130 | 143 | ||
131 | 144 | ||
132 | 145 | func isOwner (inv,name) = (toString(inv.originCaller) == valueOrElse(_getOwner(name), "")) | |
133 | 146 | ||
134 | 147 | ||
135 | 148 | func isController (address) = containsElement(controllers, address) | |
136 | 149 | ||
137 | 150 | ||
138 | 151 | func _splitLastLabel (name) = { | |
139 | 152 | let labels = split(name, ".") | |
140 | 153 | let lastIndex = (size(labels) - 1) | |
141 | 154 | let lastLabel = labels[lastIndex] | |
142 | 155 | let restLabels = makeString(removeByIndex(labels, lastIndex), ".") | |
143 | 156 | $Tuple2(lastLabel, restLabels) | |
144 | 157 | } | |
145 | 158 | ||
146 | 159 | ||
147 | 160 | func _issueNameToken (name) = [Issue(if ((size(name) > 16)) | |
148 | 161 | then (take(name, 15) + "~") | |
149 | 162 | else take(name, 16), (name + ".waves"), 1, 0, false)] | |
150 | 163 | ||
151 | 164 | ||
152 | 165 | 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))] | |
153 | 166 | ||
154 | 167 | ||
155 | 168 | func _restoreNameWithToken (name,tokenId) = [StringEntry(key_Name_token(name), tokenId), StringEntry(key_Token_name(tokenId), name)] | |
156 | 169 | ||
157 | 170 | ||
158 | 171 | func _transferTokenToOwner (tokenId,owner) = [ScriptTransfer(addressFromStringValue(owner), 1, fromBase58String(tokenId))] | |
159 | 172 | ||
160 | 173 | ||
161 | 174 | func modifiers (validations) = unit | |
162 | 175 | ||
163 | 176 | ||
164 | 177 | func onlyAdmin (inv) = if (isAdmin(inv)) | |
165 | 178 | then unit | |
166 | 179 | else throw("Permission denied") | |
167 | 180 | ||
168 | 181 | ||
169 | 182 | func onlyController (inv) = if (if (isAdmin(inv)) | |
170 | 183 | then true | |
171 | 184 | else isController(toString(inv.caller))) | |
172 | 185 | then unit | |
173 | 186 | else throw("Permission denied") | |
174 | 187 | ||
175 | 188 | ||
176 | 189 | func onlyOwner (inv,name) = if (if (isAdmin(inv)) | |
177 | 190 | then true | |
178 | 191 | else isOwner(inv, name)) | |
179 | 192 | then unit | |
180 | 193 | else throw("Permission denied") | |
181 | 194 | ||
182 | 195 | ||
183 | 196 | func onlyInitialized () = if (isInitialized) | |
184 | 197 | then unit | |
185 | 198 | else throw("Contract is not initialized") | |
186 | 199 | ||
187 | 200 | ||
188 | 201 | @Callable(inv) | |
189 | 202 | func init (nameTTL) = valueOrElse(modifiers([onlyAdmin(inv), if ((nameTTL > 0)) | |
190 | 203 | then unit | |
191 | 204 | else throw("TTL cannot be negative"), if (!(isInitialized)) | |
192 | 205 | then unit | |
193 | 206 | else throw("Contract has already been initialized")]), [IntegerEntry(key_nameTTL, nameTTL)]) | |
194 | 207 | ||
195 | 208 | ||
196 | 209 | ||
197 | 210 | @Callable(inv) | |
198 | - | func supportsInterface (interfaceId) = $Tuple2(nil, containsElement(["owner", "resolver", "createdAt", "expiresAt", "tokenId", "content"], interfaceId)) | |
199 | - | ||
200 | - | ||
201 | - | ||
202 | - | @Callable(inv) | |
203 | - | func setContent (name,content) = valueOrElse(modifiers([onlyInitialized(), onlyOwner(inv, name), if (if ((size(content) == 0)) | |
204 | - | then true | |
205 | - | else if ((size(content) == 53)) | |
206 | - | then (take(content, 4) == "ipfs") | |
207 | - | else false) | |
208 | - | then unit | |
209 | - | else throw("Incorrect content string")]), { | |
210 | - | let cid = takeRight(content, 46) | |
211 | - | let checkHash = fromBase58String(cid) | |
212 | - | if ((checkHash == checkHash)) | |
213 | - | then if ((size(content) > 0)) | |
214 | - | then [StringEntry(key_Name_content(name), content)] | |
215 | - | else [DeleteEntry(key_Name_content(name))] | |
216 | - | else throw("Strict value is not equal to itself.") | |
217 | - | }) | |
218 | - | ||
219 | - | ||
220 | - | ||
221 | - | @Callable(inv) | |
222 | 211 | func addController (address) = valueOrElse(modifiers([onlyAdmin(inv), if (isValidAddress(address)) | |
223 | 212 | then unit | |
224 | 213 | else throw("Controller must be a valid address"), if (!(isController(address))) | |
225 | 214 | then unit | |
226 | 215 | else throw((("Controller `" + address) + "` is already registered"))]), [StringEntry(key_controllers, makeString((controllers :+ address), ","))]) | |
227 | 216 | ||
228 | 217 | ||
229 | 218 | ||
230 | 219 | @Callable(inv) | |
231 | 220 | func removeController (address) = valueOrElse(modifiers([onlyAdmin(inv), if (isController(address)) | |
232 | 221 | then unit | |
233 | 222 | else throw((("Controller `" + address) + "` is not registered"))]), { | |
234 | 223 | let controllerIndex = value(indexOf(controllers, address)) | |
235 | 224 | [StringEntry(key_controllers, makeString(removeByIndex(controllers, controllerIndex), ","))] | |
236 | 225 | }) | |
237 | 226 | ||
238 | 227 | ||
239 | 228 | ||
240 | 229 | @Callable(inv) | |
241 | 230 | func isValid (name) = $Tuple2(nil, isValidName(name)) | |
242 | 231 | ||
243 | 232 | ||
244 | 233 | ||
245 | 234 | @Callable(inv) | |
246 | 235 | func isAvailable (name) = $Tuple2(nil, isAvailableName(name)) | |
247 | 236 | ||
248 | 237 | ||
249 | 238 | ||
250 | 239 | @Callable(inv) | |
240 | + | func isActive (name) = $Tuple2(nil, isActiveName(name)) | |
241 | + | ||
242 | + | ||
243 | + | ||
244 | + | @Callable(inv) | |
251 | 245 | func resolve (name,interfaceId,args) = { | |
252 | - | let $t075927639 = _splitLastLabel(name) | |
253 | - | let label = $t075927639._1 | |
254 | - | let restLabels = $t075927639._2 | |
255 | - | $Tuple2(nil, match interfaceId { | |
256 | - | case _ => | |
257 | - | if (("owner" == $match0)) | |
258 | - | then _getOwner(label) | |
259 | - | else if (("resolver" == $match0)) | |
260 | - | then _getResolver(label) | |
261 | - | else if (("createdAt" == $match0)) | |
262 | - | then _getCreatedAt(label) | |
263 | - | else if (("expiresAt" == $match0)) | |
264 | - | then _getExpiresAt(label) | |
265 | - | else if (("tokenId" == $match0)) | |
266 | - | then _getToken(label) | |
267 | - | else if (("content" == $match0)) | |
268 | - | then _getContent(label) | |
269 | - | else unit | |
270 | - | }) | |
246 | + | let $t074267473 = _splitLastLabel(name) | |
247 | + | let label = $t074267473._1 | |
248 | + | let restLabels = $t074267473._2 | |
249 | + | let owner = _getOwner(label) | |
250 | + | $Tuple2(nil, if ((size(restLabels) != 0)) | |
251 | + | then unit | |
252 | + | else if (containsElement(controllers, owner)) | |
253 | + | then unit | |
254 | + | else match interfaceId { | |
255 | + | case _ => | |
256 | + | if (("owner" == $match0)) | |
257 | + | then owner | |
258 | + | else if (("resolver" == $match0)) | |
259 | + | then _getResolver(label) | |
260 | + | else if (("createdAt" == $match0)) | |
261 | + | then _getCreatedAt(label) | |
262 | + | else if (("expiresAt" == $match0)) | |
263 | + | then _getExpiresAt(label) | |
264 | + | else if (("tokenId" == $match0)) | |
265 | + | then _getToken(label) | |
266 | + | else unit | |
267 | + | }) | |
271 | 268 | } | |
272 | 269 | ||
273 | 270 | ||
274 | 271 | ||
275 | 272 | @Callable(inv) | |
276 | 273 | func register (name,owner,createdAt) = valueOrElse(modifiers([onlyInitialized(), onlyController(inv), if (isAvailableName(name)) | |
277 | 274 | then unit | |
278 | 275 | else throw((("`" + name) + "` cannot be registered")), if (isValidAddress(owner)) | |
279 | 276 | then unit | |
280 | 277 | else throw("Owner must be a valid address"), if ((createdAt > 0)) | |
281 | 278 | then unit | |
282 | 279 | else throw("CreatedAt must be positive"), if ((lastBlock.timestamp >= createdAt)) | |
283 | 280 | then unit | |
284 | 281 | else throw("CreatedAt cannot be in the future")]), { | |
285 | 282 | let issueNameToken = _issueNameToken(name) | |
286 | 283 | let tokenId = calculateAssetId(issueNameToken[0]) | |
287 | 284 | let tokenStr = toBase58String(tokenId) | |
288 | 285 | let registerNameWithToken = _registerNameWithToken(name, tokenStr, createdAt) | |
289 | 286 | let transferTokenToOwner = _transferTokenToOwner(tokenStr, owner) | |
290 | 287 | let setOwnership = _setOwner(name, owner) | |
291 | 288 | (((issueNameToken ++ registerNameWithToken) ++ transferTokenToOwner) ++ setOwnership) | |
292 | 289 | }) | |
293 | 290 | ||
294 | 291 | ||
295 | 292 | ||
296 | 293 | @Callable(inv) | |
297 | 294 | func reclaim (name) = valueOrElse(modifiers([onlyInitialized(), if (isActiveName(name)) | |
298 | 295 | then unit | |
299 | 296 | else throw((("`" + name) + "` is not active"))]), { | |
300 | 297 | let newOwner = inv.originCaller | |
301 | 298 | let newOwnerAddress = toString(newOwner) | |
302 | 299 | let tokenStr = valueOrErrorMessage(_getToken(name), (("No token is issued for `" + name) + "`")) | |
303 | 300 | let tokenId = fromBase58String(tokenStr) | |
304 | 301 | let hasToken = (assetBalance(newOwner, tokenId) == 1) | |
305 | 302 | let isTokenOwner = isOwner(inv, name) | |
306 | 303 | let isTokenExists = match assetInfo(tokenId) { | |
307 | 304 | case token: Asset => | |
308 | 305 | (token.quantity == 1) | |
309 | 306 | case _ => | |
310 | 307 | false | |
311 | 308 | } | |
312 | 309 | if (if (isTokenOwner) | |
313 | 310 | then !(isTokenExists) | |
314 | 311 | else false) | |
315 | 312 | then { | |
316 | 313 | let issueNewToken = _issueNameToken(name) | |
317 | 314 | let newTokenId = calculateAssetId(issueNewToken[0]) | |
318 | 315 | let newTokenStr = toBase58String(newTokenId) | |
319 | 316 | let restoreNameWithNewToken = _restoreNameWithToken(name, newTokenStr) | |
320 | 317 | let transferNewTokenToOwner = _transferTokenToOwner(newTokenStr, newOwnerAddress) | |
321 | 318 | ((issueNewToken ++ restoreNameWithNewToken) ++ transferNewTokenToOwner) | |
322 | 319 | } | |
323 | 320 | else if (if (isTokenOwner) | |
324 | 321 | then hasToken | |
325 | 322 | else false) | |
326 | 323 | then throw("You already own a name token") | |
327 | 324 | else if (!(hasToken)) | |
328 | 325 | then throw("You don't have a name token") | |
329 | 326 | else _setOwner(name, newOwnerAddress) | |
330 | 327 | }) | |
331 | 328 | ||
332 | 329 | ||
330 | + | ||
331 | + | @Callable(inv) | |
332 | + | func transfer (recipient) = valueOrElse(modifiers([onlyInitialized(), if (isValidAddress(recipient)) | |
333 | + | then unit | |
334 | + | else throw("Recipient must be a valid address")]), { | |
335 | + | let attachedTokenId = if ((size(inv.payments) != 1)) | |
336 | + | then throw("Only single payment required") | |
337 | + | else toBase58String(valueOrErrorMessage(inv.payments[0].assetId, "Payment must contain name token")) | |
338 | + | let attachedName = valueOrErrorMessage(_getTokenName(attachedTokenId), "Payment must contain name token") | |
339 | + | let lastRegisteredTokenId = value(_getToken(attachedName)) | |
340 | + | if (if ((attachedTokenId != lastRegisteredTokenId)) | |
341 | + | then true | |
342 | + | else !(isActiveName(attachedName))) | |
343 | + | then throw((("Ownership of `" + attachedName) + "` for this token is expired")) | |
344 | + | else (_transferTokenToOwner(attachedTokenId, recipient) ++ _setOwner(attachedName, recipient)) | |
345 | + | }) | |
346 | + | ||
347 | + | ||
348 | + | ||
349 | + | @Callable(inv) | |
350 | + | func renew (name,years) = valueOrElse(modifiers([onlyInitialized(), onlyOwner(inv, name), if (isActiveName(name)) | |
351 | + | then unit | |
352 | + | else throw((("Name '" + name) + "' is expired or it doesn't exist")), if ((years > 0)) | |
353 | + | then unit | |
354 | + | else throw("Amount of years must be positive integer number")]), { | |
355 | + | let pmt = if (if ((size(inv.payments) == 1)) | |
356 | + | then (inv.payments[0].assetId == unit) | |
357 | + | else false) | |
358 | + | then inv.payments[0] | |
359 | + | else throw("Single Waves payment required") | |
360 | + | let expectedPayment = (years * renewalPrice) | |
361 | + | if ((pmt.amount != expectedPayment)) | |
362 | + | then throw((((((((("Attached payment '" + toString(pmt.amount)) + "' is not equal to expected '") + toString(expectedPayment)) + "' for '") + toString(years)) + "' years. Diff: '") + toString((pmt.amount - expectedPayment))) + "'")) | |
363 | + | else { | |
364 | + | let currentExpiresAt = valueOrErrorMessage(_getExpiresAt(name), (("Can't read expiration data for name '" + name) + "'")) | |
365 | + | [IntegerEntry(key_Name_expiresAt(name), (currentExpiresAt + (years * nameTTL))), ScriptTransfer(collector, pmt.amount, pmt.assetId)] | |
366 | + | } | |
367 | + | }) | |
368 | + | ||
369 | + |
github/deemru/w8io/169f3d6 52.33 ms ◑