tx · BYtyTALN5L4TbLreTVuw4wpwNRCh9Jz8eCLTT7tToNJa 3MrF6QFGLaSKfoNPMd8L3u7KYNm7cE43Ydw: -0.00600000 Waves 2022.10.09 19:37 [2265040] smart account 3MrF6QFGLaSKfoNPMd8L3u7KYNm7cE43Ydw > SELF 0.00000000 Waves
{ "type": 13, "id": "BYtyTALN5L4TbLreTVuw4wpwNRCh9Jz8eCLTT7tToNJa", "fee": 600000, "feeAssetId": null, "timestamp": 1665333478321, "version": 2, "chainId": 84, "sender": "3MrF6QFGLaSKfoNPMd8L3u7KYNm7cE43Ydw", "senderPublicKey": "6NSakbUsm1WyESQ8yj3qpc1kQUfHWNd5C6CHVpbs4X7c", "proofs": [ "5ipHWnwJYn5ewbeaUnEZzpe4yMrw4A6rP8EJdqmbfj4jDGNAG6m7eWvuf6X1XtMzWEXpQVFY8C3sxju4JfLjvZB4" ], "script": "base64:AAIFAAAAAAAAABEIAhIDCgEIEgMKAQgSAwoBCAAAAAkBAAAAEGdldFN0cmluZ09yVGhyb3cAAAACAAAAB2FkZHJlc3MAAAADa2V5CQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQdAAAAAgUAAAAHYWRkcmVzcwUAAAADa2V5CQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAxDYW4ndCByZWFkICcFAAAAA2tleQIAAAANJyBhdCBhZGRyZXNzIAkABCUAAAABBQAAAAdhZGRyZXNzAQAAABNwYXJzZUFkZHJlc3NPclRocm93AAAAAQAAAAxtYXliZUFkZHJlc3MJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABCYAAAABBQAAAAxtYXliZUFkZHJlc3MJAAEsAAAAAgkAASwAAAACAgAAABpDYW4ndCBwYXJzZSBhZGRyZXNzIGZyb20gJwUAAAAMbWF5YmVBZGRyZXNzAgAAAAEnAAAAAAxrZXlfcmVnaXN0cnkCAAAACHJlZ2lzdHJ5AAAAAAhyZWdpc3RyeQkBAAAAE3BhcnNlQW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ckbWF0Y2gwAgAAACIoU3RyaW5nLCBTdHJpbmcsIEludCwgSW50LCBTdHJpbmcpBwQAAAAKcmVnaXN0cmFudAgFAAAAByRtYXRjaDAAAAACXzEEAAAACXJlc29sdmVyXwgFAAAAByRtYXRjaDAAAAACXzIEAAAAC25hbWVDcmVhdGVkCAUAAAAHJG1hdGNoMAAAAAJfMwQAAAALbmFtZUV4cGlyZXMIBQAAAAckbWF0Y2gwAAAAAl80BAAAAAZzdGF0dXMIBQAAAAckbWF0Y2gwAAAAAl81CQAFFwAAAAUFAAAACnJlZ2lzdHJhbnQFAAAACXJlc29sdmVyXwUAAAALbmFtZUNyZWF0ZWQFAAAAC25hbWVFeHBpcmVzBQAAAAZzdGF0dXMFAAAABHVuaXQAAAAAPhNtNw==", "height": 2265040, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5xLu7GNtupcgoiKdovcPZ4eXmvpS5MBkPdr3bWFb3oLM Next: BUHtPL4tZ2UWSHGuCutBE5MX58q25rTBdnx1H9bZcaPu Diff:
Old | New | Differences | |
---|---|---|---|
22 | 22 | else throw("Permission denied") | |
23 | 23 | ||
24 | 24 | ||
25 | - | func _addr (label) = match invoke(registry, "owner", [label], nil) { | |
26 | - | case owner: String => | |
27 | - | owner | |
28 | - | case _ => | |
29 | - | unit | |
30 | - | } | |
25 | + | func _splitLastLabel (name) = { | |
26 | + | let labels = split(name, ".") | |
27 | + | let lastIndex = (size(labels) - 1) | |
28 | + | let lastLabel = labels[lastIndex] | |
29 | + | let restLabels = makeString(removeByIndex(labels, lastIndex), ".") | |
30 | + | $Tuple2(lastLabel, restLabels) | |
31 | + | } | |
32 | + | ||
33 | + | ||
34 | + | func _findResolver (name) = { | |
35 | + | let $t013121363 = _splitLastLabel(name) | |
36 | + | let lastLabel = $t013121363._1 | |
37 | + | let restLabels = $t013121363._2 | |
38 | + | match invoke(registry, "resolver", [lastLabel], nil) { | |
39 | + | case resolverAddress: String => | |
40 | + | $Tuple2(addressFromString(resolverAddress), restLabels) | |
41 | + | case _ => | |
42 | + | $Tuple2(unit, name) | |
43 | + | } | |
44 | + | } | |
31 | 45 | ||
32 | 46 | ||
33 | 47 | @Callable(inv) | |
36 | 50 | ||
37 | 51 | ||
38 | 52 | @Callable(inv) | |
39 | - | func addr (label) = $Tuple2(nil, _addr(label)) | |
40 | - | ||
41 | - | ||
42 | - | ||
43 | - | @Callable(inv) | |
44 | - | func resolve (name) = { | |
45 | - | let labels = if ((size(name) == 0)) | |
46 | - | then throw("Name cannot be empty") | |
47 | - | else split(name, ".") | |
48 | - | let lastLabel = labels[(size(labels) - 1)] | |
49 | - | $Tuple2(nil, _addr(lastLabel)) | |
50 | - | } | |
53 | + | func resolve (name) = valueOrElse(modifiers([if ((size(name) > 0)) | |
54 | + | then unit | |
55 | + | else throw("Name cannot be empty")]), { | |
56 | + | let $t019291977 = _findResolver(name) | |
57 | + | let resolver = $t019291977._1 | |
58 | + | let restLabels = $t019291977._2 | |
59 | + | if (if (!(isDefined(resolver))) | |
60 | + | then true | |
61 | + | else (size(restLabels) == 0)) | |
62 | + | then $Tuple2(nil, unit) | |
63 | + | else $Tuple2(nil, match invoke(value(resolver), "resolve", [value(restLabels)], nil) { | |
64 | + | case callbackData: String => | |
65 | + | callbackData | |
66 | + | case _ => | |
67 | + | unit | |
68 | + | }) | |
69 | + | }) | |
51 | 70 | ||
52 | 71 | ||
53 | 72 | ||
55 | 74 | func whoIs (name) = valueOrElse(modifiers([if ((size(name) > 0)) | |
56 | 75 | then unit | |
57 | 76 | else throw("Name cannot be empty")]), { | |
58 | - | let labels = split(name, ".") | |
59 | - | let lastLabel = labels[(size(labels) - 1)] | |
60 | - | let registrant = match invoke(registry, "owner", [lastLabel], nil) { | |
77 | + | let $t024982546 = _findResolver(name) | |
78 | + | let resolver = $t024982546._1 | |
79 | + | let restLabels = $t024982546._2 | |
80 | + | let lastLabel = _splitLastLabel(name)._1 | |
81 | + | let levelZeroRegistrant = match invoke(registry, "owner", [lastLabel], nil) { | |
61 | 82 | case owner: String => | |
62 | 83 | owner | |
63 | 84 | case _ => | |
64 | 85 | unit | |
65 | 86 | } | |
66 | - | let resolver = unit | |
67 | - | let nameCreated = match invoke(registry, "nameCreated", [lastLabel], nil) { | |
68 | - | case createdAt: Int => | |
69 | - | createdAt | |
70 | - | case _ => | |
71 | - | unit | |
72 | - | } | |
73 | - | let nameExpires = match invoke(registry, "nameExpires", [lastLabel], nil) { | |
74 | - | case expiresAt: Int => | |
75 | - | expiresAt | |
76 | - | case _ => | |
77 | - | unit | |
78 | - | } | |
79 | - | let nameStatus = match invoke(registry, "nameStatus", [lastLabel], nil) { | |
80 | - | case status: String => | |
81 | - | status | |
82 | - | case _ => | |
83 | - | unit | |
84 | - | } | |
85 | - | $Tuple2(nil, $Tuple5(registrant, resolver, nameCreated, nameExpires, nameStatus)) | |
87 | + | let levelZeroStatus = if (isDefined(levelZeroRegistrant)) | |
88 | + | then "ACTIVE" | |
89 | + | else "NOT_REGISTERED" | |
90 | + | if (if (!(isDefined(resolver))) | |
91 | + | then true | |
92 | + | else (size(restLabels) == 0)) | |
93 | + | then $Tuple2(nil, $Tuple5(levelZeroRegistrant, resolver, unit, unit, levelZeroStatus)) | |
94 | + | else $Tuple2(nil, match invoke(value(resolver), "whoIs", [value(restLabels)], nil) { | |
95 | + | case _ => | |
96 | + | if (if (if (if ($isInstanceOf($match0._1, "String")) | |
97 | + | then true | |
98 | + | else $isInstanceOf($match0._1, "Unit")) | |
99 | + | then if (if ($isInstanceOf($match0._2, "String")) | |
100 | + | then true | |
101 | + | else $isInstanceOf($match0._2, "Unit")) | |
102 | + | then if (if ($isInstanceOf($match0._3, "Int")) | |
103 | + | then true | |
104 | + | else $isInstanceOf($match0._3, "Unit")) | |
105 | + | then if (if ($isInstanceOf($match0._4, "Int")) | |
106 | + | then true | |
107 | + | else $isInstanceOf($match0._4, "Unit")) | |
108 | + | then if ($isInstanceOf($match0._5, "String")) | |
109 | + | then true | |
110 | + | else $isInstanceOf($match0._5, "Unit") | |
111 | + | else false | |
112 | + | else false | |
113 | + | else false | |
114 | + | else false) | |
115 | + | then if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if ($isInstanceOf($match0, "(Unit, Unit, Unit, Unit, Unit)")) | |
116 | + | then true | |
117 | + | else $isInstanceOf($match0, "(Unit, Unit, Unit, Unit, String)")) | |
118 | + | then true | |
119 | + | else $isInstanceOf($match0, "(Unit, Unit, Unit, Int, Unit)")) | |
120 | + | then true | |
121 | + | else $isInstanceOf($match0, "(Unit, Unit, Unit, Int, String)")) | |
122 | + | then true | |
123 | + | else $isInstanceOf($match0, "(Unit, Unit, Int, Unit, Unit)")) | |
124 | + | then true | |
125 | + | else $isInstanceOf($match0, "(Unit, Unit, Int, Unit, String)")) | |
126 | + | then true | |
127 | + | else $isInstanceOf($match0, "(Unit, Unit, Int, Int, Unit)")) | |
128 | + | then true | |
129 | + | else $isInstanceOf($match0, "(Unit, Unit, Int, Int, String)")) | |
130 | + | then true | |
131 | + | else $isInstanceOf($match0, "(Unit, String, Unit, Unit, Unit)")) | |
132 | + | then true | |
133 | + | else $isInstanceOf($match0, "(Unit, String, Unit, Unit, String)")) | |
134 | + | then true | |
135 | + | else $isInstanceOf($match0, "(Unit, String, Unit, Int, Unit)")) | |
136 | + | then true | |
137 | + | else $isInstanceOf($match0, "(Unit, String, Unit, Int, String)")) | |
138 | + | then true | |
139 | + | else $isInstanceOf($match0, "(Unit, String, Int, Unit, Unit)")) | |
140 | + | then true | |
141 | + | else $isInstanceOf($match0, "(Unit, String, Int, Unit, String)")) | |
142 | + | then true | |
143 | + | else $isInstanceOf($match0, "(Unit, String, Int, Int, Unit)")) | |
144 | + | then true | |
145 | + | else $isInstanceOf($match0, "(Unit, String, Int, Int, String)")) | |
146 | + | then true | |
147 | + | else $isInstanceOf($match0, "(String, Unit, Unit, Unit, Unit)")) | |
148 | + | then true | |
149 | + | else $isInstanceOf($match0, "(String, Unit, Unit, Unit, String)")) | |
150 | + | then true | |
151 | + | else $isInstanceOf($match0, "(String, Unit, Unit, Int, Unit)")) | |
152 | + | then true | |
153 | + | else $isInstanceOf($match0, "(String, Unit, Unit, Int, String)")) | |
154 | + | then true | |
155 | + | else $isInstanceOf($match0, "(String, Unit, Int, Unit, Unit)")) | |
156 | + | then true | |
157 | + | else $isInstanceOf($match0, "(String, Unit, Int, Unit, String)")) | |
158 | + | then true | |
159 | + | else $isInstanceOf($match0, "(String, Unit, Int, Int, Unit)")) | |
160 | + | then true | |
161 | + | else $isInstanceOf($match0, "(String, Unit, Int, Int, String)")) | |
162 | + | then true | |
163 | + | else $isInstanceOf($match0, "(String, String, Unit, Unit, Unit)")) | |
164 | + | then true | |
165 | + | else $isInstanceOf($match0, "(String, String, Unit, Unit, String)")) | |
166 | + | then true | |
167 | + | else $isInstanceOf($match0, "(String, String, Unit, Int, Unit)")) | |
168 | + | then true | |
169 | + | else $isInstanceOf($match0, "(String, String, Unit, Int, String)")) | |
170 | + | then true | |
171 | + | else $isInstanceOf($match0, "(String, String, Int, Unit, Unit)")) | |
172 | + | then true | |
173 | + | else $isInstanceOf($match0, "(String, String, Int, Unit, String)")) | |
174 | + | then true | |
175 | + | else $isInstanceOf($match0, "(String, String, Int, Int, Unit)")) | |
176 | + | then true | |
177 | + | else $isInstanceOf($match0, "(String, String, Int, Int, String)") | |
178 | + | else false) | |
179 | + | then { | |
180 | + | let registrant = $match0._1 | |
181 | + | let resolver_ = $match0._2 | |
182 | + | let nameCreated = $match0._3 | |
183 | + | let nameExpires = $match0._4 | |
184 | + | let status = $match0._5 | |
185 | + | $Tuple5(registrant, resolver_, nameCreated, nameExpires, status) | |
186 | + | } | |
187 | + | else unit | |
188 | + | }) | |
86 | 189 | }) | |
87 | 190 | ||
88 | 191 |
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 parseAddressOrThrow (maybeAddress) = valueOrErrorMessage(addressFromString(maybeAddress), (("Can't parse address from '" + maybeAddress) + "'")) | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | let key_registry = "registry" | |
11 | 11 | ||
12 | 12 | let registry = parseAddressOrThrow(getStringOrThrow(this, key_registry)) | |
13 | 13 | ||
14 | 14 | func isAdmin (inv) = (inv.caller == this) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func modifiers (validations) = unit | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func onlyAdmin (inv) = if (isAdmin(inv)) | |
21 | 21 | then unit | |
22 | 22 | else throw("Permission denied") | |
23 | 23 | ||
24 | 24 | ||
25 | - | func _addr (label) = match invoke(registry, "owner", [label], nil) { | |
26 | - | case owner: String => | |
27 | - | owner | |
28 | - | case _ => | |
29 | - | unit | |
30 | - | } | |
25 | + | func _splitLastLabel (name) = { | |
26 | + | let labels = split(name, ".") | |
27 | + | let lastIndex = (size(labels) - 1) | |
28 | + | let lastLabel = labels[lastIndex] | |
29 | + | let restLabels = makeString(removeByIndex(labels, lastIndex), ".") | |
30 | + | $Tuple2(lastLabel, restLabels) | |
31 | + | } | |
32 | + | ||
33 | + | ||
34 | + | func _findResolver (name) = { | |
35 | + | let $t013121363 = _splitLastLabel(name) | |
36 | + | let lastLabel = $t013121363._1 | |
37 | + | let restLabels = $t013121363._2 | |
38 | + | match invoke(registry, "resolver", [lastLabel], nil) { | |
39 | + | case resolverAddress: String => | |
40 | + | $Tuple2(addressFromString(resolverAddress), restLabels) | |
41 | + | case _ => | |
42 | + | $Tuple2(unit, name) | |
43 | + | } | |
44 | + | } | |
31 | 45 | ||
32 | 46 | ||
33 | 47 | @Callable(inv) | |
34 | 48 | func init (registryAddress) = valueOrElse(modifiers([onlyAdmin(inv)]), [StringEntry(key_registry, registryAddress)]) | |
35 | 49 | ||
36 | 50 | ||
37 | 51 | ||
38 | 52 | @Callable(inv) | |
39 | - | func addr (label) = $Tuple2(nil, _addr(label)) | |
40 | - | ||
41 | - | ||
42 | - | ||
43 | - | @Callable(inv) | |
44 | - | func resolve (name) = { | |
45 | - | let labels = if ((size(name) == 0)) | |
46 | - | then throw("Name cannot be empty") | |
47 | - | else split(name, ".") | |
48 | - | let lastLabel = labels[(size(labels) - 1)] | |
49 | - | $Tuple2(nil, _addr(lastLabel)) | |
50 | - | } | |
53 | + | func resolve (name) = valueOrElse(modifiers([if ((size(name) > 0)) | |
54 | + | then unit | |
55 | + | else throw("Name cannot be empty")]), { | |
56 | + | let $t019291977 = _findResolver(name) | |
57 | + | let resolver = $t019291977._1 | |
58 | + | let restLabels = $t019291977._2 | |
59 | + | if (if (!(isDefined(resolver))) | |
60 | + | then true | |
61 | + | else (size(restLabels) == 0)) | |
62 | + | then $Tuple2(nil, unit) | |
63 | + | else $Tuple2(nil, match invoke(value(resolver), "resolve", [value(restLabels)], nil) { | |
64 | + | case callbackData: String => | |
65 | + | callbackData | |
66 | + | case _ => | |
67 | + | unit | |
68 | + | }) | |
69 | + | }) | |
51 | 70 | ||
52 | 71 | ||
53 | 72 | ||
54 | 73 | @Callable(inv) | |
55 | 74 | func whoIs (name) = valueOrElse(modifiers([if ((size(name) > 0)) | |
56 | 75 | then unit | |
57 | 76 | else throw("Name cannot be empty")]), { | |
58 | - | let labels = split(name, ".") | |
59 | - | let lastLabel = labels[(size(labels) - 1)] | |
60 | - | let registrant = match invoke(registry, "owner", [lastLabel], nil) { | |
77 | + | let $t024982546 = _findResolver(name) | |
78 | + | let resolver = $t024982546._1 | |
79 | + | let restLabels = $t024982546._2 | |
80 | + | let lastLabel = _splitLastLabel(name)._1 | |
81 | + | let levelZeroRegistrant = match invoke(registry, "owner", [lastLabel], nil) { | |
61 | 82 | case owner: String => | |
62 | 83 | owner | |
63 | 84 | case _ => | |
64 | 85 | unit | |
65 | 86 | } | |
66 | - | let resolver = unit | |
67 | - | let nameCreated = match invoke(registry, "nameCreated", [lastLabel], nil) { | |
68 | - | case createdAt: Int => | |
69 | - | createdAt | |
70 | - | case _ => | |
71 | - | unit | |
72 | - | } | |
73 | - | let nameExpires = match invoke(registry, "nameExpires", [lastLabel], nil) { | |
74 | - | case expiresAt: Int => | |
75 | - | expiresAt | |
76 | - | case _ => | |
77 | - | unit | |
78 | - | } | |
79 | - | let nameStatus = match invoke(registry, "nameStatus", [lastLabel], nil) { | |
80 | - | case status: String => | |
81 | - | status | |
82 | - | case _ => | |
83 | - | unit | |
84 | - | } | |
85 | - | $Tuple2(nil, $Tuple5(registrant, resolver, nameCreated, nameExpires, nameStatus)) | |
87 | + | let levelZeroStatus = if (isDefined(levelZeroRegistrant)) | |
88 | + | then "ACTIVE" | |
89 | + | else "NOT_REGISTERED" | |
90 | + | if (if (!(isDefined(resolver))) | |
91 | + | then true | |
92 | + | else (size(restLabels) == 0)) | |
93 | + | then $Tuple2(nil, $Tuple5(levelZeroRegistrant, resolver, unit, unit, levelZeroStatus)) | |
94 | + | else $Tuple2(nil, match invoke(value(resolver), "whoIs", [value(restLabels)], nil) { | |
95 | + | case _ => | |
96 | + | if (if (if (if ($isInstanceOf($match0._1, "String")) | |
97 | + | then true | |
98 | + | else $isInstanceOf($match0._1, "Unit")) | |
99 | + | then if (if ($isInstanceOf($match0._2, "String")) | |
100 | + | then true | |
101 | + | else $isInstanceOf($match0._2, "Unit")) | |
102 | + | then if (if ($isInstanceOf($match0._3, "Int")) | |
103 | + | then true | |
104 | + | else $isInstanceOf($match0._3, "Unit")) | |
105 | + | then if (if ($isInstanceOf($match0._4, "Int")) | |
106 | + | then true | |
107 | + | else $isInstanceOf($match0._4, "Unit")) | |
108 | + | then if ($isInstanceOf($match0._5, "String")) | |
109 | + | then true | |
110 | + | else $isInstanceOf($match0._5, "Unit") | |
111 | + | else false | |
112 | + | else false | |
113 | + | else false | |
114 | + | else false) | |
115 | + | then if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if (if ($isInstanceOf($match0, "(Unit, Unit, Unit, Unit, Unit)")) | |
116 | + | then true | |
117 | + | else $isInstanceOf($match0, "(Unit, Unit, Unit, Unit, String)")) | |
118 | + | then true | |
119 | + | else $isInstanceOf($match0, "(Unit, Unit, Unit, Int, Unit)")) | |
120 | + | then true | |
121 | + | else $isInstanceOf($match0, "(Unit, Unit, Unit, Int, String)")) | |
122 | + | then true | |
123 | + | else $isInstanceOf($match0, "(Unit, Unit, Int, Unit, Unit)")) | |
124 | + | then true | |
125 | + | else $isInstanceOf($match0, "(Unit, Unit, Int, Unit, String)")) | |
126 | + | then true | |
127 | + | else $isInstanceOf($match0, "(Unit, Unit, Int, Int, Unit)")) | |
128 | + | then true | |
129 | + | else $isInstanceOf($match0, "(Unit, Unit, Int, Int, String)")) | |
130 | + | then true | |
131 | + | else $isInstanceOf($match0, "(Unit, String, Unit, Unit, Unit)")) | |
132 | + | then true | |
133 | + | else $isInstanceOf($match0, "(Unit, String, Unit, Unit, String)")) | |
134 | + | then true | |
135 | + | else $isInstanceOf($match0, "(Unit, String, Unit, Int, Unit)")) | |
136 | + | then true | |
137 | + | else $isInstanceOf($match0, "(Unit, String, Unit, Int, String)")) | |
138 | + | then true | |
139 | + | else $isInstanceOf($match0, "(Unit, String, Int, Unit, Unit)")) | |
140 | + | then true | |
141 | + | else $isInstanceOf($match0, "(Unit, String, Int, Unit, String)")) | |
142 | + | then true | |
143 | + | else $isInstanceOf($match0, "(Unit, String, Int, Int, Unit)")) | |
144 | + | then true | |
145 | + | else $isInstanceOf($match0, "(Unit, String, Int, Int, String)")) | |
146 | + | then true | |
147 | + | else $isInstanceOf($match0, "(String, Unit, Unit, Unit, Unit)")) | |
148 | + | then true | |
149 | + | else $isInstanceOf($match0, "(String, Unit, Unit, Unit, String)")) | |
150 | + | then true | |
151 | + | else $isInstanceOf($match0, "(String, Unit, Unit, Int, Unit)")) | |
152 | + | then true | |
153 | + | else $isInstanceOf($match0, "(String, Unit, Unit, Int, String)")) | |
154 | + | then true | |
155 | + | else $isInstanceOf($match0, "(String, Unit, Int, Unit, Unit)")) | |
156 | + | then true | |
157 | + | else $isInstanceOf($match0, "(String, Unit, Int, Unit, String)")) | |
158 | + | then true | |
159 | + | else $isInstanceOf($match0, "(String, Unit, Int, Int, Unit)")) | |
160 | + | then true | |
161 | + | else $isInstanceOf($match0, "(String, Unit, Int, Int, String)")) | |
162 | + | then true | |
163 | + | else $isInstanceOf($match0, "(String, String, Unit, Unit, Unit)")) | |
164 | + | then true | |
165 | + | else $isInstanceOf($match0, "(String, String, Unit, Unit, String)")) | |
166 | + | then true | |
167 | + | else $isInstanceOf($match0, "(String, String, Unit, Int, Unit)")) | |
168 | + | then true | |
169 | + | else $isInstanceOf($match0, "(String, String, Unit, Int, String)")) | |
170 | + | then true | |
171 | + | else $isInstanceOf($match0, "(String, String, Int, Unit, Unit)")) | |
172 | + | then true | |
173 | + | else $isInstanceOf($match0, "(String, String, Int, Unit, String)")) | |
174 | + | then true | |
175 | + | else $isInstanceOf($match0, "(String, String, Int, Int, Unit)")) | |
176 | + | then true | |
177 | + | else $isInstanceOf($match0, "(String, String, Int, Int, String)") | |
178 | + | else false) | |
179 | + | then { | |
180 | + | let registrant = $match0._1 | |
181 | + | let resolver_ = $match0._2 | |
182 | + | let nameCreated = $match0._3 | |
183 | + | let nameExpires = $match0._4 | |
184 | + | let status = $match0._5 | |
185 | + | $Tuple5(registrant, resolver_, nameCreated, nameExpires, status) | |
186 | + | } | |
187 | + | else unit | |
188 | + | }) | |
86 | 189 | }) | |
87 | 190 | ||
88 | 191 |
github/deemru/w8io/169f3d6 41.82 ms ◑