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:BgIxCAISAwoBCBIECgIRERIECgIRERIDCgEREgUKAwEBARIDCgEIEgQKAggIEgUKAwgICEsAA1NFUAICX18ABU1VTFQ2AMCEPQAFTVVMVDgAgMLXLwAGTVVMVDEwAIDIr6AlAAVjaGFpbgkAyQECCQDKAQIIBQR0aGlzBWJ5dGVzAAEAAQALdXNkbkFzc2V0SWQEByRtYXRjaDAFBWNoYWluAwkAAAIBAVcFByRtYXRjaDABILYmKcME9c5TkaQOS3UkL2SMUbH6369UKb1I0h0qsqrRAwkAAAIBAVQFByRtYXRjaDABIPd26vf3g8pl224T7gI7z1gplanB0Y3yS9ps2B1igMjeCQACAQINVW5rbm93biBjaGFpbgAVZGVmYXVsdFJlc3RBZGRyZXNzU3RyBAckbWF0Y2gwBQVjaGFpbgMJAAACAQFXBQckbWF0Y2gwAiMzUFFDdXZGYnZoNExrUFVucm5VMXozam5iQTFwOW0zV05odgMJAAACAQFUBQckbWF0Y2gwAiMzTXVta0dHenRDS0FYcFdEcXhrZGRvZnFYU1VicVFrdlNKeQkAAgECDVVua25vd24gY2hhaW4BD2dldFN0cmluZ09yRmFpbAIHYWRkcmVz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WxkbwkAzQgCBQhhY3Rpb25zMQkBDlNjcmlwdFRyYW5zZmVyAwkBEUBleHRyTmF0aXZlKDEwNjIpAQUJbGFuZE93bmVyCQBlAggFAXACXzYFC3VzZEJwMldoRmVlBQt1c2RuQXNzZXRJZAMJAQIhPQIJAJADAQgFAWkIcGF5bWVudHMAAAkAAgECEk5vIHBheW1lbnRzIG5lZWRlZAUIYWN0aW9uczEJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AGDdwpQ==", "height": 2519988, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: D8Ym5Yaxs2mf7dJkesir4SCVS5cdsTc711XgtTpfpg1A Next: H7sffFJyLftf7NJwoYGqNt59piPRhaiLsmqv9PLR1xJW Diff:
Old | New | Differences | |
---|---|---|---|
283 | 283 | func checkBlocked () = if (valueOrElse(getBoolean(stakingContract, keyBlocked()), false)) | |
284 | 284 | then throw("Contracts are under maintenance") | |
285 | 285 | 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 | + | } | |
286 | 373 | ||
287 | 374 | ||
288 | 375 | @Callable(i) | |
661 | 748 | then nil | |
662 | 749 | else split(currentOrd[ordIdxProd], "_") | |
663 | 750 | 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 | - | ||
706 | 751 | let r = { | |
707 | 752 | let $l = resParts | |
708 | 753 | let $s = size($l) | |
709 | - | let $acc0 = $ | |
754 | + | let $acc0 = $Tuple6(0, nil, 0, 0, currWhRes, currentOrdRes) | |
710 | 755 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
711 | 756 | then $a | |
712 | - | else | |
757 | + | else setCommon($a, $l[$i]) | |
713 | 758 | ||
714 | 759 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
715 | 760 | then $a | |
717 | 762 | ||
718 | 763 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
719 | 764 | } | |
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 | - | ||
762 | 765 | let m = { | |
763 | 766 | let $l = matParts | |
764 | 767 | let $s = size($l) | |
765 | - | let $acc0 = $ | |
768 | + | let $acc0 = $Tuple6(0, nil, r._3, r._4, currWhMat, currentOrdMat) | |
766 | 769 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
767 | 770 | then $a | |
768 | - | else | |
771 | + | else setCommon($a, $l[$i]) | |
769 | 772 | ||
770 | 773 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
771 | 774 | then $a | |
773 | 776 | ||
774 | 777 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
775 | 778 | } | |
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 | - | ||
818 | 779 | let p = { | |
819 | 780 | let $l = prodParts | |
820 | 781 | let $s = size($l) | |
821 | - | let $acc0 = $ | |
782 | + | let $acc0 = $Tuple6(0, nil, m._3, m._4, currWhProd, currentOrdProd) | |
822 | 783 | func $f2_1 ($a,$i) = if (($i >= $s)) | |
823 | 784 | then $a | |
824 | - | else | |
785 | + | else setCommon($a, $l[$i]) | |
825 | 786 | ||
826 | 787 | func $f2_2 ($a,$i) = if (($i >= $s)) | |
827 | 788 | then $a | |
930 | 891 | then nil | |
931 | 892 | else split(whOrd[ordIdxProd], "_") | |
932 | 893 | 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 | - | ||
975 | 894 | let r = { | |
976 | - | let $l = | |
895 | + | let $l = bpOrdRes | |
977 | 896 | let $s = size($l) | |
978 | - | let $acc0 = $ | |
897 | + | let $acc0 = $Tuple10(nil, nil, nil, 0, 0, 0, 0, bpResList, currWhRes, whOrdRes) | |
979 | 898 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
980 | 899 | then $a | |
981 | - | else | |
900 | + | else acceptCommon($a, $l[$i]) | |
982 | 901 | ||
983 | 902 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
984 | 903 | then $a | |
986 | 905 | ||
987 | 906 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
988 | 907 | } | |
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 | - | ||
1031 | 908 | let m = { | |
1032 | - | let $l = | |
909 | + | let $l = bpOrdMat | |
1033 | 910 | let $s = size($l) | |
1034 | - | let $acc0 = $ | |
911 | + | let $acc0 = $Tuple10(nil, nil, nil, r._4, r._5, r._6, 0, bpMatList, currWhMat, whOrdMat) | |
1035 | 912 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
1036 | 913 | then $a | |
1037 | - | else | |
914 | + | else acceptCommon($a, $l[$i]) | |
1038 | 915 | ||
1039 | 916 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
1040 | 917 | then $a | |
1042 | 919 | ||
1043 | 920 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
1044 | 921 | } | |
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 | - | ||
1088 | 922 | let p = { | |
1089 | 923 | let $l = bpOrdProd | |
1090 | 924 | let $s = size($l) | |
1091 | - | let $acc0 = $ | |
925 | + | let $acc0 = $Tuple10(nil, nil, nil, m._4, m._5, m._6, 0, bpProdList, currWhProd, whOrdProd) | |
1092 | 926 | func $f2_1 ($a,$i) = if (($i >= $s)) | |
1093 | 927 | then $a | |
1094 | - | else | |
928 | + | else acceptCommon($a, $l[$i]) | |
1095 | 929 | ||
1096 | 930 | func $f2_2 ($a,$i) = if (($i >= $s)) | |
1097 | 931 | then $a |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let MULT6 = 1000000 | |
7 | 7 | ||
8 | 8 | let MULT8 = 100000000 | |
9 | 9 | ||
10 | 10 | let MULT10 = 10000000000 | |
11 | 11 | ||
12 | 12 | let chain = take(drop(this.bytes, 1), 1) | |
13 | 13 | ||
14 | 14 | let usdnAssetId = match chain { | |
15 | 15 | case _ => | |
16 | 16 | if ((base58'2W' == $match0)) | |
17 | 17 | then base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p' | |
18 | 18 | else if ((base58'2T' == $match0)) | |
19 | 19 | then base58'HezsdQuRDtzksAYUy97gfhKy7Z1NW2uXYSHA3bgqenNZ' | |
20 | 20 | else throw("Unknown chain") | |
21 | 21 | } | |
22 | 22 | ||
23 | 23 | let defaultRestAddressStr = match chain { | |
24 | 24 | case _ => | |
25 | 25 | if ((base58'2W' == $match0)) | |
26 | 26 | then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv" | |
27 | 27 | else if ((base58'2T' == $match0)) | |
28 | 28 | then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy" | |
29 | 29 | else throw("Unknown chain") | |
30 | 30 | } | |
31 | 31 | ||
32 | 32 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func getIntOrElse (key,defaultVal) = valueOrElse(getInteger(this, key), defaultVal) | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | let IdxCfgStakingDapp = 1 | |
39 | 39 | ||
40 | 40 | let IdxCfgEconomyDapp = 2 | |
41 | 41 | ||
42 | 42 | let IdxCfgGovernanceDapp = 3 | |
43 | 43 | ||
44 | 44 | func keyRestCfg () = "%s__restConfig" | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func keyRestAddress () = "%s__restAddr" | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP) | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx))) | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr)) | |
57 | 57 | ||
58 | 58 | let restCfg = readRestCfgOrFail(restContract) | |
59 | 59 | ||
60 | 60 | let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp) | |
61 | 61 | ||
62 | 62 | let DEFAULTLOCATION = "Africa_F_Africa" | |
63 | 63 | ||
64 | 64 | let NUMRES = 6 | |
65 | 65 | ||
66 | 66 | let FACTORYMAXWAREHOUSE = 10000000000 | |
67 | 67 | ||
68 | 68 | let RESOURCEPRICEMIN = 158549 | |
69 | 69 | ||
70 | 70 | let MINPAYMENT = 10000 | |
71 | 71 | ||
72 | 72 | let SELLMULTIPLIER = 200 | |
73 | 73 | ||
74 | 74 | let BUYMULTIPLIER = 300 | |
75 | 75 | ||
76 | 76 | let LANDPREFIX = "LAND" | |
77 | 77 | ||
78 | 78 | let DUCKPREFIX = "DUCK" | |
79 | 79 | ||
80 | 80 | let WHMULTIPLIER = 10000000000 | |
81 | 81 | ||
82 | 82 | let AUCTIONFEE = 10000 | |
83 | 83 | ||
84 | 84 | let resTypes = ["Oil", "Ore", "Wood", "Sand", "Clay", "Organic"] | |
85 | 85 | ||
86 | 86 | let matTypes = ["Fuel", "Metal", "Plank", "Glass", "Plastic", "Protein"] | |
87 | 87 | ||
88 | 88 | let prodTypes = ["First Aid Kit", "Backpack", "Food Ration", "Jet Pack", "Radar"] | |
89 | 89 | ||
90 | 90 | let continents = ["Americas", "Europe", "Asia", "Africa", "Oceania"] | |
91 | 91 | ||
92 | 92 | 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"] | |
93 | 93 | ||
94 | 94 | let contIdxAmericas = 0 | |
95 | 95 | ||
96 | 96 | let contIdxEurope = 1 | |
97 | 97 | ||
98 | 98 | let contIdxAsia = 2 | |
99 | 99 | ||
100 | 100 | let contIdxAfrica = 3 | |
101 | 101 | ||
102 | 102 | let contIdxOceania = 4 | |
103 | 103 | ||
104 | 104 | func keyFactoryWarehouseByIdAndType (factoryId,resType) = ((("factoryWhByContinentAndRes_" + factoryId) + "_") + toString(resType)) | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func keyOrderByLand (landAssetId) = ("landOrder_" + landAssetId) | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr) | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func keyBackpackByDuck (duckAssetId) = ("backPack_" + duckAssetId) | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func keyDuckLocation (duckAssetId) = ("duckLocation_" + duckAssetId) | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func keyBlocked () = "contractsBlocked" | |
120 | 120 | ||
121 | 121 | ||
122 | 122 | func keyLandAssetIdToOwner (assetId) = ("nftOwner_" + assetId) | |
123 | 123 | ||
124 | 124 | ||
125 | 125 | func keyStakedTimeByAssetId (assetId) = ("stakedTime_" + assetId) | |
126 | 126 | ||
127 | 127 | ||
128 | 128 | let locIdxContinent = 0 | |
129 | 129 | ||
130 | 130 | let locIdxType = 1 | |
131 | 131 | ||
132 | 132 | let locIdxId = 2 | |
133 | 133 | ||
134 | 134 | let bpIdxLevel = 0 | |
135 | 135 | ||
136 | 136 | let bpIdxRes = 1 | |
137 | 137 | ||
138 | 138 | let bpIdxMat = 2 | |
139 | 139 | ||
140 | 140 | let bpIdxProd = 3 | |
141 | 141 | ||
142 | 142 | let whIdxVol = 0 | |
143 | 143 | ||
144 | 144 | let whIdxRes = 1 | |
145 | 145 | ||
146 | 146 | let whIdxMat = 2 | |
147 | 147 | ||
148 | 148 | let whIdxProd = 3 | |
149 | 149 | ||
150 | 150 | let whIdxLockedVol = 4 | |
151 | 151 | ||
152 | 152 | let ordIdxRes = 0 | |
153 | 153 | ||
154 | 154 | let ordIdxMat = 1 | |
155 | 155 | ||
156 | 156 | let ordIdxProd = 2 | |
157 | 157 | ||
158 | 158 | func asString (v) = match v { | |
159 | 159 | case s: String => | |
160 | 160 | s | |
161 | 161 | case _ => | |
162 | 162 | throw("fail to cast into String") | |
163 | 163 | } | |
164 | 164 | ||
165 | 165 | ||
166 | 166 | func getOrder (ordKey) = { | |
167 | 167 | 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:"), ":") | |
168 | 168 | [if ((size(split(p[ordIdxRes], "_")) == NUMRES)) | |
169 | 169 | then p[ordIdxRes] | |
170 | 170 | else "0@0_0@0_0@0_0@0_0@0_0@0", if ((size(split(p[ordIdxMat], "_")) == NUMRES)) | |
171 | 171 | then p[ordIdxMat] | |
172 | 172 | else "0@0_0@0_0@0_0@0_0@0_0@0", p[ordIdxProd]] | |
173 | 173 | } | |
174 | 174 | ||
175 | 175 | ||
176 | 176 | func getWarehouseVolume (volPrefix) = { | |
177 | 177 | let parts = split(volPrefix, "_") | |
178 | 178 | ((WHMULTIPLIER * (parseIntValue(parts[1]) + 1)) * parseIntValue(parts[0])) | |
179 | 179 | } | |
180 | 180 | ||
181 | 181 | ||
182 | 182 | func getWarehouseCurrResVolume (currentWh) = { | |
183 | 183 | func sum (acc,item) = (acc + parseIntValue(item)) | |
184 | 184 | ||
185 | 185 | let $l = split(currentWh[whIdxRes], "_") | |
186 | 186 | let $s = size($l) | |
187 | 187 | let $acc0 = 0 | |
188 | 188 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
189 | 189 | then $a | |
190 | 190 | else sum($a, $l[$i]) | |
191 | 191 | ||
192 | 192 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
193 | 193 | then $a | |
194 | 194 | else throw("List size exceeds 6") | |
195 | 195 | ||
196 | 196 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
197 | 197 | } | |
198 | 198 | ||
199 | 199 | ||
200 | 200 | func getWarehouseCurrMatVolume (currentWh) = { | |
201 | 201 | func sum (acc,item) = (acc + parseIntValue(item)) | |
202 | 202 | ||
203 | 203 | let $l = split(currentWh[whIdxMat], "_") | |
204 | 204 | let $s = size($l) | |
205 | 205 | let $acc0 = 0 | |
206 | 206 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
207 | 207 | then $a | |
208 | 208 | else sum($a, $l[$i]) | |
209 | 209 | ||
210 | 210 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
211 | 211 | then $a | |
212 | 212 | else throw("List size exceeds 6") | |
213 | 213 | ||
214 | 214 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
215 | 215 | } | |
216 | 216 | ||
217 | 217 | ||
218 | 218 | func getWarehouseCurrGoodsVolume (currentWh) = { | |
219 | 219 | let goods = currentWh[whIdxProd] | |
220 | 220 | if ((goods == "")) | |
221 | 221 | then 0 | |
222 | 222 | else { | |
223 | 223 | func sum (acc,item) = (acc + parseIntValue(item)) | |
224 | 224 | ||
225 | 225 | let $l = split_4C(goods, "_") | |
226 | 226 | let $s = size($l) | |
227 | 227 | let $acc0 = 0 | |
228 | 228 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
229 | 229 | then $a | |
230 | 230 | else sum($a, $l[$i]) | |
231 | 231 | ||
232 | 232 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
233 | 233 | then $a | |
234 | 234 | else throw("List size exceeds 50") | |
235 | 235 | ||
236 | 236 | $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) | |
237 | 237 | } | |
238 | 238 | } | |
239 | 239 | ||
240 | 240 | ||
241 | 241 | func sellInternal (locId,resType,amount,minPrice) = { | |
242 | 242 | let whKey = keyFactoryWarehouseByIdAndType(locId, resType) | |
243 | 243 | let w0 = valueOrElse(getInteger(whKey), 0) | |
244 | 244 | let r0 = if ((w0 > FACTORYMAXWAREHOUSE)) | |
245 | 245 | then 0 | |
246 | 246 | else if (((w0 + amount) > FACTORYMAXWAREHOUSE)) | |
247 | 247 | then (FACTORYMAXWAREHOUSE - w0) | |
248 | 248 | else amount | |
249 | 249 | let usdnReceived = (fraction(r0, ((SELLMULTIPLIER * RESOURCEPRICEMIN) - fraction(((100 * w0) + (50 * r0)), RESOURCEPRICEMIN, FACTORYMAXWAREHOUSE)), MULT10) + fraction((amount - r0), RESOURCEPRICEMIN, MULT8)) | |
250 | 250 | let min99 = (minPrice - (minPrice / 100)) | |
251 | 251 | if (((min99 * amount) > (usdnReceived * MULT8))) | |
252 | 252 | then throw((((((((((("Actual price = " + toString(usdnReceived)) + " / ") + toString(amount)) + " < minPrice = ") + toString(minPrice)) + ", (") + locId) + ", ") + resTypes[resType]) + ")")) | |
253 | 253 | else $Tuple2(IntegerEntry(whKey, (w0 + amount)), usdnReceived) | |
254 | 254 | } | |
255 | 255 | ||
256 | 256 | ||
257 | 257 | func buyInternal (locId,matType,amount,maxPrice) = { | |
258 | 258 | let whKey = keyFactoryWarehouseByIdAndType(locId, matType) | |
259 | 259 | let w0 = valueOrElse(getInteger(whKey), 0) | |
260 | 260 | let m1 = if ((w0 > FACTORYMAXWAREHOUSE)) | |
261 | 261 | then min([amount, (w0 - FACTORYMAXWAREHOUSE)]) | |
262 | 262 | else 0 | |
263 | 263 | let m0 = min([w0, (amount - m1)]) | |
264 | 264 | let m = (m0 + m1) | |
265 | 265 | let usdnSpent = (fraction(m0, ((BUYMULTIPLIER * RESOURCEPRICEMIN) - fraction(((100 * w0) - (50 * m0)), RESOURCEPRICEMIN, FACTORYMAXWAREHOUSE)), MULT10) + fraction(m1, (2 * RESOURCEPRICEMIN), MULT8)) | |
266 | 266 | let max101 = (maxPrice + (maxPrice / 100)) | |
267 | 267 | if (((usdnSpent * MULT8) > (max101 * m))) | |
268 | 268 | then throw((((((((((("Actual price = " + toString(usdnSpent)) + " / ") + toString(m)) + " > maxPrice = ") + toString(maxPrice)) + ", (") + locId) + ", ") + matTypes[matType]) + ")")) | |
269 | 269 | else $Tuple3(IntegerEntry(whKey, (w0 - m)), usdnSpent, m) | |
270 | 270 | } | |
271 | 271 | ||
272 | 272 | ||
273 | 273 | func getBackpack (bpKey) = { | |
274 | 274 | let p = split(valueOrElse(getString(stakingContract, bpKey), "0:0_0_0_0_0_0:0_0_0_0_0_0:"), ":") | |
275 | 275 | [toString(valueOrElse(parseInt(p[bpIdxLevel]), 0)), if ((size(split(p[bpIdxRes], "_")) == NUMRES)) | |
276 | 276 | then p[bpIdxRes] | |
277 | 277 | else "0_0_0_0_0_0", if ((size(split(p[bpIdxMat], "_")) == NUMRES)) | |
278 | 278 | then p[bpIdxMat] | |
279 | 279 | else "0_0_0_0_0_0", p[bpIdxProd]] | |
280 | 280 | } | |
281 | 281 | ||
282 | 282 | ||
283 | 283 | func checkBlocked () = if (valueOrElse(getBoolean(stakingContract, keyBlocked()), false)) | |
284 | 284 | then throw("Contracts are under maintenance") | |
285 | 285 | 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 | + | } | |
286 | 373 | ||
287 | 374 | ||
288 | 375 | @Callable(i) | |
289 | 376 | func constructorV1 (restAddr) = if ((i.caller != this)) | |
290 | 377 | then throw("Permission denied") | |
291 | 378 | else [StringEntry(keyRestAddress(), restAddr)] | |
292 | 379 | ||
293 | 380 | ||
294 | 381 | ||
295 | 382 | @Callable(i) | |
296 | 383 | func sellResources (amounts,minPrices) = { | |
297 | 384 | let blocked = checkBlocked() | |
298 | 385 | if ((blocked == blocked)) | |
299 | 386 | then { | |
300 | 387 | let duckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked") | |
301 | 388 | if ((size(i.payments) != 0)) | |
302 | 389 | then throw("sellResources doesn't require any payments") | |
303 | 390 | else { | |
304 | 391 | let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_") | |
305 | 392 | if ((curLocation[locIdxType] != "F")) | |
306 | 393 | then throw(("Duck location type should be Factory, but is " + curLocation[locIdxType])) | |
307 | 394 | else { | |
308 | 395 | let locId = curLocation[locIdxId] | |
309 | 396 | let currentPack = getBackpack(keyBackpackByDuck(duckAssetId)) | |
310 | 397 | let resList = split(currentPack[bpIdxRes], "_") | |
311 | 398 | func adder (acc,j) = if ((amounts[j] > parseIntValue(resList[j]))) | |
312 | 399 | then throw(((((("You have " + resList[j]) + " of ") + resTypes[j]) + ", but tried to sell ") + toString(amounts[j]))) | |
313 | 400 | else if ((0 > amounts[j])) | |
314 | 401 | then throw(((("You tried to sell negative amount of " + resTypes[j]) + ": ") + toString(amounts[j]))) | |
315 | 402 | else if ((amounts[j] > 0)) | |
316 | 403 | then { | |
317 | 404 | let b = sellInternal(locId, j, amounts[j], minPrices[j]) | |
318 | 405 | $Tuple3((acc._1 :+ b._1), (acc._2 :+ toString((parseIntValue(resList[j]) - amounts[j]))), (acc._3 + b._2)) | |
319 | 406 | } | |
320 | 407 | else $Tuple3(acc._1, (acc._2 :+ resList[j]), acc._3) | |
321 | 408 | ||
322 | 409 | let merged = { | |
323 | 410 | let $l = [0, 1, 2, 3, 4, 5] | |
324 | 411 | let $s = size($l) | |
325 | 412 | let $acc0 = $Tuple3(nil, nil, 0) | |
326 | 413 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
327 | 414 | then $a | |
328 | 415 | else adder($a, $l[$i]) | |
329 | 416 | ||
330 | 417 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
331 | 418 | then $a | |
332 | 419 | else throw("List size exceeds 6") | |
333 | 420 | ||
334 | 421 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
335 | 422 | } | |
336 | 423 | let newPack = makeString([currentPack[bpIdxLevel], makeString(merged._2, "_"), currentPack[bpIdxMat], currentPack[bpIdxProd]], ":") | |
337 | 424 | let result = asString(invoke(stakingContract, "updateBackpack", [duckAssetId, newPack], nil)) | |
338 | 425 | $Tuple2((merged._1 :+ ScriptTransfer(i.caller, merged._3, usdnAssetId)), result) | |
339 | 426 | } | |
340 | 427 | } | |
341 | 428 | } | |
342 | 429 | else throw("Strict value is not equal to itself.") | |
343 | 430 | } | |
344 | 431 | ||
345 | 432 | ||
346 | 433 | ||
347 | 434 | @Callable(i) | |
348 | 435 | func buyMaterials (amounts,maxPrices) = { | |
349 | 436 | let blocked = checkBlocked() | |
350 | 437 | if ((blocked == blocked)) | |
351 | 438 | then { | |
352 | 439 | let duckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked") | |
353 | 440 | if ((size(i.payments) != 1)) | |
354 | 441 | then throw("exactly 1 payment must be attached") | |
355 | 442 | else { | |
356 | 443 | let pmt = i.payments[0] | |
357 | 444 | let amt = pmt.amount | |
358 | 445 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment") | |
359 | 446 | if ((pmtAssetId != usdnAssetId)) | |
360 | 447 | then throw("USDN payments only!") | |
361 | 448 | else { | |
362 | 449 | let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_") | |
363 | 450 | if ((curLocation[locIdxType] != "F")) | |
364 | 451 | then throw(("Duck location type should be Factory, but is " + curLocation[locIdxType])) | |
365 | 452 | else { | |
366 | 453 | let locId = curLocation[locIdxId] | |
367 | 454 | let currentPack = getBackpack(keyBackpackByDuck(duckAssetId)) | |
368 | 455 | let matList = split(currentPack[bpIdxMat], "_") | |
369 | 456 | func mUpdater (acc,j) = if ((0 > amounts[j])) | |
370 | 457 | then throw(((("You tried to buy negative amount of " + matTypes[j]) + ": ") + toString(amounts[j]))) | |
371 | 458 | else if ((amounts[j] > 0)) | |
372 | 459 | then { | |
373 | 460 | let b = buyInternal(locId, j, amounts[j], maxPrices[j]) | |
374 | 461 | $Tuple3((acc._1 :+ b._1), (acc._2 :+ toString((parseIntValue(matList[j]) + b._3))), (acc._3 + b._2)) | |
375 | 462 | } | |
376 | 463 | else $Tuple3(acc._1, (acc._2 :+ matList[j]), acc._3) | |
377 | 464 | ||
378 | 465 | let merged = { | |
379 | 466 | let $l = [0, 1, 2, 3, 4, 5] | |
380 | 467 | let $s = size($l) | |
381 | 468 | let $acc0 = $Tuple3(nil, nil, 0) | |
382 | 469 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
383 | 470 | then $a | |
384 | 471 | else mUpdater($a, $l[$i]) | |
385 | 472 | ||
386 | 473 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
387 | 474 | then $a | |
388 | 475 | else throw("List size exceeds 6") | |
389 | 476 | ||
390 | 477 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
391 | 478 | } | |
392 | 479 | if ((merged._3 > amt)) | |
393 | 480 | then throw(((("Insufficient payment! Attached=" + toString(amt)) + ", required=") + toString(merged._3))) | |
394 | 481 | else { | |
395 | 482 | let newPack = makeString([currentPack[bpIdxLevel], currentPack[bpIdxRes], makeString(merged._2, "_"), currentPack[bpIdxProd]], ":") | |
396 | 483 | let result = asString(invoke(stakingContract, "updateBackpack", [duckAssetId, newPack], nil)) | |
397 | 484 | let rest = if (((amt - merged._3) > 0)) | |
398 | 485 | then [ScriptTransfer(i.caller, (amt - merged._3), usdnAssetId)] | |
399 | 486 | else nil | |
400 | 487 | $Tuple2((merged._1 ++ rest), result) | |
401 | 488 | } | |
402 | 489 | } | |
403 | 490 | } | |
404 | 491 | } | |
405 | 492 | } | |
406 | 493 | else throw("Strict value is not equal to itself.") | |
407 | 494 | } | |
408 | 495 | ||
409 | 496 | ||
410 | 497 | ||
411 | 498 | @Callable(i) | |
412 | 499 | func exchangeResources (amounts) = { | |
413 | 500 | let blocked = checkBlocked() | |
414 | 501 | if ((blocked == blocked)) | |
415 | 502 | then { | |
416 | 503 | let duckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked") | |
417 | 504 | if ((size(i.payments) != 1)) | |
418 | 505 | then throw("exactly 1 payment must be attached") | |
419 | 506 | else { | |
420 | 507 | let pmt = i.payments[0] | |
421 | 508 | let amt = pmt.amount | |
422 | 509 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment") | |
423 | 510 | if ((pmtAssetId != usdnAssetId)) | |
424 | 511 | then throw("USDN payments only!") | |
425 | 512 | else { | |
426 | 513 | let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_") | |
427 | 514 | if ((curLocation[locIdxType] != "F")) | |
428 | 515 | then throw(("Duck location type should be Factory, but is " + curLocation[locIdxType])) | |
429 | 516 | else { | |
430 | 517 | let locId = curLocation[locIdxId] | |
431 | 518 | let currentPack = getBackpack(keyBackpackByDuck(duckAssetId)) | |
432 | 519 | let resList = split(currentPack[bpIdxRes], "_") | |
433 | 520 | let matList = split(currentPack[bpIdxMat], "_") | |
434 | 521 | func exchanger (acc,j) = { | |
435 | 522 | let whKey = keyFactoryWarehouseByIdAndType(locId, j) | |
436 | 523 | let w0 = valueOrElse(getInteger(whKey), 0) | |
437 | 524 | let amj = amounts[j] | |
438 | 525 | if ((amj > parseIntValue(resList[j]))) | |
439 | 526 | then throw(((((("You have " + resList[j]) + " of ") + resTypes[j]) + ", but tried to exchange ") + toString(amj))) | |
440 | 527 | else if ((0 > amj)) | |
441 | 528 | then throw(((("You tried to exchange negative amount of " + resTypes[j]) + ": ") + toString(amj))) | |
442 | 529 | else if ((amj > 0)) | |
443 | 530 | 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))) | |
444 | 531 | else $Tuple4((acc._1 :+ resList[j]), (acc._2 :+ matList[j]), acc._3, acc._4) | |
445 | 532 | } | |
446 | 533 | ||
447 | 534 | let merged = { | |
448 | 535 | let $l = [0, 1, 2, 3, 4, 5] | |
449 | 536 | let $s = size($l) | |
450 | 537 | let $acc0 = $Tuple4(nil, nil, 0, nil) | |
451 | 538 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
452 | 539 | then $a | |
453 | 540 | else exchanger($a, $l[$i]) | |
454 | 541 | ||
455 | 542 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
456 | 543 | then $a | |
457 | 544 | else throw("List size exceeds 6") | |
458 | 545 | ||
459 | 546 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
460 | 547 | } | |
461 | 548 | if ((merged._3 > amt)) | |
462 | 549 | then throw(((("Insufficient payment! Attached=" + toString(amt)) + ", required=") + toString(merged._3))) | |
463 | 550 | else { | |
464 | 551 | let newPack = makeString([currentPack[bpIdxLevel], makeString(merged._1, "_"), makeString(merged._2, "_"), currentPack[bpIdxProd]], ":") | |
465 | 552 | let result = asString(invoke(stakingContract, "updateBackpack", [duckAssetId, newPack], nil)) | |
466 | 553 | let rest = if (((amt - merged._3) > 0)) | |
467 | 554 | then [ScriptTransfer(i.caller, (amt - merged._3), usdnAssetId)] | |
468 | 555 | else nil | |
469 | 556 | $Tuple2((rest ++ merged._4), result) | |
470 | 557 | } | |
471 | 558 | } | |
472 | 559 | } | |
473 | 560 | } | |
474 | 561 | } | |
475 | 562 | else throw("Strict value is not equal to itself.") | |
476 | 563 | } | |
477 | 564 | ||
478 | 565 | ||
479 | 566 | ||
480 | 567 | @Callable(i) | |
481 | 568 | func buyGoods (productIdx,level,quantity) = { | |
482 | 569 | let blocked = checkBlocked() | |
483 | 570 | if ((blocked == blocked)) | |
484 | 571 | then if ((size(i.payments) != 0)) | |
485 | 572 | then throw("buyGoods doesn't require any payments") | |
486 | 573 | else if ((0 > quantity)) | |
487 | 574 | then throw("Quantity should be positive") | |
488 | 575 | else { | |
489 | 576 | let duckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(toString(i.caller))), "You don't have a duck staked") | |
490 | 577 | let curLocation = split(valueOrElse(getString(stakingContract, keyDuckLocation(duckAssetId)), DEFAULTLOCATION), "_") | |
491 | 578 | if ((curLocation[locIdxType] != "M")) | |
492 | 579 | then throw(("Duck location type should be Manufactory, but is " + curLocation[locIdxType])) | |
493 | 580 | else { | |
494 | 581 | let cont = curLocation[locIdxContinent] | |
495 | 582 | let currentPack = getBackpack(keyBackpackByDuck(duckAssetId)) | |
496 | 583 | let matList = split(currentPack[bpIdxMat], "_") | |
497 | 584 | if (if ((0 > productIdx)) | |
498 | 585 | then true | |
499 | 586 | else (productIdx >= size(productionMatrix))) | |
500 | 587 | then throw(("Unknown product idx=" + toString(productIdx))) | |
501 | 588 | else { | |
502 | 589 | let productContIdx = (productIdx % size(continents)) | |
503 | 590 | if ((continents[productContIdx] != cont)) | |
504 | 591 | then throw(((("This product is available in " + continents[productContIdx]) + ", but you are in ") + cont)) | |
505 | 592 | else { | |
506 | 593 | let recipe = split(productionMatrix[productIdx], "_") | |
507 | 594 | if ((size(recipe) != (NUMRES + 2))) | |
508 | 595 | then throw(("Fatal: unknown recipe: " + productionMatrix[productIdx])) | |
509 | 596 | else { | |
510 | 597 | let prodList = if ((currentPack[bpIdxProd] == "")) | |
511 | 598 | then nil | |
512 | 599 | else split(currentPack[bpIdxProd], "_") | |
513 | 600 | func filler (acc,ignoredItem) = { | |
514 | 601 | let n = acc._2 | |
515 | 602 | let x = if ((size(prodList) > n)) | |
516 | 603 | then split(prodList[n], ",") | |
517 | 604 | else ["0", "0", "0"] | |
518 | 605 | let x1s = x[0] | |
519 | 606 | let x1 = parseIntValue(x1s) | |
520 | 607 | let x2s = x[1] | |
521 | 608 | let x2 = parseIntValue(x2s) | |
522 | 609 | let x3s = x[2] | |
523 | 610 | let x3 = parseIntValue(x3s) | |
524 | 611 | let amount = (quantity * parseIntValue(recipe[7])) | |
525 | 612 | let y = if ((n == productIdx)) | |
526 | 613 | then match level { | |
527 | 614 | case _ => | |
528 | 615 | if ((1 == $match0)) | |
529 | 616 | then ((((toString((x1 + amount)) + ",") + x2s) + ",") + x3s) | |
530 | 617 | else if ((2 == $match0)) | |
531 | 618 | then ((((x1s + ",") + toString((x2 + amount))) + ",") + x3s) | |
532 | 619 | else if ((3 == $match0)) | |
533 | 620 | then ((((x1s + ",") + x2s) + ",") + toString((x3 + amount))) | |
534 | 621 | else throw(("Product level should be 1..3, not " + toString(level))) | |
535 | 622 | } | |
536 | 623 | else ((((x1s + ",") + x2s) + ",") + x3s) | |
537 | 624 | $Tuple2((acc._1 :+ y), (n + 1)) | |
538 | 625 | } | |
539 | 626 | ||
540 | 627 | let bpProd = ( let $l = productionMatrix | |
541 | 628 | let $s = size($l) | |
542 | 629 | let $acc0 = $Tuple2(nil, 0) | |
543 | 630 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
544 | 631 | then $a | |
545 | 632 | else filler($a, $l[$i]) | |
546 | 633 | ||
547 | 634 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
548 | 635 | then $a | |
549 | 636 | else throw("List size exceeds 50") | |
550 | 637 | ||
551 | 638 | $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 | |
552 | 639 | func producer (acc,j) = { | |
553 | 640 | let needMat = (parseIntValue(recipe[j]) * quantity) | |
554 | 641 | let haveMat = parseIntValue(matList[j]) | |
555 | 642 | if ((needMat > haveMat)) | |
556 | 643 | then throw(((((((("You have " + matList[j]) + " of ") + matTypes[j]) + ", but recipe requires ") + toString(needMat)) + " for quantity ") + toString(quantity))) | |
557 | 644 | else if ((needMat > 0)) | |
558 | 645 | then (acc :+ toString((haveMat - needMat))) | |
559 | 646 | else (acc :+ matList[j]) | |
560 | 647 | } | |
561 | 648 | ||
562 | 649 | let merged = { | |
563 | 650 | let $l = [0, 1, 2, 3, 4, 5] | |
564 | 651 | let $s = size($l) | |
565 | 652 | let $acc0 = nil | |
566 | 653 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
567 | 654 | then $a | |
568 | 655 | else producer($a, $l[$i]) | |
569 | 656 | ||
570 | 657 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
571 | 658 | then $a | |
572 | 659 | else throw("List size exceeds 6") | |
573 | 660 | ||
574 | 661 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
575 | 662 | } | |
576 | 663 | let newPack = makeString([currentPack[bpIdxLevel], currentPack[bpIdxRes], makeString(merged, "_"), makeString(bpProd, "_")], ":") | |
577 | 664 | let result = asString(invoke(stakingContract, "updateBackpack", [duckAssetId, newPack], nil)) | |
578 | 665 | $Tuple2(nil, result) | |
579 | 666 | } | |
580 | 667 | } | |
581 | 668 | } | |
582 | 669 | } | |
583 | 670 | } | |
584 | 671 | else throw("Strict value is not equal to itself.") | |
585 | 672 | } | |
586 | 673 | ||
587 | 674 | ||
588 | 675 | ||
589 | 676 | @Callable(i) | |
590 | 677 | func acceptServicePayment (service) = { | |
591 | 678 | let blocked = checkBlocked() | |
592 | 679 | if ((blocked == blocked)) | |
593 | 680 | then if ((size(i.payments) != 1)) | |
594 | 681 | then throw("exactly 1 payment must be attached") | |
595 | 682 | else { | |
596 | 683 | let pmt = i.payments[0] | |
597 | 684 | let amt = pmt.amount | |
598 | 685 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment") | |
599 | 686 | if ((pmtAssetId != usdnAssetId)) | |
600 | 687 | then throw("USDN payments only!") | |
601 | 688 | else { | |
602 | 689 | let need = match service { | |
603 | 690 | case _ => | |
604 | 691 | if (("LAND_RENAME" == $match0)) | |
605 | 692 | then 10000000 | |
606 | 693 | else throw("Unknown service!") | |
607 | 694 | } | |
608 | 695 | if ((amt != need)) | |
609 | 696 | then throw((((service + " costs ") + toString(need)) + " USDN")) | |
610 | 697 | else $Tuple2(nil, amt) | |
611 | 698 | } | |
612 | 699 | } | |
613 | 700 | else throw("Strict value is not equal to itself.") | |
614 | 701 | } | |
615 | 702 | ||
616 | 703 | ||
617 | 704 | ||
618 | 705 | @Callable(i) | |
619 | 706 | func setWarehouseOrder (cargoListStr,landAssetId) = { | |
620 | 707 | let user = i.originCaller | |
621 | 708 | let addr = toString(user) | |
622 | 709 | let asset = value(assetInfo(fromBase58String(landAssetId))) | |
623 | 710 | if (!(isDefined(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId))))) | |
624 | 711 | then throw((("NFT " + asset.name) + " is not staked")) | |
625 | 712 | else { | |
626 | 713 | let owner = valueOrErrorMessage(getString(stakingContract, keyLandAssetIdToOwner(landAssetId)), (("NFT " + asset.name) + " is orphaned")) | |
627 | 714 | if ((owner != addr)) | |
628 | 715 | then throw((LANDPREFIX + " is not yours")) | |
629 | 716 | else { | |
630 | 717 | let cargoParts = split_4C(cargoListStr, ":") | |
631 | 718 | if ((size(cargoParts) != 3)) | |
632 | 719 | then throw("cargoListStr should contain exactly 2 ':' separators") | |
633 | 720 | else { | |
634 | 721 | let resParts = split(cargoParts[0], "_") | |
635 | 722 | let matParts = split(cargoParts[1], "_") | |
636 | 723 | let prodParts = if ((cargoParts[2] == "")) | |
637 | 724 | then nil | |
638 | 725 | else split(cargoParts[2], "_") | |
639 | 726 | if ((size(resParts) != NUMRES)) | |
640 | 727 | then throw("All 6 resources should be passed") | |
641 | 728 | else if ((size(matParts) != NUMRES)) | |
642 | 729 | then throw("All 6 materials should be passed") | |
643 | 730 | else { | |
644 | 731 | let wh = asString(invoke(stakingContract, "getWarehouseREADONLY", [landAssetId], nil)) | |
645 | 732 | let currentWh = split_4C(wh, ":") | |
646 | 733 | let currWhRes = split(currentWh[whIdxRes], "_") | |
647 | 734 | let currWhMat = split(currentWh[whIdxMat], "_") | |
648 | 735 | let currWhProd = if ((currentWh[whIdxProd] == "")) | |
649 | 736 | then nil | |
650 | 737 | else split(currentWh[whIdxProd], "_") | |
651 | 738 | let currWhResVol = getWarehouseCurrResVolume(currentWh) | |
652 | 739 | let currWhMatVol = getWarehouseCurrMatVolume(currentWh) | |
653 | 740 | let currWhGoodsVol = getWarehouseCurrGoodsVolume(currentWh) | |
654 | 741 | let currWhLockedVol = parseIntValue(currentWh[whIdxLockedVol]) | |
655 | 742 | let whSpaceLeft = ((((getWarehouseVolume(currentWh[whIdxVol]) - currWhResVol) - currWhMatVol) - currWhGoodsVol) - currWhLockedVol) | |
656 | 743 | let ordKey = keyOrderByLand(landAssetId) | |
657 | 744 | let currentOrd = getOrder(ordKey) | |
658 | 745 | let currentOrdRes = split(currentOrd[ordIdxRes], "_") | |
659 | 746 | let currentOrdMat = split(currentOrd[ordIdxMat], "_") | |
660 | 747 | let currentOrdProd = if ((currentOrd[ordIdxProd] == "")) | |
661 | 748 | then nil | |
662 | 749 | else split(currentOrd[ordIdxProd], "_") | |
663 | 750 | 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 | - | ||
706 | 751 | let r = { | |
707 | 752 | let $l = resParts | |
708 | 753 | let $s = size($l) | |
709 | - | let $acc0 = $ | |
754 | + | let $acc0 = $Tuple6(0, nil, 0, 0, currWhRes, currentOrdRes) | |
710 | 755 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
711 | 756 | then $a | |
712 | - | else | |
757 | + | else setCommon($a, $l[$i]) | |
713 | 758 | ||
714 | 759 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
715 | 760 | then $a | |
716 | 761 | else throw("List size exceeds 6") | |
717 | 762 | ||
718 | 763 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
719 | 764 | } | |
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 | - | ||
762 | 765 | let m = { | |
763 | 766 | let $l = matParts | |
764 | 767 | let $s = size($l) | |
765 | - | let $acc0 = $ | |
768 | + | let $acc0 = $Tuple6(0, nil, r._3, r._4, currWhMat, currentOrdMat) | |
766 | 769 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
767 | 770 | then $a | |
768 | - | else | |
771 | + | else setCommon($a, $l[$i]) | |
769 | 772 | ||
770 | 773 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
771 | 774 | then $a | |
772 | 775 | else throw("List size exceeds 6") | |
773 | 776 | ||
774 | 777 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
775 | 778 | } | |
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 | - | ||
818 | 779 | let p = { | |
819 | 780 | let $l = prodParts | |
820 | 781 | let $s = size($l) | |
821 | - | let $acc0 = $ | |
782 | + | let $acc0 = $Tuple6(0, nil, m._3, m._4, currWhProd, currentOrdProd) | |
822 | 783 | func $f2_1 ($a,$i) = if (($i >= $s)) | |
823 | 784 | then $a | |
824 | - | else | |
785 | + | else setCommon($a, $l[$i]) | |
825 | 786 | ||
826 | 787 | func $f2_2 ($a,$i) = if (($i >= $s)) | |
827 | 788 | then $a | |
828 | 789 | else throw("List size exceeds 50") | |
829 | 790 | ||
830 | 791 | $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) | |
831 | 792 | } | |
832 | 793 | let volSaldo = p._3 | |
833 | 794 | if ((volSaldo > whSpaceLeft)) | |
834 | 795 | then throw((((("Attempt to reserve " + toString(volSaldo)) + " space, but only ") + toString(whSpaceLeft)) + " warehouse space left")) | |
835 | 796 | else { | |
836 | 797 | let whStr = makeString_2C([currentWh[whIdxVol], makeString(r._2, "_"), makeString(m._2, "_"), makeString(p._2, "_"), toString(volSaldo)], ":") | |
837 | 798 | let whSave = invoke(stakingContract, "saveWarehouse", [whStr, landAssetId], nil) | |
838 | 799 | if ((whSave == whSave)) | |
839 | 800 | then { | |
840 | 801 | let usdSaldo = p._4 | |
841 | 802 | if ((usdSaldo > 0)) | |
842 | 803 | then if ((size(i.payments) != 1)) | |
843 | 804 | then throw("exactly 1 payment must be attached") | |
844 | 805 | else { | |
845 | 806 | let pmt = i.payments[0] | |
846 | 807 | let amt = pmt.amount | |
847 | 808 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment") | |
848 | 809 | if ((pmtAssetId != usdnAssetId)) | |
849 | 810 | then throw("USDN payments only!") | |
850 | 811 | else if ((amt != usdSaldo)) | |
851 | 812 | then throw(("Payment needed is " + toString(usdSaldo))) | |
852 | 813 | else [StringEntry(ordKey, cargoListStr)] | |
853 | 814 | } | |
854 | 815 | else if ((usdSaldo == 0)) | |
855 | 816 | then if ((size(i.payments) != 0)) | |
856 | 817 | then throw("No payments needed") | |
857 | 818 | else [StringEntry(ordKey, cargoListStr)] | |
858 | 819 | else if ((size(i.payments) != 0)) | |
859 | 820 | then throw("No payments needed") | |
860 | 821 | else [ScriptTransfer(user, -(usdSaldo), usdnAssetId), StringEntry(ordKey, cargoListStr)] | |
861 | 822 | } | |
862 | 823 | else throw("Strict value is not equal to itself.") | |
863 | 824 | } | |
864 | 825 | } | |
865 | 826 | } | |
866 | 827 | } | |
867 | 828 | } | |
868 | 829 | } | |
869 | 830 | ||
870 | 831 | ||
871 | 832 | ||
872 | 833 | @Callable(i) | |
873 | 834 | func acceptWarehouseOrder (bpOrderStr,landAssetId,duckAssetId) = { | |
874 | 835 | let caller = i.originCaller | |
875 | 836 | let callerAddr = toString(caller) | |
876 | 837 | let stakedDuckAssetId = valueOrErrorMessage(getString(stakingContract, keyStakedDuckByOwner(callerAddr)), "You don't have a duck staked") | |
877 | 838 | let curLocation = valueOrElse(getString(stakingContract, keyDuckLocation(stakedDuckAssetId)), DEFAULTLOCATION) | |
878 | 839 | let loc = split(value(curLocation), "_") | |
879 | 840 | if ((loc[locIdxType] != "L")) | |
880 | 841 | then throw((("Duck location type is " + loc[locIdxType]) + ", but should be L")) | |
881 | 842 | else if ((stakedDuckAssetId != duckAssetId)) | |
882 | 843 | then throw(((("Your staked duck is " + stakedDuckAssetId) + ", but passed ") + duckAssetId)) | |
883 | 844 | else { | |
884 | 845 | let landAsset = value(assetInfo(fromBase58String(landAssetId))) | |
885 | 846 | if (!(isDefined(getInteger(stakingContract, keyStakedTimeByAssetId(landAssetId))))) | |
886 | 847 | then throw((("NFT " + landAsset.name) + " is not staked")) | |
887 | 848 | else { | |
888 | 849 | let landOwner = valueOrErrorMessage(getString(stakingContract, keyLandAssetIdToOwner(landAssetId)), (("NFT " + landAsset.name) + " is orphaned")) | |
889 | 850 | if ((landOwner == callerAddr)) | |
890 | 851 | then throw("You cannot trade with yourself") | |
891 | 852 | else { | |
892 | 853 | let bpOrderParts = split_4C(bpOrderStr, ":") | |
893 | 854 | if ((size(bpOrderParts) != 3)) | |
894 | 855 | then throw("bpOrderStr should contain exactly 2 ':' separators") | |
895 | 856 | else { | |
896 | 857 | let bpOrdRes = split(bpOrderParts[0], "_") | |
897 | 858 | let bpOrdMat = split(bpOrderParts[1], "_") | |
898 | 859 | let bpOrdProd = if ((bpOrderParts[2] == "")) | |
899 | 860 | then nil | |
900 | 861 | else split(bpOrderParts[2], "_") | |
901 | 862 | if ((size(bpOrdRes) != NUMRES)) | |
902 | 863 | then throw("All 6 resources should be passed") | |
903 | 864 | else if ((size(bpOrdMat) != NUMRES)) | |
904 | 865 | then throw("All 6 materials should be passed") | |
905 | 866 | else { | |
906 | 867 | let wh = asString(invoke(stakingContract, "getWarehouseREADONLY", [landAssetId], nil)) | |
907 | 868 | let currentWh = split_4C(wh, ":") | |
908 | 869 | let currWhRes = split(currentWh[whIdxRes], "_") | |
909 | 870 | let currWhMat = split(currentWh[whIdxMat], "_") | |
910 | 871 | let currWhProd = if ((currentWh[whIdxProd] == "")) | |
911 | 872 | then nil | |
912 | 873 | else split(currentWh[whIdxProd], "_") | |
913 | 874 | let currWhResVol = getWarehouseCurrResVolume(currentWh) | |
914 | 875 | let currWhMatVol = getWarehouseCurrMatVolume(currentWh) | |
915 | 876 | let currWhGoodsVol = getWarehouseCurrGoodsVolume(currentWh) | |
916 | 877 | let currWhLockedVol = parseIntValue(currentWh[whIdxLockedVol]) | |
917 | 878 | let whSpaceLeft = ((((getWarehouseVolume(currentWh[whIdxVol]) - currWhResVol) - currWhMatVol) - currWhGoodsVol) - currWhLockedVol) | |
918 | 879 | let bpKey = keyBackpackByDuck(duckAssetId) | |
919 | 880 | let currentPack = getBackpack(bpKey) | |
920 | 881 | let bpResList = split(currentPack[bpIdxRes], "_") | |
921 | 882 | let bpMatList = split(currentPack[bpIdxMat], "_") | |
922 | 883 | let bpProdList = if ((currentPack[bpIdxProd] == "")) | |
923 | 884 | then nil | |
924 | 885 | else split(currentPack[bpIdxProd], "_") | |
925 | 886 | let ordKey = keyOrderByLand(landAssetId) | |
926 | 887 | let whOrd = getOrder(ordKey) | |
927 | 888 | let whOrdRes = split(whOrd[ordIdxRes], "_") | |
928 | 889 | let whOrdMat = split(whOrd[ordIdxMat], "_") | |
929 | 890 | let whOrdProd = if ((whOrd[ordIdxProd] == "")) | |
930 | 891 | then nil | |
931 | 892 | else split(whOrd[ordIdxProd], "_") | |
932 | 893 | 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 | - | ||
975 | 894 | let r = { | |
976 | - | let $l = | |
895 | + | let $l = bpOrdRes | |
977 | 896 | let $s = size($l) | |
978 | - | let $acc0 = $ | |
897 | + | let $acc0 = $Tuple10(nil, nil, nil, 0, 0, 0, 0, bpResList, currWhRes, whOrdRes) | |
979 | 898 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
980 | 899 | then $a | |
981 | - | else | |
900 | + | else acceptCommon($a, $l[$i]) | |
982 | 901 | ||
983 | 902 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
984 | 903 | then $a | |
985 | 904 | else throw("List size exceeds 6") | |
986 | 905 | ||
987 | 906 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
988 | 907 | } | |
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 | - | ||
1031 | 908 | let m = { | |
1032 | - | let $l = | |
909 | + | let $l = bpOrdMat | |
1033 | 910 | let $s = size($l) | |
1034 | - | let $acc0 = $ | |
911 | + | let $acc0 = $Tuple10(nil, nil, nil, r._4, r._5, r._6, 0, bpMatList, currWhMat, whOrdMat) | |
1035 | 912 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
1036 | 913 | then $a | |
1037 | - | else | |
914 | + | else acceptCommon($a, $l[$i]) | |
1038 | 915 | ||
1039 | 916 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
1040 | 917 | then $a | |
1041 | 918 | else throw("List size exceeds 6") | |
1042 | 919 | ||
1043 | 920 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
1044 | 921 | } | |
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 | - | ||
1088 | 922 | let p = { | |
1089 | 923 | let $l = bpOrdProd | |
1090 | 924 | let $s = size($l) | |
1091 | - | let $acc0 = $ | |
925 | + | let $acc0 = $Tuple10(nil, nil, nil, m._4, m._5, m._6, 0, bpProdList, currWhProd, whOrdProd) | |
1092 | 926 | func $f2_1 ($a,$i) = if (($i >= $s)) | |
1093 | 927 | then $a | |
1094 | - | else | |
928 | + | else acceptCommon($a, $l[$i]) | |
1095 | 929 | ||
1096 | 930 | func $f2_2 ($a,$i) = if (($i >= $s)) | |
1097 | 931 | then $a | |
1098 | 932 | else throw("List size exceeds 50") | |
1099 | 933 | ||
1100 | 934 | $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) | |
1101 | 935 | } | |
1102 | 936 | let volSaldo = p._4 | |
1103 | 937 | let newLockedVol = if ((0 > (currWhLockedVol - volSaldo))) | |
1104 | 938 | then 0 | |
1105 | 939 | else (currWhLockedVol - volSaldo) | |
1106 | 940 | let whStr = makeString_2C([currentWh[whIdxVol], makeString(r._1, "_"), makeString(m._1, "_"), makeString(p._1, "_"), toString(newLockedVol)], ":") | |
1107 | 941 | let newWhOrdStr = makeString_2C([makeString(r._2, "_"), makeString(m._2, "_"), makeString(p._2, "_")], ":") | |
1108 | 942 | let newBpStr = makeString_2C([currentPack[bpIdxLevel], makeString(r._3, "_"), makeString(m._3, "_"), makeString(p._3, "_")], ":") | |
1109 | 943 | let whSave = invoke(stakingContract, "saveWarehouse", [whStr, landAssetId], nil) | |
1110 | 944 | if ((whSave == whSave)) | |
1111 | 945 | then { | |
1112 | 946 | let bpSave = invoke(stakingContract, "updateBackpack", [duckAssetId, newBpStr], nil) | |
1113 | 947 | if ((bpSave == bpSave)) | |
1114 | 948 | then { | |
1115 | 949 | let actions = [StringEntry(ordKey, newWhOrdStr)] | |
1116 | 950 | let usdWh2BpFee = fraction(p._5, AUCTIONFEE, MULT6) | |
1117 | 951 | let usdWh2BpSaldo = p._5 | |
1118 | 952 | let actions1 = if ((usdWh2BpSaldo > 0)) | |
1119 | 953 | then (actions :+ ScriptTransfer(caller, (p._5 - usdWh2BpFee), usdnAssetId)) | |
1120 | 954 | else actions | |
1121 | 955 | let usdBp2WhFee = fraction(p._6, AUCTIONFEE, MULT6) | |
1122 | 956 | let usdBp2WhSaldo = p._6 | |
1123 | 957 | if ((usdBp2WhSaldo > 0)) | |
1124 | 958 | then if ((size(i.payments) != 1)) | |
1125 | 959 | then throw("exactly 1 payment must be attached") | |
1126 | 960 | else { | |
1127 | 961 | let pmt = i.payments[0] | |
1128 | 962 | let amt = pmt.amount | |
1129 | 963 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment") | |
1130 | 964 | if ((pmtAssetId != usdnAssetId)) | |
1131 | 965 | then throw("USDN payments only!") | |
1132 | 966 | else if ((amt != usdBp2WhSaldo)) | |
1133 | 967 | then throw(("Payment needed is " + toString(usdBp2WhSaldo))) | |
1134 | 968 | else (actions1 :+ ScriptTransfer(addressFromStringValue(landOwner), (p._6 - usdBp2WhFee), usdnAssetId)) | |
1135 | 969 | } | |
1136 | 970 | else if ((size(i.payments) != 0)) | |
1137 | 971 | then throw("No payments needed") | |
1138 | 972 | else actions1 | |
1139 | 973 | } | |
1140 | 974 | else throw("Strict value is not equal to itself.") | |
1141 | 975 | } | |
1142 | 976 | else throw("Strict value is not equal to itself.") | |
1143 | 977 | } | |
1144 | 978 | } | |
1145 | 979 | } | |
1146 | 980 | } | |
1147 | 981 | } | |
1148 | 982 | } | |
1149 | 983 | ||
1150 | 984 |
github/deemru/w8io/169f3d6 190.71 ms ◑