tx · 45hJedv3552NyZDqW11cbB7HkKbTgt8t2wQFCcLsa2p6 3MxWgDbE9EmjQj8b3LfFwa91FZizptyeQXS: -0.34000000 Waves 2022.11.16 22:01 [2320071] smart account 3MxWgDbE9EmjQj8b3LfFwa91FZizptyeQXS > SELF 0.00000000 Waves
{ "type": 13, "id": "45hJedv3552NyZDqW11cbB7HkKbTgt8t2wQFCcLsa2p6", "fee": 34000000, "feeAssetId": null, "timestamp": 1668625268454, "version": 2, "chainId": 84, "sender": "3MxWgDbE9EmjQj8b3LfFwa91FZizptyeQXS", "senderPublicKey": "C7xgcYqQ8qV8rmvzAjhQWq4cz82F6VJfXMNygvrTXsfW", "proofs": [ "32xCKJKEqi9mmSUpxybJTvZ5EcH6rJj2KD93XDctzHMqonsd9pSUUonMgDdcALBKXfkzm6Fhw5vrCkKMN8W4k2YG", "4VTHu7dDz3ZTj9YbhxW1BuQagke9jBNPeLdTW6A6URmoytsdFMPcTZaMtiA6zJxuNqSNEbKnGJVyczP8WC1Hrbnf" ], "script": "base64:BgJmCAISBAoCEQESBQoDCAEBEgUKAwEEARIECgIRCBIDCgEBEgYKBAgIAQgSBAoCCAESAwoBERIECgIRARIFCgMBCAgSBAoCCAESBQoDCAEBEgASABIECgIRBBIECgIBARIAEgASABIAXAAJUFJFQ0lTSU9OAMCEPQAFTUFYX0EAwIQ9AAxNQVhfQV9DSEFOR0UACgAIREVDSU1BTFMABgANTUlOX1JBTVBfVElNRQkAaQIAgKMFADwAB3ZlcnNpb24CBTMuMC4wAAhrVmVyc2lvbgIHdmVyc2lvbgAHa0Fzc2V0cwIJYXNzZXRfaWRzAA1rQXNzZXRCYWxhbmNlAghfYmFsYW5jZQAHa0FjdGl2ZQIGYWN0aXZlAAtrQWN0aXZlR2xvYgIUYWN0aXZlX2FsbF9jb250cmFjdHMABmtDYXVzZQIOc2h1dGRvd25fY2F1c2UADWtTaGFyZUFzc2V0SWQCDnNoYXJlX2Fzc2V0X2lkABFrU2hhcmVBc3NldFN1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ZG1pblB1YktleUludm9rZQMDBRNjYWxsVGFrZUludG9BY2NvdW50BQ1zaWduZWRCeUFkbWluBwYFE211bHRpU2lnbmVkQnlBZG1pbnMFE211bHRpU2lnbmVkQnlBZG1pbnO40wRv", "height": 2320071, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FQJkm5Aogrt7psbfx8LYFeSGcqsZKB9cxWY9bE2JPVe8 Next: 9aXugkWGEkPRK6SpH4LTpcAECJJSqBsJv4o6724riXSt Diff:
Old | New | Differences | |
---|---|---|---|
91 | 91 | ||
92 | 92 | let lpFarmingAddress = Address(getBase58FromOracle(kLPFarmingAddress)) | |
93 | 93 | ||
94 | - | let USDN = base58' | |
94 | + | let USDN = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS' | |
95 | 95 | ||
96 | 96 | let stakingAssets = [toBase58String(USDN)] | |
97 | 97 | ||
686 | 686 | } | |
687 | 687 | ||
688 | 688 | ||
689 | + | func calcWithdraw (msg,minAmounts,unlockAmount) = { | |
690 | + | let suspicious = checkSuspicious() | |
691 | + | if (suspicious._1) | |
692 | + | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, msg.payments)) | |
693 | + | else { | |
694 | + | let pmtAmount = if ((size(msg.payments) > 0)) | |
695 | + | then if ((size(msg.payments) != 1)) | |
696 | + | then throw("size(payments) != 1") | |
697 | + | else { | |
698 | + | let pmtAssetId = msg.payments[0].assetId | |
699 | + | if ((shareAssetId != pmtAssetId)) | |
700 | + | then throw("unknown payment token") | |
701 | + | else msg.payments[0].amount | |
702 | + | } | |
703 | + | else 0 | |
704 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
705 | + | func calcScriptActions (acc,balance) = { | |
706 | + | let $t01467814706 = acc | |
707 | + | let scriptActions = $t01467814706._1 | |
708 | + | let i = $t01467814706._2 | |
709 | + | let wAmount = fraction(balance, withdrawAmount, shareSupply) | |
710 | + | if (assert((wAmount >= minAmounts[i]))) | |
711 | + | then throw("Withdrawal resulted in fewer coins than expected") | |
712 | + | else { | |
713 | + | let us = unstake(wAmount, assetIds[i]) | |
714 | + | if ((us == us)) | |
715 | + | then $Tuple2((scriptActions ++ [IntegerEntry((assetIds[i] + kAssetBalance), (balance - wAmount)), ScriptTransfer(msg.caller, wAmount, fromBase58String(assetIds[i]))]), (i + 1)) | |
716 | + | else throw("Strict value is not equal to itself.") | |
717 | + | } | |
718 | + | } | |
719 | + | ||
720 | + | let $t01519515263 = { | |
721 | + | let $l = _xp() | |
722 | + | let $s = size($l) | |
723 | + | let $acc0 = $Tuple2(nil, 0) | |
724 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
725 | + | then $a | |
726 | + | else calcScriptActions($a, $l[$i]) | |
727 | + | ||
728 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
729 | + | then $a | |
730 | + | else throw("List size exceeds 10") | |
731 | + | ||
732 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
733 | + | } | |
734 | + | let scriptActions = $t01519515263._1 | |
735 | + | let i = $t01519515263._2 | |
736 | + | (scriptActions ++ [Burn(shareAssetId, withdrawAmount), IntegerEntry(kShareAssetSupply, (shareSupply - withdrawAmount))]) | |
737 | + | } | |
738 | + | } | |
739 | + | ||
740 | + | ||
741 | + | func calcWithdrawOneCoinEntries (msg,tokenOut,minAmount,unlockAmount) = if ((size(msg.payments) != 1)) | |
742 | + | then throw("size(payments) != 1") | |
743 | + | else { | |
744 | + | let suspicious = checkSuspicious() | |
745 | + | if (suspicious._1) | |
746 | + | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.originCaller, msg.payments)) | |
747 | + | else { | |
748 | + | let pmtAmount = if ((size(msg.payments) > 0)) | |
749 | + | then if ((size(msg.payments) != 1)) | |
750 | + | then throw("size(payments) != 1") | |
751 | + | else { | |
752 | + | let pmtAssetId = msg.payments[0].assetId | |
753 | + | if ((shareAssetId != pmtAssetId)) | |
754 | + | then throw("unknown payment token") | |
755 | + | else msg.payments[0].amount | |
756 | + | } | |
757 | + | else 0 | |
758 | + | let outIndex = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
759 | + | let tokenOutB58 = fromBase58String(tokenOut) | |
760 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
761 | + | let xp = _xp() | |
762 | + | let $t01627116358 = _calcWithdrawOneCoin(xp, withdrawAmount, outIndex, msg.originCaller) | |
763 | + | let dy = $t01627116358._1 | |
764 | + | let dy_fee = $t01627116358._2 | |
765 | + | if (assert((dy >= minAmount))) | |
766 | + | then throw("Not enough coins removed") | |
767 | + | else { | |
768 | + | let governanceFees = fraction(dy_fee, feeGovernance, feeScale6) | |
769 | + | let dy_and_fee = (dy + dy_fee) | |
770 | + | func makeNewBalances (acc,tokenBalance) = { | |
771 | + | let $t01661616642 = acc | |
772 | + | let newBalances = $t01661616642._1 | |
773 | + | let i = $t01661616642._2 | |
774 | + | if ((i == outIndex)) | |
775 | + | then $Tuple2((newBalances :+ (tokenBalance - dy_and_fee)), (i + 1)) | |
776 | + | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
777 | + | } | |
778 | + | ||
779 | + | let $t01680916870 = { | |
780 | + | let $l = xp | |
781 | + | let $s = size($l) | |
782 | + | let $acc0 = $Tuple2(nil, 0) | |
783 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
784 | + | then $a | |
785 | + | else makeNewBalances($a, $l[$i]) | |
786 | + | ||
787 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
788 | + | then $a | |
789 | + | else throw("List size exceeds 10") | |
790 | + | ||
791 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
792 | + | } | |
793 | + | let newBalances = $t01680916870._1 | |
794 | + | let v = $t01680916870._2 | |
795 | + | if (checkDAppThreshold(newBalances)) | |
796 | + | then throw() | |
797 | + | else { | |
798 | + | let us = unstake(dy_and_fee, tokenOut) | |
799 | + | if ((us == us)) | |
800 | + | then { | |
801 | + | let lpFees = (dy_fee - governanceFees) | |
802 | + | let airdrop = if ((lpFees > 0)) | |
803 | + | then invoke(lpFarmingAddress, "airDrop", nil, [AttachedPayment(tokenOutB58, lpFees)]) | |
804 | + | else 0 | |
805 | + | if ((airdrop == airdrop)) | |
806 | + | then [ScriptTransfer(msg.originCaller, dy, tokenOutB58), IntegerEntry((assetIds[outIndex] + kAssetBalance), (xp[outIndex] - dy_and_fee)), Burn(shareAssetId, withdrawAmount), ScriptTransfer(moneyBoxAddress, governanceFees, tokenOutB58), IntegerEntry(kShareAssetSupply, (shareSupply - withdrawAmount))] | |
807 | + | else throw("Strict value is not equal to itself.") | |
808 | + | } | |
809 | + | else throw("Strict value is not equal to itself.") | |
810 | + | } | |
811 | + | } | |
812 | + | } | |
813 | + | } | |
814 | + | ||
815 | + | ||
689 | 816 | @Callable(msg) | |
690 | 817 | func D (xp,amp) = { | |
691 | 818 | let D = get_D_internal(xp, amp) | |
720 | 847 | let D0 = if ((shareSupply == 0)) | |
721 | 848 | then 0 | |
722 | 849 | else getDMem(xp, amp) | |
723 | - | let $ | |
850 | + | let $t01901019264 = if (if ((lockType > 0)) | |
724 | 851 | then (msg.payments[(size(msg.payments) - 1)].assetId == unit) | |
725 | 852 | else false) | |
726 | 853 | then $Tuple2(removeByIndex(msg.payments, (size(msg.payments) - 1)), [msg.payments[(size(msg.payments) - 1)]]) | |
727 | 854 | else $Tuple2(msg.payments, nil) | |
728 | - | let payments = $ | |
729 | - | let lockFee = $ | |
855 | + | let payments = $t01901019264._1 | |
856 | + | let lockFee = $t01901019264._2 | |
730 | 857 | let paymentsSize = size(payments) | |
731 | 858 | func validPayments (n) = if ((paymentsSize > nCoins)) | |
732 | 859 | then throw(("payments size > " + toString(nCoins))) | |
763 | 890 | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, payments)) | |
764 | 891 | else { | |
765 | 892 | func parsePayments (acc,assetId) = { | |
766 | - | let $ | |
767 | - | let newBalances = $ | |
768 | - | let i = $ | |
893 | + | let $t02013420160 = acc | |
894 | + | let newBalances = $t02013420160._1 | |
895 | + | let i = $t02013420160._2 | |
769 | 896 | func parsePayment (newBalance,payment) = if ((getStrAssetId(payment.assetId) == assetId)) | |
770 | 897 | then (newBalance + payment.amount) | |
771 | 898 | else newBalance | |
787 | 914 | $Tuple2((newBalances :+ newBalace), (i + 1)) | |
788 | 915 | } | |
789 | 916 | ||
790 | - | let $ | |
917 | + | let $t02051020577 = { | |
791 | 918 | let $l = assetIds | |
792 | 919 | let $s = size($l) | |
793 | 920 | let $acc0 = $Tuple2(nil, 0) | |
801 | 928 | ||
802 | 929 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
803 | 930 | } | |
804 | - | let newBalances = $ | |
805 | - | let k = $ | |
931 | + | let newBalances = $t02051020577._1 | |
932 | + | let k = $t02051020577._2 | |
806 | 933 | if (checkDAppThreshold(newBalances)) | |
807 | 934 | then throw() | |
808 | 935 | else { | |
812 | 939 | else { | |
813 | 940 | let feeDiscount = calculateFeeDiscount(msg.caller) | |
814 | 941 | func calcScriptActions (acc,newBalance) = { | |
815 | - | let $ | |
816 | - | let invBalances = $ | |
817 | - | let scriptActions = $ | |
818 | - | let i = $ | |
942 | + | let $t02089720938 = acc | |
943 | + | let invBalances = $t02089720938._1 | |
944 | + | let scriptActions = $t02089720938._2 | |
945 | + | let i = $t02089720938._3 | |
819 | 946 | if ((shareSupply > 0)) | |
820 | 947 | then { | |
821 | 948 | let _fee = ((fraction(fee, feeDiscount, feeScale6, CEILING) * nCoins) / (4 * (nCoins - 1))) | |
853 | 980 | } | |
854 | 981 | } | |
855 | 982 | ||
856 | - | let $ | |
983 | + | let $t02264322731 = { | |
857 | 984 | let $l = newBalances | |
858 | 985 | let $s = size($l) | |
859 | 986 | let $acc0 = $Tuple3(nil, nil, 0) | |
867 | 994 | ||
868 | 995 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
869 | 996 | } | |
870 | - | let invBalances = $ | |
871 | - | let scriptActions = $ | |
997 | + | let invBalances = $t02264322731._1 | |
998 | + | let scriptActions = $t02264322731._2 | |
872 | 999 | let D2 = getDMem(invBalances, amp) | |
873 | 1000 | let mint_amount = if ((shareSupply == 0)) | |
874 | 1001 | then D1 | |
907 | 1034 | let D0 = getDMem(xp, amp) | |
908 | 1035 | let feeDiscount = calculateFeeDiscount(user) | |
909 | 1036 | func calcInvBalances (acc,newBalance) = { | |
910 | - | let $ | |
911 | - | let invBalances = $ | |
912 | - | let i = $ | |
1037 | + | let $t02400724033 = acc | |
1038 | + | let invBalances = $t02400724033._1 | |
1039 | + | let i = $t02400724033._2 | |
913 | 1040 | let _fee = ((fraction(fee, feeDiscount, feeScale6, CEILING) * nCoins) / (4 * (nCoins - 1))) | |
914 | 1041 | let fees = { | |
915 | 1042 | let idealBalance = fraction(D1, xp[i], D0) | |
922 | 1049 | $Tuple2((invBalances :+ invariantBalance), (i + 1)) | |
923 | 1050 | } | |
924 | 1051 | ||
925 | - | let $ | |
1052 | + | let $t02463524705 = { | |
926 | 1053 | let $l = newBalances | |
927 | 1054 | let $s = size($l) | |
928 | 1055 | let $acc0 = $Tuple2(nil, 0) | |
936 | 1063 | ||
937 | 1064 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
938 | 1065 | } | |
939 | - | let invBalances = $ | |
940 | - | let k = $ | |
1066 | + | let invBalances = $t02463524705._1 | |
1067 | + | let k = $t02463524705._2 | |
941 | 1068 | let D2 = getDMem(invBalances, amp) | |
942 | 1069 | let mintAmount = fraction(shareSupply, (D2 - D0), D0) | |
943 | 1070 | $Tuple2(nil, mintAmount) | |
992 | 1119 | then throw("Exchange resulted in fewer coins than expected") | |
993 | 1120 | else { | |
994 | 1121 | func makeNewBalances (acc,tokenBalance) = { | |
995 | - | let $ | |
996 | - | let newBalances = $ | |
997 | - | let i = $ | |
1122 | + | let $t02674626772 = acc | |
1123 | + | let newBalances = $t02674626772._1 | |
1124 | + | let i = $t02674626772._2 | |
998 | 1125 | if ((i == fromIndex)) | |
999 | 1126 | then $Tuple2((newBalances :+ (tokenBalance + dx)), (i + 1)) | |
1000 | 1127 | else if ((i == toIndex)) | |
1002 | 1129 | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
1003 | 1130 | } | |
1004 | 1131 | ||
1005 | - | let $ | |
1132 | + | let $t02702327084 = { | |
1006 | 1133 | let $l = xp | |
1007 | 1134 | let $s = size($l) | |
1008 | 1135 | let $acc0 = $Tuple2(nil, 0) | |
1016 | 1143 | ||
1017 | 1144 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
1018 | 1145 | } | |
1019 | - | let newBalances = $ | |
1020 | - | let i = $ | |
1146 | + | let newBalances = $t02702327084._1 | |
1147 | + | let i = $t02702327084._2 | |
1021 | 1148 | if (checkDAppThreshold(newBalances)) | |
1022 | 1149 | then throw() | |
1023 | 1150 | else { | |
1046 | 1173 | ||
1047 | 1174 | ||
1048 | 1175 | @Callable(msg) | |
1049 | - | func withdraw (minAmounts) = valueOrElse(isActive(), if ((size(msg.payments) != 1)) | |
1050 | - | then throw("size(payments) != 1") | |
1051 | - | else { | |
1052 | - | let pmtAmount = msg.payments[0].amount | |
1053 | - | let pmtAssetId = msg.payments[0].assetId | |
1054 | - | if ((shareAssetId != pmtAssetId)) | |
1055 | - | then throw("unknown payment token") | |
1056 | - | else { | |
1057 | - | let suspicious = checkSuspicious() | |
1058 | - | if (suspicious._1) | |
1059 | - | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.originCaller, msg.payments)) | |
1060 | - | else { | |
1061 | - | func calcScriptActions (acc,balance) = { | |
1062 | - | let $t02483524863 = acc | |
1063 | - | let scriptActions = $t02483524863._1 | |
1064 | - | let i = $t02483524863._2 | |
1065 | - | let wAmount = fraction(balance, pmtAmount, shareSupply) | |
1066 | - | if (assert((wAmount >= minAmounts[i]))) | |
1067 | - | then throw("Withdrawal resulted in fewer coins than expected") | |
1068 | - | else { | |
1069 | - | let us = unstake(wAmount, assetIds[i]) | |
1070 | - | if ((us == us)) | |
1071 | - | then $Tuple2((scriptActions ++ [IntegerEntry((assetIds[i] + kAssetBalance), (balance - wAmount)), ScriptTransfer(msg.originCaller, wAmount, fromBase58String(assetIds[i]))]), (i + 1)) | |
1072 | - | else throw("Strict value is not equal to itself.") | |
1073 | - | } | |
1074 | - | } | |
1075 | - | ||
1076 | - | let $t02535325421 = { | |
1077 | - | let $l = _xp() | |
1078 | - | let $s = size($l) | |
1079 | - | let $acc0 = $Tuple2(nil, 0) | |
1080 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1081 | - | then $a | |
1082 | - | else calcScriptActions($a, $l[$i]) | |
1083 | - | ||
1084 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1085 | - | then $a | |
1086 | - | else throw("List size exceeds 10") | |
1087 | - | ||
1088 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
1089 | - | } | |
1090 | - | let scriptActions = $t02535325421._1 | |
1091 | - | let i = $t02535325421._2 | |
1092 | - | (scriptActions ++ [Burn(shareAssetId, pmtAmount), IntegerEntry(kShareAssetSupply, (shareSupply - pmtAmount))]) | |
1093 | - | } | |
1094 | - | } | |
1095 | - | }) | |
1176 | + | func withdraw (minAmounts) = valueOrElse(isActive(), calcWithdraw(msg, minAmounts, 0)) | |
1096 | 1177 | ||
1097 | 1178 | ||
1098 | 1179 | ||
1100 | 1181 | func withdrawWithUnlock (minAmounts,unlockAmount) = valueOrElse(isActive(), if ((0 >= unlockAmount)) | |
1101 | 1182 | then throw("Unlock amount must be positive") | |
1102 | 1183 | else { | |
1103 | - | let suspicious = checkSuspicious() | |
1104 | - | if (suspicious._1) | |
1105 | - | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, msg.payments)) | |
1106 | - | else { | |
1107 | - | let pmtAmount = if ((size(msg.payments) > 0)) | |
1108 | - | then if ((size(msg.payments) != 1)) | |
1109 | - | then throw("size(payments) != 1") | |
1110 | - | else { | |
1111 | - | let pmtAssetId = msg.payments[0].assetId | |
1112 | - | if ((shareAssetId != pmtAssetId)) | |
1113 | - | then throw("unknown payment token") | |
1114 | - | else msg.payments[0].amount | |
1115 | - | } | |
1116 | - | else 0 | |
1117 | - | let unlock = invoke(farmingAddress, "withdrawShareTokensFromPool", [msg.caller.bytes, toString(this), unlockAmount], nil) | |
1118 | - | if ((unlock == unlock)) | |
1119 | - | then { | |
1120 | - | let withdrawAmount = (pmtAmount + unlockAmount) | |
1121 | - | let inv = invoke(this, "withdraw", [minAmounts], [AttachedPayment(shareAssetId, withdrawAmount)]) | |
1122 | - | if ((inv == inv)) | |
1123 | - | then nil | |
1124 | - | else throw("Strict value is not equal to itself.") | |
1125 | - | } | |
1126 | - | else throw("Strict value is not equal to itself.") | |
1127 | - | } | |
1184 | + | let unlock = invoke(farmingAddress, "withdrawShareTokensFromPool", [msg.caller.bytes, toString(this), unlockAmount], nil) | |
1185 | + | if ((unlock == unlock)) | |
1186 | + | then calcWithdraw(msg, minAmounts, unlockAmount) | |
1187 | + | else throw("Strict value is not equal to itself.") | |
1128 | 1188 | }) | |
1129 | 1189 | ||
1130 | 1190 | ||
1140 | 1200 | ||
1141 | 1201 | ||
1142 | 1202 | @Callable(msg) | |
1143 | - | func withdrawOneCoin (tokenOut,minAmount) = valueOrElse(isActive(), if ((size(msg.payments) != 1)) | |
1144 | - | then throw("size(payments) != 1") | |
1145 | - | else { | |
1146 | - | let suspicious = checkSuspicious() | |
1147 | - | if (suspicious._1) | |
1148 | - | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.originCaller, msg.payments)) | |
1149 | - | else { | |
1150 | - | let pmtAmount = msg.payments[0].amount | |
1151 | - | let pmtAssetId = msg.payments[0].assetId | |
1152 | - | if ((pmtAssetId != shareAssetId)) | |
1153 | - | then throw("unknown token") | |
1154 | - | else { | |
1155 | - | let outIndex = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
1156 | - | let tokenOutB58 = fromBase58String(tokenOut) | |
1157 | - | let xp = _xp() | |
1158 | - | let $t02747927561 = _calcWithdrawOneCoin(xp, pmtAmount, outIndex, msg.originCaller) | |
1159 | - | let dy = $t02747927561._1 | |
1160 | - | let dy_fee = $t02747927561._2 | |
1161 | - | if (assert((dy >= minAmount))) | |
1162 | - | then throw("Not enough coins removed") | |
1163 | - | else { | |
1164 | - | let governanceFees = fraction(dy_fee, feeGovernance, feeScale6) | |
1165 | - | let dy_and_fee = (dy + dy_fee) | |
1166 | - | func makeNewBalances (acc,tokenBalance) = { | |
1167 | - | let $t02781927845 = acc | |
1168 | - | let newBalances = $t02781927845._1 | |
1169 | - | let i = $t02781927845._2 | |
1170 | - | if ((i == outIndex)) | |
1171 | - | then $Tuple2((newBalances :+ (tokenBalance - dy_and_fee)), (i + 1)) | |
1172 | - | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
1173 | - | } | |
1174 | - | ||
1175 | - | let $t02801228073 = { | |
1176 | - | let $l = xp | |
1177 | - | let $s = size($l) | |
1178 | - | let $acc0 = $Tuple2(nil, 0) | |
1179 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1180 | - | then $a | |
1181 | - | else makeNewBalances($a, $l[$i]) | |
1182 | - | ||
1183 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1184 | - | then $a | |
1185 | - | else throw("List size exceeds 10") | |
1186 | - | ||
1187 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
1188 | - | } | |
1189 | - | let newBalances = $t02801228073._1 | |
1190 | - | let v = $t02801228073._2 | |
1191 | - | if (checkDAppThreshold(newBalances)) | |
1192 | - | then throw() | |
1193 | - | else { | |
1194 | - | let us = unstake(dy_and_fee, tokenOut) | |
1195 | - | if ((us == us)) | |
1196 | - | then { | |
1197 | - | let lpFees = (dy_fee - governanceFees) | |
1198 | - | let airdrop = if ((lpFees > 0)) | |
1199 | - | then invoke(lpFarmingAddress, "airDrop", nil, [AttachedPayment(tokenOutB58, lpFees)]) | |
1200 | - | else 0 | |
1201 | - | if ((airdrop == airdrop)) | |
1202 | - | then [ScriptTransfer(msg.originCaller, dy, tokenOutB58), IntegerEntry((assetIds[outIndex] + kAssetBalance), (xp[outIndex] - dy_and_fee)), Burn(shareAssetId, pmtAmount), ScriptTransfer(moneyBoxAddress, governanceFees, tokenOutB58), IntegerEntry(kShareAssetSupply, (shareSupply - pmtAmount))] | |
1203 | - | else throw("Strict value is not equal to itself.") | |
1204 | - | } | |
1205 | - | else throw("Strict value is not equal to itself.") | |
1206 | - | } | |
1207 | - | } | |
1208 | - | } | |
1209 | - | } | |
1210 | - | }) | |
1203 | + | func withdrawOneCoin (tokenOut,minAmount) = valueOrElse(isActive(), calcWithdrawOneCoinEntries(msg, tokenOut, minAmount, 0)) | |
1211 | 1204 | ||
1212 | 1205 | ||
1213 | 1206 | ||
1215 | 1208 | func withdrawOneCoinWithUnlock (tokenOut,minAmount,unlockAmount) = valueOrElse(isActive(), if ((0 >= unlockAmount)) | |
1216 | 1209 | then throw("Unlock amount must be positive") | |
1217 | 1210 | else { | |
1218 | - | let suspicious = checkSuspicious() | |
1219 | - | if (suspicious._1) | |
1220 | - | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, msg.payments)) | |
1221 | - | else { | |
1222 | - | let pmtAmount = if ((size(msg.payments) > 0)) | |
1223 | - | then if ((size(msg.payments) != 1)) | |
1224 | - | then throw("size(payments) != 1") | |
1225 | - | else { | |
1226 | - | let pmtAssetId = msg.payments[0].assetId | |
1227 | - | if ((shareAssetId != pmtAssetId)) | |
1228 | - | then throw("unknown payment token") | |
1229 | - | else msg.payments[0].amount | |
1230 | - | } | |
1231 | - | else 0 | |
1232 | - | let unlock = invoke(farmingAddress, "withdrawShareTokensFromPool", [msg.caller.bytes, toString(this), unlockAmount], nil) | |
1233 | - | if ((unlock == unlock)) | |
1234 | - | then { | |
1235 | - | let withdrawAmount = (pmtAmount + unlockAmount) | |
1236 | - | let inv = invoke(this, "withdrawOneCoin", [tokenOut, minAmount], [AttachedPayment(shareAssetId, withdrawAmount)]) | |
1237 | - | if ((inv == inv)) | |
1238 | - | then nil | |
1239 | - | else throw("Strict value is not equal to itself.") | |
1240 | - | } | |
1241 | - | else throw("Strict value is not equal to itself.") | |
1242 | - | } | |
1211 | + | let unlock = invoke(farmingAddress, "withdrawShareTokensFromPool", [msg.caller.bytes, toString(this), unlockAmount], nil) | |
1212 | + | if ((unlock == unlock)) | |
1213 | + | then calcWithdrawOneCoinEntries(msg, tokenOut, minAmount, unlockAmount) | |
1214 | + | else throw("Strict value is not equal to itself.") | |
1243 | 1215 | }) | |
1244 | 1216 | ||
1245 | 1217 | ||
1263 | 1235 | let balances = _xp() | |
1264 | 1236 | let D0 = getDMem(balances, amp) | |
1265 | 1237 | func calcNewBalances (acc,balance) = { | |
1266 | - | let $ | |
1267 | - | let newBalances = $ | |
1268 | - | let i = $ | |
1238 | + | let $t02959129617 = acc | |
1239 | + | let newBalances = $t02959129617._1 | |
1240 | + | let i = $t02959129617._2 | |
1269 | 1241 | let newBalance = (balance + (if (deposit) | |
1270 | 1242 | then amounts[i] | |
1271 | 1243 | else -(amounts[i]))) | |
1345 | 1317 | else { | |
1346 | 1318 | let balances = _xp() | |
1347 | 1319 | func takeExtraFunds (acc,assetId) = { | |
1348 | - | let $ | |
1349 | - | let sum = $ | |
1350 | - | let i = $ | |
1320 | + | let $t03195931977 = acc | |
1321 | + | let sum = $t03195931977._1 | |
1322 | + | let i = $t03195931977._2 | |
1351 | 1323 | let tokenB58 = fromBase58String(assetId) | |
1352 | 1324 | let rBalance = (assetBalance(this, tokenB58) + stakedAmount(tokenB58)) | |
1353 | 1325 | let enrollAmount = (rBalance - balances[i]) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let PRECISION = 1000000 | |
5 | 5 | ||
6 | 6 | let MAX_A = 1000000 | |
7 | 7 | ||
8 | 8 | let MAX_A_CHANGE = 10 | |
9 | 9 | ||
10 | 10 | let DECIMALS = 6 | |
11 | 11 | ||
12 | 12 | let MIN_RAMP_TIME = (86400 / 60) | |
13 | 13 | ||
14 | 14 | let version = "3.0.0" | |
15 | 15 | ||
16 | 16 | let kVersion = "version" | |
17 | 17 | ||
18 | 18 | let kAssets = "asset_ids" | |
19 | 19 | ||
20 | 20 | let kAssetBalance = "_balance" | |
21 | 21 | ||
22 | 22 | let kActive = "active" | |
23 | 23 | ||
24 | 24 | let kActiveGlob = "active_all_contracts" | |
25 | 25 | ||
26 | 26 | let kCause = "shutdown_cause" | |
27 | 27 | ||
28 | 28 | let kShareAssetId = "share_asset_id" | |
29 | 29 | ||
30 | 30 | let kShareAssetSupply = "share_asset_supply" | |
31 | 31 | ||
32 | 32 | let kFee = "commission" | |
33 | 33 | ||
34 | 34 | let kDAppThresholdCoef = "dAppThresholdCoef" | |
35 | 35 | ||
36 | 36 | let kUSDNAddress = "staking_usdnnsbt_address" | |
37 | 37 | ||
38 | 38 | let kDiscounts = "discounts" | |
39 | 39 | ||
40 | 40 | let kDiscountValues = "discount_values" | |
41 | 41 | ||
42 | 42 | let kUserSwopInGov = "_SWOP_amount" | |
43 | 43 | ||
44 | 44 | let kUserGSwopInGov = "_GSwop_amount" | |
45 | 45 | ||
46 | 46 | let kAdminPubKey1 = "admin_pub_1" | |
47 | 47 | ||
48 | 48 | let kAdminPubKey2 = "admin_pub_2" | |
49 | 49 | ||
50 | 50 | let kAdminPubKey3 = "admin_pub_3" | |
51 | 51 | ||
52 | 52 | let kAdminInvokePubKey = "admin_invoke_pub" | |
53 | 53 | ||
54 | 54 | let kMoneyBoxAddress = "money_box_address" | |
55 | 55 | ||
56 | 56 | let kGovAddress = "governance_address" | |
57 | 57 | ||
58 | 58 | let kVotingAddress = "voting_address" | |
59 | 59 | ||
60 | 60 | let kFarmingAddress = "farming_address" | |
61 | 61 | ||
62 | 62 | let kLPFarmingAddress = "lp_farming" | |
63 | 63 | ||
64 | 64 | let oracle = Address(base58'3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz') | |
65 | 65 | ||
66 | 66 | func getBase58FromOracle (key) = match getString(oracle, key) { | |
67 | 67 | case string: String => | |
68 | 68 | fromBase58String(string) | |
69 | 69 | case nothing => | |
70 | 70 | throw((key + "is empty")) | |
71 | 71 | } | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | let adminPubKey1 = getBase58FromOracle(kAdminPubKey1) | |
75 | 75 | ||
76 | 76 | let adminPubKey2 = getBase58FromOracle(kAdminPubKey2) | |
77 | 77 | ||
78 | 78 | let adminPubKey3 = getBase58FromOracle(kAdminPubKey3) | |
79 | 79 | ||
80 | 80 | let adminPubKeyInvoke = getBase58FromOracle(kAdminInvokePubKey) | |
81 | 81 | ||
82 | 82 | let moneyBoxAddress = Address(getBase58FromOracle(kMoneyBoxAddress)) | |
83 | 83 | ||
84 | 84 | let govAddress = Address(getBase58FromOracle(kGovAddress)) | |
85 | 85 | ||
86 | 86 | let stakingUSDNAddress = Address(getBase58FromOracle(kUSDNAddress)) | |
87 | 87 | ||
88 | 88 | let votingAddress = Address(getBase58FromOracle(kVotingAddress)) | |
89 | 89 | ||
90 | 90 | let farmingAddress = Address(getBase58FromOracle(kFarmingAddress)) | |
91 | 91 | ||
92 | 92 | let lpFarmingAddress = Address(getBase58FromOracle(kLPFarmingAddress)) | |
93 | 93 | ||
94 | - | let USDN = base58' | |
94 | + | let USDN = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS' | |
95 | 95 | ||
96 | 96 | let stakingAssets = [toBase58String(USDN)] | |
97 | 97 | ||
98 | 98 | let active = getBooleanValue(this, kActive) | |
99 | 99 | ||
100 | 100 | let activeGlob = valueOrElse(getBoolean(oracle, kActiveGlob), true) | |
101 | 101 | ||
102 | 102 | let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId)) | |
103 | 103 | ||
104 | 104 | let shareSupply = getIntegerValue(this, kShareAssetSupply) | |
105 | 105 | ||
106 | 106 | let feeScale6 = 1000000 | |
107 | 107 | ||
108 | 108 | let fee = getIntegerValue(this, kFee) | |
109 | 109 | ||
110 | 110 | let feeGovernance = fraction(40, feeScale6, 100) | |
111 | 111 | ||
112 | 112 | let initial_A = getIntegerValue(this, "initial_A") | |
113 | 113 | ||
114 | 114 | let future_A = getIntegerValue(this, "future_A") | |
115 | 115 | ||
116 | 116 | let initial_A_time = valueOrElse(getInteger(this, "initial_A_time"), 0) | |
117 | 117 | ||
118 | 118 | let future_A_time = valueOrElse(getInteger(this, "future_A_time"), 0) | |
119 | 119 | ||
120 | 120 | let assetIds = split(getStringValue(this, kAssets), ",") | |
121 | 121 | ||
122 | 122 | let nCoins = size(assetIds) | |
123 | 123 | ||
124 | 124 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func throwIsActive () = throw("DApp is already active") | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func isActive () = if (if (active) | |
131 | 131 | then activeGlob | |
132 | 132 | else false) | |
133 | 133 | then unit | |
134 | 134 | else throw("DApp is inactive at this moment") | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
138 | 138 | then unit | |
139 | 139 | else throw("Only admin can call this function") | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | func isSelfCall (i) = if ((this == i.caller)) | |
143 | 143 | then unit | |
144 | 144 | else throw("Only contract itself can call this function") | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | let big2 = toBigInt(2) | |
148 | 148 | ||
149 | 149 | let iter10 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
150 | 150 | ||
151 | 151 | let iter15 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | |
152 | 152 | ||
153 | 153 | let iter16 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] | |
154 | 154 | ||
155 | 155 | let blockTimestamp = height | |
156 | 156 | ||
157 | 157 | func assert (a) = if (a) | |
158 | 158 | then false | |
159 | 159 | else true | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | func calculateFeeDiscount (userAddr) = { | |
163 | 163 | let user = match userAddr { | |
164 | 164 | case u: Address => | |
165 | 165 | toString(u) | |
166 | 166 | case u: String => | |
167 | 167 | u | |
168 | 168 | case _ => | |
169 | 169 | throw("Unknow type of user Addr") | |
170 | 170 | } | |
171 | 171 | let swopAmount = valueOrElse(getInteger(govAddress, (user + kUserGSwopInGov)), 0) | |
172 | 172 | let gSwopAmount = valueOrElse(getInteger(govAddress, (user + kUserGSwopInGov)), swopAmount) | |
173 | 173 | let discountValues = split(getStringValue(oracle, kDiscountValues), ",") | |
174 | 174 | let discounts = split(getStringValue(oracle, kDiscounts), ",") | |
175 | 175 | if (if ((gSwopAmount >= parseIntValue(discountValues[0]))) | |
176 | 176 | then (parseIntValue(discountValues[1]) > gSwopAmount) | |
177 | 177 | else false) | |
178 | 178 | then (feeScale6 - parseIntValue(discounts[0])) | |
179 | 179 | else if (if ((gSwopAmount >= parseIntValue(discountValues[1]))) | |
180 | 180 | then (parseIntValue(discountValues[2]) > gSwopAmount) | |
181 | 181 | else false) | |
182 | 182 | then (feeScale6 - parseIntValue(discounts[1])) | |
183 | 183 | else if (if ((gSwopAmount >= parseIntValue(discountValues[2]))) | |
184 | 184 | then (parseIntValue(discountValues[3]) > gSwopAmount) | |
185 | 185 | else false) | |
186 | 186 | then (feeScale6 - parseIntValue(discounts[2])) | |
187 | 187 | else if (if ((gSwopAmount >= parseIntValue(discountValues[3]))) | |
188 | 188 | then (parseIntValue(discountValues[4]) > gSwopAmount) | |
189 | 189 | else false) | |
190 | 190 | then (feeScale6 - parseIntValue(discounts[3])) | |
191 | 191 | else if ((gSwopAmount >= parseIntValue(discountValues[4]))) | |
192 | 192 | then (feeScale6 - parseIntValue(discounts[4])) | |
193 | 193 | else feeScale6 | |
194 | 194 | } | |
195 | 195 | ||
196 | 196 | ||
197 | 197 | func _A () = { | |
198 | 198 | let t1 = future_A_time | |
199 | 199 | let A1 = future_A | |
200 | 200 | if ((t1 > blockTimestamp)) | |
201 | 201 | then { | |
202 | 202 | let A0 = initial_A | |
203 | 203 | let t0 = initial_A_time | |
204 | 204 | if ((A1 > A0)) | |
205 | 205 | then (A0 + (((A1 - A0) * (blockTimestamp - t0)) / (t1 - t0))) | |
206 | 206 | else (A0 - (((A0 - A1) * (blockTimestamp - t0)) / (t1 - t0))) | |
207 | 207 | } | |
208 | 208 | else A1 | |
209 | 209 | } | |
210 | 210 | ||
211 | 211 | ||
212 | 212 | func _xp () = { | |
213 | 213 | func assetBalances (acc,assetId) = (acc :+ valueOrElse(getInteger(this, (assetId + kAssetBalance)), 0)) | |
214 | 214 | ||
215 | 215 | let $l = assetIds | |
216 | 216 | let $s = size($l) | |
217 | 217 | let $acc0 = nil | |
218 | 218 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
219 | 219 | then $a | |
220 | 220 | else assetBalances($a, $l[$i]) | |
221 | 221 | ||
222 | 222 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
223 | 223 | then $a | |
224 | 224 | else throw("List size exceeds 10") | |
225 | 225 | ||
226 | 226 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
227 | 227 | } | |
228 | 228 | ||
229 | 229 | ||
230 | 230 | func _xp_mem (xp) = xp | |
231 | 231 | ||
232 | 232 | ||
233 | 233 | func sumList (acc,element) = (acc + element) | |
234 | 234 | ||
235 | 235 | ||
236 | 236 | func get_D (xp,amp) = { | |
237 | 237 | let @ = invoke(this, "D", [xp, amp], nil) | |
238 | 238 | if ($isInstanceOf(@, "Int")) | |
239 | 239 | then @ | |
240 | 240 | else throw(($getType(@) + " couldn't be cast to Int")) | |
241 | 241 | } | |
242 | 242 | ||
243 | 243 | ||
244 | 244 | func get_D_internal (xp,amp) = { | |
245 | 245 | let S = { | |
246 | 246 | let $l = xp | |
247 | 247 | let $s = size($l) | |
248 | 248 | let $acc0 = 0 | |
249 | 249 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
250 | 250 | then $a | |
251 | 251 | else sumList($a, $l[$i]) | |
252 | 252 | ||
253 | 253 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
254 | 254 | then $a | |
255 | 255 | else throw("List size exceeds 10") | |
256 | 256 | ||
257 | 257 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
258 | 258 | } | |
259 | 259 | if ((S == 0)) | |
260 | 260 | then 0 | |
261 | 261 | else { | |
262 | 262 | let Ann = (amp * nCoins) | |
263 | 263 | let AnnS = (toBigInt(Ann) * toBigInt(S)) | |
264 | 264 | let Ann1 = toBigInt((Ann - 1)) | |
265 | 265 | func Dproc (acc,i) = if ((acc._2 == true)) | |
266 | 266 | then acc | |
267 | 267 | else { | |
268 | 268 | let Dprev = acc._1 | |
269 | 269 | func D_PProc (D_P,i) = if ((nCoins > i)) | |
270 | 270 | then ((D_P * Dprev) / (toBigInt(xp[i]) * toBigInt(nCoins))) | |
271 | 271 | else D_P | |
272 | 272 | ||
273 | 273 | let D_P = { | |
274 | 274 | let $l = iter10 | |
275 | 275 | let $s = size($l) | |
276 | 276 | let $acc0 = Dprev | |
277 | 277 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
278 | 278 | then $a | |
279 | 279 | else D_PProc($a, $l[$i]) | |
280 | 280 | ||
281 | 281 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
282 | 282 | then $a | |
283 | 283 | else throw("List size exceeds 10") | |
284 | 284 | ||
285 | 285 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
286 | 286 | } | |
287 | 287 | let D = fraction((AnnS + (toBigInt(nCoins) * D_P)), Dprev, ((Ann1 * Dprev) + (toBigInt((nCoins + 1)) * D_P))) | |
288 | 288 | if ((D > Dprev)) | |
289 | 289 | then if ((1 >= toInt((D - Dprev)))) | |
290 | 290 | then $Tuple2(D, true) | |
291 | 291 | else $Tuple2(D, false) | |
292 | 292 | else if ((1 >= toInt((Dprev - D)))) | |
293 | 293 | then $Tuple2(D, true) | |
294 | 294 | else $Tuple2(D, false) | |
295 | 295 | } | |
296 | 296 | ||
297 | 297 | let $t065826648 = { | |
298 | 298 | let $l = iter15 | |
299 | 299 | let $s = size($l) | |
300 | 300 | let $acc0 = $Tuple2(toBigInt(S), false) | |
301 | 301 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
302 | 302 | then $a | |
303 | 303 | else Dproc($a, $l[$i]) | |
304 | 304 | ||
305 | 305 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
306 | 306 | then $a | |
307 | 307 | else throw("List size exceeds 15") | |
308 | 308 | ||
309 | 309 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
310 | 310 | } | |
311 | 311 | let D = $t065826648._1 | |
312 | 312 | let finished = $t065826648._2 | |
313 | 313 | if ((finished == false)) | |
314 | 314 | then throw(("get_D() not finished with " + toString(D))) | |
315 | 315 | else toInt(D) | |
316 | 316 | } | |
317 | 317 | } | |
318 | 318 | ||
319 | 319 | ||
320 | 320 | func getDMem (xp,amp) = get_D(_xp_mem(xp), amp) | |
321 | 321 | ||
322 | 322 | ||
323 | 323 | func getY (in,out,x,xp_) = if (assert((in != out))) | |
324 | 324 | then throw("same coin") | |
325 | 325 | else if (assert(if ((out >= 0)) | |
326 | 326 | then (in >= 0) | |
327 | 327 | else false)) | |
328 | 328 | then throw("below zero") | |
329 | 329 | else if (assert(if ((nCoins > out)) | |
330 | 330 | then (nCoins > in) | |
331 | 331 | else false)) | |
332 | 332 | then throw("above N_COINS") | |
333 | 333 | else { | |
334 | 334 | let amp = _A() | |
335 | 335 | let D = get_D(xp_, amp) | |
336 | 336 | let Ann = (amp * nCoins) | |
337 | 337 | func S_c (acc,i) = { | |
338 | 338 | let $t072197236 = acc | |
339 | 339 | let S_ = $t072197236._1 | |
340 | 340 | let c = $t072197236._2 | |
341 | 341 | let x_ = if ((in == i)) | |
342 | 342 | then x | |
343 | 343 | else xp_[i] | |
344 | 344 | if (if ((i != out)) | |
345 | 345 | then (nCoins > i) | |
346 | 346 | else false) | |
347 | 347 | then $Tuple2((S_ + x_), fraction(c, toBigInt(D), toBigInt((x_ * nCoins)))) | |
348 | 348 | else $Tuple2(S_, c) | |
349 | 349 | } | |
350 | 350 | ||
351 | 351 | let $t074447499 = { | |
352 | 352 | let $l = iter10 | |
353 | 353 | let $s = size($l) | |
354 | 354 | let $acc0 = $Tuple2(0, toBigInt(D)) | |
355 | 355 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
356 | 356 | then $a | |
357 | 357 | else S_c($a, $l[$i]) | |
358 | 358 | ||
359 | 359 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
360 | 360 | then $a | |
361 | 361 | else throw("List size exceeds 10") | |
362 | 362 | ||
363 | 363 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
364 | 364 | } | |
365 | 365 | let S_ = $t074447499._1 | |
366 | 366 | let c_ = $t074447499._2 | |
367 | 367 | let c = fraction(c_, toBigInt(D), toBigInt((Ann * nCoins))) | |
368 | 368 | let bD = toBigInt(((S_ + (D / Ann)) - D)) | |
369 | 369 | func y_proc (acc,_i) = if ((acc._2 == true)) | |
370 | 370 | then acc | |
371 | 371 | else { | |
372 | 372 | let y_prev = acc._1 | |
373 | 373 | let y = (((y_prev * y_prev) + c) / ((big2 * y_prev) + bD)) | |
374 | 374 | if ((y > y_prev)) | |
375 | 375 | then if ((1 >= toInt((y - y_prev)))) | |
376 | 376 | then $Tuple2(y, true) | |
377 | 377 | else $Tuple2(y, false) | |
378 | 378 | else if ((1 >= toInt((y_prev - y)))) | |
379 | 379 | then $Tuple2(y, true) | |
380 | 380 | else $Tuple2(y, false) | |
381 | 381 | } | |
382 | 382 | ||
383 | 383 | let $t079818048 = { | |
384 | 384 | let $l = iter16 | |
385 | 385 | let $s = size($l) | |
386 | 386 | let $acc0 = $Tuple2(toBigInt(D), false) | |
387 | 387 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
388 | 388 | then $a | |
389 | 389 | else y_proc($a, $l[$i]) | |
390 | 390 | ||
391 | 391 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
392 | 392 | then $a | |
393 | 393 | else throw("List size exceeds 16") | |
394 | 394 | ||
395 | 395 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16) | |
396 | 396 | } | |
397 | 397 | let y = $t079818048._1 | |
398 | 398 | let finished = $t079818048._2 | |
399 | 399 | if ((finished == false)) | |
400 | 400 | then throw(("getY() not finished with " + toString(y))) | |
401 | 401 | else toInt(y) | |
402 | 402 | } | |
403 | 403 | ||
404 | 404 | ||
405 | 405 | func get_y_D (A_,in,xp,D) = if (assert((in >= 0))) | |
406 | 406 | then throw("i below zero") | |
407 | 407 | else if (assert((nCoins > in))) | |
408 | 408 | then throw("i above N_COINS") | |
409 | 409 | else { | |
410 | 410 | let Ann = (A_ * nCoins) | |
411 | 411 | func S_c (acc,i) = { | |
412 | 412 | let $t084278444 = acc | |
413 | 413 | let S_ = $t084278444._1 | |
414 | 414 | let c = $t084278444._2 | |
415 | 415 | let x_ = if (if ((in != i)) | |
416 | 416 | then (nCoins > i) | |
417 | 417 | else false) | |
418 | 418 | then xp[i] | |
419 | 419 | else 0 | |
420 | 420 | if (if ((nCoins > i)) | |
421 | 421 | then (in != i) | |
422 | 422 | else false) | |
423 | 423 | then $Tuple2((S_ + x_), fraction(c, toBigInt(D), toBigInt((x_ * nCoins)))) | |
424 | 424 | else $Tuple2(S_, c) | |
425 | 425 | } | |
426 | 426 | ||
427 | 427 | let $t086648719 = { | |
428 | 428 | let $l = iter10 | |
429 | 429 | let $s = size($l) | |
430 | 430 | let $acc0 = $Tuple2(0, toBigInt(D)) | |
431 | 431 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
432 | 432 | then $a | |
433 | 433 | else S_c($a, $l[$i]) | |
434 | 434 | ||
435 | 435 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
436 | 436 | then $a | |
437 | 437 | else throw("List size exceeds 10") | |
438 | 438 | ||
439 | 439 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
440 | 440 | } | |
441 | 441 | let S_ = $t086648719._1 | |
442 | 442 | let c_ = $t086648719._2 | |
443 | 443 | let c = fraction(c_, toBigInt(D), toBigInt((Ann * nCoins))) | |
444 | 444 | let bD = toBigInt(((S_ + (D / Ann)) - D)) | |
445 | 445 | func y_D_proc (acc,i) = if ((acc._2 == true)) | |
446 | 446 | then acc | |
447 | 447 | else { | |
448 | 448 | let y_prev = acc._1 | |
449 | 449 | let y = (((y_prev * y_prev) + c) / ((big2 * y_prev) + bD)) | |
450 | 450 | if ((y > y_prev)) | |
451 | 451 | then if ((1 >= toInt((y - y_prev)))) | |
452 | 452 | then $Tuple2(y, true) | |
453 | 453 | else $Tuple2(y, false) | |
454 | 454 | else if ((1 >= toInt((y_prev - y)))) | |
455 | 455 | then $Tuple2(y, true) | |
456 | 456 | else $Tuple2(y, false) | |
457 | 457 | } | |
458 | 458 | ||
459 | 459 | let $t092029271 = { | |
460 | 460 | let $l = iter16 | |
461 | 461 | let $s = size($l) | |
462 | 462 | let $acc0 = $Tuple2(toBigInt(D), false) | |
463 | 463 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
464 | 464 | then $a | |
465 | 465 | else y_D_proc($a, $l[$i]) | |
466 | 466 | ||
467 | 467 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
468 | 468 | then $a | |
469 | 469 | else throw("List size exceeds 16") | |
470 | 470 | ||
471 | 471 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16) | |
472 | 472 | } | |
473 | 473 | let y = $t092029271._1 | |
474 | 474 | let finished = $t092029271._2 | |
475 | 475 | if ((finished == false)) | |
476 | 476 | then throw(("get_y_D() not finished with " + toString(y))) | |
477 | 477 | else toInt(y) | |
478 | 478 | } | |
479 | 479 | ||
480 | 480 | ||
481 | 481 | func _calcWithdrawOneCoin (xp,_token_amount,i,caller) = { | |
482 | 482 | let feeDiscount = calculateFeeDiscount(caller) | |
483 | 483 | let amp = _A() | |
484 | 484 | let _fee = ((fraction(fee, feeDiscount, feeScale6, CEILING) * nCoins) / (4 * (nCoins - 1))) | |
485 | 485 | let total_supply = shareSupply | |
486 | 486 | let D0 = get_D(xp, amp) | |
487 | 487 | let D1 = (D0 - fraction(_token_amount, D0, total_supply)) | |
488 | 488 | let new_y = get_y_D(amp, i, xp, D1) | |
489 | 489 | let dy_0 = (xp[i] - new_y) | |
490 | 490 | func xp_reduced_proc (acc,xp_j) = { | |
491 | 491 | let $t099129941 = acc | |
492 | 492 | let xp_reduced = $t099129941._1 | |
493 | 493 | let index = $t099129941._2 | |
494 | 494 | let dx_expected = if ((index == i)) | |
495 | 495 | then (fraction(xp_j, D1, D0) - new_y) | |
496 | 496 | else (xp_j - fraction(xp_j, D1, D0)) | |
497 | 497 | $Tuple2((xp_reduced :+ (xp_j - fraction(_fee, dx_expected, feeScale6))), (index + 1)) | |
498 | 498 | } | |
499 | 499 | ||
500 | 500 | let $t01020310267 = { | |
501 | 501 | let $l = xp | |
502 | 502 | let $s = size($l) | |
503 | 503 | let $acc0 = $Tuple2(nil, 0) | |
504 | 504 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
505 | 505 | then $a | |
506 | 506 | else xp_reduced_proc($a, $l[$i]) | |
507 | 507 | ||
508 | 508 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
509 | 509 | then $a | |
510 | 510 | else throw("List size exceeds 10") | |
511 | 511 | ||
512 | 512 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
513 | 513 | } | |
514 | 514 | let xp_reduced = $t01020310267._1 | |
515 | 515 | let index = $t01020310267._2 | |
516 | 516 | let xp_reduced_i = xp_reduced[i] | |
517 | 517 | let dy = ((xp_reduced_i - get_y_D(amp, i, xp_reduced, D1)) - 1) | |
518 | 518 | $Tuple2(dy, (dy_0 - dy)) | |
519 | 519 | } | |
520 | 520 | ||
521 | 521 | ||
522 | 522 | func getStrAssetId (assetId) = match assetId { | |
523 | 523 | case id: ByteVector => | |
524 | 524 | toBase58String(id) | |
525 | 525 | case waves: Unit => | |
526 | 526 | "WAVES" | |
527 | 527 | case _ => | |
528 | 528 | throw("Match error") | |
529 | 529 | } | |
530 | 530 | ||
531 | 531 | ||
532 | 532 | func calcStakingFuncAndAddres (stake,assetId) = if (stake) | |
533 | 533 | then $Tuple2("lockNeutrino", stakingUSDNAddress) | |
534 | 534 | else $Tuple2("unlockNeutrino", stakingUSDNAddress) | |
535 | 535 | ||
536 | 536 | ||
537 | 537 | func calcStakingParams (stake,amount,assetId) = if (stake) | |
538 | 538 | then { | |
539 | 539 | let $t01083110897 = calcStakingFuncAndAddres(stake, assetId) | |
540 | 540 | let call = $t01083110897._1 | |
541 | 541 | let stakingAddr = $t01083110897._2 | |
542 | 542 | $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)]) | |
543 | 543 | } | |
544 | 544 | else { | |
545 | 545 | let $t01098311049 = calcStakingFuncAndAddres(stake, assetId) | |
546 | 546 | let call = $t01098311049._1 | |
547 | 547 | let stakingAddr = $t01098311049._2 | |
548 | 548 | $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil) | |
549 | 549 | } | |
550 | 550 | ||
551 | 551 | ||
552 | 552 | func stake (amount,assetIdString) = if (containsElement(stakingAssets, assetIdString)) | |
553 | 553 | then { | |
554 | 554 | let $t01123611338 = calcStakingParams(true, amount, fromBase58String(assetIdString)) | |
555 | 555 | let call = $t01123611338._1 | |
556 | 556 | let addr = $t01123611338._2 | |
557 | 557 | let params = $t01123611338._3 | |
558 | 558 | let payments = $t01123611338._4 | |
559 | 559 | invoke(addr, call, params, payments) | |
560 | 560 | } | |
561 | 561 | else 0 | |
562 | 562 | ||
563 | 563 | ||
564 | 564 | func unstake (amount,assetIdString) = if (containsElement(stakingAssets, assetIdString)) | |
565 | 565 | then { | |
566 | 566 | let $t01152311626 = calcStakingParams(false, amount, fromBase58String(assetIdString)) | |
567 | 567 | let call = $t01152311626._1 | |
568 | 568 | let addr = $t01152311626._2 | |
569 | 569 | let params = $t01152311626._3 | |
570 | 570 | let payments = $t01152311626._4 | |
571 | 571 | invoke(addr, call, params, payments) | |
572 | 572 | } | |
573 | 573 | else 0 | |
574 | 574 | ||
575 | 575 | ||
576 | 576 | func stakedAmount (assetId) = { | |
577 | 577 | let stakedAmountCalculated = match assetId { | |
578 | 578 | case aId: ByteVector => | |
579 | 579 | if ((aId == USDN)) | |
580 | 580 | then getInteger(stakingUSDNAddress, ((("rpd_balance_" + toBase58String(aId)) + "_") + toString(this))) | |
581 | 581 | else 0 | |
582 | 582 | case _: Unit => | |
583 | 583 | 0 | |
584 | 584 | case _ => | |
585 | 585 | throw("Match error") | |
586 | 586 | } | |
587 | 587 | match stakedAmountCalculated { | |
588 | 588 | case i: Int => | |
589 | 589 | i | |
590 | 590 | case _ => | |
591 | 591 | 0 | |
592 | 592 | } | |
593 | 593 | } | |
594 | 594 | ||
595 | 595 | ||
596 | 596 | func checkSuspicious () = { | |
597 | 597 | let contractBalances = _xp() | |
598 | 598 | func checkBalance (acc,assetId) = { | |
599 | 599 | let $t01223712262 = acc | |
600 | 600 | let suspicious = $t01223712262._1 | |
601 | 601 | let i = $t01223712262._2 | |
602 | 602 | if (suspicious) | |
603 | 603 | then $Tuple2(suspicious, i) | |
604 | 604 | else { | |
605 | 605 | let aBalance = (assetBalance(this, fromBase58String(assetId)) + stakedAmount(fromBase58String(assetId))) | |
606 | 606 | if ((contractBalances[i] > aBalance)) | |
607 | 607 | then $Tuple2(true, i) | |
608 | 608 | else $Tuple2(false, (i + 1)) | |
609 | 609 | } | |
610 | 610 | } | |
611 | 611 | ||
612 | 612 | let $l = assetIds | |
613 | 613 | let $s = size($l) | |
614 | 614 | let $acc0 = $Tuple2(false, 0) | |
615 | 615 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
616 | 616 | then $a | |
617 | 617 | else checkBalance($a, $l[$i]) | |
618 | 618 | ||
619 | 619 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
620 | 620 | then $a | |
621 | 621 | else throw("List size exceeds 10") | |
622 | 622 | ||
623 | 623 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
624 | 624 | } | |
625 | 625 | ||
626 | 626 | ||
627 | 627 | func suspendSuspicious (i) = suspend(("Suspicious state with asset: " + assetIds[i])) | |
628 | 628 | ||
629 | 629 | ||
630 | 630 | func returnPayments (caller,payments) = { | |
631 | 631 | func parsePayments (acc,payment) = (acc :+ ScriptTransfer(caller, payment.amount, payment.assetId)) | |
632 | 632 | ||
633 | 633 | let $l = payments | |
634 | 634 | let $s = size($l) | |
635 | 635 | let $acc0 = nil | |
636 | 636 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
637 | 637 | then $a | |
638 | 638 | else parsePayments($a, $l[$i]) | |
639 | 639 | ||
640 | 640 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
641 | 641 | then $a | |
642 | 642 | else throw("List size exceeds 10") | |
643 | 643 | ||
644 | 644 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
645 | 645 | } | |
646 | 646 | ||
647 | 647 | ||
648 | 648 | func checkDAppThreshold (newBalances) = { | |
649 | 649 | let dAppThresholdCoef = valueOrErrorMessage(getInteger(this, kDAppThresholdCoef), "No dAppThresholdCoef key") | |
650 | 650 | let thresholdScale = 10000 | |
651 | 651 | let maxBalance = max(newBalances) | |
652 | 652 | let minBalance = min(newBalances) | |
653 | 653 | let ratio = fraction(maxBalance, thresholdScale, minBalance) | |
654 | 654 | if ((ratio > (dAppThresholdCoef * thresholdScale))) | |
655 | 655 | then throw("New balance in assets of the DApp is less than threshold") | |
656 | 656 | else false | |
657 | 657 | } | |
658 | 658 | ||
659 | 659 | ||
660 | 660 | func checkCoins (assetIds) = { | |
661 | 661 | let coins = split(assetIds, ",") | |
662 | 662 | if ((size(coins) > 10)) | |
663 | 663 | then throw("To many coins, max coins size 10") | |
664 | 664 | else { | |
665 | 665 | func checkCoin (error,assetId) = { | |
666 | 666 | let asset = valueOrErrorMessage(fromBase58String(assetId), ("fromBase58String: " + assetId)) | |
667 | 667 | let decimals = valueOrErrorMessage(assetInfo(asset), ("assetInfo: " + assetId)).decimals | |
668 | 668 | if ((decimals != DECIMALS)) | |
669 | 669 | then throw("wrong decimals") | |
670 | 670 | else false | |
671 | 671 | } | |
672 | 672 | ||
673 | 673 | let $l = coins | |
674 | 674 | let $s = size($l) | |
675 | 675 | let $acc0 = false | |
676 | 676 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
677 | 677 | then $a | |
678 | 678 | else checkCoin($a, $l[$i]) | |
679 | 679 | ||
680 | 680 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
681 | 681 | then $a | |
682 | 682 | else throw("List size exceeds 10") | |
683 | 683 | ||
684 | 684 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
685 | 685 | } | |
686 | 686 | } | |
687 | 687 | ||
688 | 688 | ||
689 | + | func calcWithdraw (msg,minAmounts,unlockAmount) = { | |
690 | + | let suspicious = checkSuspicious() | |
691 | + | if (suspicious._1) | |
692 | + | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, msg.payments)) | |
693 | + | else { | |
694 | + | let pmtAmount = if ((size(msg.payments) > 0)) | |
695 | + | then if ((size(msg.payments) != 1)) | |
696 | + | then throw("size(payments) != 1") | |
697 | + | else { | |
698 | + | let pmtAssetId = msg.payments[0].assetId | |
699 | + | if ((shareAssetId != pmtAssetId)) | |
700 | + | then throw("unknown payment token") | |
701 | + | else msg.payments[0].amount | |
702 | + | } | |
703 | + | else 0 | |
704 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
705 | + | func calcScriptActions (acc,balance) = { | |
706 | + | let $t01467814706 = acc | |
707 | + | let scriptActions = $t01467814706._1 | |
708 | + | let i = $t01467814706._2 | |
709 | + | let wAmount = fraction(balance, withdrawAmount, shareSupply) | |
710 | + | if (assert((wAmount >= minAmounts[i]))) | |
711 | + | then throw("Withdrawal resulted in fewer coins than expected") | |
712 | + | else { | |
713 | + | let us = unstake(wAmount, assetIds[i]) | |
714 | + | if ((us == us)) | |
715 | + | then $Tuple2((scriptActions ++ [IntegerEntry((assetIds[i] + kAssetBalance), (balance - wAmount)), ScriptTransfer(msg.caller, wAmount, fromBase58String(assetIds[i]))]), (i + 1)) | |
716 | + | else throw("Strict value is not equal to itself.") | |
717 | + | } | |
718 | + | } | |
719 | + | ||
720 | + | let $t01519515263 = { | |
721 | + | let $l = _xp() | |
722 | + | let $s = size($l) | |
723 | + | let $acc0 = $Tuple2(nil, 0) | |
724 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
725 | + | then $a | |
726 | + | else calcScriptActions($a, $l[$i]) | |
727 | + | ||
728 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
729 | + | then $a | |
730 | + | else throw("List size exceeds 10") | |
731 | + | ||
732 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
733 | + | } | |
734 | + | let scriptActions = $t01519515263._1 | |
735 | + | let i = $t01519515263._2 | |
736 | + | (scriptActions ++ [Burn(shareAssetId, withdrawAmount), IntegerEntry(kShareAssetSupply, (shareSupply - withdrawAmount))]) | |
737 | + | } | |
738 | + | } | |
739 | + | ||
740 | + | ||
741 | + | func calcWithdrawOneCoinEntries (msg,tokenOut,minAmount,unlockAmount) = if ((size(msg.payments) != 1)) | |
742 | + | then throw("size(payments) != 1") | |
743 | + | else { | |
744 | + | let suspicious = checkSuspicious() | |
745 | + | if (suspicious._1) | |
746 | + | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.originCaller, msg.payments)) | |
747 | + | else { | |
748 | + | let pmtAmount = if ((size(msg.payments) > 0)) | |
749 | + | then if ((size(msg.payments) != 1)) | |
750 | + | then throw("size(payments) != 1") | |
751 | + | else { | |
752 | + | let pmtAssetId = msg.payments[0].assetId | |
753 | + | if ((shareAssetId != pmtAssetId)) | |
754 | + | then throw("unknown payment token") | |
755 | + | else msg.payments[0].amount | |
756 | + | } | |
757 | + | else 0 | |
758 | + | let outIndex = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
759 | + | let tokenOutB58 = fromBase58String(tokenOut) | |
760 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
761 | + | let xp = _xp() | |
762 | + | let $t01627116358 = _calcWithdrawOneCoin(xp, withdrawAmount, outIndex, msg.originCaller) | |
763 | + | let dy = $t01627116358._1 | |
764 | + | let dy_fee = $t01627116358._2 | |
765 | + | if (assert((dy >= minAmount))) | |
766 | + | then throw("Not enough coins removed") | |
767 | + | else { | |
768 | + | let governanceFees = fraction(dy_fee, feeGovernance, feeScale6) | |
769 | + | let dy_and_fee = (dy + dy_fee) | |
770 | + | func makeNewBalances (acc,tokenBalance) = { | |
771 | + | let $t01661616642 = acc | |
772 | + | let newBalances = $t01661616642._1 | |
773 | + | let i = $t01661616642._2 | |
774 | + | if ((i == outIndex)) | |
775 | + | then $Tuple2((newBalances :+ (tokenBalance - dy_and_fee)), (i + 1)) | |
776 | + | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
777 | + | } | |
778 | + | ||
779 | + | let $t01680916870 = { | |
780 | + | let $l = xp | |
781 | + | let $s = size($l) | |
782 | + | let $acc0 = $Tuple2(nil, 0) | |
783 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
784 | + | then $a | |
785 | + | else makeNewBalances($a, $l[$i]) | |
786 | + | ||
787 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
788 | + | then $a | |
789 | + | else throw("List size exceeds 10") | |
790 | + | ||
791 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
792 | + | } | |
793 | + | let newBalances = $t01680916870._1 | |
794 | + | let v = $t01680916870._2 | |
795 | + | if (checkDAppThreshold(newBalances)) | |
796 | + | then throw() | |
797 | + | else { | |
798 | + | let us = unstake(dy_and_fee, tokenOut) | |
799 | + | if ((us == us)) | |
800 | + | then { | |
801 | + | let lpFees = (dy_fee - governanceFees) | |
802 | + | let airdrop = if ((lpFees > 0)) | |
803 | + | then invoke(lpFarmingAddress, "airDrop", nil, [AttachedPayment(tokenOutB58, lpFees)]) | |
804 | + | else 0 | |
805 | + | if ((airdrop == airdrop)) | |
806 | + | then [ScriptTransfer(msg.originCaller, dy, tokenOutB58), IntegerEntry((assetIds[outIndex] + kAssetBalance), (xp[outIndex] - dy_and_fee)), Burn(shareAssetId, withdrawAmount), ScriptTransfer(moneyBoxAddress, governanceFees, tokenOutB58), IntegerEntry(kShareAssetSupply, (shareSupply - withdrawAmount))] | |
807 | + | else throw("Strict value is not equal to itself.") | |
808 | + | } | |
809 | + | else throw("Strict value is not equal to itself.") | |
810 | + | } | |
811 | + | } | |
812 | + | } | |
813 | + | } | |
814 | + | ||
815 | + | ||
689 | 816 | @Callable(msg) | |
690 | 817 | func D (xp,amp) = { | |
691 | 818 | let D = get_D_internal(xp, amp) | |
692 | 819 | $Tuple2([IntegerEntry("D", D)], D) | |
693 | 820 | } | |
694 | 821 | ||
695 | 822 | ||
696 | 823 | ||
697 | 824 | @Callable(msg) | |
698 | 825 | func init (assetIds,_A,_dAppThresholdCoef) = if (!(isDataStorageUntouched(this))) | |
699 | 826 | then throw("Already initialized") | |
700 | 827 | else if ((0 >= _A)) | |
701 | 828 | then throw("Amp must be must > 0") | |
702 | 829 | else if ((0 >= _dAppThresholdCoef)) | |
703 | 830 | then throw("dApp Threshold Coef must be > 0") | |
704 | 831 | else { | |
705 | 832 | let shareName = "s_Multi_USD" | |
706 | 833 | let shareDescription = ("ShareToken of SwopFi protocol for MultiStable USD pool at address " + toString(this)) | |
707 | 834 | let issueToken = Issue(shareName, shareDescription, 0, 6, true) | |
708 | 835 | let tokenId = calculateAssetId(issueToken) | |
709 | 836 | if (checkCoins(assetIds)) | |
710 | 837 | then throw() | |
711 | 838 | else [StringEntry(kVersion, version), StringEntry(kAssets, assetIds), IntegerEntry("initial_A", _A), IntegerEntry("future_A", _A), IntegerEntry(kFee, getIntegerValue(oracle, "base_fee_flat")), StringEntry(kShareAssetId, toBase58String(tokenId)), IntegerEntry(kShareAssetSupply, 0), IntegerEntry(kDAppThresholdCoef, _dAppThresholdCoef), BooleanEntry(kActive, true), issueToken] | |
712 | 839 | } | |
713 | 840 | ||
714 | 841 | ||
715 | 842 | ||
716 | 843 | @Callable(msg) | |
717 | 844 | func addLiquidity (minMintAmount,stakeFarming,lockType) = valueOrElse(isActive(), { | |
718 | 845 | let amp = _A() | |
719 | 846 | let xp = _xp() | |
720 | 847 | let D0 = if ((shareSupply == 0)) | |
721 | 848 | then 0 | |
722 | 849 | else getDMem(xp, amp) | |
723 | - | let $ | |
850 | + | let $t01901019264 = if (if ((lockType > 0)) | |
724 | 851 | then (msg.payments[(size(msg.payments) - 1)].assetId == unit) | |
725 | 852 | else false) | |
726 | 853 | then $Tuple2(removeByIndex(msg.payments, (size(msg.payments) - 1)), [msg.payments[(size(msg.payments) - 1)]]) | |
727 | 854 | else $Tuple2(msg.payments, nil) | |
728 | - | let payments = $ | |
729 | - | let lockFee = $ | |
855 | + | let payments = $t01901019264._1 | |
856 | + | let lockFee = $t01901019264._2 | |
730 | 857 | let paymentsSize = size(payments) | |
731 | 858 | func validPayments (n) = if ((paymentsSize > nCoins)) | |
732 | 859 | then throw(("payments size > " + toString(nCoins))) | |
733 | 860 | else if ((1 > paymentsSize)) | |
734 | 861 | then throw("payments size < 1") | |
735 | 862 | else if (if ((shareSupply == 0)) | |
736 | 863 | then (nCoins != paymentsSize) | |
737 | 864 | else false) | |
738 | 865 | then throw("initial deposit requires all coins") | |
739 | 866 | else { | |
740 | 867 | func paymantValid (acc,payment) = if (containsElement(assetIds, getStrAssetId(payment.assetId))) | |
741 | 868 | then true | |
742 | 869 | else throw("Invalid asset in payment") | |
743 | 870 | ||
744 | 871 | let $l = payments | |
745 | 872 | let $s = size($l) | |
746 | 873 | let $acc0 = false | |
747 | 874 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
748 | 875 | then $a | |
749 | 876 | else paymantValid($a, $l[$i]) | |
750 | 877 | ||
751 | 878 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
752 | 879 | then $a | |
753 | 880 | else throw("List size exceeds 10") | |
754 | 881 | ||
755 | 882 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
756 | 883 | } | |
757 | 884 | ||
758 | 885 | if (!(validPayments(paymentsSize))) | |
759 | 886 | then throw() | |
760 | 887 | else { | |
761 | 888 | let suspicious = checkSuspicious() | |
762 | 889 | if (suspicious._1) | |
763 | 890 | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, payments)) | |
764 | 891 | else { | |
765 | 892 | func parsePayments (acc,assetId) = { | |
766 | - | let $ | |
767 | - | let newBalances = $ | |
768 | - | let i = $ | |
893 | + | let $t02013420160 = acc | |
894 | + | let newBalances = $t02013420160._1 | |
895 | + | let i = $t02013420160._2 | |
769 | 896 | func parsePayment (newBalance,payment) = if ((getStrAssetId(payment.assetId) == assetId)) | |
770 | 897 | then (newBalance + payment.amount) | |
771 | 898 | else newBalance | |
772 | 899 | ||
773 | 900 | let newBalace = { | |
774 | 901 | let $l = payments | |
775 | 902 | let $s = size($l) | |
776 | 903 | let $acc0 = xp[i] | |
777 | 904 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
778 | 905 | then $a | |
779 | 906 | else parsePayment($a, $l[$i]) | |
780 | 907 | ||
781 | 908 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
782 | 909 | then $a | |
783 | 910 | else throw("List size exceeds 10") | |
784 | 911 | ||
785 | 912 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
786 | 913 | } | |
787 | 914 | $Tuple2((newBalances :+ newBalace), (i + 1)) | |
788 | 915 | } | |
789 | 916 | ||
790 | - | let $ | |
917 | + | let $t02051020577 = { | |
791 | 918 | let $l = assetIds | |
792 | 919 | let $s = size($l) | |
793 | 920 | let $acc0 = $Tuple2(nil, 0) | |
794 | 921 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
795 | 922 | then $a | |
796 | 923 | else parsePayments($a, $l[$i]) | |
797 | 924 | ||
798 | 925 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
799 | 926 | then $a | |
800 | 927 | else throw("List size exceeds 10") | |
801 | 928 | ||
802 | 929 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
803 | 930 | } | |
804 | - | let newBalances = $ | |
805 | - | let k = $ | |
931 | + | let newBalances = $t02051020577._1 | |
932 | + | let k = $t02051020577._2 | |
806 | 933 | if (checkDAppThreshold(newBalances)) | |
807 | 934 | then throw() | |
808 | 935 | else { | |
809 | 936 | let D1 = getDMem(newBalances, amp) | |
810 | 937 | if (assert((D1 > D0))) | |
811 | 938 | then throw("D1 > D0") | |
812 | 939 | else { | |
813 | 940 | let feeDiscount = calculateFeeDiscount(msg.caller) | |
814 | 941 | func calcScriptActions (acc,newBalance) = { | |
815 | - | let $ | |
816 | - | let invBalances = $ | |
817 | - | let scriptActions = $ | |
818 | - | let i = $ | |
942 | + | let $t02089720938 = acc | |
943 | + | let invBalances = $t02089720938._1 | |
944 | + | let scriptActions = $t02089720938._2 | |
945 | + | let i = $t02089720938._3 | |
819 | 946 | if ((shareSupply > 0)) | |
820 | 947 | then { | |
821 | 948 | let _fee = ((fraction(fee, feeDiscount, feeScale6, CEILING) * nCoins) / (4 * (nCoins - 1))) | |
822 | 949 | let fees = { | |
823 | 950 | let idealBalance = fraction(D1, xp[i], D0) | |
824 | 951 | let difference = if ((idealBalance > newBalance)) | |
825 | 952 | then (idealBalance - newBalance) | |
826 | 953 | else (newBalance - idealBalance) | |
827 | 954 | fraction(_fee, difference, feeScale6) | |
828 | 955 | } | |
829 | 956 | let governanceFees = fraction(fees, feeGovernance, feeScale6) | |
830 | 957 | let finalBalance = (newBalance - fees) | |
831 | 958 | let invariantBalance = (newBalance - fees) | |
832 | 959 | let pmt = (newBalance - xp[i]) | |
833 | 960 | let lpFees = (fees - governanceFees) | |
834 | 961 | let inv = if ((pmt > 0)) | |
835 | 962 | then stake((pmt - fees), assetIds[i]) | |
836 | 963 | else unstake(fees, assetIds[i]) | |
837 | 964 | if ((inv == inv)) | |
838 | 965 | then { | |
839 | 966 | let airdrop = if ((lpFees > 0)) | |
840 | 967 | then invoke(lpFarmingAddress, "airDrop", nil, [AttachedPayment(fromBase58String(assetIds[i]), lpFees)]) | |
841 | 968 | else 0 | |
842 | 969 | if ((airdrop == airdrop)) | |
843 | 970 | then $Tuple3((invBalances :+ invariantBalance), (scriptActions ++ [ScriptTransfer(moneyBoxAddress, governanceFees, fromBase58String(assetIds[i])), IntegerEntry((assetIds[i] + kAssetBalance), finalBalance)]), (i + 1)) | |
844 | 971 | else throw("Strict value is not equal to itself.") | |
845 | 972 | } | |
846 | 973 | else throw("Strict value is not equal to itself.") | |
847 | 974 | } | |
848 | 975 | else { | |
849 | 976 | let inv = stake(newBalance, assetIds[i]) | |
850 | 977 | if ((inv == inv)) | |
851 | 978 | then $Tuple3((invBalances :+ newBalance), (scriptActions :+ IntegerEntry((assetIds[i] + kAssetBalance), newBalance)), (i + 1)) | |
852 | 979 | else throw("Strict value is not equal to itself.") | |
853 | 980 | } | |
854 | 981 | } | |
855 | 982 | ||
856 | - | let $ | |
983 | + | let $t02264322731 = { | |
857 | 984 | let $l = newBalances | |
858 | 985 | let $s = size($l) | |
859 | 986 | let $acc0 = $Tuple3(nil, nil, 0) | |
860 | 987 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
861 | 988 | then $a | |
862 | 989 | else calcScriptActions($a, $l[$i]) | |
863 | 990 | ||
864 | 991 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
865 | 992 | then $a | |
866 | 993 | else throw("List size exceeds 10") | |
867 | 994 | ||
868 | 995 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
869 | 996 | } | |
870 | - | let invBalances = $ | |
871 | - | let scriptActions = $ | |
997 | + | let invBalances = $t02264322731._1 | |
998 | + | let scriptActions = $t02264322731._2 | |
872 | 999 | let D2 = getDMem(invBalances, amp) | |
873 | 1000 | let mint_amount = if ((shareSupply == 0)) | |
874 | 1001 | then D1 | |
875 | 1002 | else fraction(shareSupply, (D2 - D0), D0) | |
876 | 1003 | if (assert((mint_amount >= minMintAmount))) | |
877 | 1004 | then throw("Slippage screwed you") | |
878 | 1005 | else if (stakeFarming) | |
879 | 1006 | then { | |
880 | 1007 | let re = invoke(this, "reissueShare", [mint_amount], nil) | |
881 | 1008 | if ((re == re)) | |
882 | 1009 | then { | |
883 | 1010 | let s = invoke(farmingAddress, "lockShareTokensFromPool", [msg.caller.bytes, toString(this), lockType], ([AttachedPayment(shareAssetId, mint_amount)] ++ lockFee)) | |
884 | 1011 | if ((s == s)) | |
885 | 1012 | then (scriptActions :+ IntegerEntry(kShareAssetSupply, (shareSupply + mint_amount))) | |
886 | 1013 | else throw("Strict value is not equal to itself.") | |
887 | 1014 | } | |
888 | 1015 | else throw("Strict value is not equal to itself.") | |
889 | 1016 | } | |
890 | 1017 | else (scriptActions ++ [Reissue(shareAssetId, mint_amount, true), ScriptTransfer(msg.caller, mint_amount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareSupply + mint_amount))]) | |
891 | 1018 | } | |
892 | 1019 | } | |
893 | 1020 | } | |
894 | 1021 | } | |
895 | 1022 | }) | |
896 | 1023 | ||
897 | 1024 | ||
898 | 1025 | ||
899 | 1026 | @Callable(msg) | |
900 | 1027 | func calcMintAmount (newBalances,user) = { | |
901 | 1028 | let amp = _A() | |
902 | 1029 | let xp = _xp() | |
903 | 1030 | let D1 = getDMem(newBalances, amp) | |
904 | 1031 | if ((shareSupply == 0)) | |
905 | 1032 | then $Tuple2(nil, D1) | |
906 | 1033 | else { | |
907 | 1034 | let D0 = getDMem(xp, amp) | |
908 | 1035 | let feeDiscount = calculateFeeDiscount(user) | |
909 | 1036 | func calcInvBalances (acc,newBalance) = { | |
910 | - | let $ | |
911 | - | let invBalances = $ | |
912 | - | let i = $ | |
1037 | + | let $t02400724033 = acc | |
1038 | + | let invBalances = $t02400724033._1 | |
1039 | + | let i = $t02400724033._2 | |
913 | 1040 | let _fee = ((fraction(fee, feeDiscount, feeScale6, CEILING) * nCoins) / (4 * (nCoins - 1))) | |
914 | 1041 | let fees = { | |
915 | 1042 | let idealBalance = fraction(D1, xp[i], D0) | |
916 | 1043 | let difference = if ((idealBalance > newBalance)) | |
917 | 1044 | then (idealBalance - newBalance) | |
918 | 1045 | else (newBalance - idealBalance) | |
919 | 1046 | fraction(_fee, difference, feeScale6) | |
920 | 1047 | } | |
921 | 1048 | let invariantBalance = (newBalance - fees) | |
922 | 1049 | $Tuple2((invBalances :+ invariantBalance), (i + 1)) | |
923 | 1050 | } | |
924 | 1051 | ||
925 | - | let $ | |
1052 | + | let $t02463524705 = { | |
926 | 1053 | let $l = newBalances | |
927 | 1054 | let $s = size($l) | |
928 | 1055 | let $acc0 = $Tuple2(nil, 0) | |
929 | 1056 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
930 | 1057 | then $a | |
931 | 1058 | else calcInvBalances($a, $l[$i]) | |
932 | 1059 | ||
933 | 1060 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
934 | 1061 | then $a | |
935 | 1062 | else throw("List size exceeds 10") | |
936 | 1063 | ||
937 | 1064 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
938 | 1065 | } | |
939 | - | let invBalances = $ | |
940 | - | let k = $ | |
1066 | + | let invBalances = $t02463524705._1 | |
1067 | + | let k = $t02463524705._2 | |
941 | 1068 | let D2 = getDMem(invBalances, amp) | |
942 | 1069 | let mintAmount = fraction(shareSupply, (D2 - D0), D0) | |
943 | 1070 | $Tuple2(nil, mintAmount) | |
944 | 1071 | } | |
945 | 1072 | } | |
946 | 1073 | ||
947 | 1074 | ||
948 | 1075 | ||
949 | 1076 | @Callable(msg) | |
950 | 1077 | func reissueShare (amount) = valueOrElse(isSelfCall(msg), [Reissue(shareAssetId, amount, true)]) | |
951 | 1078 | ||
952 | 1079 | ||
953 | 1080 | ||
954 | 1081 | @Callable(msg) | |
955 | 1082 | func getDy (assetFrom,assetTo,dx,userAddress) = { | |
956 | 1083 | let xp = _xp() | |
957 | 1084 | let fromIndex = valueOrErrorMessage(indexOf(assetIds, assetFrom), "unknown token in") | |
958 | 1085 | let toIndex = valueOrErrorMessage(indexOf(assetIds, assetTo), "unknown token out") | |
959 | 1086 | let x = (xp[fromIndex] + dx) | |
960 | 1087 | let y = getY(fromIndex, toIndex, x, xp) | |
961 | 1088 | let dy = ((xp[toIndex] - y) - 1) | |
962 | 1089 | let feeDiscount = calculateFeeDiscount(Address(fromBase58String(userAddress))) | |
963 | 1090 | let _fee = fraction(fraction(fee, feeDiscount, feeScale6, CEILING), dy, feeScale6) | |
964 | 1091 | $Tuple2(nil, $Tuple2((dy - _fee), _fee)) | |
965 | 1092 | } | |
966 | 1093 | ||
967 | 1094 | ||
968 | 1095 | ||
969 | 1096 | @Callable(msg) | |
970 | 1097 | func exchange (tokenOut,min_dy) = valueOrElse(isActive(), if ((size(msg.payments) != 1)) | |
971 | 1098 | then throw("size(payments) != 1") | |
972 | 1099 | else { | |
973 | 1100 | let suspicious = checkSuspicious() | |
974 | 1101 | if (suspicious._1) | |
975 | 1102 | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, msg.payments)) | |
976 | 1103 | else { | |
977 | 1104 | let payment = msg.payments[0] | |
978 | 1105 | let tokenIn = getStrAssetId(payment.assetId) | |
979 | 1106 | let tokenOutB58 = fromBase58String(tokenOut) | |
980 | 1107 | let dx = payment.amount | |
981 | 1108 | let fromIndex = valueOrErrorMessage(indexOf(assetIds, tokenIn), "unknown token in") | |
982 | 1109 | let toIndex = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
983 | 1110 | let xp = _xp() | |
984 | 1111 | let x = (xp[fromIndex] + dx) | |
985 | 1112 | let y = getY(fromIndex, toIndex, x, xp) | |
986 | 1113 | let _dy = ((xp[toIndex] - y) - 1) | |
987 | 1114 | let feeDiscount = calculateFeeDiscount(msg.originCaller) | |
988 | 1115 | let _fee = fraction(_dy, fraction(fee, feeDiscount, feeScale6, CEILING), feeScale6) | |
989 | 1116 | let dy = (_dy - _fee) | |
990 | 1117 | let governanceFees = fraction(_fee, feeGovernance, feeScale6) | |
991 | 1118 | if (assert((dy >= min_dy))) | |
992 | 1119 | then throw("Exchange resulted in fewer coins than expected") | |
993 | 1120 | else { | |
994 | 1121 | func makeNewBalances (acc,tokenBalance) = { | |
995 | - | let $ | |
996 | - | let newBalances = $ | |
997 | - | let i = $ | |
1122 | + | let $t02674626772 = acc | |
1123 | + | let newBalances = $t02674626772._1 | |
1124 | + | let i = $t02674626772._2 | |
998 | 1125 | if ((i == fromIndex)) | |
999 | 1126 | then $Tuple2((newBalances :+ (tokenBalance + dx)), (i + 1)) | |
1000 | 1127 | else if ((i == toIndex)) | |
1001 | 1128 | then $Tuple2((newBalances :+ (tokenBalance - _dy)), (i + 1)) | |
1002 | 1129 | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
1003 | 1130 | } | |
1004 | 1131 | ||
1005 | - | let $ | |
1132 | + | let $t02702327084 = { | |
1006 | 1133 | let $l = xp | |
1007 | 1134 | let $s = size($l) | |
1008 | 1135 | let $acc0 = $Tuple2(nil, 0) | |
1009 | 1136 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1010 | 1137 | then $a | |
1011 | 1138 | else makeNewBalances($a, $l[$i]) | |
1012 | 1139 | ||
1013 | 1140 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1014 | 1141 | then $a | |
1015 | 1142 | else throw("List size exceeds 10") | |
1016 | 1143 | ||
1017 | 1144 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
1018 | 1145 | } | |
1019 | - | let newBalances = $ | |
1020 | - | let i = $ | |
1146 | + | let newBalances = $t02702327084._1 | |
1147 | + | let i = $t02702327084._2 | |
1021 | 1148 | if (checkDAppThreshold(newBalances)) | |
1022 | 1149 | then throw() | |
1023 | 1150 | else { | |
1024 | 1151 | let s = stake(payment.amount, getStrAssetId(payment.assetId)) | |
1025 | 1152 | if ((s == s)) | |
1026 | 1153 | then { | |
1027 | 1154 | let us = unstake(_dy, tokenOut) | |
1028 | 1155 | if ((us == us)) | |
1029 | 1156 | then { | |
1030 | 1157 | let lpFees = (_fee - governanceFees) | |
1031 | 1158 | let airdrop = if ((lpFees > 0)) | |
1032 | 1159 | then invoke(lpFarmingAddress, "airDrop", nil, [AttachedPayment(tokenOutB58, lpFees)]) | |
1033 | 1160 | else 0 | |
1034 | 1161 | if ((airdrop == airdrop)) | |
1035 | 1162 | then $Tuple2([IntegerEntry((tokenIn + kAssetBalance), x), IntegerEntry((tokenOut + kAssetBalance), (xp[toIndex] - _dy)), ScriptTransfer(msg.caller, dy, tokenOutB58), ScriptTransfer(moneyBoxAddress, governanceFees, tokenOutB58)], [dy, tokenOutB58]) | |
1036 | 1163 | else throw("Strict value is not equal to itself.") | |
1037 | 1164 | } | |
1038 | 1165 | else throw("Strict value is not equal to itself.") | |
1039 | 1166 | } | |
1040 | 1167 | else throw("Strict value is not equal to itself.") | |
1041 | 1168 | } | |
1042 | 1169 | } | |
1043 | 1170 | } | |
1044 | 1171 | }) | |
1045 | 1172 | ||
1046 | 1173 | ||
1047 | 1174 | ||
1048 | 1175 | @Callable(msg) | |
1049 | - | func withdraw (minAmounts) = valueOrElse(isActive(), if ((size(msg.payments) != 1)) | |
1050 | - | then throw("size(payments) != 1") | |
1051 | - | else { | |
1052 | - | let pmtAmount = msg.payments[0].amount | |
1053 | - | let pmtAssetId = msg.payments[0].assetId | |
1054 | - | if ((shareAssetId != pmtAssetId)) | |
1055 | - | then throw("unknown payment token") | |
1056 | - | else { | |
1057 | - | let suspicious = checkSuspicious() | |
1058 | - | if (suspicious._1) | |
1059 | - | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.originCaller, msg.payments)) | |
1060 | - | else { | |
1061 | - | func calcScriptActions (acc,balance) = { | |
1062 | - | let $t02483524863 = acc | |
1063 | - | let scriptActions = $t02483524863._1 | |
1064 | - | let i = $t02483524863._2 | |
1065 | - | let wAmount = fraction(balance, pmtAmount, shareSupply) | |
1066 | - | if (assert((wAmount >= minAmounts[i]))) | |
1067 | - | then throw("Withdrawal resulted in fewer coins than expected") | |
1068 | - | else { | |
1069 | - | let us = unstake(wAmount, assetIds[i]) | |
1070 | - | if ((us == us)) | |
1071 | - | then $Tuple2((scriptActions ++ [IntegerEntry((assetIds[i] + kAssetBalance), (balance - wAmount)), ScriptTransfer(msg.originCaller, wAmount, fromBase58String(assetIds[i]))]), (i + 1)) | |
1072 | - | else throw("Strict value is not equal to itself.") | |
1073 | - | } | |
1074 | - | } | |
1075 | - | ||
1076 | - | let $t02535325421 = { | |
1077 | - | let $l = _xp() | |
1078 | - | let $s = size($l) | |
1079 | - | let $acc0 = $Tuple2(nil, 0) | |
1080 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1081 | - | then $a | |
1082 | - | else calcScriptActions($a, $l[$i]) | |
1083 | - | ||
1084 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1085 | - | then $a | |
1086 | - | else throw("List size exceeds 10") | |
1087 | - | ||
1088 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
1089 | - | } | |
1090 | - | let scriptActions = $t02535325421._1 | |
1091 | - | let i = $t02535325421._2 | |
1092 | - | (scriptActions ++ [Burn(shareAssetId, pmtAmount), IntegerEntry(kShareAssetSupply, (shareSupply - pmtAmount))]) | |
1093 | - | } | |
1094 | - | } | |
1095 | - | }) | |
1176 | + | func withdraw (minAmounts) = valueOrElse(isActive(), calcWithdraw(msg, minAmounts, 0)) | |
1096 | 1177 | ||
1097 | 1178 | ||
1098 | 1179 | ||
1099 | 1180 | @Callable(msg) | |
1100 | 1181 | func withdrawWithUnlock (minAmounts,unlockAmount) = valueOrElse(isActive(), if ((0 >= unlockAmount)) | |
1101 | 1182 | then throw("Unlock amount must be positive") | |
1102 | 1183 | else { | |
1103 | - | let suspicious = checkSuspicious() | |
1104 | - | if (suspicious._1) | |
1105 | - | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, msg.payments)) | |
1106 | - | else { | |
1107 | - | let pmtAmount = if ((size(msg.payments) > 0)) | |
1108 | - | then if ((size(msg.payments) != 1)) | |
1109 | - | then throw("size(payments) != 1") | |
1110 | - | else { | |
1111 | - | let pmtAssetId = msg.payments[0].assetId | |
1112 | - | if ((shareAssetId != pmtAssetId)) | |
1113 | - | then throw("unknown payment token") | |
1114 | - | else msg.payments[0].amount | |
1115 | - | } | |
1116 | - | else 0 | |
1117 | - | let unlock = invoke(farmingAddress, "withdrawShareTokensFromPool", [msg.caller.bytes, toString(this), unlockAmount], nil) | |
1118 | - | if ((unlock == unlock)) | |
1119 | - | then { | |
1120 | - | let withdrawAmount = (pmtAmount + unlockAmount) | |
1121 | - | let inv = invoke(this, "withdraw", [minAmounts], [AttachedPayment(shareAssetId, withdrawAmount)]) | |
1122 | - | if ((inv == inv)) | |
1123 | - | then nil | |
1124 | - | else throw("Strict value is not equal to itself.") | |
1125 | - | } | |
1126 | - | else throw("Strict value is not equal to itself.") | |
1127 | - | } | |
1184 | + | let unlock = invoke(farmingAddress, "withdrawShareTokensFromPool", [msg.caller.bytes, toString(this), unlockAmount], nil) | |
1185 | + | if ((unlock == unlock)) | |
1186 | + | then calcWithdraw(msg, minAmounts, unlockAmount) | |
1187 | + | else throw("Strict value is not equal to itself.") | |
1128 | 1188 | }) | |
1129 | 1189 | ||
1130 | 1190 | ||
1131 | 1191 | ||
1132 | 1192 | @Callable(msg) | |
1133 | 1193 | func calcWithdrawOneCoin (tokenAmount,tokenOut,user) = if ((0 >= tokenAmount)) | |
1134 | 1194 | then throw("Amount must be positive") | |
1135 | 1195 | else { | |
1136 | 1196 | let i = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
1137 | 1197 | $Tuple2(nil, _calcWithdrawOneCoin(_xp(), tokenAmount, i, Address(fromBase58String(user)))._1) | |
1138 | 1198 | } | |
1139 | 1199 | ||
1140 | 1200 | ||
1141 | 1201 | ||
1142 | 1202 | @Callable(msg) | |
1143 | - | func withdrawOneCoin (tokenOut,minAmount) = valueOrElse(isActive(), if ((size(msg.payments) != 1)) | |
1144 | - | then throw("size(payments) != 1") | |
1145 | - | else { | |
1146 | - | let suspicious = checkSuspicious() | |
1147 | - | if (suspicious._1) | |
1148 | - | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.originCaller, msg.payments)) | |
1149 | - | else { | |
1150 | - | let pmtAmount = msg.payments[0].amount | |
1151 | - | let pmtAssetId = msg.payments[0].assetId | |
1152 | - | if ((pmtAssetId != shareAssetId)) | |
1153 | - | then throw("unknown token") | |
1154 | - | else { | |
1155 | - | let outIndex = valueOrErrorMessage(indexOf(assetIds, tokenOut), "unknown token out") | |
1156 | - | let tokenOutB58 = fromBase58String(tokenOut) | |
1157 | - | let xp = _xp() | |
1158 | - | let $t02747927561 = _calcWithdrawOneCoin(xp, pmtAmount, outIndex, msg.originCaller) | |
1159 | - | let dy = $t02747927561._1 | |
1160 | - | let dy_fee = $t02747927561._2 | |
1161 | - | if (assert((dy >= minAmount))) | |
1162 | - | then throw("Not enough coins removed") | |
1163 | - | else { | |
1164 | - | let governanceFees = fraction(dy_fee, feeGovernance, feeScale6) | |
1165 | - | let dy_and_fee = (dy + dy_fee) | |
1166 | - | func makeNewBalances (acc,tokenBalance) = { | |
1167 | - | let $t02781927845 = acc | |
1168 | - | let newBalances = $t02781927845._1 | |
1169 | - | let i = $t02781927845._2 | |
1170 | - | if ((i == outIndex)) | |
1171 | - | then $Tuple2((newBalances :+ (tokenBalance - dy_and_fee)), (i + 1)) | |
1172 | - | else $Tuple2((newBalances :+ tokenBalance), (i + 1)) | |
1173 | - | } | |
1174 | - | ||
1175 | - | let $t02801228073 = { | |
1176 | - | let $l = xp | |
1177 | - | let $s = size($l) | |
1178 | - | let $acc0 = $Tuple2(nil, 0) | |
1179 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1180 | - | then $a | |
1181 | - | else makeNewBalances($a, $l[$i]) | |
1182 | - | ||
1183 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1184 | - | then $a | |
1185 | - | else throw("List size exceeds 10") | |
1186 | - | ||
1187 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
1188 | - | } | |
1189 | - | let newBalances = $t02801228073._1 | |
1190 | - | let v = $t02801228073._2 | |
1191 | - | if (checkDAppThreshold(newBalances)) | |
1192 | - | then throw() | |
1193 | - | else { | |
1194 | - | let us = unstake(dy_and_fee, tokenOut) | |
1195 | - | if ((us == us)) | |
1196 | - | then { | |
1197 | - | let lpFees = (dy_fee - governanceFees) | |
1198 | - | let airdrop = if ((lpFees > 0)) | |
1199 | - | then invoke(lpFarmingAddress, "airDrop", nil, [AttachedPayment(tokenOutB58, lpFees)]) | |
1200 | - | else 0 | |
1201 | - | if ((airdrop == airdrop)) | |
1202 | - | then [ScriptTransfer(msg.originCaller, dy, tokenOutB58), IntegerEntry((assetIds[outIndex] + kAssetBalance), (xp[outIndex] - dy_and_fee)), Burn(shareAssetId, pmtAmount), ScriptTransfer(moneyBoxAddress, governanceFees, tokenOutB58), IntegerEntry(kShareAssetSupply, (shareSupply - pmtAmount))] | |
1203 | - | else throw("Strict value is not equal to itself.") | |
1204 | - | } | |
1205 | - | else throw("Strict value is not equal to itself.") | |
1206 | - | } | |
1207 | - | } | |
1208 | - | } | |
1209 | - | } | |
1210 | - | }) | |
1203 | + | func withdrawOneCoin (tokenOut,minAmount) = valueOrElse(isActive(), calcWithdrawOneCoinEntries(msg, tokenOut, minAmount, 0)) | |
1211 | 1204 | ||
1212 | 1205 | ||
1213 | 1206 | ||
1214 | 1207 | @Callable(msg) | |
1215 | 1208 | func withdrawOneCoinWithUnlock (tokenOut,minAmount,unlockAmount) = valueOrElse(isActive(), if ((0 >= unlockAmount)) | |
1216 | 1209 | then throw("Unlock amount must be positive") | |
1217 | 1210 | else { | |
1218 | - | let suspicious = checkSuspicious() | |
1219 | - | if (suspicious._1) | |
1220 | - | then (suspendSuspicious(suspicious._2) ++ returnPayments(msg.caller, msg.payments)) | |
1221 | - | else { | |
1222 | - | let pmtAmount = if ((size(msg.payments) > 0)) | |
1223 | - | then if ((size(msg.payments) != 1)) | |
1224 | - | then throw("size(payments) != 1") | |
1225 | - | else { | |
1226 | - | let pmtAssetId = msg.payments[0].assetId | |
1227 | - | if ((shareAssetId != pmtAssetId)) | |
1228 | - | then throw("unknown payment token") | |
1229 | - | else msg.payments[0].amount | |
1230 | - | } | |
1231 | - | else 0 | |
1232 | - | let unlock = invoke(farmingAddress, "withdrawShareTokensFromPool", [msg.caller.bytes, toString(this), unlockAmount], nil) | |
1233 | - | if ((unlock == unlock)) | |
1234 | - | then { | |
1235 | - | let withdrawAmount = (pmtAmount + unlockAmount) | |
1236 | - | let inv = invoke(this, "withdrawOneCoin", [tokenOut, minAmount], [AttachedPayment(shareAssetId, withdrawAmount)]) | |
1237 | - | if ((inv == inv)) | |
1238 | - | then nil | |
1239 | - | else throw("Strict value is not equal to itself.") | |
1240 | - | } | |
1241 | - | else throw("Strict value is not equal to itself.") | |
1242 | - | } | |
1211 | + | let unlock = invoke(farmingAddress, "withdrawShareTokensFromPool", [msg.caller.bytes, toString(this), unlockAmount], nil) | |
1212 | + | if ((unlock == unlock)) | |
1213 | + | then calcWithdrawOneCoinEntries(msg, tokenOut, minAmount, unlockAmount) | |
1214 | + | else throw("Strict value is not equal to itself.") | |
1243 | 1215 | }) | |
1244 | 1216 | ||
1245 | 1217 | ||
1246 | 1218 | ||
1247 | 1219 | @Callable(msg) | |
1248 | 1220 | func A () = $Tuple2(nil, _A()) | |
1249 | 1221 | ||
1250 | 1222 | ||
1251 | 1223 | ||
1252 | 1224 | @Callable(msg) | |
1253 | 1225 | func getVirtualPrice () = { | |
1254 | 1226 | let D = get_D(_xp(), _A()) | |
1255 | 1227 | $Tuple2(nil, fraction(D, PRECISION, shareSupply)) | |
1256 | 1228 | } | |
1257 | 1229 | ||
1258 | 1230 | ||
1259 | 1231 | ||
1260 | 1232 | @Callable(msg) | |
1261 | 1233 | func calcTokenAmount (amounts,deposit) = { | |
1262 | 1234 | let amp = _A() | |
1263 | 1235 | let balances = _xp() | |
1264 | 1236 | let D0 = getDMem(balances, amp) | |
1265 | 1237 | func calcNewBalances (acc,balance) = { | |
1266 | - | let $ | |
1267 | - | let newBalances = $ | |
1268 | - | let i = $ | |
1238 | + | let $t02959129617 = acc | |
1239 | + | let newBalances = $t02959129617._1 | |
1240 | + | let i = $t02959129617._2 | |
1269 | 1241 | let newBalance = (balance + (if (deposit) | |
1270 | 1242 | then amounts[i] | |
1271 | 1243 | else -(amounts[i]))) | |
1272 | 1244 | $Tuple2((newBalances :+ newBalance), (i + 1)) | |
1273 | 1245 | } | |
1274 | 1246 | ||
1275 | 1247 | let newBalances = ( let $l = balances | |
1276 | 1248 | let $s = size($l) | |
1277 | 1249 | let $acc0 = $Tuple2(nil, 0) | |
1278 | 1250 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1279 | 1251 | then $a | |
1280 | 1252 | else calcNewBalances($a, $l[$i]) | |
1281 | 1253 | ||
1282 | 1254 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1283 | 1255 | then $a | |
1284 | 1256 | else throw("List size exceeds 10") | |
1285 | 1257 | ||
1286 | 1258 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10))._1 | |
1287 | 1259 | let D1 = getDMem(newBalances, amp) | |
1288 | 1260 | let diff = if (deposit) | |
1289 | 1261 | then (D1 - D0) | |
1290 | 1262 | else (D0 - D1) | |
1291 | 1263 | $Tuple2(nil, fraction(diff, shareSupply, D0)) | |
1292 | 1264 | } | |
1293 | 1265 | ||
1294 | 1266 | ||
1295 | 1267 | ||
1296 | 1268 | @Callable(msg) | |
1297 | 1269 | func rampA (_futureA,_futureTime) = valueOrElse(isActive(), valueOrElse(isAdminCall(msg), if (assert((blockTimestamp >= (initial_A_time + MIN_RAMP_TIME)))) | |
1298 | 1270 | then throw("too often") | |
1299 | 1271 | else if (assert((_futureTime >= (blockTimestamp + MIN_RAMP_TIME)))) | |
1300 | 1272 | then throw("insufficient time") | |
1301 | 1273 | else { | |
1302 | 1274 | let _initial_A = _A() | |
1303 | 1275 | if (assert(if ((_futureA > 0)) | |
1304 | 1276 | then (MAX_A > _futureA) | |
1305 | 1277 | else false)) | |
1306 | 1278 | then throw("out of base range") | |
1307 | 1279 | else if (assert(if (if ((_futureA >= _initial_A)) | |
1308 | 1280 | then ((_initial_A * MAX_A_CHANGE) >= _futureA) | |
1309 | 1281 | else false) | |
1310 | 1282 | then true | |
1311 | 1283 | else if ((_initial_A > _futureA)) | |
1312 | 1284 | then ((_futureA * MAX_A_CHANGE) >= _initial_A) | |
1313 | 1285 | else false)) | |
1314 | 1286 | then throw("out of range") | |
1315 | 1287 | else [IntegerEntry("initial_A", _initial_A), IntegerEntry("future_A", _futureA), IntegerEntry("initial_A_time", blockTimestamp), IntegerEntry("future_A_time", _futureTime)] | |
1316 | 1288 | })) | |
1317 | 1289 | ||
1318 | 1290 | ||
1319 | 1291 | ||
1320 | 1292 | @Callable(msg) | |
1321 | 1293 | func stopRampA () = valueOrElse(isActive(), valueOrElse(isAdminCall(msg), { | |
1322 | 1294 | let currentA = _A() | |
1323 | 1295 | [IntegerEntry("initial_A", currentA), IntegerEntry("future_A", currentA), IntegerEntry("initial_A_time", blockTimestamp), IntegerEntry("future_A_time", blockTimestamp)] | |
1324 | 1296 | })) | |
1325 | 1297 | ||
1326 | 1298 | ||
1327 | 1299 | ||
1328 | 1300 | @Callable(msg) | |
1329 | 1301 | func shutdown () = valueOrElse(isAdminCall(msg), if (!(active)) | |
1330 | 1302 | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
1331 | 1303 | else suspend("Paused by admin")) | |
1332 | 1304 | ||
1333 | 1305 | ||
1334 | 1306 | ||
1335 | 1307 | @Callable(msg) | |
1336 | 1308 | func activate () = valueOrElse(isAdminCall(msg), if (active) | |
1337 | 1309 | then throwIsActive() | |
1338 | 1310 | else [BooleanEntry(kActive, true), DeleteEntry(kCause)]) | |
1339 | 1311 | ||
1340 | 1312 | ||
1341 | 1313 | ||
1342 | 1314 | @Callable(msg) | |
1343 | 1315 | func takeIntoAccountExtraFunds () = valueOrElse(isActive(), if ((msg.caller != moneyBoxAddress)) | |
1344 | 1316 | then throw("Only the wallet can call this function") | |
1345 | 1317 | else { | |
1346 | 1318 | let balances = _xp() | |
1347 | 1319 | func takeExtraFunds (acc,assetId) = { | |
1348 | - | let $ | |
1349 | - | let sum = $ | |
1350 | - | let i = $ | |
1320 | + | let $t03195931977 = acc | |
1321 | + | let sum = $t03195931977._1 | |
1322 | + | let i = $t03195931977._2 | |
1351 | 1323 | let tokenB58 = fromBase58String(assetId) | |
1352 | 1324 | let rBalance = (assetBalance(this, tokenB58) + stakedAmount(tokenB58)) | |
1353 | 1325 | let enrollAmount = (rBalance - balances[i]) | |
1354 | 1326 | if ((0 > enrollAmount)) | |
1355 | 1327 | then suspend(("Enroll amount negative for asset" + assetId)) | |
1356 | 1328 | else { | |
1357 | 1329 | let airdrop = if ((enrollAmount > 0)) | |
1358 | 1330 | then invoke(lpFarmingAddress, "airDrop", nil, [AttachedPayment(tokenB58, enrollAmount)]) | |
1359 | 1331 | else 0 | |
1360 | 1332 | if ((airdrop == airdrop)) | |
1361 | 1333 | then $Tuple2((sum + enrollAmount), (i + 1)) | |
1362 | 1334 | else throw("Strict value is not equal to itself.") | |
1363 | 1335 | } | |
1364 | 1336 | } | |
1365 | 1337 | ||
1366 | 1338 | let k = { | |
1367 | 1339 | let $l = assetIds | |
1368 | 1340 | let $s = size($l) | |
1369 | 1341 | let $acc0 = $Tuple2(0, 0) | |
1370 | 1342 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
1371 | 1343 | then $a | |
1372 | 1344 | else takeExtraFunds($a, $l[$i]) | |
1373 | 1345 | ||
1374 | 1346 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
1375 | 1347 | then $a | |
1376 | 1348 | else throw("List size exceeds 10") | |
1377 | 1349 | ||
1378 | 1350 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
1379 | 1351 | } | |
1380 | 1352 | if ((k._1 == 0)) | |
1381 | 1353 | then throw("No money to take") | |
1382 | 1354 | else nil | |
1383 | 1355 | }) | |
1384 | 1356 | ||
1385 | 1357 | ||
1386 | 1358 | @Verifier(tx) | |
1387 | 1359 | func verify () = { | |
1388 | 1360 | let multiSignedByAdmins = { | |
1389 | 1361 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
1390 | 1362 | then 1 | |
1391 | 1363 | else 0 | |
1392 | 1364 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
1393 | 1365 | then 1 | |
1394 | 1366 | else 0 | |
1395 | 1367 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
1396 | 1368 | then 1 | |
1397 | 1369 | else 0 | |
1398 | 1370 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
1399 | 1371 | } | |
1400 | 1372 | match tx { | |
1401 | 1373 | case inv: InvokeScriptTransaction => | |
1402 | 1374 | let callTakeIntoAccount = if ((inv.dApp == this)) | |
1403 | 1375 | then (inv.function == "takeIntoAccountExtraFunds") | |
1404 | 1376 | else false | |
1405 | 1377 | let signedByAdmin = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
1406 | 1378 | then true | |
1407 | 1379 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey2)) | |
1408 | 1380 | then true | |
1409 | 1381 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey3)) | |
1410 | 1382 | then true | |
1411 | 1383 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKeyInvoke) | |
1412 | 1384 | if (if (callTakeIntoAccount) | |
1413 | 1385 | then signedByAdmin | |
1414 | 1386 | else false) | |
1415 | 1387 | then true | |
1416 | 1388 | else multiSignedByAdmins | |
1417 | 1389 | case _ => | |
1418 | 1390 | multiSignedByAdmins | |
1419 | 1391 | } | |
1420 | 1392 | } | |
1421 | 1393 |
github/deemru/w8io/026f985 139.01 ms ◑