tx · BmA973qTCRT6vnKXmgU6dv2eBRJp3rwREqATjmtKQmST

3N8y4wxX3JC4TdrCJBXX16SjWf6X256hrep:  -0.03100000 Waves

2023.04.04 18:20 [2519988] smart account 3N8y4wxX3JC4TdrCJBXX16SjWf6X256hrep > SELF 0.00000000 Waves

{ "type": 13, "id": "BmA973qTCRT6vnKXmgU6dv2eBRJp3rwREqATjmtKQmST", "fee": 3100000, "feeAssetId": null, "timestamp": 1680621662200, "version": 2, "chainId": 84, "sender": "3N8y4wxX3JC4TdrCJBXX16SjWf6X256hrep", "senderPublicKey": "7v5L7QkXxfkirALdyqmox38QCsa9jtfAtgUfHTh34eWq", "proofs": [ "cQYDbwoArs9rcz4w7ZNdCs3e3fdWetdQ9A7Mgpgs8phHdC2V8yCKuazDVBguZxDNeuo3DtKn1uQV8NvxBUvywP6" ], "script": "base64:BgIxCAISAwoBCBIECgIRERIECgIRERIDCgEREgUKAwEBARIDCgEIEgQKAggIEgUKAwgICEsAA1NFUAICX18ABU1VTFQ2AMCEPQAFTVVMVDgAgMLXLwAGTVVMVDEwAIDIr6AlAAVjaGFpbgkAyQECCQDKAQIIBQR0aGlzBWJ5dGVzAAEAAQALdXNkbkFzc2V0SWQEByRtYXRjaDAFBWNoYWluAwkAAAIBAVcFByRtYXRjaDABILYmKcME9c5TkaQOS3UkL2SMUbH6369UKb1I0h0qsqrRAwkAAAIBAVQFByRtYXRjaDABIPd26vf3g8pl224T7gI7z1gplanB0Y3yS9ps2B1igMjeCQACAQINVW5rbm93biBjaGFpbgAVZGVmYXVsdFJlc3RBZGRyZXNzU3RyBAckbWF0Y2gwBQVjaGFpbgMJAAACAQFXBQckbWF0Y2gwAiMzUFFDdXZGYnZoNExrUFVucm5VMXozam5iQTFwOW0zV05odgMJAAACAQFUBQckbWF0Y2gwAiMzTXVta0dHenRDS0FYcFdEcXhrZGRvZnFYU1VicVFrdlNKeQkAAgECDVVua25vd24gY2hhaW4BD2dldFN0cmluZ09yRmFpbAIHYWRkcmV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YWxkbwkAzQgCBQhhY3Rpb25zMQkBDlNjcmlwdFRyYW5zZmVyAwkBEUBleHRyTmF0aXZlKDEwNjIpAQUJbGFuZE93bmVyCQBlAggFAXACXzYFC3VzZEJwMldoRmVlBQt1c2RuQXNzZXRJZAMJAQIhPQIJAJADAQgFAWkIcGF5bWVudHMAAAkAAgECEk5vIHBheW1lbnRzIG5lZWRlZAUIYWN0aW9uczEJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AGDdwpQ==", "height": 2519988, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: D8Ym5Yaxs2mf7dJkesir4SCVS5cdsTc711XgtTpfpg1A Next: H7sffFJyLftf7NJwoYGqNt59piPRhaiLsmqv9PLR1xJW Diff:
OldNewDifferences
283283 func checkBlocked () = if (valueOrElse(getBoolean(stakingContract, keyBlocked()), false))
284284 then throw("Contracts are under maintenance")
285285 else unit
286+
287+
288+func setCommon (acc,item) = {
289+ let j = acc._1
290+ let itemParts = split(item, "@")
291+ if ((size(itemParts) != 2))
292+ then throw("Incorrect order format, should be amount@price")
293+ else {
294+ let newOrdAm = parseIntValue(itemParts[0])
295+ let newOrdPr = parseIntValue(itemParts[1])
296+ let newOrdUsd = fraction(newOrdAm, newOrdPr, MULT8)
297+ let whp = parseIntValue(acc._5[j])
298+ let curOrdParts = split(acc._6[j], "@")
299+ let curOrdAm = parseIntValue(curOrdParts[0])
300+ let curOrdPr = parseIntValue(curOrdParts[1])
301+ if ((0 > curOrdPr))
302+ then throw("Price can't be negative")
303+ else {
304+ let curOrdUsd = fraction(curOrdAm, curOrdPr, MULT8)
305+ if ((newOrdAm == 0))
306+ then if ((curOrdAm > 0))
307+ then $Tuple4((j + 1), (acc._2 :+ toString(whp)), (acc._3 - curOrdAm), (acc._4 - curOrdUsd))
308+ else $Tuple4((j + 1), (acc._2 :+ toString((whp - curOrdAm))), (acc._3 + curOrdAm), acc._4)
309+ else if ((newOrdAm > 0))
310+ then if ((0 > curOrdAm))
311+ then {
312+ let amDiff = (newOrdAm + curOrdAm)
313+ $Tuple4((j + 1), (acc._2 :+ toString((whp - curOrdAm))), (acc._3 + amDiff), (acc._4 + newOrdUsd))
314+ }
315+ else $Tuple4((j + 1), (acc._2 :+ toString(whp)), ((acc._3 + newOrdAm) - curOrdAm), ((acc._4 + newOrdUsd) - curOrdUsd))
316+ else if ((0 > curOrdAm))
317+ then {
318+ let amDiff = (curOrdAm - newOrdAm)
319+ if ((0 > (whp - amDiff)))
320+ then throw((((("Attempt to take " + toString(amDiff)) + " from warehouse, but only ") + toString(whp)) + " available"))
321+ else $Tuple4((j + 1), (acc._2 :+ toString((whp - amDiff))), (acc._3 + amDiff), acc._3)
322+ }
323+ else if ((0 > (whp + newOrdAm)))
324+ then throw((((("Attempt to take " + toString(-(newOrdAm))) + " from warehouse, but only ") + toString(whp)) + " available"))
325+ else $Tuple4((j + 1), (acc._2 :+ toString((whp + newOrdAm))), ((acc._3 - newOrdAm) - curOrdAm), (acc._4 - curOrdUsd))
326+ }
327+ }
328+ }
329+
330+
331+func acceptCommon (acc,bpOrdProdItem) = {
332+ let j = acc._7
333+ let bpOrdProdParts = split(bpOrdProdItem, "@")
334+ if ((size(bpOrdProdParts) != 2))
335+ then throw("Incorrect order format, should be amount@price")
336+ else {
337+ let bpOrdAm = parseIntValue(bpOrdProdParts[0])
338+ let bpOrdPr = parseIntValue(bpOrdProdParts[1])
339+ if ((0 > bpOrdPr))
340+ then throw("Price can't be negative")
341+ else {
342+ let bpOrdUsd = fraction(bpOrdAm, bpOrdPr, MULT8)
343+ let bpp = parseIntValue(acc._8[j])
344+ let whp = parseIntValue(acc._9[j])
345+ let whOrdParts = split(acc._10[j], "@")
346+ let whOrdAm = parseIntValue(whOrdParts[0])
347+ let whOrdPr = parseIntValue(whOrdParts[1])
348+ if (if ((bpOrdAm != 0))
349+ then (bpOrdPr != whOrdPr)
350+ else false)
351+ then throw(((((("Prices of " + prodTypes[j]) + " don't match! WH price=") + toString(whOrdPr)) + ", your price=") + toString(bpOrdPr)))
352+ else {
353+ let whOrdUsd = fraction(whOrdAm, whOrdPr, MULT8)
354+ if ((bpOrdAm == 0))
355+ then $Tuple10((acc._1 :+ toString(whp)), (acc._2 :+ acc._10[j]), (acc._3 :+ toString(bpp)), acc._4, acc._5, acc._6, (acc._7 + 1), acc._8, acc._9, acc._10)
356+ else if ((bpOrdAm > 0))
357+ then if ((0 > whOrdAm))
358+ then if ((bpOrdAm > -(whOrdAm)))
359+ then throw(((((("Attempt to buy " + toString(bpOrdAm)) + " of ") + prodTypes[j]) + ", but warehouse only sells ") + toString(-(whOrdAm))))
360+ else $Tuple10((acc._1 :+ toString(whp)), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpp + bpOrdAm))), (acc._4 + bpOrdAm), acc._5, (acc._6 + bpOrdUsd), (acc._7 + 1), acc._8, acc._9, acc._10)
361+ else throw((("Attempt to buy " + prodTypes[j]) + " while warehouse doesn't sell it"))
362+ else if ((whOrdAm > 0))
363+ then if ((-(bpOrdAm) > whOrdAm))
364+ then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + " of ") + prodTypes[j]) + ", but warehouse only buys ") + toString(whOrdAm)))
365+ else if ((-(bpOrdAm) > bpp))
366+ then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + ", but you only have ") + toString(bpp)) + " of ") + prodTypes[j]))
367+ else $Tuple10((acc._1 :+ toString((whp - bpOrdAm))), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpp + bpOrdAm))), (acc._4 - bpOrdAm), (acc._5 - bpOrdUsd), acc._6, (acc._7 + 1), acc._8, acc._9, acc._10)
368+ else throw((("Attempt to sell " + prodTypes[j]) + " while warehouse doesn't buy it"))
369+ }
370+ }
371+ }
372+ }
286373
287374
288375 @Callable(i)
661748 then nil
662749 else split(currentOrd[ordIdxProd], "_")
663750 let usdnNeed2Lock = 0
664- func ordR (acc,item) = {
665- let j = acc._1
666- let itemParts = split(item, "@")
667- if ((size(itemParts) != 2))
668- then throw("Incorrect order format, should be amount@price")
669- else {
670- let newOrdAm = parseIntValue(itemParts[0])
671- let newOrdPr = parseIntValue(itemParts[1])
672- let newOrdUsd = fraction(newOrdAm, newOrdPr, MULT8)
673- let whr = parseIntValue(currWhRes[j])
674- let curOrdParts = split(currentOrdRes[j], "@")
675- let curOrdAm = parseIntValue(curOrdParts[0])
676- let curOrdPr = parseIntValue(curOrdParts[1])
677- if ((0 > curOrdPr))
678- then throw("Price can't be negative")
679- else {
680- let curOrdUsd = fraction(curOrdAm, curOrdPr, MULT8)
681- if ((newOrdAm == 0))
682- then if ((curOrdAm > 0))
683- then $Tuple4((j + 1), (acc._2 :+ toString(whr)), (acc._3 - curOrdAm), (acc._4 - curOrdUsd))
684- else $Tuple4((j + 1), (acc._2 :+ toString((whr - curOrdAm))), (acc._3 + curOrdAm), acc._4)
685- else if ((newOrdAm > 0))
686- then if ((0 > curOrdAm))
687- then {
688- let amDiff = (newOrdAm + curOrdAm)
689- $Tuple4((j + 1), (acc._2 :+ toString((whr - curOrdAm))), (acc._3 + amDiff), (acc._4 + newOrdUsd))
690- }
691- else $Tuple4((j + 1), (acc._2 :+ toString(whr)), ((acc._3 + newOrdAm) - curOrdAm), ((acc._4 + newOrdUsd) - curOrdUsd))
692- else if ((0 > curOrdAm))
693- then {
694- let amDiff = (curOrdAm - newOrdAm)
695- if ((0 > (whr - amDiff)))
696- then throw((((("Attempt to take " + toString(amDiff)) + " from warehouse, but only ") + toString(whr)) + " available"))
697- else $Tuple4((j + 1), (acc._2 :+ toString((whr - amDiff))), (acc._3 + amDiff), acc._4)
698- }
699- else if ((0 > (whr + newOrdAm)))
700- then throw((((("Attempt to take " + toString(-(newOrdAm))) + " from warehouse, but only ") + toString(whr)) + " available"))
701- else $Tuple4((j + 1), (acc._2 :+ toString((whr + newOrdAm))), ((acc._3 - newOrdAm) - curOrdAm), (acc._4 - curOrdUsd))
702- }
703- }
704- }
705-
706751 let r = {
707752 let $l = resParts
708753 let $s = size($l)
709- let $acc0 = $Tuple4(0, nil, 0, 0)
754+ let $acc0 = $Tuple6(0, nil, 0, 0, currWhRes, currentOrdRes)
710755 func $f0_1 ($a,$i) = if (($i >= $s))
711756 then $a
712- else ordR($a, $l[$i])
757+ else setCommon($a, $l[$i])
713758
714759 func $f0_2 ($a,$i) = if (($i >= $s))
715760 then $a
717762
718763 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
719764 }
720- func ordM (acc,item) = {
721- let j = acc._1
722- let itemParts = split(item, "@")
723- if ((size(itemParts) != 2))
724- then throw("Incorrect order format, should be amount@price")
725- else {
726- let newOrdAm = parseIntValue(itemParts[0])
727- let newOrdPr = parseIntValue(itemParts[1])
728- let newOrdUsd = fraction(newOrdAm, newOrdPr, MULT8)
729- let whm = parseIntValue(currWhMat[j])
730- let curOrdParts = split(currentOrdMat[j], "@")
731- let curOrdAm = parseIntValue(curOrdParts[0])
732- let curOrdPr = parseIntValue(curOrdParts[1])
733- if ((0 > curOrdPr))
734- then throw("Price can't be negative")
735- else {
736- let curOrdUsd = fraction(curOrdAm, curOrdPr, MULT8)
737- if ((newOrdAm == 0))
738- then if ((curOrdAm > 0))
739- then $Tuple4((j + 1), (acc._2 :+ toString(whm)), (acc._3 - curOrdAm), (acc._4 - curOrdUsd))
740- else $Tuple4((j + 1), (acc._2 :+ toString((whm - curOrdAm))), (acc._3 + curOrdAm), acc._4)
741- else if ((newOrdAm > 0))
742- then if ((0 > curOrdAm))
743- then {
744- let amDiff = (newOrdAm + curOrdAm)
745- $Tuple4((j + 1), (acc._2 :+ toString((whm - curOrdAm))), (acc._3 + amDiff), (acc._4 + newOrdUsd))
746- }
747- else $Tuple4((j + 1), (acc._2 :+ toString(whm)), ((acc._3 + newOrdAm) - curOrdAm), ((acc._4 + newOrdUsd) - curOrdUsd))
748- else if ((0 > curOrdAm))
749- then {
750- let amDiff = (curOrdAm - newOrdAm)
751- if ((0 > (whm - amDiff)))
752- then throw((((("Attempt to take " + toString(amDiff)) + " from warehouse, but only ") + toString(whm)) + " available"))
753- else $Tuple4((j + 1), (acc._2 :+ toString((whm - amDiff))), (acc._3 + amDiff), acc._4)
754- }
755- else if ((0 > (whm + newOrdAm)))
756- then throw((((("Attempt to take " + toString(-(newOrdAm))) + " from warehouse, but only ") + toString(whm)) + " available"))
757- else $Tuple4((j + 1), (acc._2 :+ toString((whm + newOrdAm))), ((acc._3 - newOrdAm) - curOrdAm), (acc._4 - curOrdUsd))
758- }
759- }
760- }
761-
762765 let m = {
763766 let $l = matParts
764767 let $s = size($l)
765- let $acc0 = $Tuple4(0, nil, r._3, r._4)
768+ let $acc0 = $Tuple6(0, nil, r._3, r._4, currWhMat, currentOrdMat)
766769 func $f1_1 ($a,$i) = if (($i >= $s))
767770 then $a
768- else ordM($a, $l[$i])
771+ else setCommon($a, $l[$i])
769772
770773 func $f1_2 ($a,$i) = if (($i >= $s))
771774 then $a
773776
774777 $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6)
775778 }
776- func ordP (acc,item) = {
777- let j = acc._1
778- let itemParts = split(item, "@")
779- if ((size(itemParts) != 2))
780- then throw("Incorrect order format, should be amount@price")
781- else {
782- let newOrdAm = parseIntValue(itemParts[0])
783- let newOrdPr = parseIntValue(itemParts[1])
784- let newOrdUsd = fraction(newOrdAm, newOrdPr, MULT8)
785- let whp = parseIntValue(currWhProd[j])
786- let curOrdParts = split(currentOrdProd[j], "@")
787- let curOrdAm = parseIntValue(curOrdParts[0])
788- let curOrdPr = parseIntValue(curOrdParts[1])
789- if ((0 > curOrdPr))
790- then throw("Price can't be negative")
791- else {
792- let curOrdUsd = fraction(curOrdAm, curOrdPr, MULT8)
793- if ((newOrdAm == 0))
794- then if ((curOrdAm > 0))
795- then $Tuple4((j + 1), (acc._2 :+ toString(whp)), (acc._3 - curOrdAm), (acc._4 - curOrdUsd))
796- else $Tuple4((j + 1), (acc._2 :+ toString((whp - curOrdAm))), (acc._3 + curOrdAm), acc._4)
797- else if ((newOrdAm > 0))
798- then if ((0 > curOrdAm))
799- then {
800- let amDiff = (newOrdAm + curOrdAm)
801- $Tuple4((j + 1), (acc._2 :+ toString((whp - curOrdAm))), (acc._3 + amDiff), (acc._4 + newOrdUsd))
802- }
803- else $Tuple4((j + 1), (acc._2 :+ toString(whp)), ((acc._3 + newOrdAm) - curOrdAm), ((acc._4 + newOrdUsd) - curOrdUsd))
804- else if ((0 > curOrdAm))
805- then {
806- let amDiff = (curOrdAm - newOrdAm)
807- if ((0 > (whp - amDiff)))
808- then throw((((("Attempt to take " + toString(amDiff)) + " from warehouse, but only ") + toString(whp)) + " available"))
809- else $Tuple4((j + 1), (acc._2 :+ toString((whp - amDiff))), (acc._3 + amDiff), acc._3)
810- }
811- else if ((0 > (whp + newOrdAm)))
812- then throw((((("Attempt to take " + toString(-(newOrdAm))) + " from warehouse, but only ") + toString(whp)) + " available"))
813- else $Tuple4((j + 1), (acc._2 :+ toString((whp + newOrdAm))), ((acc._3 - newOrdAm) - curOrdAm), (acc._4 - curOrdUsd))
814- }
815- }
816- }
817-
818779 let p = {
819780 let $l = prodParts
820781 let $s = size($l)
821- let $acc0 = $Tuple4(0, nil, m._3, m._4)
782+ let $acc0 = $Tuple6(0, nil, m._3, m._4, currWhProd, currentOrdProd)
822783 func $f2_1 ($a,$i) = if (($i >= $s))
823784 then $a
824- else ordP($a, $l[$i])
785+ else setCommon($a, $l[$i])
825786
826787 func $f2_2 ($a,$i) = if (($i >= $s))
827788 then $a
930891 then nil
931892 else split(whOrd[ordIdxProd], "_")
932893 let usdnNeed2Lock = 0
933- func ordR (acc,j) = {
934- let bpOrdResParts = split(bpOrdRes[j], "@")
935- if ((size(bpOrdResParts) != 2))
936- then throw("Incorrect order format, should be amount@price")
937- else {
938- let bpOrdAm = parseIntValue(bpOrdResParts[0])
939- let bpOrdPr = parseIntValue(bpOrdResParts[1])
940- if ((0 > bpOrdPr))
941- then throw("Price can't be negative")
942- else {
943- let bpOrdUsd = fraction(bpOrdAm, bpOrdPr, MULT8)
944- let bpr = parseIntValue(bpResList[j])
945- let whr = parseIntValue(currWhRes[j])
946- let whOrdParts = split(whOrdRes[j], "@")
947- let whOrdAm = parseIntValue(whOrdParts[0])
948- let whOrdPr = parseIntValue(whOrdParts[1])
949- if (if ((bpOrdAm != 0))
950- then (bpOrdPr != whOrdPr)
951- else false)
952- then throw(((((("Prices of " + resTypes[j]) + " don't match! WH price=") + toString(whOrdPr)) + ", your price=") + toString(bpOrdPr)))
953- else {
954- let whOrdUsd = fraction(whOrdAm, whOrdPr, MULT8)
955- if ((bpOrdAm == 0))
956- then $Tuple6((acc._1 :+ currWhRes[j]), (acc._2 :+ whOrdRes[j]), (acc._3 :+ bpResList[j]), acc._4, acc._5, acc._6)
957- else if ((bpOrdAm > 0))
958- then if ((0 > whOrdAm))
959- then if ((bpOrdAm > -(whOrdAm)))
960- then throw(((((("Attempt to buy " + toString(bpOrdAm)) + " of ") + resTypes[j]) + ", but warehouse only sells ") + toString(-(whOrdAm))))
961- else $Tuple6((acc._1 :+ currWhRes[j]), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpr + bpOrdAm))), (acc._4 + bpOrdAm), acc._5, (acc._6 + bpOrdUsd))
962- else throw((("Attempt to buy " + resTypes[j]) + " while warehouse doesn't sell it"))
963- else if ((whOrdAm > 0))
964- then if ((-(bpOrdAm) > whOrdAm))
965- then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + " of ") + resTypes[j]) + ", but warehouse only buys ") + toString(whOrdAm)))
966- else if ((-(bpOrdAm) > bpr))
967- then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + ", but you only have ") + bpResList[j]) + " of ") + resTypes[j]))
968- else $Tuple6((acc._1 :+ toString((whr - bpOrdAm))), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpr + bpOrdAm))), (acc._4 - bpOrdAm), (acc._5 - bpOrdUsd), acc._6)
969- else throw((("Attempt to sell " + resTypes[j]) + " while warehouse doesn't buy it"))
970- }
971- }
972- }
973- }
974-
975894 let r = {
976- let $l = [0, 1, 2, 3, 4, 5]
895+ let $l = bpOrdRes
977896 let $s = size($l)
978- let $acc0 = $Tuple6(nil, nil, nil, 0, 0, 0)
897+ let $acc0 = $Tuple10(nil, nil, nil, 0, 0, 0, 0, bpResList, currWhRes, whOrdRes)
979898 func $f0_1 ($a,$i) = if (($i >= $s))
980899 then $a
981- else ordR($a, $l[$i])
900+ else acceptCommon($a, $l[$i])
982901
983902 func $f0_2 ($a,$i) = if (($i >= $s))
984903 then $a
986905
987906 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
988907 }
989- func ordM (acc,j) = {
990- let bpOrdMatParts = split(bpOrdMat[j], "@")
991- if ((size(bpOrdMatParts) != 2))
992- then throw("Incorrect order format, should be amount@price")
993- else {
994- let bpOrdAm = parseIntValue(bpOrdMatParts[0])
995- let bpOrdPr = parseIntValue(bpOrdMatParts[1])
996- if ((0 > bpOrdPr))
997- then throw("Price can't be negative")
998- else {
999- let bpOrdUsd = fraction(bpOrdAm, bpOrdPr, MULT8)
1000- let bpm = parseIntValue(bpMatList[j])
1001- let whm = parseIntValue(currWhMat[j])
1002- let whOrdParts = split(whOrdMat[j], "@")
1003- let whOrdAm = parseIntValue(whOrdParts[0])
1004- let whOrdPr = parseIntValue(whOrdParts[1])
1005- if (if ((bpOrdAm != 0))
1006- then (bpOrdPr != whOrdPr)
1007- else false)
1008- then throw(((((("Prices of " + matTypes[j]) + " don't match! WH price=") + toString(whOrdPr)) + ", your price=") + toString(bpOrdPr)))
1009- else {
1010- let whOrdUsd = fraction(whOrdAm, whOrdPr, MULT8)
1011- if ((bpOrdAm == 0))
1012- then $Tuple6((acc._1 :+ currWhMat[j]), (acc._2 :+ whOrdMat[j]), (acc._3 :+ bpMatList[j]), acc._4, acc._5, acc._6)
1013- else if ((bpOrdAm > 0))
1014- then if ((0 > whOrdAm))
1015- then if ((bpOrdAm > -(whOrdAm)))
1016- then throw(((((("Attempt to buy " + toString(bpOrdAm)) + " of ") + matTypes[j]) + ", but warehouse only sells ") + toString(-(whOrdAm))))
1017- else $Tuple6((acc._1 :+ currWhMat[j]), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpm + bpOrdAm))), (acc._4 + bpOrdAm), acc._5, (acc._6 + bpOrdUsd))
1018- else throw((("Attempt to buy " + matTypes[j]) + " while warehouse doesn't sell it"))
1019- else if ((whOrdAm > 0))
1020- then if ((-(bpOrdAm) > whOrdAm))
1021- then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + " of ") + matTypes[j]) + ", but warehouse only buys ") + toString(whOrdAm)))
1022- else if ((-(bpOrdAm) > bpm))
1023- then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + ", but you only have ") + bpMatList[j]) + " of ") + matTypes[j]))
1024- else $Tuple6((acc._1 :+ toString((whm - bpOrdAm))), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpm + bpOrdAm))), (acc._4 - bpOrdAm), (acc._5 - bpOrdUsd), acc._6)
1025- else throw((("Attempt to sell " + matTypes[j]) + " while warehouse doesn't buy it"))
1026- }
1027- }
1028- }
1029- }
1030-
1031908 let m = {
1032- let $l = [0, 1, 2, 3, 4, 5]
909+ let $l = bpOrdMat
1033910 let $s = size($l)
1034- let $acc0 = $Tuple6(nil, nil, nil, r._4, r._5, r._6)
911+ let $acc0 = $Tuple10(nil, nil, nil, r._4, r._5, r._6, 0, bpMatList, currWhMat, whOrdMat)
1035912 func $f1_1 ($a,$i) = if (($i >= $s))
1036913 then $a
1037- else ordM($a, $l[$i])
914+ else acceptCommon($a, $l[$i])
1038915
1039916 func $f1_2 ($a,$i) = if (($i >= $s))
1040917 then $a
1042919
1043920 $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6)
1044921 }
1045- func ordP (acc,bpOrdProdItem) = {
1046- let j = acc._7
1047- let bpOrdProdParts = split(bpOrdProdItem, "@")
1048- if ((size(bpOrdProdParts) != 2))
1049- then throw("Incorrect order format, should be amount@price")
1050- else {
1051- let bpOrdAm = parseIntValue(bpOrdProdParts[0])
1052- let bpOrdPr = parseIntValue(bpOrdProdParts[1])
1053- if ((0 > bpOrdPr))
1054- then throw("Price can't be negative")
1055- else {
1056- let bpOrdUsd = fraction(bpOrdAm, bpOrdPr, MULT8)
1057- let bpp = parseIntValue(bpProdList[j])
1058- let whp = parseIntValue(currWhProd[j])
1059- let whOrdParts = split(whOrdProd[j], "@")
1060- let whOrdAm = parseIntValue(whOrdParts[0])
1061- let whOrdPr = parseIntValue(whOrdParts[1])
1062- if (if ((bpOrdAm != 0))
1063- then (bpOrdPr != whOrdPr)
1064- else false)
1065- then throw(((((("Prices of " + prodTypes[j]) + " don't match! WH price=") + toString(whOrdPr)) + ", your price=") + toString(bpOrdPr)))
1066- else {
1067- let whOrdUsd = fraction(whOrdAm, whOrdPr, MULT8)
1068- if ((bpOrdAm == 0))
1069- then $Tuple7((acc._1 :+ currWhProd[j]), (acc._2 :+ whOrdProd[j]), (acc._3 :+ bpProdList[j]), acc._4, acc._5, acc._6, (acc._7 + 1))
1070- else if ((bpOrdAm > 0))
1071- then if ((0 > whOrdAm))
1072- then if ((bpOrdAm > -(whOrdAm)))
1073- then throw(((((("Attempt to buy " + toString(bpOrdAm)) + " of ") + prodTypes[j]) + ", but warehouse only sells ") + toString(-(whOrdAm))))
1074- else $Tuple7((acc._1 :+ currWhProd[j]), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpp + bpOrdAm))), (acc._4 + bpOrdAm), acc._5, (acc._6 + bpOrdUsd), (acc._7 + 1))
1075- else throw((("Attempt to buy " + prodTypes[j]) + " while warehouse doesn't sell it"))
1076- else if ((whOrdAm > 0))
1077- then if ((-(bpOrdAm) > whOrdAm))
1078- then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + " of ") + prodTypes[j]) + ", but warehouse only buys ") + toString(whOrdAm)))
1079- else if ((-(bpOrdAm) > bpp))
1080- then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + ", but you only have ") + bpProdList[j]) + " of ") + prodTypes[j]))
1081- else $Tuple7((acc._1 :+ toString((whp - bpOrdAm))), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpp + bpOrdAm))), (acc._4 - bpOrdAm), (acc._5 - bpOrdUsd), acc._6, (acc._7 + 1))
1082- else throw((("Attempt to sell " + prodTypes[j]) + " while warehouse doesn't buy it"))
1083- }
1084- }
1085- }
1086- }
1087-
1088922 let p = {
1089923 let $l = bpOrdProd
1090924 let $s = size($l)
1091- let $acc0 = $Tuple7(nil, nil, nil, m._4, m._5, m._6, 0)
925+ let $acc0 = $Tuple10(nil, nil, nil, m._4, m._5, m._6, 0, bpProdList, currWhProd, whOrdProd)
1092926 func $f2_1 ($a,$i) = if (($i >= $s))
1093927 then $a
1094- else ordP($a, $l[$i])
928+ else acceptCommon($a, $l[$i])
1095929
1096930 func $f2_2 ($a,$i) = if (($i >= $s))
1097931 then $a
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let MULT6 = 1000000
77
88 let MULT8 = 100000000
99
1010 let MULT10 = 10000000000
1111
1212 let chain = take(drop(this.bytes, 1), 1)
1313
1414 let usdnAssetId = match chain {
1515 case _ =>
1616 if ((base58'2W' == $match0))
1717 then base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p'
1818 else if ((base58'2T' == $match0))
1919 then base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ'
2020 else throw("Unknown chain")
2121 }
2222
2323 let defaultRestAddressStr = match chain {
2424 case _ =>
2525 if ((base58'2W' == $match0))
2626 then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv"
2727 else if ((base58'2T' == $match0))
2828 then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy"
2929 else throw("Unknown chain")
3030 }
3131
3232 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
3333
3434
3535 func getIntOrElse (key,defaultVal) = valueOrElse(getInteger(this, key), defaultVal)
3636
3737
3838 let IdxCfgStakingDapp = 1
3939
4040 let IdxCfgEconomyDapp = 2
4141
4242 let IdxCfgGovernanceDapp = 3
4343
4444 func keyRestCfg () = "%s__restConfig"
4545
4646
4747 func keyRestAddress () = "%s__restAddr"
4848
4949
5050 func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP)
5151
5252
5353 func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx)))
5454
5555
5656 let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr))
5757
5858 let restCfg = readRestCfgOrFail(restContract)
5959
6060 let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp)
6161
6262 let DEFAULTLOCATION = "Africa_F_Africa"
6363
6464 let NUMRES = 6
6565
6666 let FACTORYMAXWAREHOUSE = 10000000000
6767
6868 let RESOURCEPRICEMIN = 158549
6969
7070 let MINPAYMENT = 10000
7171
7272 let SELLMULTIPLIER = 200
7373
7474 let BUYMULTIPLIER = 300
7575
7676 let LANDPREFIX = "LAND"
7777
7878 let DUCKPREFIX = "DUCK"
7979
8080 let WHMULTIPLIER = 10000000000
8181
8282 let AUCTIONFEE = 10000
8383
8484 let resTypes = ["Oil", "Ore", "Wood", "Sand", "Clay", "Organic"]
8585
8686 let matTypes = ["Fuel", "Metal", "Plank", "Glass", "Plastic", "Protein"]
8787
8888 let prodTypes = ["First Aid Kit", "Backpack", "Food Ration", "Jet Pack", "Radar"]
8989
9090 let continents = ["Americas", "Europe", "Asia", "Africa", "Oceania"]
9191
9292 let productionMatrix = ["1_1_1_2_2_5_1_10", "2_5_5_2_7_5_2_100", "1_1_1_2_2_5_1_10", "9_9_1_5_5_1_5_100", "1_5_1_5_5_1_1_100"]
9393
9494 let contIdxAmericas = 0
9595
9696 let contIdxEurope = 1
9797
9898 let contIdxAsia = 2
9999
100100 let contIdxAfrica = 3
101101
102102 let contIdxOceania = 4
103103
104104 func keyFactoryWarehouseByIdAndType (factoryId,resType) = ((("factoryWhByContinentAndRes_" + factoryId) + "_") + toString(resType))
105105
106106
107107 func keyOrderByLand (landAssetId) = ("landOrder_" + landAssetId)
108108
109109
110110 func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr)
111111
112112
113113 func keyBackpackByDuck (duckAssetId) = ("backPack_" + duckAssetId)
114114
115115
116116 func keyDuckLocation (duckAssetId) = ("duckLocation_" + duckAssetId)
117117
118118
119119 func keyBlocked () = "contractsBlocked"
120120
121121
122122 func keyLandAssetIdToOwner (assetId) = ("nftOwner_" + assetId)
123123
124124
125125 func keyStakedTimeByAssetId (assetId) = ("stakedTime_" + assetId)
126126
127127
128128 let locIdxContinent = 0
129129
130130 let locIdxType = 1
131131
132132 let locIdxId = 2
133133
134134 let bpIdxLevel = 0
135135
136136 let bpIdxRes = 1
137137
138138 let bpIdxMat = 2
139139
140140 let bpIdxProd = 3
141141
142142 let whIdxVol = 0
143143
144144 let whIdxRes = 1
145145
146146 let whIdxMat = 2
147147
148148 let whIdxProd = 3
149149
150150 let whIdxLockedVol = 4
151151
152152 let ordIdxRes = 0
153153
154154 let ordIdxMat = 1
155155
156156 let ordIdxProd = 2
157157
158158 func asString (v) = match v {
159159 case s: String =>
160160 s
161161 case _ =>
162162 throw("fail to cast into String")
163163 }
164164
165165
166166 func getOrder (ordKey) = {
167167 let p = split(valueOrElse(getString(ordKey), "0@0_0@0_0@0_0@0_0@0_0@0:0@0_0@0_0@0_0@0_0@0_0@0:"), ":")
168168 [if ((size(split(p[ordIdxRes], "_")) == NUMRES))
169169 then p[ordIdxRes]
170170 else "0@0_0@0_0@0_0@0_0@0_0@0", if ((size(split(p[ordIdxMat], "_")) == NUMRES))
171171 then p[ordIdxMat]
172172 else "0@0_0@0_0@0_0@0_0@0_0@0", p[ordIdxProd]]
173173 }
174174
175175
176176 func getWarehouseVolume (volPrefix) = {
177177 let parts = split(volPrefix, "_")
178178 ((WHMULTIPLIER * (parseIntValue(parts[1]) + 1)) * parseIntValue(parts[0]))
179179 }
180180
181181
182182 func getWarehouseCurrResVolume (currentWh) = {
183183 func sum (acc,item) = (acc + parseIntValue(item))
184184
185185 let $l = split(currentWh[whIdxRes], "_")
186186 let $s = size($l)
187187 let $acc0 = 0
188188 func $f0_1 ($a,$i) = if (($i >= $s))
189189 then $a
190190 else sum($a, $l[$i])
191191
192192 func $f0_2 ($a,$i) = if (($i >= $s))
193193 then $a
194194 else throw("List size exceeds 6")
195195
196196 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
197197 }
198198
199199
200200 func getWarehouseCurrMatVolume (currentWh) = {
201201 func sum (acc,item) = (acc + parseIntValue(item))
202202
203203 let $l = split(currentWh[whIdxMat], "_")
204204 let $s = size($l)
205205 let $acc0 = 0
206206 func $f0_1 ($a,$i) = if (($i >= $s))
207207 then $a
208208 else sum($a, $l[$i])
209209
210210 func $f0_2 ($a,$i) = if (($i >= $s))
211211 then $a
212212 else throw("List size exceeds 6")
213213
214214 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
215215 }
216216
217217
218218 func getWarehouseCurrGoodsVolume (currentWh) = {
219219 let goods = currentWh[whIdxProd]
220220 if ((goods == ""))
221221 then 0
222222 else {
223223 func sum (acc,item) = (acc + parseIntValue(item))
224224
225225 let $l = split_4C(goods, "_")
226226 let $s = size($l)
227227 let $acc0 = 0
228228 func $f0_1 ($a,$i) = if (($i >= $s))
229229 then $a
230230 else sum($a, $l[$i])
231231
232232 func $f0_2 ($a,$i) = if (($i >= $s))
233233 then $a
234234 else throw("List size exceeds 50")
235235
236236 $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($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)
237237 }
238238 }
239239
240240
241241 func sellInternal (locId,resType,amount,minPrice) = {
242242 let whKey = keyFactoryWarehouseByIdAndType(locId, resType)
243243 let w0 = valueOrElse(getInteger(whKey), 0)
244244 let r0 = if ((w0 > FACTORYMAXWAREHOUSE))
245245 then 0
246246 else if (((w0 + amount) > FACTORYMAXWAREHOUSE))
247247 then (FACTORYMAXWAREHOUSE - w0)
248248 else amount
249249 let usdnReceived = (fraction(r0, ((SELLMULTIPLIER * RESOURCEPRICEMIN) - fraction(((100 * w0) + (50 * r0)), RESOURCEPRICEMIN, FACTORYMAXWAREHOUSE)), MULT10) + fraction((amount - r0), RESOURCEPRICEMIN, MULT8))
250250 let min99 = (minPrice - (minPrice / 100))
251251 if (((min99 * amount) > (usdnReceived * MULT8)))
252252 then throw((((((((((("Actual price = " + toString(usdnReceived)) + " / ") + toString(amount)) + " < minPrice = ") + toString(minPrice)) + ", (") + locId) + ", ") + resTypes[resType]) + ")"))
253253 else $Tuple2(IntegerEntry(whKey, (w0 + amount)), usdnReceived)
254254 }
255255
256256
257257 func buyInternal (locId,matType,amount,maxPrice) = {
258258 let whKey = keyFactoryWarehouseByIdAndType(locId, matType)
259259 let w0 = valueOrElse(getInteger(whKey), 0)
260260 let m1 = if ((w0 > FACTORYMAXWAREHOUSE))
261261 then min([amount, (w0 - FACTORYMAXWAREHOUSE)])
262262 else 0
263263 let m0 = min([w0, (amount - m1)])
264264 let m = (m0 + m1)
265265 let usdnSpent = (fraction(m0, ((BUYMULTIPLIER * RESOURCEPRICEMIN) - fraction(((100 * w0) - (50 * m0)), RESOURCEPRICEMIN, FACTORYMAXWAREHOUSE)), MULT10) + fraction(m1, (2 * RESOURCEPRICEMIN), MULT8))
266266 let max101 = (maxPrice + (maxPrice / 100))
267267 if (((usdnSpent * MULT8) > (max101 * m)))
268268 then throw((((((((((("Actual price = " + toString(usdnSpent)) + " / ") + toString(m)) + " > maxPrice = ") + toString(maxPrice)) + ", (") + locId) + ", ") + matTypes[matType]) + ")"))
269269 else $Tuple3(IntegerEntry(whKey, (w0 - m)), usdnSpent, m)
270270 }
271271
272272
273273 func getBackpack (bpKey) = {
274274 let p = split(valueOrElse(getString(stakingContract, bpKey), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":")
275275 [toString(valueOrElse(parseInt(p[bpIdxLevel]), 0)), if ((size(split(p[bpIdxRes], "_")) == NUMRES))
276276 then p[bpIdxRes]
277277 else "0_0_0_0_0_0", if ((size(split(p[bpIdxMat], "_")) == NUMRES))
278278 then p[bpIdxMat]
279279 else "0_0_0_0_0_0", p[bpIdxProd]]
280280 }
281281
282282
283283 func checkBlocked () = if (valueOrElse(getBoolean(stakingContract, keyBlocked()), false))
284284 then throw("Contracts are under maintenance")
285285 else unit
286+
287+
288+func setCommon (acc,item) = {
289+ let j = acc._1
290+ let itemParts = split(item, "@")
291+ if ((size(itemParts) != 2))
292+ then throw("Incorrect order format, should be amount@price")
293+ else {
294+ let newOrdAm = parseIntValue(itemParts[0])
295+ let newOrdPr = parseIntValue(itemParts[1])
296+ let newOrdUsd = fraction(newOrdAm, newOrdPr, MULT8)
297+ let whp = parseIntValue(acc._5[j])
298+ let curOrdParts = split(acc._6[j], "@")
299+ let curOrdAm = parseIntValue(curOrdParts[0])
300+ let curOrdPr = parseIntValue(curOrdParts[1])
301+ if ((0 > curOrdPr))
302+ then throw("Price can't be negative")
303+ else {
304+ let curOrdUsd = fraction(curOrdAm, curOrdPr, MULT8)
305+ if ((newOrdAm == 0))
306+ then if ((curOrdAm > 0))
307+ then $Tuple4((j + 1), (acc._2 :+ toString(whp)), (acc._3 - curOrdAm), (acc._4 - curOrdUsd))
308+ else $Tuple4((j + 1), (acc._2 :+ toString((whp - curOrdAm))), (acc._3 + curOrdAm), acc._4)
309+ else if ((newOrdAm > 0))
310+ then if ((0 > curOrdAm))
311+ then {
312+ let amDiff = (newOrdAm + curOrdAm)
313+ $Tuple4((j + 1), (acc._2 :+ toString((whp - curOrdAm))), (acc._3 + amDiff), (acc._4 + newOrdUsd))
314+ }
315+ else $Tuple4((j + 1), (acc._2 :+ toString(whp)), ((acc._3 + newOrdAm) - curOrdAm), ((acc._4 + newOrdUsd) - curOrdUsd))
316+ else if ((0 > curOrdAm))
317+ then {
318+ let amDiff = (curOrdAm - newOrdAm)
319+ if ((0 > (whp - amDiff)))
320+ then throw((((("Attempt to take " + toString(amDiff)) + " from warehouse, but only ") + toString(whp)) + " available"))
321+ else $Tuple4((j + 1), (acc._2 :+ toString((whp - amDiff))), (acc._3 + amDiff), acc._3)
322+ }
323+ else if ((0 > (whp + newOrdAm)))
324+ then throw((((("Attempt to take " + toString(-(newOrdAm))) + " from warehouse, but only ") + toString(whp)) + " available"))
325+ else $Tuple4((j + 1), (acc._2 :+ toString((whp + newOrdAm))), ((acc._3 - newOrdAm) - curOrdAm), (acc._4 - curOrdUsd))
326+ }
327+ }
328+ }
329+
330+
331+func acceptCommon (acc,bpOrdProdItem) = {
332+ let j = acc._7
333+ let bpOrdProdParts = split(bpOrdProdItem, "@")
334+ if ((size(bpOrdProdParts) != 2))
335+ then throw("Incorrect order format, should be amount@price")
336+ else {
337+ let bpOrdAm = parseIntValue(bpOrdProdParts[0])
338+ let bpOrdPr = parseIntValue(bpOrdProdParts[1])
339+ if ((0 > bpOrdPr))
340+ then throw("Price can't be negative")
341+ else {
342+ let bpOrdUsd = fraction(bpOrdAm, bpOrdPr, MULT8)
343+ let bpp = parseIntValue(acc._8[j])
344+ let whp = parseIntValue(acc._9[j])
345+ let whOrdParts = split(acc._10[j], "@")
346+ let whOrdAm = parseIntValue(whOrdParts[0])
347+ let whOrdPr = parseIntValue(whOrdParts[1])
348+ if (if ((bpOrdAm != 0))
349+ then (bpOrdPr != whOrdPr)
350+ else false)
351+ then throw(((((("Prices of " + prodTypes[j]) + " don't match! WH price=") + toString(whOrdPr)) + ", your price=") + toString(bpOrdPr)))
352+ else {
353+ let whOrdUsd = fraction(whOrdAm, whOrdPr, MULT8)
354+ if ((bpOrdAm == 0))
355+ then $Tuple10((acc._1 :+ toString(whp)), (acc._2 :+ acc._10[j]), (acc._3 :+ toString(bpp)), acc._4, acc._5, acc._6, (acc._7 + 1), acc._8, acc._9, acc._10)
356+ else if ((bpOrdAm > 0))
357+ then if ((0 > whOrdAm))
358+ then if ((bpOrdAm > -(whOrdAm)))
359+ then throw(((((("Attempt to buy " + toString(bpOrdAm)) + " of ") + prodTypes[j]) + ", but warehouse only sells ") + toString(-(whOrdAm))))
360+ else $Tuple10((acc._1 :+ toString(whp)), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpp + bpOrdAm))), (acc._4 + bpOrdAm), acc._5, (acc._6 + bpOrdUsd), (acc._7 + 1), acc._8, acc._9, acc._10)
361+ else throw((("Attempt to buy " + prodTypes[j]) + " while warehouse doesn't sell it"))
362+ else if ((whOrdAm > 0))
363+ then if ((-(bpOrdAm) > whOrdAm))
364+ then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + " of ") + prodTypes[j]) + ", but warehouse only buys ") + toString(whOrdAm)))
365+ else if ((-(bpOrdAm) > bpp))
366+ then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + ", but you only have ") + toString(bpp)) + " of ") + prodTypes[j]))
367+ else $Tuple10((acc._1 :+ toString((whp - bpOrdAm))), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpp + bpOrdAm))), (acc._4 - bpOrdAm), (acc._5 - bpOrdUsd), acc._6, (acc._7 + 1), acc._8, acc._9, acc._10)
368+ else throw((("Attempt to sell " + prodTypes[j]) + " while warehouse doesn't buy it"))
369+ }
370+ }
371+ }
372+ }
286373
287374
288375 @Callable(i)
289376 func constructorV1 (restAddr) = if ((i.caller != this))
290377 then throw("Permission denied")
291378 else [StringEntry(keyRestAddress(), restAddr)]
292379
293380
294381
295382 @Callable(i)
296383 func sellResources (amounts,minPrices) = {
297384 let blocked = checkBlocked()
298385 if ((blocked == blocked))
299386 then {
300387 let duckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked")
301388 if ((size(i.payments) != 0))
302389 then throw("sellResources doesn't require any payments")
303390 else {
304391 let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
305392 if ((curLocation[locIdxType] != "F"))
306393 then throw(("Duck location type should be Factory, but is " + curLocation[locIdxType]))
307394 else {
308395 let locId = curLocation[locIdxId]
309396 let currentPack = getBackpack(keyBackpackByDuck(duckAssetId))
310397 let resList = split(currentPack[bpIdxRes], "_")
311398 func adder (acc,j) = if ((amounts[j] > parseIntValue(resList[j])))
312399 then throw(((((("You have " + resList[j]) + " of ") + resTypes[j]) + ", but tried to sell ") + toString(amounts[j])))
313400 else if ((0 > amounts[j]))
314401 then throw(((("You tried to sell negative amount of " + resTypes[j]) + ": ") + toString(amounts[j])))
315402 else if ((amounts[j] > 0))
316403 then {
317404 let b = sellInternal(locId, j, amounts[j], minPrices[j])
318405 $Tuple3((acc._1 :+ b._1), (acc._2 :+ toString((parseIntValue(resList[j]) - amounts[j]))), (acc._3 + b._2))
319406 }
320407 else $Tuple3(acc._1, (acc._2 :+ resList[j]), acc._3)
321408
322409 let merged = {
323410 let $l = [0, 1, 2, 3, 4, 5]
324411 let $s = size($l)
325412 let $acc0 = $Tuple3(nil, nil, 0)
326413 func $f0_1 ($a,$i) = if (($i >= $s))
327414 then $a
328415 else adder($a, $l[$i])
329416
330417 func $f0_2 ($a,$i) = if (($i >= $s))
331418 then $a
332419 else throw("List size exceeds 6")
333420
334421 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
335422 }
336423 let newPack = makeString([currentPack[bpIdxLevel], makeString(merged._2, "_"), currentPack[bpIdxMat], currentPack[bpIdxProd]], ":")
337424 let result = asString(invoke(stakingContract, "updateBackpack", [duckAssetId, newPack], nil))
338425 $Tuple2((merged._1 :+ ScriptTransfer(i.caller, merged._3, usdnAssetId)), result)
339426 }
340427 }
341428 }
342429 else throw("Strict value is not equal to itself.")
343430 }
344431
345432
346433
347434 @Callable(i)
348435 func buyMaterials (amounts,maxPrices) = {
349436 let blocked = checkBlocked()
350437 if ((blocked == blocked))
351438 then {
352439 let duckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked")
353440 if ((size(i.payments) != 1))
354441 then throw("exactly 1 payment must be attached")
355442 else {
356443 let pmt = i.payments[0]
357444 let amt = pmt.amount
358445 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment")
359446 if ((pmtAssetId != usdnAssetId))
360447 then throw("USDN payments only!")
361448 else {
362449 let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
363450 if ((curLocation[locIdxType] != "F"))
364451 then throw(("Duck location type should be Factory, but is " + curLocation[locIdxType]))
365452 else {
366453 let locId = curLocation[locIdxId]
367454 let currentPack = getBackpack(keyBackpackByDuck(duckAssetId))
368455 let matList = split(currentPack[bpIdxMat], "_")
369456 func mUpdater (acc,j) = if ((0 > amounts[j]))
370457 then throw(((("You tried to buy negative amount of " + matTypes[j]) + ": ") + toString(amounts[j])))
371458 else if ((amounts[j] > 0))
372459 then {
373460 let b = buyInternal(locId, j, amounts[j], maxPrices[j])
374461 $Tuple3((acc._1 :+ b._1), (acc._2 :+ toString((parseIntValue(matList[j]) + b._3))), (acc._3 + b._2))
375462 }
376463 else $Tuple3(acc._1, (acc._2 :+ matList[j]), acc._3)
377464
378465 let merged = {
379466 let $l = [0, 1, 2, 3, 4, 5]
380467 let $s = size($l)
381468 let $acc0 = $Tuple3(nil, nil, 0)
382469 func $f0_1 ($a,$i) = if (($i >= $s))
383470 then $a
384471 else mUpdater($a, $l[$i])
385472
386473 func $f0_2 ($a,$i) = if (($i >= $s))
387474 then $a
388475 else throw("List size exceeds 6")
389476
390477 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
391478 }
392479 if ((merged._3 > amt))
393480 then throw(((("Insufficient payment! Attached=" + toString(amt)) + ", required=") + toString(merged._3)))
394481 else {
395482 let newPack = makeString([currentPack[bpIdxLevel], currentPack[bpIdxRes], makeString(merged._2, "_"), currentPack[bpIdxProd]], ":")
396483 let result = asString(invoke(stakingContract, "updateBackpack", [duckAssetId, newPack], nil))
397484 let rest = if (((amt - merged._3) > 0))
398485 then [ScriptTransfer(i.caller, (amt - merged._3), usdnAssetId)]
399486 else nil
400487 $Tuple2((merged._1 ++ rest), result)
401488 }
402489 }
403490 }
404491 }
405492 }
406493 else throw("Strict value is not equal to itself.")
407494 }
408495
409496
410497
411498 @Callable(i)
412499 func exchangeResources (amounts) = {
413500 let blocked = checkBlocked()
414501 if ((blocked == blocked))
415502 then {
416503 let duckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked")
417504 if ((size(i.payments) != 1))
418505 then throw("exactly 1 payment must be attached")
419506 else {
420507 let pmt = i.payments[0]
421508 let amt = pmt.amount
422509 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment")
423510 if ((pmtAssetId != usdnAssetId))
424511 then throw("USDN payments only!")
425512 else {
426513 let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
427514 if ((curLocation[locIdxType] != "F"))
428515 then throw(("Duck location type should be Factory, but is " + curLocation[locIdxType]))
429516 else {
430517 let locId = curLocation[locIdxId]
431518 let currentPack = getBackpack(keyBackpackByDuck(duckAssetId))
432519 let resList = split(currentPack[bpIdxRes], "_")
433520 let matList = split(currentPack[bpIdxMat], "_")
434521 func exchanger (acc,j) = {
435522 let whKey = keyFactoryWarehouseByIdAndType(locId, j)
436523 let w0 = valueOrElse(getInteger(whKey), 0)
437524 let amj = amounts[j]
438525 if ((amj > parseIntValue(resList[j])))
439526 then throw(((((("You have " + resList[j]) + " of ") + resTypes[j]) + ", but tried to exchange ") + toString(amj)))
440527 else if ((0 > amj))
441528 then throw(((("You tried to exchange negative amount of " + resTypes[j]) + ": ") + toString(amj)))
442529 else if ((amj > 0))
443530 then $Tuple4((acc._1 :+ toString((parseIntValue(resList[j]) - amj))), (acc._2 :+ toString((parseIntValue(matList[j]) + amj))), (acc._3 + fraction(amj, RESOURCEPRICEMIN, MULT8)), (acc._4 :+ IntegerEntry(whKey, w0)))
444531 else $Tuple4((acc._1 :+ resList[j]), (acc._2 :+ matList[j]), acc._3, acc._4)
445532 }
446533
447534 let merged = {
448535 let $l = [0, 1, 2, 3, 4, 5]
449536 let $s = size($l)
450537 let $acc0 = $Tuple4(nil, nil, 0, nil)
451538 func $f0_1 ($a,$i) = if (($i >= $s))
452539 then $a
453540 else exchanger($a, $l[$i])
454541
455542 func $f0_2 ($a,$i) = if (($i >= $s))
456543 then $a
457544 else throw("List size exceeds 6")
458545
459546 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
460547 }
461548 if ((merged._3 > amt))
462549 then throw(((("Insufficient payment! Attached=" + toString(amt)) + ", required=") + toString(merged._3)))
463550 else {
464551 let newPack = makeString([currentPack[bpIdxLevel], makeString(merged._1, "_"), makeString(merged._2, "_"), currentPack[bpIdxProd]], ":")
465552 let result = asString(invoke(stakingContract, "updateBackpack", [duckAssetId, newPack], nil))
466553 let rest = if (((amt - merged._3) > 0))
467554 then [ScriptTransfer(i.caller, (amt - merged._3), usdnAssetId)]
468555 else nil
469556 $Tuple2((rest ++ merged._4), result)
470557 }
471558 }
472559 }
473560 }
474561 }
475562 else throw("Strict value is not equal to itself.")
476563 }
477564
478565
479566
480567 @Callable(i)
481568 func buyGoods (productIdx,level,quantity) = {
482569 let blocked = checkBlocked()
483570 if ((blocked == blocked))
484571 then if ((size(i.payments) != 0))
485572 then throw("buyGoods doesn't require any payments")
486573 else if ((0 > quantity))
487574 then throw("Quantity should be positive")
488575 else {
489576 let duckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked")
490577 let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_")
491578 if ((curLocation[locIdxType] != "M"))
492579 then throw(("Duck location type should be Manufactory, but is " + curLocation[locIdxType]))
493580 else {
494581 let cont = curLocation[locIdxContinent]
495582 let currentPack = getBackpack(keyBackpackByDuck(duckAssetId))
496583 let matList = split(currentPack[bpIdxMat], "_")
497584 if (if ((0 > productIdx))
498585 then true
499586 else (productIdx >= size(productionMatrix)))
500587 then throw(("Unknown product idx=" + toString(productIdx)))
501588 else {
502589 let productContIdx = (productIdx % size(continents))
503590 if ((continents[productContIdx] != cont))
504591 then throw(((("This product is available in " + continents[productContIdx]) + ", but you are in ") + cont))
505592 else {
506593 let recipe = split(productionMatrix[productIdx], "_")
507594 if ((size(recipe) != (NUMRES + 2)))
508595 then throw(("Fatal: unknown recipe: " + productionMatrix[productIdx]))
509596 else {
510597 let prodList = if ((currentPack[bpIdxProd] == ""))
511598 then nil
512599 else split(currentPack[bpIdxProd], "_")
513600 func filler (acc,ignoredItem) = {
514601 let n = acc._2
515602 let x = if ((size(prodList) > n))
516603 then split(prodList[n], ",")
517604 else ["0", "0", "0"]
518605 let x1s = x[0]
519606 let x1 = parseIntValue(x1s)
520607 let x2s = x[1]
521608 let x2 = parseIntValue(x2s)
522609 let x3s = x[2]
523610 let x3 = parseIntValue(x3s)
524611 let amount = (quantity * parseIntValue(recipe[7]))
525612 let y = if ((n == productIdx))
526613 then match level {
527614 case _ =>
528615 if ((1 == $match0))
529616 then ((((toString((x1 + amount)) + ",") + x2s) + ",") + x3s)
530617 else if ((2 == $match0))
531618 then ((((x1s + ",") + toString((x2 + amount))) + ",") + x3s)
532619 else if ((3 == $match0))
533620 then ((((x1s + ",") + x2s) + ",") + toString((x3 + amount)))
534621 else throw(("Product level should be 1..3, not " + toString(level)))
535622 }
536623 else ((((x1s + ",") + x2s) + ",") + x3s)
537624 $Tuple2((acc._1 :+ y), (n + 1))
538625 }
539626
540627 let bpProd = ( let $l = productionMatrix
541628 let $s = size($l)
542629 let $acc0 = $Tuple2(nil, 0)
543630 func $f0_1 ($a,$i) = if (($i >= $s))
544631 then $a
545632 else filler($a, $l[$i])
546633
547634 func $f0_2 ($a,$i) = if (($i >= $s))
548635 then $a
549636 else throw("List size exceeds 50")
550637
551638 $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($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))._1
552639 func producer (acc,j) = {
553640 let needMat = (parseIntValue(recipe[j]) * quantity)
554641 let haveMat = parseIntValue(matList[j])
555642 if ((needMat > haveMat))
556643 then throw(((((((("You have " + matList[j]) + " of ") + matTypes[j]) + ", but recipe requires ") + toString(needMat)) + " for quantity ") + toString(quantity)))
557644 else if ((needMat > 0))
558645 then (acc :+ toString((haveMat - needMat)))
559646 else (acc :+ matList[j])
560647 }
561648
562649 let merged = {
563650 let $l = [0, 1, 2, 3, 4, 5]
564651 let $s = size($l)
565652 let $acc0 = nil
566653 func $f1_1 ($a,$i) = if (($i >= $s))
567654 then $a
568655 else producer($a, $l[$i])
569656
570657 func $f1_2 ($a,$i) = if (($i >= $s))
571658 then $a
572659 else throw("List size exceeds 6")
573660
574661 $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6)
575662 }
576663 let newPack = makeString([currentPack[bpIdxLevel], currentPack[bpIdxRes], makeString(merged, "_"), makeString(bpProd, "_")], ":")
577664 let result = asString(invoke(stakingContract, "updateBackpack", [duckAssetId, newPack], nil))
578665 $Tuple2(nil, result)
579666 }
580667 }
581668 }
582669 }
583670 }
584671 else throw("Strict value is not equal to itself.")
585672 }
586673
587674
588675
589676 @Callable(i)
590677 func acceptServicePayment (service) = {
591678 let blocked = checkBlocked()
592679 if ((blocked == blocked))
593680 then if ((size(i.payments) != 1))
594681 then throw("exactly 1 payment must be attached")
595682 else {
596683 let pmt = i.payments[0]
597684 let amt = pmt.amount
598685 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment")
599686 if ((pmtAssetId != usdnAssetId))
600687 then throw("USDN payments only!")
601688 else {
602689 let need = match service {
603690 case _ =>
604691 if (("LAND_RENAME" == $match0))
605692 then 10000000
606693 else throw("Unknown service!")
607694 }
608695 if ((amt != need))
609696 then throw((((service + " costs ") + toString(need)) + " USDN"))
610697 else $Tuple2(nil, amt)
611698 }
612699 }
613700 else throw("Strict value is not equal to itself.")
614701 }
615702
616703
617704
618705 @Callable(i)
619706 func setWarehouseOrder (cargoListStr,landAssetId) = {
620707 let user = i.originCaller
621708 let addr = toString(user)
622709 let asset = value(assetInfo(fromBase58String(landAssetId)))
623710 if (!(isDefined(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)))))
624711 then throw((("NFT " + asset.name) + " is not staked"))
625712 else {
626713 let owner = valueOrErrorMessage(getString(stakingContract, keyLandAssetIdToOwner(landAssetId)), (("NFT " + asset.name) + " is orphaned"))
627714 if ((owner != addr))
628715 then throw((LANDPREFIX + " is not yours"))
629716 else {
630717 let cargoParts = split_4C(cargoListStr, ":")
631718 if ((size(cargoParts) != 3))
632719 then throw("cargoListStr should contain exactly 2 ':' separators")
633720 else {
634721 let resParts = split(cargoParts[0], "_")
635722 let matParts = split(cargoParts[1], "_")
636723 let prodParts = if ((cargoParts[2] == ""))
637724 then nil
638725 else split(cargoParts[2], "_")
639726 if ((size(resParts) != NUMRES))
640727 then throw("All 6 resources should be passed")
641728 else if ((size(matParts) != NUMRES))
642729 then throw("All 6 materials should be passed")
643730 else {
644731 let wh = asString(invoke(stakingContract, "getWarehouseREADONLY", [landAssetId], nil))
645732 let currentWh = split_4C(wh, ":")
646733 let currWhRes = split(currentWh[whIdxRes], "_")
647734 let currWhMat = split(currentWh[whIdxMat], "_")
648735 let currWhProd = if ((currentWh[whIdxProd] == ""))
649736 then nil
650737 else split(currentWh[whIdxProd], "_")
651738 let currWhResVol = getWarehouseCurrResVolume(currentWh)
652739 let currWhMatVol = getWarehouseCurrMatVolume(currentWh)
653740 let currWhGoodsVol = getWarehouseCurrGoodsVolume(currentWh)
654741 let currWhLockedVol = parseIntValue(currentWh[whIdxLockedVol])
655742 let whSpaceLeft = ((((getWarehouseVolume(currentWh[whIdxVol]) - currWhResVol) - currWhMatVol) - currWhGoodsVol) - currWhLockedVol)
656743 let ordKey = keyOrderByLand(landAssetId)
657744 let currentOrd = getOrder(ordKey)
658745 let currentOrdRes = split(currentOrd[ordIdxRes], "_")
659746 let currentOrdMat = split(currentOrd[ordIdxMat], "_")
660747 let currentOrdProd = if ((currentOrd[ordIdxProd] == ""))
661748 then nil
662749 else split(currentOrd[ordIdxProd], "_")
663750 let usdnNeed2Lock = 0
664- func ordR (acc,item) = {
665- let j = acc._1
666- let itemParts = split(item, "@")
667- if ((size(itemParts) != 2))
668- then throw("Incorrect order format, should be amount@price")
669- else {
670- let newOrdAm = parseIntValue(itemParts[0])
671- let newOrdPr = parseIntValue(itemParts[1])
672- let newOrdUsd = fraction(newOrdAm, newOrdPr, MULT8)
673- let whr = parseIntValue(currWhRes[j])
674- let curOrdParts = split(currentOrdRes[j], "@")
675- let curOrdAm = parseIntValue(curOrdParts[0])
676- let curOrdPr = parseIntValue(curOrdParts[1])
677- if ((0 > curOrdPr))
678- then throw("Price can't be negative")
679- else {
680- let curOrdUsd = fraction(curOrdAm, curOrdPr, MULT8)
681- if ((newOrdAm == 0))
682- then if ((curOrdAm > 0))
683- then $Tuple4((j + 1), (acc._2 :+ toString(whr)), (acc._3 - curOrdAm), (acc._4 - curOrdUsd))
684- else $Tuple4((j + 1), (acc._2 :+ toString((whr - curOrdAm))), (acc._3 + curOrdAm), acc._4)
685- else if ((newOrdAm > 0))
686- then if ((0 > curOrdAm))
687- then {
688- let amDiff = (newOrdAm + curOrdAm)
689- $Tuple4((j + 1), (acc._2 :+ toString((whr - curOrdAm))), (acc._3 + amDiff), (acc._4 + newOrdUsd))
690- }
691- else $Tuple4((j + 1), (acc._2 :+ toString(whr)), ((acc._3 + newOrdAm) - curOrdAm), ((acc._4 + newOrdUsd) - curOrdUsd))
692- else if ((0 > curOrdAm))
693- then {
694- let amDiff = (curOrdAm - newOrdAm)
695- if ((0 > (whr - amDiff)))
696- then throw((((("Attempt to take " + toString(amDiff)) + " from warehouse, but only ") + toString(whr)) + " available"))
697- else $Tuple4((j + 1), (acc._2 :+ toString((whr - amDiff))), (acc._3 + amDiff), acc._4)
698- }
699- else if ((0 > (whr + newOrdAm)))
700- then throw((((("Attempt to take " + toString(-(newOrdAm))) + " from warehouse, but only ") + toString(whr)) + " available"))
701- else $Tuple4((j + 1), (acc._2 :+ toString((whr + newOrdAm))), ((acc._3 - newOrdAm) - curOrdAm), (acc._4 - curOrdUsd))
702- }
703- }
704- }
705-
706751 let r = {
707752 let $l = resParts
708753 let $s = size($l)
709- let $acc0 = $Tuple4(0, nil, 0, 0)
754+ let $acc0 = $Tuple6(0, nil, 0, 0, currWhRes, currentOrdRes)
710755 func $f0_1 ($a,$i) = if (($i >= $s))
711756 then $a
712- else ordR($a, $l[$i])
757+ else setCommon($a, $l[$i])
713758
714759 func $f0_2 ($a,$i) = if (($i >= $s))
715760 then $a
716761 else throw("List size exceeds 6")
717762
718763 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
719764 }
720- func ordM (acc,item) = {
721- let j = acc._1
722- let itemParts = split(item, "@")
723- if ((size(itemParts) != 2))
724- then throw("Incorrect order format, should be amount@price")
725- else {
726- let newOrdAm = parseIntValue(itemParts[0])
727- let newOrdPr = parseIntValue(itemParts[1])
728- let newOrdUsd = fraction(newOrdAm, newOrdPr, MULT8)
729- let whm = parseIntValue(currWhMat[j])
730- let curOrdParts = split(currentOrdMat[j], "@")
731- let curOrdAm = parseIntValue(curOrdParts[0])
732- let curOrdPr = parseIntValue(curOrdParts[1])
733- if ((0 > curOrdPr))
734- then throw("Price can't be negative")
735- else {
736- let curOrdUsd = fraction(curOrdAm, curOrdPr, MULT8)
737- if ((newOrdAm == 0))
738- then if ((curOrdAm > 0))
739- then $Tuple4((j + 1), (acc._2 :+ toString(whm)), (acc._3 - curOrdAm), (acc._4 - curOrdUsd))
740- else $Tuple4((j + 1), (acc._2 :+ toString((whm - curOrdAm))), (acc._3 + curOrdAm), acc._4)
741- else if ((newOrdAm > 0))
742- then if ((0 > curOrdAm))
743- then {
744- let amDiff = (newOrdAm + curOrdAm)
745- $Tuple4((j + 1), (acc._2 :+ toString((whm - curOrdAm))), (acc._3 + amDiff), (acc._4 + newOrdUsd))
746- }
747- else $Tuple4((j + 1), (acc._2 :+ toString(whm)), ((acc._3 + newOrdAm) - curOrdAm), ((acc._4 + newOrdUsd) - curOrdUsd))
748- else if ((0 > curOrdAm))
749- then {
750- let amDiff = (curOrdAm - newOrdAm)
751- if ((0 > (whm - amDiff)))
752- then throw((((("Attempt to take " + toString(amDiff)) + " from warehouse, but only ") + toString(whm)) + " available"))
753- else $Tuple4((j + 1), (acc._2 :+ toString((whm - amDiff))), (acc._3 + amDiff), acc._4)
754- }
755- else if ((0 > (whm + newOrdAm)))
756- then throw((((("Attempt to take " + toString(-(newOrdAm))) + " from warehouse, but only ") + toString(whm)) + " available"))
757- else $Tuple4((j + 1), (acc._2 :+ toString((whm + newOrdAm))), ((acc._3 - newOrdAm) - curOrdAm), (acc._4 - curOrdUsd))
758- }
759- }
760- }
761-
762765 let m = {
763766 let $l = matParts
764767 let $s = size($l)
765- let $acc0 = $Tuple4(0, nil, r._3, r._4)
768+ let $acc0 = $Tuple6(0, nil, r._3, r._4, currWhMat, currentOrdMat)
766769 func $f1_1 ($a,$i) = if (($i >= $s))
767770 then $a
768- else ordM($a, $l[$i])
771+ else setCommon($a, $l[$i])
769772
770773 func $f1_2 ($a,$i) = if (($i >= $s))
771774 then $a
772775 else throw("List size exceeds 6")
773776
774777 $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6)
775778 }
776- func ordP (acc,item) = {
777- let j = acc._1
778- let itemParts = split(item, "@")
779- if ((size(itemParts) != 2))
780- then throw("Incorrect order format, should be amount@price")
781- else {
782- let newOrdAm = parseIntValue(itemParts[0])
783- let newOrdPr = parseIntValue(itemParts[1])
784- let newOrdUsd = fraction(newOrdAm, newOrdPr, MULT8)
785- let whp = parseIntValue(currWhProd[j])
786- let curOrdParts = split(currentOrdProd[j], "@")
787- let curOrdAm = parseIntValue(curOrdParts[0])
788- let curOrdPr = parseIntValue(curOrdParts[1])
789- if ((0 > curOrdPr))
790- then throw("Price can't be negative")
791- else {
792- let curOrdUsd = fraction(curOrdAm, curOrdPr, MULT8)
793- if ((newOrdAm == 0))
794- then if ((curOrdAm > 0))
795- then $Tuple4((j + 1), (acc._2 :+ toString(whp)), (acc._3 - curOrdAm), (acc._4 - curOrdUsd))
796- else $Tuple4((j + 1), (acc._2 :+ toString((whp - curOrdAm))), (acc._3 + curOrdAm), acc._4)
797- else if ((newOrdAm > 0))
798- then if ((0 > curOrdAm))
799- then {
800- let amDiff = (newOrdAm + curOrdAm)
801- $Tuple4((j + 1), (acc._2 :+ toString((whp - curOrdAm))), (acc._3 + amDiff), (acc._4 + newOrdUsd))
802- }
803- else $Tuple4((j + 1), (acc._2 :+ toString(whp)), ((acc._3 + newOrdAm) - curOrdAm), ((acc._4 + newOrdUsd) - curOrdUsd))
804- else if ((0 > curOrdAm))
805- then {
806- let amDiff = (curOrdAm - newOrdAm)
807- if ((0 > (whp - amDiff)))
808- then throw((((("Attempt to take " + toString(amDiff)) + " from warehouse, but only ") + toString(whp)) + " available"))
809- else $Tuple4((j + 1), (acc._2 :+ toString((whp - amDiff))), (acc._3 + amDiff), acc._3)
810- }
811- else if ((0 > (whp + newOrdAm)))
812- then throw((((("Attempt to take " + toString(-(newOrdAm))) + " from warehouse, but only ") + toString(whp)) + " available"))
813- else $Tuple4((j + 1), (acc._2 :+ toString((whp + newOrdAm))), ((acc._3 - newOrdAm) - curOrdAm), (acc._4 - curOrdUsd))
814- }
815- }
816- }
817-
818779 let p = {
819780 let $l = prodParts
820781 let $s = size($l)
821- let $acc0 = $Tuple4(0, nil, m._3, m._4)
782+ let $acc0 = $Tuple6(0, nil, m._3, m._4, currWhProd, currentOrdProd)
822783 func $f2_1 ($a,$i) = if (($i >= $s))
823784 then $a
824- else ordP($a, $l[$i])
785+ else setCommon($a, $l[$i])
825786
826787 func $f2_2 ($a,$i) = if (($i >= $s))
827788 then $a
828789 else throw("List size exceeds 50")
829790
830791 $f2_2($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_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)
831792 }
832793 let volSaldo = p._3
833794 if ((volSaldo > whSpaceLeft))
834795 then throw((((("Attempt to reserve " + toString(volSaldo)) + " space, but only ") + toString(whSpaceLeft)) + " warehouse space left"))
835796 else {
836797 let whStr = makeString_2C([currentWh[whIdxVol], makeString(r._2, "_"), makeString(m._2, "_"), makeString(p._2, "_"), toString(volSaldo)], ":")
837798 let whSave = invoke(stakingContract, "saveWarehouse", [whStr, landAssetId], nil)
838799 if ((whSave == whSave))
839800 then {
840801 let usdSaldo = p._4
841802 if ((usdSaldo > 0))
842803 then if ((size(i.payments) != 1))
843804 then throw("exactly 1 payment must be attached")
844805 else {
845806 let pmt = i.payments[0]
846807 let amt = pmt.amount
847808 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment")
848809 if ((pmtAssetId != usdnAssetId))
849810 then throw("USDN payments only!")
850811 else if ((amt != usdSaldo))
851812 then throw(("Payment needed is " + toString(usdSaldo)))
852813 else [StringEntry(ordKey, cargoListStr)]
853814 }
854815 else if ((usdSaldo == 0))
855816 then if ((size(i.payments) != 0))
856817 then throw("No payments needed")
857818 else [StringEntry(ordKey, cargoListStr)]
858819 else if ((size(i.payments) != 0))
859820 then throw("No payments needed")
860821 else [ScriptTransfer(user, -(usdSaldo), usdnAssetId), StringEntry(ordKey, cargoListStr)]
861822 }
862823 else throw("Strict value is not equal to itself.")
863824 }
864825 }
865826 }
866827 }
867828 }
868829 }
869830
870831
871832
872833 @Callable(i)
873834 func acceptWarehouseOrder (bpOrderStr,landAssetId,duckAssetId) = {
874835 let caller = i.originCaller
875836 let callerAddr = toString(caller)
876837 let stakedDuckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(callerAddr)), "You don't have a duck staked")
877838 let curLocation = valueOrElse(getString(stakingContract, keyDuckLocation(stakedDuckAssetId)), DEFAULTLOCATION)
878839 let loc = split(value(curLocation), "_")
879840 if ((loc[locIdxType] != "L"))
880841 then throw((("Duck location type is " + loc[locIdxType]) + ", but should be L"))
881842 else if ((stakedDuckAssetId != duckAssetId))
882843 then throw(((("Your staked duck is " + stakedDuckAssetId) + ", but passed ") + duckAssetId))
883844 else {
884845 let landAsset = value(assetInfo(fromBase58String(landAssetId)))
885846 if (!(isDefined(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId)))))
886847 then throw((("NFT " + landAsset.name) + " is not staked"))
887848 else {
888849 let landOwner = valueOrErrorMessage(getString(stakingContract, keyLandAssetIdToOwner(landAssetId)), (("NFT " + landAsset.name) + " is orphaned"))
889850 if ((landOwner == callerAddr))
890851 then throw("You cannot trade with yourself")
891852 else {
892853 let bpOrderParts = split_4C(bpOrderStr, ":")
893854 if ((size(bpOrderParts) != 3))
894855 then throw("bpOrderStr should contain exactly 2 ':' separators")
895856 else {
896857 let bpOrdRes = split(bpOrderParts[0], "_")
897858 let bpOrdMat = split(bpOrderParts[1], "_")
898859 let bpOrdProd = if ((bpOrderParts[2] == ""))
899860 then nil
900861 else split(bpOrderParts[2], "_")
901862 if ((size(bpOrdRes) != NUMRES))
902863 then throw("All 6 resources should be passed")
903864 else if ((size(bpOrdMat) != NUMRES))
904865 then throw("All 6 materials should be passed")
905866 else {
906867 let wh = asString(invoke(stakingContract, "getWarehouseREADONLY", [landAssetId], nil))
907868 let currentWh = split_4C(wh, ":")
908869 let currWhRes = split(currentWh[whIdxRes], "_")
909870 let currWhMat = split(currentWh[whIdxMat], "_")
910871 let currWhProd = if ((currentWh[whIdxProd] == ""))
911872 then nil
912873 else split(currentWh[whIdxProd], "_")
913874 let currWhResVol = getWarehouseCurrResVolume(currentWh)
914875 let currWhMatVol = getWarehouseCurrMatVolume(currentWh)
915876 let currWhGoodsVol = getWarehouseCurrGoodsVolume(currentWh)
916877 let currWhLockedVol = parseIntValue(currentWh[whIdxLockedVol])
917878 let whSpaceLeft = ((((getWarehouseVolume(currentWh[whIdxVol]) - currWhResVol) - currWhMatVol) - currWhGoodsVol) - currWhLockedVol)
918879 let bpKey = keyBackpackByDuck(duckAssetId)
919880 let currentPack = getBackpack(bpKey)
920881 let bpResList = split(currentPack[bpIdxRes], "_")
921882 let bpMatList = split(currentPack[bpIdxMat], "_")
922883 let bpProdList = if ((currentPack[bpIdxProd] == ""))
923884 then nil
924885 else split(currentPack[bpIdxProd], "_")
925886 let ordKey = keyOrderByLand(landAssetId)
926887 let whOrd = getOrder(ordKey)
927888 let whOrdRes = split(whOrd[ordIdxRes], "_")
928889 let whOrdMat = split(whOrd[ordIdxMat], "_")
929890 let whOrdProd = if ((whOrd[ordIdxProd] == ""))
930891 then nil
931892 else split(whOrd[ordIdxProd], "_")
932893 let usdnNeed2Lock = 0
933- func ordR (acc,j) = {
934- let bpOrdResParts = split(bpOrdRes[j], "@")
935- if ((size(bpOrdResParts) != 2))
936- then throw("Incorrect order format, should be amount@price")
937- else {
938- let bpOrdAm = parseIntValue(bpOrdResParts[0])
939- let bpOrdPr = parseIntValue(bpOrdResParts[1])
940- if ((0 > bpOrdPr))
941- then throw("Price can't be negative")
942- else {
943- let bpOrdUsd = fraction(bpOrdAm, bpOrdPr, MULT8)
944- let bpr = parseIntValue(bpResList[j])
945- let whr = parseIntValue(currWhRes[j])
946- let whOrdParts = split(whOrdRes[j], "@")
947- let whOrdAm = parseIntValue(whOrdParts[0])
948- let whOrdPr = parseIntValue(whOrdParts[1])
949- if (if ((bpOrdAm != 0))
950- then (bpOrdPr != whOrdPr)
951- else false)
952- then throw(((((("Prices of " + resTypes[j]) + " don't match! WH price=") + toString(whOrdPr)) + ", your price=") + toString(bpOrdPr)))
953- else {
954- let whOrdUsd = fraction(whOrdAm, whOrdPr, MULT8)
955- if ((bpOrdAm == 0))
956- then $Tuple6((acc._1 :+ currWhRes[j]), (acc._2 :+ whOrdRes[j]), (acc._3 :+ bpResList[j]), acc._4, acc._5, acc._6)
957- else if ((bpOrdAm > 0))
958- then if ((0 > whOrdAm))
959- then if ((bpOrdAm > -(whOrdAm)))
960- then throw(((((("Attempt to buy " + toString(bpOrdAm)) + " of ") + resTypes[j]) + ", but warehouse only sells ") + toString(-(whOrdAm))))
961- else $Tuple6((acc._1 :+ currWhRes[j]), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpr + bpOrdAm))), (acc._4 + bpOrdAm), acc._5, (acc._6 + bpOrdUsd))
962- else throw((("Attempt to buy " + resTypes[j]) + " while warehouse doesn't sell it"))
963- else if ((whOrdAm > 0))
964- then if ((-(bpOrdAm) > whOrdAm))
965- then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + " of ") + resTypes[j]) + ", but warehouse only buys ") + toString(whOrdAm)))
966- else if ((-(bpOrdAm) > bpr))
967- then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + ", but you only have ") + bpResList[j]) + " of ") + resTypes[j]))
968- else $Tuple6((acc._1 :+ toString((whr - bpOrdAm))), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpr + bpOrdAm))), (acc._4 - bpOrdAm), (acc._5 - bpOrdUsd), acc._6)
969- else throw((("Attempt to sell " + resTypes[j]) + " while warehouse doesn't buy it"))
970- }
971- }
972- }
973- }
974-
975894 let r = {
976- let $l = [0, 1, 2, 3, 4, 5]
895+ let $l = bpOrdRes
977896 let $s = size($l)
978- let $acc0 = $Tuple6(nil, nil, nil, 0, 0, 0)
897+ let $acc0 = $Tuple10(nil, nil, nil, 0, 0, 0, 0, bpResList, currWhRes, whOrdRes)
979898 func $f0_1 ($a,$i) = if (($i >= $s))
980899 then $a
981- else ordR($a, $l[$i])
900+ else acceptCommon($a, $l[$i])
982901
983902 func $f0_2 ($a,$i) = if (($i >= $s))
984903 then $a
985904 else throw("List size exceeds 6")
986905
987906 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
988907 }
989- func ordM (acc,j) = {
990- let bpOrdMatParts = split(bpOrdMat[j], "@")
991- if ((size(bpOrdMatParts) != 2))
992- then throw("Incorrect order format, should be amount@price")
993- else {
994- let bpOrdAm = parseIntValue(bpOrdMatParts[0])
995- let bpOrdPr = parseIntValue(bpOrdMatParts[1])
996- if ((0 > bpOrdPr))
997- then throw("Price can't be negative")
998- else {
999- let bpOrdUsd = fraction(bpOrdAm, bpOrdPr, MULT8)
1000- let bpm = parseIntValue(bpMatList[j])
1001- let whm = parseIntValue(currWhMat[j])
1002- let whOrdParts = split(whOrdMat[j], "@")
1003- let whOrdAm = parseIntValue(whOrdParts[0])
1004- let whOrdPr = parseIntValue(whOrdParts[1])
1005- if (if ((bpOrdAm != 0))
1006- then (bpOrdPr != whOrdPr)
1007- else false)
1008- then throw(((((("Prices of " + matTypes[j]) + " don't match! WH price=") + toString(whOrdPr)) + ", your price=") + toString(bpOrdPr)))
1009- else {
1010- let whOrdUsd = fraction(whOrdAm, whOrdPr, MULT8)
1011- if ((bpOrdAm == 0))
1012- then $Tuple6((acc._1 :+ currWhMat[j]), (acc._2 :+ whOrdMat[j]), (acc._3 :+ bpMatList[j]), acc._4, acc._5, acc._6)
1013- else if ((bpOrdAm > 0))
1014- then if ((0 > whOrdAm))
1015- then if ((bpOrdAm > -(whOrdAm)))
1016- then throw(((((("Attempt to buy " + toString(bpOrdAm)) + " of ") + matTypes[j]) + ", but warehouse only sells ") + toString(-(whOrdAm))))
1017- else $Tuple6((acc._1 :+ currWhMat[j]), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpm + bpOrdAm))), (acc._4 + bpOrdAm), acc._5, (acc._6 + bpOrdUsd))
1018- else throw((("Attempt to buy " + matTypes[j]) + " while warehouse doesn't sell it"))
1019- else if ((whOrdAm > 0))
1020- then if ((-(bpOrdAm) > whOrdAm))
1021- then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + " of ") + matTypes[j]) + ", but warehouse only buys ") + toString(whOrdAm)))
1022- else if ((-(bpOrdAm) > bpm))
1023- then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + ", but you only have ") + bpMatList[j]) + " of ") + matTypes[j]))
1024- else $Tuple6((acc._1 :+ toString((whm - bpOrdAm))), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpm + bpOrdAm))), (acc._4 - bpOrdAm), (acc._5 - bpOrdUsd), acc._6)
1025- else throw((("Attempt to sell " + matTypes[j]) + " while warehouse doesn't buy it"))
1026- }
1027- }
1028- }
1029- }
1030-
1031908 let m = {
1032- let $l = [0, 1, 2, 3, 4, 5]
909+ let $l = bpOrdMat
1033910 let $s = size($l)
1034- let $acc0 = $Tuple6(nil, nil, nil, r._4, r._5, r._6)
911+ let $acc0 = $Tuple10(nil, nil, nil, r._4, r._5, r._6, 0, bpMatList, currWhMat, whOrdMat)
1035912 func $f1_1 ($a,$i) = if (($i >= $s))
1036913 then $a
1037- else ordM($a, $l[$i])
914+ else acceptCommon($a, $l[$i])
1038915
1039916 func $f1_2 ($a,$i) = if (($i >= $s))
1040917 then $a
1041918 else throw("List size exceeds 6")
1042919
1043920 $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6)
1044921 }
1045- func ordP (acc,bpOrdProdItem) = {
1046- let j = acc._7
1047- let bpOrdProdParts = split(bpOrdProdItem, "@")
1048- if ((size(bpOrdProdParts) != 2))
1049- then throw("Incorrect order format, should be amount@price")
1050- else {
1051- let bpOrdAm = parseIntValue(bpOrdProdParts[0])
1052- let bpOrdPr = parseIntValue(bpOrdProdParts[1])
1053- if ((0 > bpOrdPr))
1054- then throw("Price can't be negative")
1055- else {
1056- let bpOrdUsd = fraction(bpOrdAm, bpOrdPr, MULT8)
1057- let bpp = parseIntValue(bpProdList[j])
1058- let whp = parseIntValue(currWhProd[j])
1059- let whOrdParts = split(whOrdProd[j], "@")
1060- let whOrdAm = parseIntValue(whOrdParts[0])
1061- let whOrdPr = parseIntValue(whOrdParts[1])
1062- if (if ((bpOrdAm != 0))
1063- then (bpOrdPr != whOrdPr)
1064- else false)
1065- then throw(((((("Prices of " + prodTypes[j]) + " don't match! WH price=") + toString(whOrdPr)) + ", your price=") + toString(bpOrdPr)))
1066- else {
1067- let whOrdUsd = fraction(whOrdAm, whOrdPr, MULT8)
1068- if ((bpOrdAm == 0))
1069- then $Tuple7((acc._1 :+ currWhProd[j]), (acc._2 :+ whOrdProd[j]), (acc._3 :+ bpProdList[j]), acc._4, acc._5, acc._6, (acc._7 + 1))
1070- else if ((bpOrdAm > 0))
1071- then if ((0 > whOrdAm))
1072- then if ((bpOrdAm > -(whOrdAm)))
1073- then throw(((((("Attempt to buy " + toString(bpOrdAm)) + " of ") + prodTypes[j]) + ", but warehouse only sells ") + toString(-(whOrdAm))))
1074- else $Tuple7((acc._1 :+ currWhProd[j]), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpp + bpOrdAm))), (acc._4 + bpOrdAm), acc._5, (acc._6 + bpOrdUsd), (acc._7 + 1))
1075- else throw((("Attempt to buy " + prodTypes[j]) + " while warehouse doesn't sell it"))
1076- else if ((whOrdAm > 0))
1077- then if ((-(bpOrdAm) > whOrdAm))
1078- then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + " of ") + prodTypes[j]) + ", but warehouse only buys ") + toString(whOrdAm)))
1079- else if ((-(bpOrdAm) > bpp))
1080- then throw(((((("Attempt to sell " + toString(-(bpOrdAm))) + ", but you only have ") + bpProdList[j]) + " of ") + prodTypes[j]))
1081- else $Tuple7((acc._1 :+ toString((whp - bpOrdAm))), (acc._2 :+ ((toString((whOrdAm + bpOrdAm)) + "@") + toString(whOrdPr))), (acc._3 :+ toString((bpp + bpOrdAm))), (acc._4 - bpOrdAm), (acc._5 - bpOrdUsd), acc._6, (acc._7 + 1))
1082- else throw((("Attempt to sell " + prodTypes[j]) + " while warehouse doesn't buy it"))
1083- }
1084- }
1085- }
1086- }
1087-
1088922 let p = {
1089923 let $l = bpOrdProd
1090924 let $s = size($l)
1091- let $acc0 = $Tuple7(nil, nil, nil, m._4, m._5, m._6, 0)
925+ let $acc0 = $Tuple10(nil, nil, nil, m._4, m._5, m._6, 0, bpProdList, currWhProd, whOrdProd)
1092926 func $f2_1 ($a,$i) = if (($i >= $s))
1093927 then $a
1094- else ordP($a, $l[$i])
928+ else acceptCommon($a, $l[$i])
1095929
1096930 func $f2_2 ($a,$i) = if (($i >= $s))
1097931 then $a
1098932 else throw("List size exceeds 50")
1099933
1100934 $f2_2($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_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)
1101935 }
1102936 let volSaldo = p._4
1103937 let newLockedVol = if ((0 > (currWhLockedVol - volSaldo)))
1104938 then 0
1105939 else (currWhLockedVol - volSaldo)
1106940 let whStr = makeString_2C([currentWh[whIdxVol], makeString(r._1, "_"), makeString(m._1, "_"), makeString(p._1, "_"), toString(newLockedVol)], ":")
1107941 let newWhOrdStr = makeString_2C([makeString(r._2, "_"), makeString(m._2, "_"), makeString(p._2, "_")], ":")
1108942 let newBpStr = makeString_2C([currentPack[bpIdxLevel], makeString(r._3, "_"), makeString(m._3, "_"), makeString(p._3, "_")], ":")
1109943 let whSave = invoke(stakingContract, "saveWarehouse", [whStr, landAssetId], nil)
1110944 if ((whSave == whSave))
1111945 then {
1112946 let bpSave = invoke(stakingContract, "updateBackpack", [duckAssetId, newBpStr], nil)
1113947 if ((bpSave == bpSave))
1114948 then {
1115949 let actions = [StringEntry(ordKey, newWhOrdStr)]
1116950 let usdWh2BpFee = fraction(p._5, AUCTIONFEE, MULT6)
1117951 let usdWh2BpSaldo = p._5
1118952 let actions1 = if ((usdWh2BpSaldo > 0))
1119953 then (actions :+ ScriptTransfer(caller, (p._5 - usdWh2BpFee), usdnAssetId))
1120954 else actions
1121955 let usdBp2WhFee = fraction(p._6, AUCTIONFEE, MULT6)
1122956 let usdBp2WhSaldo = p._6
1123957 if ((usdBp2WhSaldo > 0))
1124958 then if ((size(i.payments) != 1))
1125959 then throw("exactly 1 payment must be attached")
1126960 else {
1127961 let pmt = i.payments[0]
1128962 let amt = pmt.amount
1129963 let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment")
1130964 if ((pmtAssetId != usdnAssetId))
1131965 then throw("USDN payments only!")
1132966 else if ((amt != usdBp2WhSaldo))
1133967 then throw(("Payment needed is " + toString(usdBp2WhSaldo)))
1134968 else (actions1 :+ ScriptTransfer(addressFromStringValue(landOwner), (p._6 - usdBp2WhFee), usdnAssetId))
1135969 }
1136970 else if ((size(i.payments) != 0))
1137971 then throw("No payments needed")
1138972 else actions1
1139973 }
1140974 else throw("Strict value is not equal to itself.")
1141975 }
1142976 else throw("Strict value is not equal to itself.")
1143977 }
1144978 }
1145979 }
1146980 }
1147981 }
1148982 }
1149983
1150984

github/deemru/w8io/169f3d6 
190.71 ms