tx · GVzumzxbxdikRJYB68uyHyN3siPN3dfYnKNS3iugUsdx 3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7: -0.01500000 Waves 2023.03.23 16:55 [2502737] smart account 3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7 > SELF 0.00000000 Waves
{ "type": 13, "id": "GVzumzxbxdikRJYB68uyHyN3siPN3dfYnKNS3iugUsdx", "fee": 1500000, "feeAssetId": null, "timestamp": 1679579788492, "version": 2, "chainId": 84, "sender": "3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7", "senderPublicKey": "CrHxACS7bWTh8cgmgqstvybmgMqR9KtDryGFt5svZhBW", "proofs": [ "5MxomS8YNx5ux5kJxuC8nC7eepho2yz3y74g9wr7Kk68jELdt2oM315vgGPkaEAHxDWcKz5hJeHFnc36jvpnGqLm" ], "script": "base64:BgJHCAISBAoCCAgSBAoCCAESAwoBCBIGCgQICAgIEgUKAwgICBIDCgECEgQKAggBEgMKAQgSBgoECAEBARIECgIBARIDCgEBEgAcAA5jb2xsZWN0aW9uTmFtZQkBEUBleHRyTmF0aXZlKDEwNTgpAQIOY29sbGVjdGlvbk5hbWUABnN5bWJvbAkBEUBleHRyTmF0aXZlKDEwNTgpAQIGc3ltYm9sAAtkZXNjcmlwdGlvbgkBEUBleHRyTmF0aXZlKDEwNTgpAQILZGVzY3JpcHRpb24AC3RvdGFsQW1vdW50CQERQGV4dHJOYXRpdmUoMTA1NSkBAgt0b3RhbEFtb3VudAAHYmFzZVVSSQkBEUBleHRyTmF0aXZlKDEwNTgpAQIHYmFzZVVSSQAIZEFwcEpzb24JAQdBZGRyZXNzAQkA2QQBAiMzTXJHYVpWUmhrbkVHZkhKMTl0dFVQTm5EUm9GcWNIaFZONwAMdG9rZW5QYXltZW50CQERQGV4dHJOYXRpdmUoMTA1NykBAgx0b2tlblBheW1lbnQAEXRva2VuUGF5bWVudEFzc2V0CQETdmFsdWVPckVycm9yTWVzc2FnZQIJAOwHAQkBE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FfMQIJAQUkZjFfMQIJAQUkZjFfMQIJAQUkZjFfMQIJAQUkZjFfMQIJAQUkZjFfMQIJAQUkZjFfMQIJAQUkZjFfMQIJAQUkZjFfMQIFBSRhY2MwAAAAAQACAAMABAAFAAYABwAIAAkACgALAAwADQAOAA8AEAARABIAEwAUABUAFgAXABgAGQAaABsAHAAdAB4AHwAgACEAIgAjACQAJQAmACcAKAApACoAKwAsAC0ALgAvADAAMQAyADMANAA1ADYANwA4ADkAOgA7ADwAPQA+AD8AQABBAEIAQwBEAEUARgBHAEgASQBKAEsATABNAE4ATwBQAFEAUgBTAFQAVQBWAFcAWABZAFoAWwBcAF0AXgBfAGAAYQBiAGMAZAUDbmlsAA8afCo=", "height": 2502737, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4V1GuHpGzqn1g4QER36Sezi1sG99Pc3YYHBHpAdKRbjF Next: EZgPb8KCpRZtm4dGCcEtvqRJknDuJZxoDL8MhrRGtWvD Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let collectionName = getStringValue("collectionName") | |
5 | 5 | ||
6 | - | let | |
6 | + | let symbol = getStringValue("symbol") | |
7 | 7 | ||
8 | - | func makeField (nextValue) = (((((((quote + nextValue._1) + quote) + ":") + quote) + nextValue._2) + quote) + ",") | |
8 | + | let description = getStringValue("description") | |
9 | + | ||
10 | + | let totalAmount = getIntegerValue("totalAmount") | |
11 | + | ||
12 | + | let baseURI = getStringValue("baseURI") | |
13 | + | ||
14 | + | let dAppJson = Address(fromBase58String("3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7")) | |
15 | + | ||
16 | + | let tokenPayment = getBinaryValue("tokenPayment") | |
17 | + | ||
18 | + | let tokenPaymentAsset = valueOrErrorMessage(assetInfo(getBinaryValue("tokenPayment")), "token payment asset doesn't connect") | |
19 | + | ||
20 | + | let lendCount = getIntegerValue("lendCount") | |
21 | + | ||
22 | + | let lendCurrentCount = getIntegerValue("lendCurrentCount") | |
23 | + | ||
24 | + | let hundredList = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""] | |
25 | + | ||
26 | + | func parseIdtoAsset (assetId) = valueOrErrorMessage(assetInfo(fromBase58String(assetId)), "Can't find asset by asset id") | |
9 | 27 | ||
10 | 28 | ||
11 | - | func reducerMakeJSON (accum,nextValue) = (accum + makeField(nextValue)) | |
29 | + | func transferOrNot (to,amount,assetId) = if ((to == this)) | |
30 | + | then StringEntry("smth", "smth") | |
31 | + | else ScriptTransfer(to, amount, assetId) | |
12 | 32 | ||
13 | 33 | ||
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") | |
34 | + | func getLendJson (lendId) = { | |
35 | + | let lendIdString = toString(lendId) | |
36 | + | getStringValue(("lend-" + lendIdString)) | |
37 | + | } | |
167 | 38 | ||
168 | 39 | ||
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) | |
40 | + | func getKey (lendJson,key) = { | |
41 | + | let timeUnitSeconds = { | |
42 | + | let @ = invoke(dAppJson, "readByJSONKey", [lendJson, key], nil) | |
43 | + | if ($isInstanceOf(@, "String")) | |
44 | + | then @ | |
45 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
46 | + | } | |
47 | + | if ((timeUnitSeconds == timeUnitSeconds)) | |
48 | + | then timeUnitSeconds | |
49 | + | else throw("Strict value is not equal to itself.") | |
191 | 50 | } | |
51 | + | ||
52 | + | ||
53 | + | func getRentCount (lendId) = { | |
54 | + | let lendIdString = toString(lendId) | |
55 | + | getIntegerValue(("lend-rentCount-" + lendIdString)) | |
56 | + | } | |
57 | + | ||
58 | + | ||
59 | + | func calcLendCost (lendId,timeUnitSeconds) = { | |
60 | + | let lendJson = getLendJson(lendId) | |
61 | + | let timeUnitPriceString = getKey(lendJson, "timeUnitPrice") | |
62 | + | if ((timeUnitPriceString == timeUnitPriceString)) | |
63 | + | then { | |
64 | + | let timeUnitPrice = parseIntValue(timeUnitPriceString) | |
65 | + | (timeUnitSeconds * timeUnitPrice) | |
66 | + | } | |
67 | + | else throw("Strict value is not equal to itself.") | |
68 | + | } | |
69 | + | ||
70 | + | ||
71 | + | func getLendCost (lendId) = valueOrElse(getInteger(("lend-cost-" + toString(lendId))), 0) | |
192 | 72 | ||
193 | 73 | ||
194 | 74 | func onlyInternal (caller) = if ((caller == this)) | |
196 | 76 | else throw("Only internal call") | |
197 | 77 | ||
198 | 78 | ||
199 | - | func prepare_1 (arr,arr2) = [$Tuple2(arr[0], arr2[0])] | |
200 | - | ||
201 | - | ||
202 | - | func prepare_2 (arr,arr2) = [$Tuple2(arr[0], arr2[0]), $Tuple2(arr[1], arr2[1])] | |
203 | - | ||
204 | - | ||
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 reducerFindObjcetByKey (accum,next) = { | |
263 | - | let $t064646786 = accum | |
264 | - | let key = $t064646786._1 | |
265 | - | let levelOn = $t064646786._2 | |
266 | - | let currentLevelOn = $t064646786._3 | |
267 | - | let startIndex = $t064646786._4 | |
268 | - | let endIndex = $t064646786._5 | |
269 | - | let currentIndex = $t064646786._6 | |
270 | - | let end = $t064646786._7 | |
271 | - | if (!(end)) | |
272 | - | then { | |
273 | - | let keyValueList = split(next, ":") | |
274 | - | let leftBraceCount = (size(split(next, "{")) - 1) | |
275 | - | let rightBraceCount = (size(split(next, "}")) - 1) | |
276 | - | let nextCurrentCount = (leftBraceCount - rightBraceCount) | |
277 | - | let $t070397239 = if (if ((levelOn == currentLevelOn)) | |
278 | - | then (keyValueList[0] == key) | |
279 | - | else false) | |
280 | - | then $Tuple2(currentIndex, true) | |
281 | - | else $Tuple2(0, false) | |
282 | - | let foundedStartIndex = $t070397239._1 | |
283 | - | let foundedStart = $t070397239._2 | |
284 | - | let $t072497445 = if (if ((levelOn == currentLevelOn)) | |
285 | - | then (keyValueList[0] == key) | |
286 | - | else false) | |
287 | - | then $Tuple2(currentIndex, true) | |
288 | - | else $Tuple2(0, false) | |
289 | - | let foundedEndIndex = $t072497445._1 | |
290 | - | let foundedEnd = $t072497445._2 | |
291 | - | $Tuple7(key, levelOn, (currentLevelOn + nextCurrentCount), if (foundedStart) | |
292 | - | then foundedStartIndex | |
293 | - | else startIndex, if (foundedEnd) | |
294 | - | then foundedEndIndex | |
295 | - | else endIndex, (currentIndex + 1), if (foundedEnd) | |
296 | - | then foundedEnd | |
297 | - | else end) | |
298 | - | } | |
79 | + | func reducerGetDeleteEntry (accum,next) = { | |
80 | + | let $t025422592 = accum | |
81 | + | let deletions = $t025422592._1 | |
82 | + | let current = $t025422592._2 | |
83 | + | let maxCount = $t025422592._3 | |
84 | + | let lendId = $t025422592._4 | |
85 | + | if ((maxCount > current)) | |
86 | + | then $Tuple4((deletions :+ DeleteEntry(((("lend-rent-" + lendId) + "-") + toString(current)))), (current + 1), maxCount, lendId) | |
299 | 87 | else accum | |
300 | 88 | } | |
301 | 89 | ||
302 | 90 | ||
303 | - | func | |
304 | - | ||
305 | - | ||
306 | - | ||
307 | - | ||
308 | - | ||
309 | - | ||
310 | - | ||
311 | - | ||
312 | - | ||
313 | - | | |
314 | - | | |
315 | - | | |
316 | - | | |
317 | - | ||
318 | - | | |
319 | - | | |
320 | - | else | |
91 | + | func reducerConcatLists (accum,next) = (accum :+ next) | |
92 | + | ||
93 | + | ||
94 | + | func reducerConcatListsString (accum,next) = (accum :+ next) | |
95 | + | ||
96 | + | ||
97 | + | func reducerListToString (accum,next) = ((accum + "-") + next) | |
98 | + | ||
99 | + | ||
100 | + | func reducerTest (accum,next) = { | |
101 | + | let $t032203270 = accum | |
102 | + | let deletions = $t032203270._1 | |
103 | + | let current = $t032203270._2 | |
104 | + | let maxCount = $t032203270._3 | |
105 | + | let lendId = $t032203270._4 | |
106 | + | if ((maxCount > current)) | |
107 | + | then $Tuple4((deletions :+ ((("lend-rent-" + lendId) + "-") + toString(current))), (current + 1), maxCount, lendId) | |
108 | + | else $Tuple4(deletions, current, maxCount, lendId) | |
321 | 109 | } | |
322 | 110 | ||
323 | 111 | ||
324 | - | func reducerTakeObject (accum,next) = { | |
325 | - | let $t083908450 = accum | |
326 | - | let result = $t083908450._1 | |
327 | - | let leftCount = $t083908450._2 | |
328 | - | let rightCount = $t083908450._3 | |
329 | - | let i = $t083908450._4 | |
330 | - | let iCount = $t083908450._5 | |
331 | - | let end = $t083908450._6 | |
332 | - | if (if (!(end)) | |
333 | - | then true | |
334 | - | else (iCount > i)) | |
335 | - | then { | |
336 | - | let $t084889245 = if (contains(next, "{")) | |
337 | - | then { | |
338 | - | let _nextLeftCount = (size(split(next, "{")) - 1) | |
339 | - | $Tuple2(_nextLeftCount, 0) | |
340 | - | } | |
341 | - | else if (contains(next, "}")) | |
342 | - | then { | |
343 | - | let _nextRightCount = (size(split(next, "}")) - 1) | |
344 | - | $Tuple2(0, _nextRightCount) | |
345 | - | } | |
346 | - | else $Tuple2(0, 0) | |
347 | - | let nextLeftCount = $t084889245._1 | |
348 | - | let nextRightCount = $t084889245._2 | |
349 | - | let curentLeftCount = (leftCount + nextLeftCount) | |
350 | - | let currentRightCount = (rightCount + nextRightCount) | |
351 | - | if ((curentLeftCount == currentRightCount)) | |
352 | - | then $Tuple6(result, curentLeftCount, currentRightCount, (i + 1), iCount, true) | |
353 | - | else $Tuple6(((result + ",") + next), curentLeftCount, currentRightCount, (i + 1), iCount, false) | |
354 | - | } | |
355 | - | else accum | |
356 | - | } | |
112 | + | func checkAssetOwner (caller,assetId) = if ((assetBalance(caller, fromBase58String(assetId)) == 1)) | |
113 | + | then unit | |
114 | + | else throw("Only asset owner") | |
357 | 115 | ||
358 | 116 | ||
359 | - | func readByKeyInternal (json,key) = { | |
360 | - | let $t097799895 = getStartAndEndIndexes(json, key) | |
361 | - | let keyLen = $t097799895._1 | |
362 | - | let startIndex = $t097799895._2 | |
363 | - | let endIndex = $t097799895._3 | |
364 | - | drop(take(json, (endIndex - 1)), ((startIndex + keyLen) + 3)) | |
365 | - | } | |
117 | + | func checkPayment (payments,amount) = if ((payments[0].amount >= amount)) | |
118 | + | then unit | |
119 | + | else throw("amount less then need") | |
366 | 120 | ||
367 | 121 | ||
368 | - | func deleteByKeyInternal (json,key) = { | |
369 | - | let $t01017610244 = getStartAndEndIndexes(json, key) | |
370 | - | let keyLen = $t01017610244._1 | |
371 | - | let startIndex = $t01017610244._2 | |
372 | - | let endIndex = $t01017610244._3 | |
373 | - | let deletedValue = drop(take(json, (endIndex - 1)), ((startIndex + keyLen) + 3)) | |
374 | - | let newJson = if (((size(json) - endIndex) == 1)) | |
375 | - | then (take(json, (startIndex - 2)) + drop(json, endIndex)) | |
376 | - | else (take(json, (startIndex - 1)) + drop(json, (endIndex + 1))) | |
377 | - | $Tuple2(deletedValue, newJson) | |
378 | - | } | |
122 | + | func checkAssetExists (assetId) = if (valueOrElse(getBoolean(assetId), false)) | |
123 | + | then throw("this token already use") | |
124 | + | else unit | |
125 | + | ||
126 | + | ||
127 | + | func checkLendOwner (caller,lendId) = if ((getKey(getLendJson(lendId), "owner") != toString(caller))) | |
128 | + | then throw("you haven't perms") | |
129 | + | else unit | |
379 | 130 | ||
380 | 131 | ||
381 | 132 | @Callable(i) | |
382 | - | func makeJSONInternal (arrKeys,arrValues,iterationsCount,lastIterationLen,res) = valueOrElse(onlyInternal(i.caller), if ((iterationsCount > 0)) | |
383 | - | then { | |
384 | - | let $t01188212047 = getPartAndTail(arrKeys) | |
385 | - | let currentArrPartKeys = $t01188212047._1 | |
386 | - | let arrTailKeys = $t01188212047._2 | |
387 | - | let $t01205612174 = getPartAndTail(arrValues) | |
388 | - | let currentArrPartValues = $t01205612174._1 | |
389 | - | let arrTailValues = $t01205612174._2 | |
390 | - | let params = prepareParams(currentArrPartKeys, currentArrPartValues, 10) | |
391 | - | let newString = iterateMakeJSON(params, res, 10) | |
392 | - | let result = invoke(this, "makeJSONInternal", [arrTailKeys, arrTailValues, (iterationsCount - 1), lastIterationLen, newString], nil) | |
393 | - | if ((result == result)) | |
394 | - | then $Tuple2(nil, result) | |
395 | - | else throw("Strict value is not equal to itself.") | |
396 | - | } | |
397 | - | else if ((lastIterationLen != 0)) | |
398 | - | then { | |
399 | - | let params = prepareParams(arrKeys, arrValues, lastIterationLen) | |
400 | - | let newString = iterateMakeJSON(params, res, lastIterationLen) | |
401 | - | $Tuple2(nil, (("{" + dropRight(newString, 1)) + "}")) | |
402 | - | } | |
403 | - | else $Tuple2(nil, (("{" + dropRight(res, 1)) + "}"))) | |
133 | + | func setString (_key,_value) = valueOrElse(onlyInternal(i.caller), [StringEntry(_key, _value)]) | |
404 | 134 | ||
405 | 135 | ||
406 | 136 | ||
407 | 137 | @Callable(i) | |
408 | - | func makeJSON (arrKeys,arrValues) = if ((size(arrKeys) != size(arrValues))) | |
409 | - | then throw("ArrayKeys and ArrayValues length must be equal") | |
410 | - | else { | |
411 | - | let len = size(arrKeys) | |
412 | - | let iterationsCount = fraction(1, len, 10) | |
413 | - | let lastIterationLen = (len % 10) | |
414 | - | let res = invoke(this, "makeJSONInternal", [arrKeys, arrValues, iterationsCount, lastIterationLen, ""], nil) | |
415 | - | if ((res == res)) | |
416 | - | then $Tuple2(nil, res) | |
417 | - | else throw("Strict value is not equal to itself.") | |
418 | - | } | |
138 | + | func setInt (_key,_value) = valueOrElse(onlyInternal(i.caller), [IntegerEntry(_key, _value)]) | |
419 | 139 | ||
420 | 140 | ||
421 | 141 | ||
422 | 142 | @Callable(i) | |
423 | - | func addToJSON (json,arrKeys,arrValues) = if ((size(arrKeys) != size(arrValues))) | |
424 | - | then throw("ArrayKeys and ArrayValues length must be equal") | |
425 | - | else { | |
426 | - | let len = size(arrKeys) | |
427 | - | let iterationsCount = fraction(1, len, 10) | |
428 | - | let lastIterationLen = (len % 10) | |
429 | - | let res = invoke(this, "makeJSONInternal", [arrKeys, arrValues, iterationsCount, lastIterationLen, (drop(dropRight(json, 1), 1) + ",")], nil) | |
430 | - | if ((res == res)) | |
431 | - | then $Tuple2(nil, res) | |
432 | - | else throw("Strict value is not equal to itself.") | |
433 | - | } | |
143 | + | func deleteEntry (_key) = valueOrElse(onlyInternal(i.caller), [DeleteEntry(_key)]) | |
434 | 144 | ||
435 | 145 | ||
436 | 146 | ||
437 | 147 | @Callable(i) | |
438 | - | func readByJSONKey (json,key) = { | |
439 | - | let valueByKey = readByKeyInternal(json, key) | |
440 | - | $Tuple2([StringEntry("valueByKey", valueByKey)], valueByKey) | |
148 | + | func init (_collectionName,_symbol,_description,_baseURI) = valueOrElse(onlyInternal(i.caller), [StringEntry("collectionName", _collectionName), StringEntry("symbol", _symbol), StringEntry("description", _description), IntegerEntry("totalAmount", 0), StringEntry("baseURI", _baseURI)]) | |
149 | + | ||
150 | + | ||
151 | + | ||
152 | + | @Callable(i) | |
153 | + | func setUser (assetId,user,expires) = { | |
154 | + | let res = invoke(dAppJson, "makeJSON", [["user", "expires"], [user, expires]], nil) | |
155 | + | if ((res == res)) | |
156 | + | then $Tuple2([StringEntry(("userOf-" + assetId), { | |
157 | + | let @ = res | |
158 | + | if ($isInstanceOf(@, "String")) | |
159 | + | then @ | |
160 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
161 | + | })], res) | |
162 | + | else throw("Strict value is not equal to itself.") | |
441 | 163 | } | |
442 | 164 | ||
443 | 165 | ||
444 | 166 | ||
445 | 167 | @Callable(i) | |
446 | - | func deleteByJSONKey (json,key) = { | |
447 | - | let $t01659016949 = deleteByKeyInternal(json, key) | |
448 | - | let deletedValueByKey = $t01659016949._1 | |
449 | - | let newJson = $t01659016949._2 | |
450 | - | $Tuple2([StringEntry("deletedValue", deletedValueByKey), StringEntry(kJsonRes, newJson)], $Tuple2(deletedValueByKey, newJson)) | |
168 | + | func setTokenPayment (assetBinary) = valueOrElse(onlyInternal(i.caller), [BinaryEntry("tokenPayment", assetBinary)]) | |
169 | + | ||
170 | + | ||
171 | + | ||
172 | + | @Callable(i) | |
173 | + | func mintTokens (to,amount) = { | |
174 | + | let reisue = Reissue(tokenPayment, amount, true) | |
175 | + | let toAddress = Address(fromBase58String(to)) | |
176 | + | let transfer = transferOrNot(toAddress, amount, tokenPayment) | |
177 | + | if ((transfer == transfer)) | |
178 | + | then [transfer, reisue] | |
179 | + | else throw("Strict value is not equal to itself.") | |
180 | + | } | |
181 | + | ||
182 | + | ||
183 | + | ||
184 | + | @Callable(i) | |
185 | + | func mintNFT (to) = { | |
186 | + | let tokenId = (totalAmount + 1) | |
187 | + | let tokenIdString = toString(tokenId) | |
188 | + | let preName = ((symbol + "#") + tokenIdString) | |
189 | + | let name = if ((16 >= size(preName))) | |
190 | + | then preName | |
191 | + | else tokenIdString | |
192 | + | let tokenURI = (baseURI + tokenIdString) | |
193 | + | let json = { | |
194 | + | let @ = invoke(dAppJson, "makeJSON", [["tokenURI"], [tokenURI]], nil) | |
195 | + | if ($isInstanceOf(@, "String")) | |
196 | + | then @ | |
197 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
198 | + | } | |
199 | + | let asset = Issue(name, json, 1, 0, false, unit, height) | |
200 | + | let assetId = calculateAssetId(asset) | |
201 | + | let toAddress = Address(fromBase58String(to)) | |
202 | + | let transfer = transferOrNot(toAddress, 1, assetId) | |
203 | + | if ((transfer == transfer)) | |
204 | + | then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)] | |
205 | + | else throw("Strict value is not equal to itself.") | |
206 | + | } | |
207 | + | ||
208 | + | ||
209 | + | ||
210 | + | @Callable(i) | |
211 | + | func initLend (assetId,timeUnitSeconds,timeUnitPrice,timeUnitCount) = valueOrElse(checkAssetOwner(i.caller, assetId), valueOrElse(checkAssetExists(assetId), { | |
212 | + | let asset = parseIdtoAsset(assetId) | |
213 | + | let tokenURI = { | |
214 | + | let @ = invoke(dAppJson, "readByJSONKey", [asset.description, "tokenURI"], nil) | |
215 | + | if ($isInstanceOf(@, "String")) | |
216 | + | then @ | |
217 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
218 | + | } | |
219 | + | if ((tokenURI == tokenURI)) | |
220 | + | then { | |
221 | + | let lendJson = { | |
222 | + | let @ = invoke(dAppJson, "makeJSON", [["supportedInterface", "assetdId", "tokenURI", "owner", "timeUnitSeconds", "timeUnitPrice", "timeUnitCount", "startTimestamp", "endTimestamp", "deposit", "claimed"], ["0", assetId, tokenURI, toString(i.caller), toString(timeUnitSeconds), toString(timeUnitPrice), toString(timeUnitCount), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (timeUnitSeconds * timeUnitCount))), "0", "0"]], nil) | |
223 | + | if ($isInstanceOf(@, "String")) | |
224 | + | then @ | |
225 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
226 | + | } | |
227 | + | if ((lendJson == lendJson)) | |
228 | + | then { | |
229 | + | let lendIdString = toString(lendCount) | |
230 | + | [IntegerEntry("lendCount", (lendCount + 1)), IntegerEntry("lendCurrentCount", (lendCurrentCount + 1)), IntegerEntry(("lend-rentCount-" + lendIdString), 0), StringEntry(("lend-" + lendIdString), lendJson), BooleanEntry(assetId, true)] | |
231 | + | } | |
232 | + | else throw("Strict value is not equal to itself.") | |
233 | + | } | |
234 | + | else throw("Strict value is not equal to itself.") | |
235 | + | })) | |
236 | + | ||
237 | + | ||
238 | + | ||
239 | + | @Callable(i) | |
240 | + | func initRent (lendId,timeUnitCount) = valueOrElse(checkPayment(i.payments, calcLendCost(lendId, timeUnitCount)), { | |
241 | + | let lendIdString = toString(lendId) | |
242 | + | let lendJson = getStringValue(("lend-" + lendIdString)) | |
243 | + | let rentId = getRentCount(lendId) | |
244 | + | let rentIdString = toString(rentId) | |
245 | + | let timeUnitSeconds = { | |
246 | + | let @ = invoke(dAppJson, "readByJSONKey", [lendJson, "timeUnitSeconds"], nil) | |
247 | + | if ($isInstanceOf(@, "String")) | |
248 | + | then @ | |
249 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
250 | + | } | |
251 | + | if ((timeUnitSeconds == timeUnitSeconds)) | |
252 | + | then { | |
253 | + | let timeUnitSecondsInt = parseIntValue(timeUnitSeconds) | |
254 | + | if ((timeUnitSecondsInt == timeUnitSecondsInt)) | |
255 | + | then { | |
256 | + | let rentJson = { | |
257 | + | let @ = invoke(dAppJson, "makeJSON", [["customer", "timeUnitCount", "startTimestamp", "endTimestamp", "closed"], [toString(i.caller), toString(timeUnitCount), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (timeUnitSecondsInt * timeUnitCount))), "0"]], nil) | |
258 | + | if ($isInstanceOf(@, "String")) | |
259 | + | then @ | |
260 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
261 | + | } | |
262 | + | if ((rentJson == rentJson)) | |
263 | + | then [IntegerEntry(("lend-rentCount-" + lendIdString), (rentId + 1)), StringEntry(((("lend-rent-" + lendIdString) + "-") + rentIdString), rentJson), IntegerEntry(("lend-cost-" + lendIdString), (calcLendCost(lendId, timeUnitCount) + getLendCost(lendId)))] | |
264 | + | else throw("Strict value is not equal to itself.") | |
265 | + | } | |
266 | + | else throw("Strict value is not equal to itself.") | |
267 | + | } | |
268 | + | else throw("Strict value is not equal to itself.") | |
269 | + | }) | |
270 | + | ||
271 | + | ||
272 | + | ||
273 | + | @Callable(i) | |
274 | + | func closeLend (lendId) = valueOrElse(checkLendOwner(i.caller, lendId), { | |
275 | + | let lendIdString = toString(lendId) | |
276 | + | let rentCount = getIntegerValue(("lend-rentCount-" + lendIdString)) | |
277 | + | let deleteEntryList = ( let $l = hundredList | |
278 | + | let $s = size($l) | |
279 | + | let $acc0 = $Tuple4(nil, 0, rentCount, lendIdString) | |
280 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
281 | + | then $a | |
282 | + | else reducerGetDeleteEntry($a, $l[$i]) | |
283 | + | ||
284 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
285 | + | then $a | |
286 | + | else throw("List size exceeds 100") | |
287 | + | ||
288 | + | $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($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), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100))._1 | |
289 | + | let assetId = valueOrElse(getKey(getLendJson(lendId), "assetdId"), "") | |
290 | + | let txListRaw = [BooleanEntry(assetId, false), DeleteEntry(("lend-" + lendIdString)), DeleteEntry(("lend-rentCount-" + lendIdString)), DeleteEntry(("lend-cost-" + lendIdString)), IntegerEntry("lendCurrentCount", (lendCurrentCount - 1)), ScriptTransfer(i.caller, getLendCost(lendId), tokenPayment)] | |
291 | + | let txList = { | |
292 | + | let $l = txListRaw | |
293 | + | let $s = size($l) | |
294 | + | let $acc0 = deleteEntryList | |
295 | + | func $f1_1 ($a,$i) = if (($i >= $s)) | |
296 | + | then $a | |
297 | + | else reducerConcatLists($a, $l[$i]) | |
298 | + | ||
299 | + | func $f1_2 ($a,$i) = if (($i >= $s)) | |
300 | + | then $a | |
301 | + | else throw("List size exceeds 100") | |
302 | + | ||
303 | + | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_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), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
304 | + | } | |
305 | + | txList | |
306 | + | }) | |
307 | + | ||
308 | + | ||
309 | + | ||
310 | + | @Callable(i) | |
311 | + | func test () = { | |
312 | + | let data = ["1", "2", "3"] | |
313 | + | let list = ( let $l = hundredList | |
314 | + | let $s = size($l) | |
315 | + | let $acc0 = $Tuple4(data, 0, 5, "5") | |
316 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
317 | + | then $a | |
318 | + | else reducerTest($a, $l[$i]) | |
319 | + | ||
320 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
321 | + | then $a | |
322 | + | else throw("List size exceeds 100") | |
323 | + | ||
324 | + | $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($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), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100))._1 | |
325 | + | [StringEntry("Debug", { | |
326 | + | let $l = list | |
327 | + | let $s = size($l) | |
328 | + | let $acc0 = "" | |
329 | + | func $f1_1 ($a,$i) = if (($i >= $s)) | |
330 | + | then $a | |
331 | + | else reducerListToString($a, $l[$i]) | |
332 | + | ||
333 | + | func $f1_2 ($a,$i) = if (($i >= $s)) | |
334 | + | then $a | |
335 | + | else throw("List size exceeds 100") | |
336 | + | ||
337 | + | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_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), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
338 | + | })] | |
451 | 339 | } | |
452 | 340 | ||
453 | 341 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let collectionName = getStringValue("collectionName") | |
5 | 5 | ||
6 | - | let | |
6 | + | let symbol = getStringValue("symbol") | |
7 | 7 | ||
8 | - | func makeField (nextValue) = (((((((quote + nextValue._1) + quote) + ":") + quote) + nextValue._2) + quote) + ",") | |
8 | + | let description = getStringValue("description") | |
9 | + | ||
10 | + | let totalAmount = getIntegerValue("totalAmount") | |
11 | + | ||
12 | + | let baseURI = getStringValue("baseURI") | |
13 | + | ||
14 | + | let dAppJson = Address(fromBase58String("3MrGaZVRhknEGfHJ19ttUPNnDRoFqcHhVN7")) | |
15 | + | ||
16 | + | let tokenPayment = getBinaryValue("tokenPayment") | |
17 | + | ||
18 | + | let tokenPaymentAsset = valueOrErrorMessage(assetInfo(getBinaryValue("tokenPayment")), "token payment asset doesn't connect") | |
19 | + | ||
20 | + | let lendCount = getIntegerValue("lendCount") | |
21 | + | ||
22 | + | let lendCurrentCount = getIntegerValue("lendCurrentCount") | |
23 | + | ||
24 | + | let hundredList = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""] | |
25 | + | ||
26 | + | func parseIdtoAsset (assetId) = valueOrErrorMessage(assetInfo(fromBase58String(assetId)), "Can't find asset by asset id") | |
9 | 27 | ||
10 | 28 | ||
11 | - | func reducerMakeJSON (accum,nextValue) = (accum + makeField(nextValue)) | |
29 | + | func transferOrNot (to,amount,assetId) = if ((to == this)) | |
30 | + | then StringEntry("smth", "smth") | |
31 | + | else ScriptTransfer(to, amount, assetId) | |
12 | 32 | ||
13 | 33 | ||
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") | |
34 | + | func getLendJson (lendId) = { | |
35 | + | let lendIdString = toString(lendId) | |
36 | + | getStringValue(("lend-" + lendIdString)) | |
37 | + | } | |
167 | 38 | ||
168 | 39 | ||
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) | |
40 | + | func getKey (lendJson,key) = { | |
41 | + | let timeUnitSeconds = { | |
42 | + | let @ = invoke(dAppJson, "readByJSONKey", [lendJson, key], nil) | |
43 | + | if ($isInstanceOf(@, "String")) | |
44 | + | then @ | |
45 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
46 | + | } | |
47 | + | if ((timeUnitSeconds == timeUnitSeconds)) | |
48 | + | then timeUnitSeconds | |
49 | + | else throw("Strict value is not equal to itself.") | |
191 | 50 | } | |
51 | + | ||
52 | + | ||
53 | + | func getRentCount (lendId) = { | |
54 | + | let lendIdString = toString(lendId) | |
55 | + | getIntegerValue(("lend-rentCount-" + lendIdString)) | |
56 | + | } | |
57 | + | ||
58 | + | ||
59 | + | func calcLendCost (lendId,timeUnitSeconds) = { | |
60 | + | let lendJson = getLendJson(lendId) | |
61 | + | let timeUnitPriceString = getKey(lendJson, "timeUnitPrice") | |
62 | + | if ((timeUnitPriceString == timeUnitPriceString)) | |
63 | + | then { | |
64 | + | let timeUnitPrice = parseIntValue(timeUnitPriceString) | |
65 | + | (timeUnitSeconds * timeUnitPrice) | |
66 | + | } | |
67 | + | else throw("Strict value is not equal to itself.") | |
68 | + | } | |
69 | + | ||
70 | + | ||
71 | + | func getLendCost (lendId) = valueOrElse(getInteger(("lend-cost-" + toString(lendId))), 0) | |
192 | 72 | ||
193 | 73 | ||
194 | 74 | func onlyInternal (caller) = if ((caller == this)) | |
195 | 75 | then unit | |
196 | 76 | else throw("Only internal call") | |
197 | 77 | ||
198 | 78 | ||
199 | - | func prepare_1 (arr,arr2) = [$Tuple2(arr[0], arr2[0])] | |
200 | - | ||
201 | - | ||
202 | - | func prepare_2 (arr,arr2) = [$Tuple2(arr[0], arr2[0]), $Tuple2(arr[1], arr2[1])] | |
203 | - | ||
204 | - | ||
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 reducerFindObjcetByKey (accum,next) = { | |
263 | - | let $t064646786 = accum | |
264 | - | let key = $t064646786._1 | |
265 | - | let levelOn = $t064646786._2 | |
266 | - | let currentLevelOn = $t064646786._3 | |
267 | - | let startIndex = $t064646786._4 | |
268 | - | let endIndex = $t064646786._5 | |
269 | - | let currentIndex = $t064646786._6 | |
270 | - | let end = $t064646786._7 | |
271 | - | if (!(end)) | |
272 | - | then { | |
273 | - | let keyValueList = split(next, ":") | |
274 | - | let leftBraceCount = (size(split(next, "{")) - 1) | |
275 | - | let rightBraceCount = (size(split(next, "}")) - 1) | |
276 | - | let nextCurrentCount = (leftBraceCount - rightBraceCount) | |
277 | - | let $t070397239 = if (if ((levelOn == currentLevelOn)) | |
278 | - | then (keyValueList[0] == key) | |
279 | - | else false) | |
280 | - | then $Tuple2(currentIndex, true) | |
281 | - | else $Tuple2(0, false) | |
282 | - | let foundedStartIndex = $t070397239._1 | |
283 | - | let foundedStart = $t070397239._2 | |
284 | - | let $t072497445 = if (if ((levelOn == currentLevelOn)) | |
285 | - | then (keyValueList[0] == key) | |
286 | - | else false) | |
287 | - | then $Tuple2(currentIndex, true) | |
288 | - | else $Tuple2(0, false) | |
289 | - | let foundedEndIndex = $t072497445._1 | |
290 | - | let foundedEnd = $t072497445._2 | |
291 | - | $Tuple7(key, levelOn, (currentLevelOn + nextCurrentCount), if (foundedStart) | |
292 | - | then foundedStartIndex | |
293 | - | else startIndex, if (foundedEnd) | |
294 | - | then foundedEndIndex | |
295 | - | else endIndex, (currentIndex + 1), if (foundedEnd) | |
296 | - | then foundedEnd | |
297 | - | else end) | |
298 | - | } | |
79 | + | func reducerGetDeleteEntry (accum,next) = { | |
80 | + | let $t025422592 = accum | |
81 | + | let deletions = $t025422592._1 | |
82 | + | let current = $t025422592._2 | |
83 | + | let maxCount = $t025422592._3 | |
84 | + | let lendId = $t025422592._4 | |
85 | + | if ((maxCount > current)) | |
86 | + | then $Tuple4((deletions :+ DeleteEntry(((("lend-rent-" + lendId) + "-") + toString(current)))), (current + 1), maxCount, lendId) | |
299 | 87 | else accum | |
300 | 88 | } | |
301 | 89 | ||
302 | 90 | ||
303 | - | func | |
304 | - | ||
305 | - | ||
306 | - | ||
307 | - | ||
308 | - | ||
309 | - | ||
310 | - | ||
311 | - | ||
312 | - | ||
313 | - | | |
314 | - | | |
315 | - | | |
316 | - | | |
317 | - | ||
318 | - | | |
319 | - | | |
320 | - | else | |
91 | + | func reducerConcatLists (accum,next) = (accum :+ next) | |
92 | + | ||
93 | + | ||
94 | + | func reducerConcatListsString (accum,next) = (accum :+ next) | |
95 | + | ||
96 | + | ||
97 | + | func reducerListToString (accum,next) = ((accum + "-") + next) | |
98 | + | ||
99 | + | ||
100 | + | func reducerTest (accum,next) = { | |
101 | + | let $t032203270 = accum | |
102 | + | let deletions = $t032203270._1 | |
103 | + | let current = $t032203270._2 | |
104 | + | let maxCount = $t032203270._3 | |
105 | + | let lendId = $t032203270._4 | |
106 | + | if ((maxCount > current)) | |
107 | + | then $Tuple4((deletions :+ ((("lend-rent-" + lendId) + "-") + toString(current))), (current + 1), maxCount, lendId) | |
108 | + | else $Tuple4(deletions, current, maxCount, lendId) | |
321 | 109 | } | |
322 | 110 | ||
323 | 111 | ||
324 | - | func reducerTakeObject (accum,next) = { | |
325 | - | let $t083908450 = accum | |
326 | - | let result = $t083908450._1 | |
327 | - | let leftCount = $t083908450._2 | |
328 | - | let rightCount = $t083908450._3 | |
329 | - | let i = $t083908450._4 | |
330 | - | let iCount = $t083908450._5 | |
331 | - | let end = $t083908450._6 | |
332 | - | if (if (!(end)) | |
333 | - | then true | |
334 | - | else (iCount > i)) | |
335 | - | then { | |
336 | - | let $t084889245 = if (contains(next, "{")) | |
337 | - | then { | |
338 | - | let _nextLeftCount = (size(split(next, "{")) - 1) | |
339 | - | $Tuple2(_nextLeftCount, 0) | |
340 | - | } | |
341 | - | else if (contains(next, "}")) | |
342 | - | then { | |
343 | - | let _nextRightCount = (size(split(next, "}")) - 1) | |
344 | - | $Tuple2(0, _nextRightCount) | |
345 | - | } | |
346 | - | else $Tuple2(0, 0) | |
347 | - | let nextLeftCount = $t084889245._1 | |
348 | - | let nextRightCount = $t084889245._2 | |
349 | - | let curentLeftCount = (leftCount + nextLeftCount) | |
350 | - | let currentRightCount = (rightCount + nextRightCount) | |
351 | - | if ((curentLeftCount == currentRightCount)) | |
352 | - | then $Tuple6(result, curentLeftCount, currentRightCount, (i + 1), iCount, true) | |
353 | - | else $Tuple6(((result + ",") + next), curentLeftCount, currentRightCount, (i + 1), iCount, false) | |
354 | - | } | |
355 | - | else accum | |
356 | - | } | |
112 | + | func checkAssetOwner (caller,assetId) = if ((assetBalance(caller, fromBase58String(assetId)) == 1)) | |
113 | + | then unit | |
114 | + | else throw("Only asset owner") | |
357 | 115 | ||
358 | 116 | ||
359 | - | func readByKeyInternal (json,key) = { | |
360 | - | let $t097799895 = getStartAndEndIndexes(json, key) | |
361 | - | let keyLen = $t097799895._1 | |
362 | - | let startIndex = $t097799895._2 | |
363 | - | let endIndex = $t097799895._3 | |
364 | - | drop(take(json, (endIndex - 1)), ((startIndex + keyLen) + 3)) | |
365 | - | } | |
117 | + | func checkPayment (payments,amount) = if ((payments[0].amount >= amount)) | |
118 | + | then unit | |
119 | + | else throw("amount less then need") | |
366 | 120 | ||
367 | 121 | ||
368 | - | func deleteByKeyInternal (json,key) = { | |
369 | - | let $t01017610244 = getStartAndEndIndexes(json, key) | |
370 | - | let keyLen = $t01017610244._1 | |
371 | - | let startIndex = $t01017610244._2 | |
372 | - | let endIndex = $t01017610244._3 | |
373 | - | let deletedValue = drop(take(json, (endIndex - 1)), ((startIndex + keyLen) + 3)) | |
374 | - | let newJson = if (((size(json) - endIndex) == 1)) | |
375 | - | then (take(json, (startIndex - 2)) + drop(json, endIndex)) | |
376 | - | else (take(json, (startIndex - 1)) + drop(json, (endIndex + 1))) | |
377 | - | $Tuple2(deletedValue, newJson) | |
378 | - | } | |
122 | + | func checkAssetExists (assetId) = if (valueOrElse(getBoolean(assetId), false)) | |
123 | + | then throw("this token already use") | |
124 | + | else unit | |
125 | + | ||
126 | + | ||
127 | + | func checkLendOwner (caller,lendId) = if ((getKey(getLendJson(lendId), "owner") != toString(caller))) | |
128 | + | then throw("you haven't perms") | |
129 | + | else unit | |
379 | 130 | ||
380 | 131 | ||
381 | 132 | @Callable(i) | |
382 | - | func makeJSONInternal (arrKeys,arrValues,iterationsCount,lastIterationLen,res) = valueOrElse(onlyInternal(i.caller), if ((iterationsCount > 0)) | |
383 | - | then { | |
384 | - | let $t01188212047 = getPartAndTail(arrKeys) | |
385 | - | let currentArrPartKeys = $t01188212047._1 | |
386 | - | let arrTailKeys = $t01188212047._2 | |
387 | - | let $t01205612174 = getPartAndTail(arrValues) | |
388 | - | let currentArrPartValues = $t01205612174._1 | |
389 | - | let arrTailValues = $t01205612174._2 | |
390 | - | let params = prepareParams(currentArrPartKeys, currentArrPartValues, 10) | |
391 | - | let newString = iterateMakeJSON(params, res, 10) | |
392 | - | let result = invoke(this, "makeJSONInternal", [arrTailKeys, arrTailValues, (iterationsCount - 1), lastIterationLen, newString], nil) | |
393 | - | if ((result == result)) | |
394 | - | then $Tuple2(nil, result) | |
395 | - | else throw("Strict value is not equal to itself.") | |
396 | - | } | |
397 | - | else if ((lastIterationLen != 0)) | |
398 | - | then { | |
399 | - | let params = prepareParams(arrKeys, arrValues, lastIterationLen) | |
400 | - | let newString = iterateMakeJSON(params, res, lastIterationLen) | |
401 | - | $Tuple2(nil, (("{" + dropRight(newString, 1)) + "}")) | |
402 | - | } | |
403 | - | else $Tuple2(nil, (("{" + dropRight(res, 1)) + "}"))) | |
133 | + | func setString (_key,_value) = valueOrElse(onlyInternal(i.caller), [StringEntry(_key, _value)]) | |
404 | 134 | ||
405 | 135 | ||
406 | 136 | ||
407 | 137 | @Callable(i) | |
408 | - | func makeJSON (arrKeys,arrValues) = if ((size(arrKeys) != size(arrValues))) | |
409 | - | then throw("ArrayKeys and ArrayValues length must be equal") | |
410 | - | else { | |
411 | - | let len = size(arrKeys) | |
412 | - | let iterationsCount = fraction(1, len, 10) | |
413 | - | let lastIterationLen = (len % 10) | |
414 | - | let res = invoke(this, "makeJSONInternal", [arrKeys, arrValues, iterationsCount, lastIterationLen, ""], nil) | |
415 | - | if ((res == res)) | |
416 | - | then $Tuple2(nil, res) | |
417 | - | else throw("Strict value is not equal to itself.") | |
418 | - | } | |
138 | + | func setInt (_key,_value) = valueOrElse(onlyInternal(i.caller), [IntegerEntry(_key, _value)]) | |
419 | 139 | ||
420 | 140 | ||
421 | 141 | ||
422 | 142 | @Callable(i) | |
423 | - | func addToJSON (json,arrKeys,arrValues) = if ((size(arrKeys) != size(arrValues))) | |
424 | - | then throw("ArrayKeys and ArrayValues length must be equal") | |
425 | - | else { | |
426 | - | let len = size(arrKeys) | |
427 | - | let iterationsCount = fraction(1, len, 10) | |
428 | - | let lastIterationLen = (len % 10) | |
429 | - | let res = invoke(this, "makeJSONInternal", [arrKeys, arrValues, iterationsCount, lastIterationLen, (drop(dropRight(json, 1), 1) + ",")], nil) | |
430 | - | if ((res == res)) | |
431 | - | then $Tuple2(nil, res) | |
432 | - | else throw("Strict value is not equal to itself.") | |
433 | - | } | |
143 | + | func deleteEntry (_key) = valueOrElse(onlyInternal(i.caller), [DeleteEntry(_key)]) | |
434 | 144 | ||
435 | 145 | ||
436 | 146 | ||
437 | 147 | @Callable(i) | |
438 | - | func readByJSONKey (json,key) = { | |
439 | - | let valueByKey = readByKeyInternal(json, key) | |
440 | - | $Tuple2([StringEntry("valueByKey", valueByKey)], valueByKey) | |
148 | + | func init (_collectionName,_symbol,_description,_baseURI) = valueOrElse(onlyInternal(i.caller), [StringEntry("collectionName", _collectionName), StringEntry("symbol", _symbol), StringEntry("description", _description), IntegerEntry("totalAmount", 0), StringEntry("baseURI", _baseURI)]) | |
149 | + | ||
150 | + | ||
151 | + | ||
152 | + | @Callable(i) | |
153 | + | func setUser (assetId,user,expires) = { | |
154 | + | let res = invoke(dAppJson, "makeJSON", [["user", "expires"], [user, expires]], nil) | |
155 | + | if ((res == res)) | |
156 | + | then $Tuple2([StringEntry(("userOf-" + assetId), { | |
157 | + | let @ = res | |
158 | + | if ($isInstanceOf(@, "String")) | |
159 | + | then @ | |
160 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
161 | + | })], res) | |
162 | + | else throw("Strict value is not equal to itself.") | |
441 | 163 | } | |
442 | 164 | ||
443 | 165 | ||
444 | 166 | ||
445 | 167 | @Callable(i) | |
446 | - | func deleteByJSONKey (json,key) = { | |
447 | - | let $t01659016949 = deleteByKeyInternal(json, key) | |
448 | - | let deletedValueByKey = $t01659016949._1 | |
449 | - | let newJson = $t01659016949._2 | |
450 | - | $Tuple2([StringEntry("deletedValue", deletedValueByKey), StringEntry(kJsonRes, newJson)], $Tuple2(deletedValueByKey, newJson)) | |
168 | + | func setTokenPayment (assetBinary) = valueOrElse(onlyInternal(i.caller), [BinaryEntry("tokenPayment", assetBinary)]) | |
169 | + | ||
170 | + | ||
171 | + | ||
172 | + | @Callable(i) | |
173 | + | func mintTokens (to,amount) = { | |
174 | + | let reisue = Reissue(tokenPayment, amount, true) | |
175 | + | let toAddress = Address(fromBase58String(to)) | |
176 | + | let transfer = transferOrNot(toAddress, amount, tokenPayment) | |
177 | + | if ((transfer == transfer)) | |
178 | + | then [transfer, reisue] | |
179 | + | else throw("Strict value is not equal to itself.") | |
180 | + | } | |
181 | + | ||
182 | + | ||
183 | + | ||
184 | + | @Callable(i) | |
185 | + | func mintNFT (to) = { | |
186 | + | let tokenId = (totalAmount + 1) | |
187 | + | let tokenIdString = toString(tokenId) | |
188 | + | let preName = ((symbol + "#") + tokenIdString) | |
189 | + | let name = if ((16 >= size(preName))) | |
190 | + | then preName | |
191 | + | else tokenIdString | |
192 | + | let tokenURI = (baseURI + tokenIdString) | |
193 | + | let json = { | |
194 | + | let @ = invoke(dAppJson, "makeJSON", [["tokenURI"], [tokenURI]], nil) | |
195 | + | if ($isInstanceOf(@, "String")) | |
196 | + | then @ | |
197 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
198 | + | } | |
199 | + | let asset = Issue(name, json, 1, 0, false, unit, height) | |
200 | + | let assetId = calculateAssetId(asset) | |
201 | + | let toAddress = Address(fromBase58String(to)) | |
202 | + | let transfer = transferOrNot(toAddress, 1, assetId) | |
203 | + | if ((transfer == transfer)) | |
204 | + | then [asset, transfer, IntegerEntry("totalAmount", tokenId), StringEntry(name, tokenURI)] | |
205 | + | else throw("Strict value is not equal to itself.") | |
206 | + | } | |
207 | + | ||
208 | + | ||
209 | + | ||
210 | + | @Callable(i) | |
211 | + | func initLend (assetId,timeUnitSeconds,timeUnitPrice,timeUnitCount) = valueOrElse(checkAssetOwner(i.caller, assetId), valueOrElse(checkAssetExists(assetId), { | |
212 | + | let asset = parseIdtoAsset(assetId) | |
213 | + | let tokenURI = { | |
214 | + | let @ = invoke(dAppJson, "readByJSONKey", [asset.description, "tokenURI"], nil) | |
215 | + | if ($isInstanceOf(@, "String")) | |
216 | + | then @ | |
217 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
218 | + | } | |
219 | + | if ((tokenURI == tokenURI)) | |
220 | + | then { | |
221 | + | let lendJson = { | |
222 | + | let @ = invoke(dAppJson, "makeJSON", [["supportedInterface", "assetdId", "tokenURI", "owner", "timeUnitSeconds", "timeUnitPrice", "timeUnitCount", "startTimestamp", "endTimestamp", "deposit", "claimed"], ["0", assetId, tokenURI, toString(i.caller), toString(timeUnitSeconds), toString(timeUnitPrice), toString(timeUnitCount), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (timeUnitSeconds * timeUnitCount))), "0", "0"]], nil) | |
223 | + | if ($isInstanceOf(@, "String")) | |
224 | + | then @ | |
225 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
226 | + | } | |
227 | + | if ((lendJson == lendJson)) | |
228 | + | then { | |
229 | + | let lendIdString = toString(lendCount) | |
230 | + | [IntegerEntry("lendCount", (lendCount + 1)), IntegerEntry("lendCurrentCount", (lendCurrentCount + 1)), IntegerEntry(("lend-rentCount-" + lendIdString), 0), StringEntry(("lend-" + lendIdString), lendJson), BooleanEntry(assetId, true)] | |
231 | + | } | |
232 | + | else throw("Strict value is not equal to itself.") | |
233 | + | } | |
234 | + | else throw("Strict value is not equal to itself.") | |
235 | + | })) | |
236 | + | ||
237 | + | ||
238 | + | ||
239 | + | @Callable(i) | |
240 | + | func initRent (lendId,timeUnitCount) = valueOrElse(checkPayment(i.payments, calcLendCost(lendId, timeUnitCount)), { | |
241 | + | let lendIdString = toString(lendId) | |
242 | + | let lendJson = getStringValue(("lend-" + lendIdString)) | |
243 | + | let rentId = getRentCount(lendId) | |
244 | + | let rentIdString = toString(rentId) | |
245 | + | let timeUnitSeconds = { | |
246 | + | let @ = invoke(dAppJson, "readByJSONKey", [lendJson, "timeUnitSeconds"], nil) | |
247 | + | if ($isInstanceOf(@, "String")) | |
248 | + | then @ | |
249 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
250 | + | } | |
251 | + | if ((timeUnitSeconds == timeUnitSeconds)) | |
252 | + | then { | |
253 | + | let timeUnitSecondsInt = parseIntValue(timeUnitSeconds) | |
254 | + | if ((timeUnitSecondsInt == timeUnitSecondsInt)) | |
255 | + | then { | |
256 | + | let rentJson = { | |
257 | + | let @ = invoke(dAppJson, "makeJSON", [["customer", "timeUnitCount", "startTimestamp", "endTimestamp", "closed"], [toString(i.caller), toString(timeUnitCount), toString(lastBlock.timestamp), toString((lastBlock.timestamp + (timeUnitSecondsInt * timeUnitCount))), "0"]], nil) | |
258 | + | if ($isInstanceOf(@, "String")) | |
259 | + | then @ | |
260 | + | else throw(($getType(@) + " couldn't be cast to String")) | |
261 | + | } | |
262 | + | if ((rentJson == rentJson)) | |
263 | + | then [IntegerEntry(("lend-rentCount-" + lendIdString), (rentId + 1)), StringEntry(((("lend-rent-" + lendIdString) + "-") + rentIdString), rentJson), IntegerEntry(("lend-cost-" + lendIdString), (calcLendCost(lendId, timeUnitCount) + getLendCost(lendId)))] | |
264 | + | else throw("Strict value is not equal to itself.") | |
265 | + | } | |
266 | + | else throw("Strict value is not equal to itself.") | |
267 | + | } | |
268 | + | else throw("Strict value is not equal to itself.") | |
269 | + | }) | |
270 | + | ||
271 | + | ||
272 | + | ||
273 | + | @Callable(i) | |
274 | + | func closeLend (lendId) = valueOrElse(checkLendOwner(i.caller, lendId), { | |
275 | + | let lendIdString = toString(lendId) | |
276 | + | let rentCount = getIntegerValue(("lend-rentCount-" + lendIdString)) | |
277 | + | let deleteEntryList = ( let $l = hundredList | |
278 | + | let $s = size($l) | |
279 | + | let $acc0 = $Tuple4(nil, 0, rentCount, lendIdString) | |
280 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
281 | + | then $a | |
282 | + | else reducerGetDeleteEntry($a, $l[$i]) | |
283 | + | ||
284 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
285 | + | then $a | |
286 | + | else throw("List size exceeds 100") | |
287 | + | ||
288 | + | $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($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), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100))._1 | |
289 | + | let assetId = valueOrElse(getKey(getLendJson(lendId), "assetdId"), "") | |
290 | + | let txListRaw = [BooleanEntry(assetId, false), DeleteEntry(("lend-" + lendIdString)), DeleteEntry(("lend-rentCount-" + lendIdString)), DeleteEntry(("lend-cost-" + lendIdString)), IntegerEntry("lendCurrentCount", (lendCurrentCount - 1)), ScriptTransfer(i.caller, getLendCost(lendId), tokenPayment)] | |
291 | + | let txList = { | |
292 | + | let $l = txListRaw | |
293 | + | let $s = size($l) | |
294 | + | let $acc0 = deleteEntryList | |
295 | + | func $f1_1 ($a,$i) = if (($i >= $s)) | |
296 | + | then $a | |
297 | + | else reducerConcatLists($a, $l[$i]) | |
298 | + | ||
299 | + | func $f1_2 ($a,$i) = if (($i >= $s)) | |
300 | + | then $a | |
301 | + | else throw("List size exceeds 100") | |
302 | + | ||
303 | + | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_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), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
304 | + | } | |
305 | + | txList | |
306 | + | }) | |
307 | + | ||
308 | + | ||
309 | + | ||
310 | + | @Callable(i) | |
311 | + | func test () = { | |
312 | + | let data = ["1", "2", "3"] | |
313 | + | let list = ( let $l = hundredList | |
314 | + | let $s = size($l) | |
315 | + | let $acc0 = $Tuple4(data, 0, 5, "5") | |
316 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
317 | + | then $a | |
318 | + | else reducerTest($a, $l[$i]) | |
319 | + | ||
320 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
321 | + | then $a | |
322 | + | else throw("List size exceeds 100") | |
323 | + | ||
324 | + | $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($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), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100))._1 | |
325 | + | [StringEntry("Debug", { | |
326 | + | let $l = list | |
327 | + | let $s = size($l) | |
328 | + | let $acc0 = "" | |
329 | + | func $f1_1 ($a,$i) = if (($i >= $s)) | |
330 | + | then $a | |
331 | + | else reducerListToString($a, $l[$i]) | |
332 | + | ||
333 | + | func $f1_2 ($a,$i) = if (($i >= $s)) | |
334 | + | then $a | |
335 | + | else throw("List size exceeds 100") | |
336 | + | ||
337 | + | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_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), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
338 | + | })] | |
451 | 339 | } | |
452 | 340 | ||
453 | 341 |
github/deemru/w8io/169f3d6 72.85 ms ◑