tx · notHVVbmeACEefPovHpjq4NSGrWhiFrdjEDnyPtUcsH

3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb:  -0.00500000 Waves

2023.03.16 23:23 [2493055] smart account 3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb > SELF 0.00000000 Waves

{ "type": 13, "id": "notHVVbmeACEefPovHpjq4NSGrWhiFrdjEDnyPtUcsH", "fee": 500000, "feeAssetId": null, "timestamp": 1678998231254, "version": 2, "chainId": 84, "sender": "3MrQ4g9YCsAN2Wr4QUXiWAPhNPv7DGdQNWb", "senderPublicKey": "2VQGRNRWyFAZvjDtkgZwdZcTwZvBJJ61n8zJfYYxm5eK", "proofs": [ "yEyFVDfCuQB39djf7XP5kr3EqXgduL8KdekmUK8J7ZJK2yxpgJEE9EutGLW9VPKeNvm9wwaU8Wj26fkXPiqKyrY" ], "script": "base64:BgJCCAISBAoCGBgSBQoDCBgYEgQKAggIEgQKAggIEgQKAggIEgUKAwgICBIDCgECEgUKAwgICBIECgIICBIGCgQIAQEBCgAOY29sbGVjdGlvbk5hbWUJARFAZXh0ck5hdGl2ZSgxMDU4KQECDmNvbGxlY3Rpb25OYW1lAAZzeW1ib2wJARFAZXh0ck5hdGl2ZSgxMDU4KQECBnN5bWJvbAALZGVzY3JpcHRpb24JARFAZXh0ck5hdGl2ZSgxMDU4KQECC2Rlc2NyaXB0aW9uAAt0b3RhbEFtb3VudAkBEUBleHRyTmF0aXZlKDEwNTUpAQILdG90YWxBbW91bnQACGRBcHBKc29uCQEHQWRkcmVzcwEJANkEAQIjM01yR2FaVlJoa25FR2ZISjE5dHRVUE5uRFJvRnFjSGhWTjcADHRva2VuUGF5bWVudAkBB0FkZHJlc3MBCQERQGV4dHJOYXRpdmUoMTA1NykBAgx0b2tlblBheW1lbnQBDG9ubHlJbnRlcm5hbAEGY2FsbGVyAwkAAAIFBmNhbGxlcgUEdGhpcwUEdW5pdAkAAgECEk9ubHkgaW50ZXJuYWwgY2Fsb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"succeeded", "spentComplexity": 0 } View: original | compacted Prev: 833svTK6QrFXkgpew1W9GSaGaWvDWuBumXPmJmfKhpY8 Next: F4LiBoc19nHNMB9PhjqYtc6ghtHEJmNAPi79omz8v2ee Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let jsonRes = "jsonRes"
4+let collectionName = getStringValue("collectionName")
55
6-let quote = toUtf8String(base58'b')
6+let symbol = getStringValue("symbol")
77
8-func makeField (nextValue) = (((((((quote + nextValue._1) + quote) + ":") + quote) + nextValue._2) + quote) + ",")
8+let description = getStringValue("description")
99
10+let totalAmount = getIntegerValue("totalAmount")
1011
11-func reducerMakeJSON (accum,nextValue) = (accum + makeField(nextValue))
12+let dAppJson = Address(fromBase58String("3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7"))
1213
13-
14-func iterateMakeJSON (params,res,length) = if ((length == 0))
15- then throw("Empty params")
16- else if ((length == 1))
17- then {
18- let $l = params
19- let $s = size($l)
20- let $acc0 = res
21- func $f0_1 ($a,$i) = if (($i >= $s))
22- then $a
23- else reducerMakeJSON($a, $l[$i])
24-
25- func $f0_2 ($a,$i) = if (($i >= $s))
26- then $a
27- else throw("List size exceeds 1")
28-
29- $f0_2($f0_1($acc0, 0), 1)
30- }
31- else if ((length == 2))
32- then {
33- let $l = params
34- let $s = size($l)
35- let $acc0 = res
36- func $f0_1 ($a,$i) = if (($i >= $s))
37- then $a
38- else reducerMakeJSON($a, $l[$i])
39-
40- func $f0_2 ($a,$i) = if (($i >= $s))
41- then $a
42- else throw("List size exceeds 2")
43-
44- $f0_2($f0_1($f0_1($acc0, 0), 1), 2)
45- }
46- else if ((length == 3))
47- then {
48- let $l = params
49- let $s = size($l)
50- let $acc0 = res
51- func $f0_1 ($a,$i) = if (($i >= $s))
52- then $a
53- else reducerMakeJSON($a, $l[$i])
54-
55- func $f0_2 ($a,$i) = if (($i >= $s))
56- then $a
57- else throw("List size exceeds 3")
58-
59- $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
60- }
61- else if ((length == 4))
62- then {
63- let $l = params
64- let $s = size($l)
65- let $acc0 = res
66- func $f0_1 ($a,$i) = if (($i >= $s))
67- then $a
68- else reducerMakeJSON($a, $l[$i])
69-
70- func $f0_2 ($a,$i) = if (($i >= $s))
71- then $a
72- else throw("List size exceeds 4")
73-
74- $f0_2($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4)
75- }
76- else if ((length == 5))
77- then {
78- let $l = params
79- let $s = size($l)
80- let $acc0 = res
81- func $f0_1 ($a,$i) = if (($i >= $s))
82- then $a
83- else reducerMakeJSON($a, $l[$i])
84-
85- func $f0_2 ($a,$i) = if (($i >= $s))
86- then $a
87- else throw("List size exceeds 5")
88-
89- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
90- }
91- else if ((length == 6))
92- then {
93- let $l = params
94- let $s = size($l)
95- let $acc0 = res
96- func $f0_1 ($a,$i) = if (($i >= $s))
97- then $a
98- else reducerMakeJSON($a, $l[$i])
99-
100- func $f0_2 ($a,$i) = if (($i >= $s))
101- then $a
102- else throw("List size exceeds 6")
103-
104- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
105- }
106- else if ((length == 7))
107- then {
108- let $l = params
109- let $s = size($l)
110- let $acc0 = res
111- func $f0_1 ($a,$i) = if (($i >= $s))
112- then $a
113- else reducerMakeJSON($a, $l[$i])
114-
115- func $f0_2 ($a,$i) = if (($i >= $s))
116- then $a
117- else throw("List size exceeds 7")
118-
119- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7)
120- }
121- else if ((length == 8))
122- then {
123- let $l = params
124- let $s = size($l)
125- let $acc0 = res
126- func $f0_1 ($a,$i) = if (($i >= $s))
127- then $a
128- else reducerMakeJSON($a, $l[$i])
129-
130- func $f0_2 ($a,$i) = if (($i >= $s))
131- then $a
132- else throw("List size exceeds 8")
133-
134- $f0_2($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)
135- }
136- else if ((length == 9))
137- then {
138- let $l = params
139- let $s = size($l)
140- let $acc0 = res
141- func $f0_1 ($a,$i) = if (($i >= $s))
142- then $a
143- else reducerMakeJSON($a, $l[$i])
144-
145- func $f0_2 ($a,$i) = if (($i >= $s))
146- then $a
147- else throw("List size exceeds 9")
148-
149- $f0_2($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)
150- }
151- else if ((length == 10))
152- then {
153- let $l = params
154- let $s = size($l)
155- let $acc0 = res
156- func $f0_1 ($a,$i) = if (($i >= $s))
157- then $a
158- else reducerMakeJSON($a, $l[$i])
159-
160- func $f0_2 ($a,$i) = if (($i >= $s))
161- then $a
162- else throw("List size exceeds 10")
163-
164- $f0_2($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)
165- }
166- else throw("The max number of parameters exceeded")
167-
168-
169-func getPartAndTail (arr) = {
170- let el0 = arr[0]
171- let el1 = arr[1]
172- let el2 = arr[2]
173- let el3 = arr[3]
174- let el4 = arr[4]
175- let el5 = arr[5]
176- let el6 = arr[6]
177- let el7 = arr[7]
178- let el8 = arr[8]
179- let el9 = arr[9]
180- let arr0 = removeByIndex(arr, 0)
181- let arr1 = removeByIndex(arr0, 0)
182- let arr2 = removeByIndex(arr1, 0)
183- let arr3 = removeByIndex(arr2, 0)
184- let arr4 = removeByIndex(arr3, 0)
185- let arr5 = removeByIndex(arr4, 0)
186- let arr6 = removeByIndex(arr5, 0)
187- let arr7 = removeByIndex(arr6, 0)
188- let arr8 = removeByIndex(arr7, 0)
189- let arr9 = removeByIndex(arr8, 0)
190- $Tuple2([el0, el1, el2, el3, el4, el5, el6, el7, el8, el9], arr9)
191- }
192-
14+let tokenPayment = Address(getBinaryValue("tokenPayment"))
19315
19416 func onlyInternal (caller) = if ((caller == this))
19517 then unit
19618 else throw("Only internal call")
19719
19820
199-func prepare_1 (arr,arr2) = [$Tuple2(arr[0], arr2[0])]
21+func transferOrNot (to,assetId) = if ((to == this))
22+ then StringEntry("костыль", "костыль")
23+ else ScriptTransfer(to, 1, assetId)
20024
20125
202-func prepare_2 (arr,arr2) = [$Tuple2(arr[0], arr2[0]), $Tuple2(arr[1], arr2[1])]
26+func parseIdtoAsset (assetId) = valueOrErrorMessage(assetInfo(fromBase58String(assetId)), "Can't find asset by asset id")
20327
20428
205-func prepare_3 (arr,arr2) = [$Tuple2(arr[0], arr2[0]), $Tuple2(arr[1], arr2[1]), $Tuple2(arr[2], arr2[2])]
206-
207-
208-func prepare_4 (arr,arr2) = [$Tuple2(arr[0], arr2[0]), $Tuple2(arr[1], arr2[1]), $Tuple2(arr[2], arr2[2]), $Tuple2(arr[3], arr2[3])]
209-
210-
211-func prepare_5 (arr,arr2) = [$Tuple2(arr[0], arr2[0]), $Tuple2(arr[1], arr2[1]), $Tuple2(arr[2], arr2[2]), $Tuple2(arr[3], arr2[3]), $Tuple2(arr[4], arr2[4])]
212-
213-
214-func prepare_6 (arr,arr2) = [$Tuple2(arr[0], arr2[0]), $Tuple2(arr[1], arr2[1]), $Tuple2(arr[2], arr2[2]), $Tuple2(arr[3], arr2[3]), $Tuple2(arr[4], arr2[4]), $Tuple2(arr[5], arr2[5])]
215-
216-
217-func prepare_7 (arr,arr2) = [$Tuple2(arr[0], arr2[0]), $Tuple2(arr[1], arr2[1]), $Tuple2(arr[2], arr2[2]), $Tuple2(arr[3], arr2[3]), $Tuple2(arr[4], arr2[4]), $Tuple2(arr[5], arr2[5]), $Tuple2(arr[6], arr2[6])]
218-
219-
220-func prepare_8 (arr,arr2) = [$Tuple2(arr[0], arr2[0]), $Tuple2(arr[1], arr2[1]), $Tuple2(arr[2], arr2[2]), $Tuple2(arr[3], arr2[3]), $Tuple2(arr[4], arr2[4]), $Tuple2(arr[5], arr2[5]), $Tuple2(arr[6], arr2[6]), $Tuple2(arr[7], arr2[7])]
221-
222-
223-func prepare_9 (arr,arr2) = [$Tuple2(arr[0], arr2[0]), $Tuple2(arr[1], arr2[1]), $Tuple2(arr[2], arr2[2]), $Tuple2(arr[3], arr2[3]), $Tuple2(arr[4], arr2[4]), $Tuple2(arr[5], arr2[5]), $Tuple2(arr[6], arr2[6]), $Tuple2(arr[7], arr2[7]), $Tuple2(arr[8], arr2[8])]
224-
225-
226-func prepare_10 (arr,arr2) = [$Tuple2(arr[0], arr2[0]), $Tuple2(arr[1], arr2[1]), $Tuple2(arr[2], arr2[2]), $Tuple2(arr[3], arr2[3]), $Tuple2(arr[4], arr2[4]), $Tuple2(arr[5], arr2[5]), $Tuple2(arr[6], arr2[6]), $Tuple2(arr[7], arr2[7]), $Tuple2(arr[8], arr2[8]), $Tuple2(arr[9], arr2[9])]
227-
228-
229-func prepareParams (currentArrPartKeys,currentArrPartValues,length) = if ((length == 0))
230- then throw("Empty params")
231- else if ((length == 1))
232- then prepare_1(currentArrPartKeys, currentArrPartValues)
233- else if ((length == 2))
234- then prepare_2(currentArrPartKeys, currentArrPartValues)
235- else if ((length == 3))
236- then prepare_3(currentArrPartKeys, currentArrPartValues)
237- else if ((length == 4))
238- then prepare_4(currentArrPartKeys, currentArrPartValues)
239- else if ((length == 5))
240- then prepare_5(currentArrPartKeys, currentArrPartValues)
241- else if ((length == 6))
242- then prepare_6(currentArrPartKeys, currentArrPartValues)
243- else if ((length == 7))
244- then prepare_7(currentArrPartKeys, currentArrPartValues)
245- else if ((length == 8))
246- then prepare_8(currentArrPartKeys, currentArrPartValues)
247- else if ((length == 9))
248- then prepare_9(currentArrPartKeys, currentArrPartValues)
249- else if ((length == 10))
250- then prepare_10(currentArrPartKeys, currentArrPartValues)
251- else throw("Max number of parameters exceeded")
252-
253-
254-func getStartAndEndIndexes (json,key) = {
255- let keyLen = size(key)
256- let startIndex = value(indexOf(json, key))
257- let endIndex = valueOrElse(indexOf(json, ",", startIndex), value(indexOf(json, "}", startIndex)))
258- $Tuple3(keyLen, startIndex, endIndex)
259- }
260-
261-
262-func readByKeyInternal (json,key) = {
263- let $t064226538 = getStartAndEndIndexes(json, key)
264- let keyLen = $t064226538._1
265- let startIndex = $t064226538._2
266- let endIndex = $t064226538._3
267- drop(take(json, (endIndex - 1)), ((startIndex + keyLen) + 3))
268- }
269-
270-
271-func deleteByKeyInternal (json,key) = {
272- let $t068196946 = getStartAndEndIndexes(json, key)
273- let keyLen = $t068196946._1
274- let startIndex = $t068196946._2
275- let endIndex = $t068196946._3
276- let deletedValue = drop(take(json, (endIndex - 1)), ((startIndex + keyLen) + 3))
277- let newJson = if (((size(json) - endIndex) == 1))
278- then (take(json, (startIndex - 2)) + drop(json, endIndex))
279- else (take(json, (startIndex - 1)) + drop(json, (endIndex + 1)))
280- $Tuple2(deletedValue, newJson)
281- }
29+func checkAssetOwner (caller,assetId) = if ((assetBalance(caller, fromBase58String(assetId)) == 1))
30+ then unit
31+ else throw("Only asset owner")
28232
28333
28434 @Callable(i)
285-func makeJSONInternal (arrKeys,arrValues,iterationsCount,lastIterationLen,res) = valueOrElse(onlyInternal(i.caller), if ((iterationsCount > 0))
286- then {
287- let $t080728237 = getPartAndTail(arrKeys)
288- let currentArrPartKeys = $t080728237._1
289- let arrTailKeys = $t080728237._2
290- let $t082468364 = getPartAndTail(arrValues)
291- let currentArrPartValues = $t082468364._1
292- let arrTailValues = $t082468364._2
293- let params = prepareParams(currentArrPartKeys, currentArrPartValues, 10)
294- let newString = iterateMakeJSON(params, res, 10)
295- let result = invoke(this, "makeJSONInternal", [arrTailKeys, arrTailValues, (iterationsCount - 1), lastIterationLen, newString], nil)
296- if ((result == result))
297- then $Tuple2(nil, result)
298- else throw("Strict value is not equal to itself.")
299- }
300- else if ((lastIterationLen != 0))
301- then {
302- let params = prepareParams(arrKeys, arrValues, lastIterationLen)
303- let newString = iterateMakeJSON(params, res, lastIterationLen)
304- $Tuple2(nil, (("{" + dropRight(newString, 1)) + "}"))
305- }
306- else $Tuple2(nil, (("{" + dropRight(res, 1)) + "}")))
35+func makeJSONInternal (arrKeys,arrValues) = valueOrElse(onlyInternal(i.caller), {
36+ let res = invoke(dAppJson, "makeJSON", [arrKeys, arrValues], nil)
37+ if ((res == res))
38+ then $Tuple2(nil, res)
39+ else throw("Strict value is not equal to itself.")
40+ })
30741
30842
30943
31044 @Callable(i)
311-func makeJSON (arrKeys,arrValues) = if ((size(arrKeys) != size(arrValues)))
312- then throw("ArrayKeys and ArrayValues length must be equal")
313- else {
314- let len = size(arrKeys)
315- let iterationsCount = fraction(1, len, 10)
316- let lastIterationLen = (len % 10)
317- let res = invoke(this, "makeJSONInternal", [arrKeys, arrValues, iterationsCount, lastIterationLen, ""], nil)
318- if ((res == res))
319- then $Tuple2(nil, res)
320- else throw("Strict value is not equal to itself.")
321- }
45+func addToJSONInternal (json,arrKeys,arrValues) = valueOrElse(onlyInternal(i.caller), {
46+ let res = invoke(dAppJson, "addToJSON", [json, arrKeys, arrValues], nil)
47+ if ((res == res))
48+ then $Tuple2(nil, res)
49+ else throw("Strict value is not equal to itself.")
50+ })
32251
32352
32453
32554 @Callable(i)
326-func addToJSON (oldJson,arrKeys,arrValues) = if ((size(arrKeys) != size(arrValues)))
327- then throw("ArrayKeys and ArrayValues length must be equal")
328- else {
329- let len = size(arrKeys)
330- let iterationsCount = fraction(1, len, 10)
331- let lastIterationLen = (len % 10)
332- let res = invoke(this, "makeJSONInternal", [arrKeys, arrValues, iterationsCount, lastIterationLen, (drop(dropRight(oldJson, 1), 1) + ",")], nil)
333- if ((res == res))
334- then $Tuple2(nil, res)
335- else throw("Strict value is not equal to itself.")
336- }
55+func readByJSONKeyInternal (json,key) = valueOrElse(onlyInternal(i.caller), {
56+ let res = invoke(dAppJson, "readByJSONKey", [json, key], nil)
57+ if ((res == res))
58+ then $Tuple2(nil, res)
59+ else throw("Strict value is not equal to itself.")
60+ })
33761
33862
33963
34064 @Callable(i)
341-func readByJSONKey (json,key) = {
342- let valueByKey = readByKeyInternal(json, key)
343- $Tuple2(nil, valueByKey)
65+func deleteByJSONKeyInternal (json,key) = valueOrElse(onlyInternal(i.caller), {
66+ let res = invoke(dAppJson, "deleteByJSONKey", [json, key], nil)
67+ if ((res == res))
68+ then $Tuple2(nil, res)
69+ else throw("Strict value is not equal to itself.")
70+ })
71+
72+
73+
74+@Callable(i)
75+func storageJsonInternal (jsonKey,jsonString) = valueOrElse(onlyInternal(i.caller), [StringEntry(jsonKey, jsonString)])
76+
77+
78+
79+@Callable(i)
80+func setUser (assetId,user,expires) = {
81+ let res = invoke(dAppJson, "makeJSON", [["user", "expires"], [user, expires]], nil)
82+ if ((res == res))
83+ then $Tuple2([StringEntry(("userOf-" + assetId), {
84+ let @ = res
85+ if ($isInstanceOf(@, "String"))
86+ then @
87+ else throw(($getType(@) + " couldn't be cast to String"))
88+ })], res)
89+ else throw("Strict value is not equal to itself.")
34490 }
34591
34692
34793
34894 @Callable(i)
349-func deleteByJSONKey (json,key) = {
350- let $t01286512998 = deleteByKeyInternal(json, key)
351- let deletedValueByKey = $t01286512998._1
352- let newJson = $t01286512998._2
353- $Tuple2(nil, $Tuple2(deletedValueByKey, newJson))
354- }
95+func setTokenPayment (assetId) = valueOrElse(onlyInternal(i.caller), [BinaryEntry("tokenPayment", assetId)])
96+
97+
98+
99+@Callable(i)
100+func init (collectionName,symbol,description) = valueOrElse(onlyInternal(i.caller), [StringEntry("collectionName", collectionName), StringEntry("symbol", symbol), StringEntry("description", description), IntegerEntry("totalAmount", 0)])
101+
102+
103+
104+@Callable(i)
105+func mint (to,tokenURI) = valueOrElse(onlyInternal(i.caller), {
106+ let tokenId = (totalAmount + 1)
107+ let preName = ((symbol + "#") + toString(tokenId))
108+ let name = if ((16 >= size(preName)))
109+ then preName
110+ else toString(tokenId)
111+ let asset = Issue(name, (("{uri:\"" + tokenURI) + "\"}"), 1, 0, false, unit, height)
112+ let assetId = calculateAssetId(asset)
113+ let toAddress = Address(fromBase58String(to))
114+ let transfer = transferOrNot(toAddress, assetId)
115+ if ((transfer == transfer))
116+ then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)]
117+ else throw("Strict value is not equal to itself.")
118+ })
119+
120+
121+
122+@Callable(i)
123+func initLend (assetId,timeUnitSeconds,timeUnitPrice,timeUnitCount) = valueOrElse(checkAssetOwner(i.caller, assetId), {
124+ let asset = parseIdtoAsset(assetId)
125+ let tokenUri = asset.description
126+ let lends = getStringValue("Lends")
127+ let read = invoke(dAppJson, "readByJSONKey", [lends, "count"], nil)
128+ let lendId = {
129+ let @ = read
130+ if ($isInstanceOf(@, "String"))
131+ then @
132+ else throw(($getType(@) + " couldn't be cast to String"))
133+ }
134+ let newCount = toString((parseIntValue(lendId) + 1))
135+ let make = invoke(dAppJson, "makeJSON", [["supportedInterface", "assetdId", "tokenUri", "owner", "timeUnitSeconds", "timeUnitPrice", "timeUnitCount", "startTimestamp", "endTimestamp", "deposit", "claimed", "rents"], ["0", assetId, tokenUri, toString(i.caller), toString(timeUnitSeconds), toString(timeUnitPrice), toString(timeUnitCount), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (timeUnitSeconds * timeUnitCount))), "0", "0", "{\"count\":\"0\"}"]], nil)
136+ if ((make == make))
137+ then {
138+ let insert = invoke(dAppJson, "addToJSON", [[lendId, "count"], [{
139+ let @ = make
140+ if ($isInstanceOf(@, "String"))
141+ then @
142+ else throw(($getType(@) + " couldn't be cast to String"))
143+ }, newCount]], nil)
144+ if ((insert == insert))
145+ then [StringEntry("Lends", {
146+ let @ = insert
147+ if ($isInstanceOf(@, "String"))
148+ then @
149+ else throw(($getType(@) + " couldn't be cast to String"))
150+ })]
151+ else throw("Strict value is not equal to itself.")
152+ }
153+ else throw("Strict value is not equal to itself.")
154+ })
355155
356156

github/deemru/w8io/169f3d6 
47.18 ms