tx · GBhQcfEcGr6EdoJqrBTJxNS8KRPWvG1SDmq5HHz6o8aY 3MzqQ3HKdkHmJmk9mDhAeAMxmK5D2ztdAe5: -0.05000000 Waves 2022.11.25 20:41 [2333116] smart account 3MzqQ3HKdkHmJmk9mDhAeAMxmK5D2ztdAe5 > SELF 0.00000000 Waves
{ "type": 13, "id": "GBhQcfEcGr6EdoJqrBTJxNS8KRPWvG1SDmq5HHz6o8aY", "fee": 5000000, "feeAssetId": null, "timestamp": 1669408899123, "version": 2, "chainId": 84, "sender": "3MzqQ3HKdkHmJmk9mDhAeAMxmK5D2ztdAe5", "senderPublicKey": "FEnkfXnQZkk1FmjhH6QZqyK2taN6ngnZBexevKxouLUM", "proofs": [ "eJJiwAEPZzxShVw2UcwnhebvTriRymMUCUNcJQjbusoHhAez4ScjF9gRTDtbgHKaf6uHV3NDYM7ogRpUd8E5wWC", "3AAfEKa8VuFKP9Xsa884k3Lx3X6nGL3jG2QfBXAQkDutECGTFskFZDRXNJdm2nfUtd9NPDMtm5Lz8aThFP6Dadih" ], "script": "base64:BgJKCAISBgoEAhgREhIGCgQCGBESEgYKBAIYERISBgoEAhgREhIGCgQCGBESEgYKBAIYERISBgoEAhgREhIGCgQCGBESEgYKBAIYERJLAAd2ZXJzaW9uAgUxLjAuMAAIa1ZlcnNpb24CB3ZlcnNpb24AB2tBY3RpdmUCBmFjdGl2ZQAJa0Fzc2V0SWRBAgpBX2Fzc2V0X2lkAAlrQXNzZXRJZEICCkJfYXNzZXRfaWQACWtCYWxhbmNlQQIPQV9hc3NldF9iYWxhbmNlAAlrQmFsYW5jZUICD0JfYXNzZXRfYmFsYW5jZQANa0JhbGFuY2VJbml0QQIMQV9hc3NldF9pbml0AA1rQmFsYW5jZUluaXRCAgxCX2Fzc2V0X2luaXQADWtTaGFyZUFzc2V0SWQCDnNoYXJlX2Fzc2V0X2lkABFrU2hhcmVBc3NldFN1cHBseQISc2hhcmVfYXNzZXRfc3VwcGx5AARrRmVlAgpjb21taXN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Z25lZAUSYWRtaW5QdWJLZXkzU2lnbmVkAAIFE211bHRpU2lnbmVkQnlBZG1pbnOn4Ctt", "height": 2333116, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DPyp1jZciazAD3rf9Q7azcsWbqaaB7Unonk6KPBh4d2T Next: 5fy4M9617sVwqkpQQJksvCcdoTDordPRbNhGF85Hy7pd Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let version = "1.0.0" | |
5 | + | ||
6 | + | let kVersion = "version" | |
7 | + | ||
4 | 8 | let kActive = "active" | |
5 | 9 | ||
6 | - | let kActiveGlob = "active_all_contracts" | |
10 | + | let kAssetIdA = "A_asset_id" | |
11 | + | ||
12 | + | let kAssetIdB = "B_asset_id" | |
13 | + | ||
14 | + | let kBalanceA = "A_asset_balance" | |
15 | + | ||
16 | + | let kBalanceB = "B_asset_balance" | |
17 | + | ||
18 | + | let kBalanceInitA = "A_asset_init" | |
19 | + | ||
20 | + | let kBalanceInitB = "B_asset_init" | |
21 | + | ||
22 | + | let kShareAssetId = "share_asset_id" | |
23 | + | ||
24 | + | let kShareAssetSupply = "share_asset_supply" | |
25 | + | ||
26 | + | let kFee = "commission" | |
7 | 27 | ||
8 | 28 | let kCause = "shutdown_cause" | |
29 | + | ||
30 | + | let kFirstHarvest = "first_harvest" | |
31 | + | ||
32 | + | let kFirstHarvestHeight = "first_harvest_height" | |
33 | + | ||
34 | + | let kShareLimit = "share_limit_on_first_harvest" | |
35 | + | ||
36 | + | let kBasePeriod = "base_period" | |
37 | + | ||
38 | + | let kPeriodLength = "period_length" | |
39 | + | ||
40 | + | let kStartHeight = "start_height" | |
9 | 41 | ||
10 | 42 | let kUSDNAddress = "staking_usdnnsbt_address" | |
11 | 43 | ||
12 | 44 | let kEURNAddress = "staking_eurn_address" | |
13 | 45 | ||
14 | - | let kLeasingPool = "leasing_address" | |
15 | - | ||
16 | 46 | let kLeasingAmount = "leasing_amount" | |
17 | 47 | ||
18 | - | let kLeasingId = "leasing_id" | |
48 | + | let kUSDNAssetId = "usdn_asset_id" | |
49 | + | ||
50 | + | let kEURNAssetId = "eurn_asset_id" | |
51 | + | ||
52 | + | let kStakingAssets = "staking_assets" | |
53 | + | ||
54 | + | let kOracleActive = "active_all_contracts" | |
55 | + | ||
56 | + | let kDiscounts = "discounts" | |
57 | + | ||
58 | + | let kDiscountValues = "discount_values" | |
59 | + | ||
60 | + | let kUserGSwopInGov = "_GSwop_amount" | |
61 | + | ||
62 | + | let kUserSwopInGov = "_SWOP_amount" | |
63 | + | ||
64 | + | let kOraclePool = "pool_" | |
19 | 65 | ||
20 | 66 | let kAdminPubKey1 = "admin_pub_1" | |
21 | 67 | ||
25 | 71 | ||
26 | 72 | let kAdminInvokePubKey = "admin_invoke_pub" | |
27 | 73 | ||
28 | - | let | |
74 | + | let kMoneyBoxAddress = "money_box_address" | |
29 | 75 | ||
30 | - | let | |
76 | + | let kVotingAddress = "voting_address" | |
31 | 77 | ||
32 | - | let | |
78 | + | let kGovAddress = "governance_address" | |
33 | 79 | ||
34 | - | let kStakingAssets = "staking_assets" | |
35 | - | ||
36 | - | let kShareAssetId = "share_asset_id" | |
80 | + | let kFarmingAddress = "farming_address" | |
37 | 81 | ||
38 | 82 | let oracle = Address(base58'3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz') | |
39 | 83 | ||
51 | 95 | ||
52 | 96 | let adminPubKey3 = getBase58FromOracle(kAdminPubKey3) | |
53 | 97 | ||
54 | - | let | |
98 | + | let adminInvokePubKey = getBase58FromOracle(kAdminInvokePubKey) | |
55 | 99 | ||
56 | - | let | |
100 | + | let moneyBoxAddress = Address(getBase58FromOracle(kMoneyBoxAddress)) | |
57 | 101 | ||
58 | - | let | |
102 | + | let votingAddress = Address(getBase58FromOracle(kVotingAddress)) | |
59 | 103 | ||
60 | - | let cpmmContract = Address(getBase58FromOracle(kCpmmContract)) | |
104 | + | let govAddress = Address(getBase58FromOracle(kGovAddress)) | |
105 | + | ||
106 | + | let farmingAddress = Address(getBase58FromOracle(kFarmingAddress)) | |
61 | 107 | ||
62 | 108 | let USDN = getBase58FromOracle(kUSDNAssetId) | |
63 | 109 | ||
65 | 111 | ||
66 | 112 | let stakingAssets = getStringValue(oracle, kStakingAssets) | |
67 | 113 | ||
68 | - | let | |
114 | + | let stakingUSDNAddress = Address(getBase58FromOracle(kUSDNAddress)) | |
69 | 115 | ||
70 | - | let | |
116 | + | let stakingEURNAddress = Address(getBase58FromOracle(kEURNAddress)) | |
71 | 117 | ||
72 | - | func isActive () = if (if (active) | |
73 | - | then activeGlob | |
74 | - | else false) | |
75 | - | then unit | |
76 | - | else throw("DApp is inactive at this moment") | |
118 | + | let basePeriod = valueOrErrorMessage(getInteger(votingAddress, kBasePeriod), "Empty kBasePeriod") | |
119 | + | ||
120 | + | let startHeight = valueOrErrorMessage(getInteger(votingAddress, kStartHeight), "Empty kStartHeight") | |
121 | + | ||
122 | + | let periodLength = valueOrErrorMessage(getInteger(votingAddress, kPeriodLength), "Empty kPeriodLength") | |
123 | + | ||
124 | + | let firstHarvestEndPeriod = ((basePeriod + ((height - startHeight) / periodLength)) + 3) | |
125 | + | ||
126 | + | let active = getBooleanValue(oracle, kOracleActive) | |
127 | + | ||
128 | + | let feeScale6 = 1000000 | |
129 | + | ||
130 | + | let scale8 = 100000000 | |
131 | + | ||
132 | + | func accountBalance (assetId,pool) = match assetId { | |
133 | + | case id: ByteVector => | |
134 | + | assetBalance(pool, id) | |
135 | + | case waves: Unit => | |
136 | + | wavesBalance(pool).available | |
137 | + | case _ => | |
138 | + | throw("Match error") | |
139 | + | } | |
77 | 140 | ||
78 | 141 | ||
79 | - | func isGlobalCaller (caller) = if ((caller == cpmmContract)) | |
80 | - | then unit | |
81 | - | else throw("Only global Contract can invoke this function") | |
142 | + | func stakedAmount (assetId,pool) = { | |
143 | + | let stakedAmountCalculated = match assetId { | |
144 | + | case aId: ByteVector => | |
145 | + | if ((aId == USDN)) | |
146 | + | then getInteger(stakingUSDNAddress, ((("rpd_balance_" + toBase58String(aId)) + "_") + toString(pool))) | |
147 | + | else if ((aId == EURN)) | |
148 | + | then getInteger(stakingEURNAddress, ((("%s%s%s__stakingBalance__" + toBase58String(aId)) + "__") + toString(pool))) | |
149 | + | else 0 | |
150 | + | case _: Unit => | |
151 | + | valueOrElse(getInteger(pool, kLeasingAmount), 0) | |
152 | + | case _ => | |
153 | + | throw("Match error") | |
154 | + | } | |
155 | + | match stakedAmountCalculated { | |
156 | + | case i: Int => | |
157 | + | i | |
158 | + | case _ => | |
159 | + | 0 | |
160 | + | } | |
161 | + | } | |
82 | 162 | ||
83 | 163 | ||
84 | - | func isAdminCall (callerPubKey) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], callerPubKey)) | |
85 | - | then unit | |
86 | - | else throw("Only admin can call this function") | |
164 | + | func getAssetInfo (assetId) = match assetId { | |
165 | + | case id: String|ByteVector => | |
166 | + | let $t038974069 = match id { | |
167 | + | case aId: ByteVector => | |
168 | + | $Tuple2(toBase58String(aId), aId) | |
169 | + | case aId: String => | |
170 | + | $Tuple2(aId, fromBase58String(aId)) | |
171 | + | case _ => | |
172 | + | throw("Match error") | |
173 | + | } | |
174 | + | let stringId = $t038974069._1 | |
175 | + | let bytesId = $t038974069._2 | |
176 | + | let info = valueOrErrorMessage(assetInfo(bytesId), (("Asset " + stringId) + " doesn't exist")) | |
177 | + | $Tuple3(stringId, info.name, info.decimals) | |
178 | + | case waves: Unit => | |
179 | + | $Tuple3("WAVES", "WAVES", 8) | |
180 | + | case _ => | |
181 | + | throw("Match error") | |
182 | + | } | |
87 | 183 | ||
88 | 184 | ||
89 | 185 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
90 | 186 | ||
91 | 187 | ||
92 | - | func calcStakingFuncAndAddres (stake,assetId) = if (stake) | |
93 | - | then if ((assetId == USDN)) | |
94 | - | then $Tuple2("lockNeutrino", stakingUSDNAddress) | |
95 | - | else $Tuple2("startStaking", stakingEURNAddress) | |
96 | - | else if ((assetId == USDN)) | |
97 | - | then $Tuple2("unlockNeutrino", stakingUSDNAddress) | |
98 | - | else $Tuple2("stopStaking", stakingEURNAddress) | |
99 | - | ||
100 | - | ||
101 | - | func calcStakingParams (stake,amount,assetId) = if (stake) | |
102 | - | then { | |
103 | - | let $t025932659 = calcStakingFuncAndAddres(stake, assetId) | |
104 | - | let call = $t025932659._1 | |
105 | - | let stakingAddr = $t025932659._2 | |
106 | - | $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)]) | |
107 | - | } | |
108 | - | else { | |
109 | - | let $t027452811 = calcStakingFuncAndAddres(stake, assetId) | |
110 | - | let call = $t027452811._1 | |
111 | - | let stakingAddr = $t027452811._2 | |
112 | - | $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil) | |
113 | - | } | |
114 | - | ||
115 | - | ||
116 | - | func collectPayments (acc,payment) = { | |
117 | - | let $t029733016 = acc | |
118 | - | let paymentAmounts = $t029733016._1 | |
119 | - | let paymentAssetIds = $t029733016._2 | |
120 | - | $Tuple2((paymentAmounts :+ payment.amount), (paymentAssetIds :+ (if ((payment.assetId == unit)) | |
121 | - | then base58'' | |
122 | - | else payment.assetId))) | |
188 | + | func calculateFeeDiscount (userAddr) = { | |
189 | + | let swopAmount = valueOrElse(getInteger(govAddress, (toString(userAddr) + kUserSwopInGov)), 0) | |
190 | + | let gSwopAmount = valueOrElse(getInteger(govAddress, (toString(userAddr) + kUserGSwopInGov)), swopAmount) | |
191 | + | let discountValues = split(getStringValue(oracle, kDiscountValues), ",") | |
192 | + | let discounts = split(getStringValue(oracle, kDiscounts), ",") | |
193 | + | if (if ((gSwopAmount >= parseIntValue(discountValues[0]))) | |
194 | + | then (parseIntValue(discountValues[1]) > gSwopAmount) | |
195 | + | else false) | |
196 | + | then (feeScale6 - parseIntValue(discounts[0])) | |
197 | + | else if (if ((gSwopAmount >= parseIntValue(discountValues[1]))) | |
198 | + | then (parseIntValue(discountValues[2]) > gSwopAmount) | |
199 | + | else false) | |
200 | + | then (feeScale6 - parseIntValue(discounts[1])) | |
201 | + | else if (if ((gSwopAmount >= parseIntValue(discountValues[2]))) | |
202 | + | then (parseIntValue(discountValues[3]) > gSwopAmount) | |
203 | + | else false) | |
204 | + | then (feeScale6 - parseIntValue(discounts[2])) | |
205 | + | else if (if ((gSwopAmount >= parseIntValue(discountValues[3]))) | |
206 | + | then (parseIntValue(discountValues[4]) > gSwopAmount) | |
207 | + | else false) | |
208 | + | then (feeScale6 - parseIntValue(discounts[3])) | |
209 | + | else if ((gSwopAmount >= parseIntValue(discountValues[4]))) | |
210 | + | then (feeScale6 - parseIntValue(discounts[4])) | |
211 | + | else feeScale6 | |
123 | 212 | } | |
124 | 213 | ||
125 | 214 | ||
126 | - | func collectState (result,source) = match source { | |
127 | - | case e: Issue|Burn|Reissue|ScriptTransfer|BinaryEntry|BooleanEntry|StringEntry|IntegerEntry => | |
128 | - | (result :+ e) | |
129 | - | case _ => | |
130 | - | result | |
131 | - | } | |
215 | + | func calculateFees (pmtAmount,minAmountToReceive,tokenFrom,tokenTo,fee,feeGovernance) = { | |
216 | + | let amountWithoutFee = fraction(tokenTo, pmtAmount, (pmtAmount + tokenFrom)) | |
217 | + | let amountWithFee = fraction(amountWithoutFee, (feeScale6 - fee), feeScale6) | |
218 | + | let governanceReward = fraction(amountWithoutFee, feeGovernance, feeScale6) | |
219 | + | if ((minAmountToReceive > amountWithFee)) | |
220 | + | then throw(((("Calculated amount to receive " + toString(amountWithFee)) + " is less than specified minimum ") + toString(minAmountToReceive))) | |
221 | + | else $Tuple3(amountWithoutFee, amountWithFee, governanceReward) | |
222 | + | } | |
132 | 223 | ||
133 | 224 | ||
134 | - | func collectData (result,source) = match source { | |
135 | - | case v: String => | |
136 | - | (result :+ v) | |
137 | - | case v: Int => | |
138 | - | (result :+ v) | |
139 | - | case v: Boolean => | |
140 | - | (result :+ v) | |
141 | - | case v: ByteVector => | |
142 | - | (result :+ v) | |
143 | - | case v: Unit => | |
144 | - | (result :+ v) | |
145 | - | case _ => | |
146 | - | throw() | |
147 | - | } | |
225 | + | func calculateVirtPay (pmtAmount,balance,fee) = { | |
226 | + | let F = (feeScale6 - fee) | |
227 | + | let k = fraction(fee, 60, 100) | |
228 | + | let a = (scale8 + fraction((F * k), scale8, (feeScale6 * feeScale6))) | |
229 | + | let b = ((((balance + fraction(balance, F, feeScale6)) + fraction(pmtAmount, F, feeScale6)) - pmtAmount) - fraction(pmtAmount, (F * k), (feeScale6 * feeScale6))) | |
230 | + | let c = (-(toBigInt(balance)) * toBigInt(pmtAmount)) | |
231 | + | let D = ((toBigInt(b) * toBigInt(b)) - fraction((toBigInt(4) * c), toBigInt(a), toBigInt(scale8))) | |
232 | + | toInt(fraction((-(toBigInt(b)) + sqrtBigInt(D, 0, 0, DOWN)), toBigInt(scale8), toBigInt((2 * a)))) | |
233 | + | } | |
148 | 234 | ||
149 | 235 | ||
150 | - | func callCommon (funcName,caller,args,payments) = valueOrElse(isActive(), { | |
151 | - | let $t039364020 = { | |
152 | - | let $l = payments | |
153 | - | let $s = size($l) | |
154 | - | let $acc0 = $Tuple2(nil, nil) | |
155 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
156 | - | then $a | |
157 | - | else collectPayments($a, $l[$i]) | |
236 | + | func parsePaymentAsset (assetId) = if ((assetId == base58'')) | |
237 | + | then unit | |
238 | + | else assetId | |
158 | 239 | ||
159 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
160 | - | then $a | |
161 | - | else throw("List size exceeds 10") | |
162 | 240 | ||
163 | - | $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) | |
164 | - | } | |
165 | - | let paymentAmounts = $t039364020._1 | |
166 | - | let paymentAssetIds = $t039364020._2 | |
167 | - | let lockPayment = if (if ((funcName == "replenishWithTwoTokens")) | |
168 | - | then (size(payments) == 3) | |
169 | - | else false) | |
170 | - | then [payments[2]] | |
171 | - | else if (if ((funcName == "replenishWithOneToken")) | |
172 | - | then (size(payments) == 2) | |
173 | - | else false) | |
174 | - | then [payments[1]] | |
175 | - | else nil | |
176 | - | let $t042494406 = { | |
177 | - | let @ = reentrantInvoke(cpmmContract, funcName, [caller, args, paymentAmounts, paymentAssetIds], lockPayment) | |
178 | - | if ($isInstanceOf(@, "(List[Any], List[Any])")) | |
179 | - | then @ | |
180 | - | else throw(($getType(@) + " couldn't be cast to (List[Any], List[Any])")) | |
181 | - | } | |
182 | - | if (($t042494406 == $t042494406)) | |
183 | - | then { | |
184 | - | let data = $t042494406._2 | |
185 | - | let actions = $t042494406._1 | |
186 | - | let mappedData = { | |
187 | - | let $l = data | |
188 | - | let $s = size($l) | |
189 | - | let $acc0 = nil | |
190 | - | func $f1_1 ($a,$i) = if (($i >= $s)) | |
191 | - | then $a | |
192 | - | else collectData($a, $l[$i]) | |
241 | + | func suspendSuspicious (accountBalanceA,accountBalanceB,balanceA,balanceB,assetIdA,assetIdB) = suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(accountBalanceA)) + " ") + assetIdA) + ", ") + toString(accountBalanceB)) + " ") + assetIdB) + ". State: ") + toString(balanceA)) + " ") + assetIdA) + ", ") + toString(balanceB)) + " ") + assetIdB)) | |
193 | 242 | ||
194 | - | func $f1_2 ($a,$i) = if (($i >= $s)) | |
195 | - | then $a | |
196 | - | else throw("List size exceeds 10") | |
197 | 243 | ||
198 | - | $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) | |
199 | - | } | |
200 | - | let mappedActions = { | |
201 | - | let $l = actions | |
202 | - | let $s = size($l) | |
203 | - | let $acc0 = nil | |
204 | - | func $f2_1 ($a,$i) = if (($i >= $s)) | |
205 | - | then $a | |
206 | - | else collectState($a, $l[$i]) | |
244 | + | func isActive () = if (active) | |
245 | + | then unit | |
246 | + | else throw("DApp is inactive at this moment") | |
207 | 247 | ||
208 | - | func $f2_2 ($a,$i) = if (($i >= $s)) | |
209 | - | then $a | |
210 | - | else throw("List size exceeds 15") | |
211 | 248 | ||
212 | - | $f2_2($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
213 | - | } | |
214 | - | $Tuple2(mappedActions, mappedData) | |
215 | - | } | |
216 | - | else throw("Strict value is not equal to itself.") | |
217 | - | }) | |
249 | + | func isOraclePool (poolAddress) = if (isDefined(getString(oracle, (kOraclePool + poolAddress)))) | |
250 | + | then unit | |
251 | + | else throw("DApp is not registered pool") | |
252 | + | ||
253 | + | ||
254 | + | func getPoolBalances (pool,assetIdA,assetIdB) = { | |
255 | + | let balanceA = getIntegerValue(pool, kBalanceA) | |
256 | + | let balanceB = getIntegerValue(pool, kBalanceB) | |
257 | + | let stakedAmountA = stakedAmount(assetIdA, pool) | |
258 | + | let stakedAmountB = stakedAmount(assetIdB, pool) | |
259 | + | let accountBalanceA = (accountBalance(assetIdA, pool) + stakedAmountA) | |
260 | + | let accountBalanceB = (accountBalance(assetIdB, pool) + stakedAmountB) | |
261 | + | let shareSupply = getIntegerValue(pool, kShareAssetSupply) | |
262 | + | $Tuple5(balanceA, balanceB, accountBalanceA, accountBalanceB, shareSupply) | |
263 | + | } | |
264 | + | ||
265 | + | ||
266 | + | func getPoolAssets (pool) = { | |
267 | + | let strAssetIdA = getStringValue(pool, kAssetIdA) | |
268 | + | let strAssetIdB = getStringValue(pool, kAssetIdB) | |
269 | + | let assetIdA = if ((strAssetIdA == "WAVES")) | |
270 | + | then unit | |
271 | + | else fromBase58String(strAssetIdA) | |
272 | + | let assetIdB = if ((strAssetIdB == "WAVES")) | |
273 | + | then unit | |
274 | + | else fromBase58String(strAssetIdB) | |
275 | + | let shareAssetId = fromBase58String(getStringValue(pool, kShareAssetId)) | |
276 | + | $Tuple5(strAssetIdA, strAssetIdB, assetIdA, assetIdB, shareAssetId) | |
277 | + | } | |
278 | + | ||
279 | + | ||
280 | + | func getFeeParams (pool,caller) = { | |
281 | + | let feeDiscount = calculateFeeDiscount(caller) | |
282 | + | let fee = fraction(getIntegerValue(pool, kFee), feeDiscount, feeScale6, CEILING) | |
283 | + | let govFee = fraction(fraction(fee, 40, 100), feeDiscount, feeScale6, CEILING) | |
284 | + | $Tuple2(fee, govFee) | |
285 | + | } | |
218 | 286 | ||
219 | 287 | ||
220 | 288 | @Callable(i) | |
221 | - | func callFunction (funcName,args) = callCommon(funcName, i.caller.bytes, args, i.payments) | |
289 | + | func init (callerBytes,args,pAmounts,pAssetIds) = { | |
290 | + | let caller = Address(callerBytes) | |
291 | + | let $t090769154 = $Tuple2(pAmounts[0], parsePaymentAsset(pAssetIds[0])) | |
292 | + | let pmtAmountA = $t090769154._1 | |
293 | + | let pmtAssetIdA = $t090769154._2 | |
294 | + | let $t091599237 = $Tuple2(pAmounts[1], parsePaymentAsset(pAssetIds[1])) | |
295 | + | let pmtAmountB = $t091599237._1 | |
296 | + | let pmtAssetIdB = $t091599237._2 | |
297 | + | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminInvokePubKey], i.originCallerPublicKey))) | |
298 | + | then throw("Only admin can call this function") | |
299 | + | else if ((size(args) != 1)) | |
300 | + | then throw("Wrong args size") | |
301 | + | else if (isDefined(getBoolean(caller, kActive))) | |
302 | + | then throw("DApp is already active") | |
303 | + | else if ((pmtAssetIdA == pmtAssetIdB)) | |
304 | + | then throw("Assets must be different") | |
305 | + | else { | |
306 | + | let $t096729749 = getAssetInfo(pmtAssetIdA) | |
307 | + | let pmtStrAssetIdA = $t096729749._1 | |
308 | + | let pmtAssetNameA = $t096729749._2 | |
309 | + | let pmtDecimalsA = $t096729749._3 | |
310 | + | let $t097589835 = getAssetInfo(pmtAssetIdB) | |
311 | + | let pmtStrAssetIdB = $t097589835._1 | |
312 | + | let pmtAssetNameB = $t097589835._2 | |
313 | + | let pmtDecimalsB = $t097589835._3 | |
314 | + | let firstHarvest = (args[0] == "true") | |
315 | + | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
316 | + | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
317 | + | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
318 | + | let arg1 = pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN) | |
319 | + | let arg2 = pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN) | |
320 | + | let arg3 = pow(10, 0, shareDecimals, 0, 0, DOWN) | |
321 | + | let shareInitialSupply = fraction(arg1, arg2, arg3) | |
322 | + | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
323 | + | let shareIssueId = calculateAssetId(shareIssue) | |
324 | + | let stake1 = if (contains(stakingAssets, pmtStrAssetIdA)) | |
325 | + | then invoke(i.caller, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
326 | + | else 0 | |
327 | + | if ((stake1 == stake1)) | |
328 | + | then { | |
329 | + | let stake2 = if (contains(stakingAssets, pmtStrAssetIdB)) | |
330 | + | then invoke(i.caller, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
331 | + | else 0 | |
332 | + | if ((stake2 == stake2)) | |
333 | + | then { | |
334 | + | let baseEntry = [StringEntry(kVersion, version), BooleanEntry(kActive, true), StringEntry(kAssetIdA, pmtStrAssetIdA), StringEntry(kAssetIdB, pmtStrAssetIdB), IntegerEntry(kBalanceA, pmtAmountA), IntegerEntry(kBalanceB, pmtAmountB), IntegerEntry(kFee, getIntegerValue(oracle, "base_fee_cpmm")), shareIssue, StringEntry(kShareAssetId, toBase58String(shareIssueId)), IntegerEntry(kShareAssetSupply, shareInitialSupply), ScriptTransfer(caller, shareInitialSupply, shareIssueId)] | |
335 | + | if (firstHarvest) | |
336 | + | then $Tuple2(nil, $Tuple2((baseEntry ++ [BooleanEntry(kFirstHarvest, firstHarvest), IntegerEntry(kFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]), nil)) | |
337 | + | else $Tuple2(nil, $Tuple2(baseEntry, nil)) | |
338 | + | } | |
339 | + | else throw("Strict value is not equal to itself.") | |
340 | + | } | |
341 | + | else throw("Strict value is not equal to itself.") | |
342 | + | } | |
343 | + | } | |
222 | 344 | ||
223 | 345 | ||
224 | 346 | ||
225 | 347 | @Callable(i) | |
226 | - | func shutdown () = valueOrElse(isAdminCall(i.callerPublicKey), if (!(active)) | |
227 | - | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
228 | - | else suspend("Paused by admin")) | |
348 | + | func initWithInitRatio (callerBytes,args,pAmounts,pAssetIds) = { | |
349 | + | let caller = Address(callerBytes) | |
350 | + | let $t01205612256 = $Tuple5(parseIntValue(args[0]), parseIntValue(args[1]), args[2], args[3], (args[4] == "true")) | |
351 | + | let amtAssetA = $t01205612256._1 | |
352 | + | let amtAssetB = $t01205612256._2 | |
353 | + | let assetIdAStr = $t01205612256._3 | |
354 | + | let assetIdBStr = $t01205612256._4 | |
355 | + | let firstHarvest = $t01205612256._5 | |
356 | + | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminInvokePubKey], i.originCallerPublicKey))) | |
357 | + | then throw("Only admin can call this function") | |
358 | + | else if ((size(args) != 5)) | |
359 | + | then throw("Wrong args size") | |
360 | + | else if (isDefined(getBoolean(caller, kActive))) | |
361 | + | then throw("DApp is already active") | |
362 | + | else if ((assetIdAStr == assetIdBStr)) | |
363 | + | then throw("Assets must be different") | |
364 | + | else { | |
365 | + | let $t01269112768 = getAssetInfo(assetIdAStr) | |
366 | + | let pmtStrAssetIdA = $t01269112768._1 | |
367 | + | let pmtAssetNameA = $t01269112768._2 | |
368 | + | let pmtDecimalsA = $t01269112768._3 | |
369 | + | let $t01277712854 = getAssetInfo(assetIdBStr) | |
370 | + | let pmtStrAssetIdB = $t01277712854._1 | |
371 | + | let pmtAssetNameB = $t01277712854._2 | |
372 | + | let pmtDecimalsB = $t01277712854._3 | |
373 | + | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
374 | + | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
375 | + | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
376 | + | let shareInitialSupply = 0 | |
377 | + | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
378 | + | let shareIssueId = calculateAssetId(shareIssue) | |
379 | + | let baseEntry = [StringEntry(kVersion, version), BooleanEntry(kActive, true), StringEntry(kAssetIdA, pmtStrAssetIdA), StringEntry(kAssetIdB, pmtStrAssetIdB), IntegerEntry(kBalanceInitA, amtAssetA), IntegerEntry(kBalanceInitB, amtAssetB), IntegerEntry(kBalanceA, 0), IntegerEntry(kBalanceB, 0), IntegerEntry(kFee, getIntegerValue(oracle, "base_fee_cpmm")), shareIssue, StringEntry(kShareAssetId, toBase58String(shareIssueId)), IntegerEntry(kShareAssetSupply, shareInitialSupply)] | |
380 | + | if (firstHarvest) | |
381 | + | then $Tuple2(nil, $Tuple2((baseEntry ++ [BooleanEntry(kFirstHarvest, firstHarvest), IntegerEntry(kFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]), nil)) | |
382 | + | else $Tuple2(nil, $Tuple2(baseEntry, nil)) | |
383 | + | } | |
384 | + | } | |
229 | 385 | ||
230 | 386 | ||
231 | 387 | ||
232 | 388 | @Callable(i) | |
233 | - | func activate () = valueOrElse(isAdminCall(i.callerPublicKey), if (active) | |
234 | - | then throw("DApp is already active") | |
235 | - | else [BooleanEntry(kActive, true), DeleteEntry(kCause)]) | |
389 | + | func keepLimitForFirstHarvest (callerBytes,args,pAmounts,pAssetIds) = valueOrElse(isOraclePool(toString(i.caller)), valueOrElse(isActive(), if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminInvokePubKey], i.originCallerPublicKey))) | |
390 | + | then throw("Only admin can call this function") | |
391 | + | else if ((size(args) != 1)) | |
392 | + | then throw("Wrong args size") | |
393 | + | else { | |
394 | + | let shareLimit = parseIntValue(args[0]) | |
395 | + | $Tuple2(nil, $Tuple2([IntegerEntry(kShareLimit, shareLimit)], nil)) | |
396 | + | })) | |
236 | 397 | ||
237 | 398 | ||
238 | 399 | ||
239 | 400 | @Callable(i) | |
240 | - | func stakeUnstake (stake,amount,assetIdString) = valueOrElse(isActive(), if ((i.caller != cpmmContract)) | |
241 | - | then throw("Only global Contract can invoke this function") | |
242 | - | else if ((assetIdString == "WAVES")) | |
243 | - | then { | |
244 | - | let pool = addressFromStringValue(valueOrErrorMessage(getString(oracle, kLeasingPool), "No leasing pool in oracle")) | |
245 | - | let leasingId = getBinary(this, kLeasingId) | |
246 | - | let leasingAmount = valueOrElse(getInteger(this, kLeasingAmount), 0) | |
247 | - | let newLeaseAmount = if (stake) | |
248 | - | then (leasingAmount + amount) | |
249 | - | else (leasingAmount - amount) | |
250 | - | let newLease = Lease(pool, newLeaseAmount) | |
251 | - | let newLeaseId = calculateLeaseId(newLease) | |
252 | - | let baseEtry = [newLease, BinaryEntry(kLeasingId, newLeaseId), IntegerEntry(kLeasingAmount, newLeaseAmount)] | |
253 | - | match leasingId { | |
254 | - | case lId: ByteVector => | |
255 | - | ([LeaseCancel(lId)] ++ baseEtry) | |
256 | - | case _ => | |
257 | - | baseEtry | |
258 | - | } | |
259 | - | } | |
260 | - | else { | |
261 | - | let $t064026505 = calcStakingParams(stake, amount, fromBase58String(assetIdString)) | |
262 | - | let call = $t064026505._1 | |
263 | - | let addr = $t064026505._2 | |
264 | - | let params = $t064026505._3 | |
265 | - | let payments = $t064026505._4 | |
266 | - | let inv = invoke(addr, call, params, payments) | |
267 | - | if ((inv == inv)) | |
268 | - | then nil | |
269 | - | else throw("Strict value is not equal to itself.") | |
270 | - | }) | |
271 | - | ||
272 | - | ||
273 | - | ||
274 | - | @Callable(i) | |
275 | - | func reissueShareToken (amount) = valueOrElse(isGlobalCaller(i.caller), valueOrElse(isActive(), { | |
276 | - | let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId)) | |
277 | - | [Reissue(shareAssetId, amount, true), ScriptTransfer(i.caller, amount, shareAssetId)] | |
401 | + | func exchange (callerBytes,args,pAmounts,pAssetIds) = valueOrElse(isOraclePool(toString(i.caller)), valueOrElse(isActive(), { | |
402 | + | let caller = Address(callerBytes) | |
403 | + | let $t01524015316 = $Tuple2(pAmounts[0], parsePaymentAsset(pAssetIds[0])) | |
404 | + | let pmtAmount = $t01524015316._1 | |
405 | + | let pmtAssetId = $t01524015316._2 | |
406 | + | let minAmountToReceive = parseIntValue(args[0]) | |
407 | + | let $t01538915465 = getPoolAssets(i.caller) | |
408 | + | let strAssetIdA = $t01538915465._1 | |
409 | + | let strAssetIdB = $t01538915465._2 | |
410 | + | let assetIdA = $t01538915465._3 | |
411 | + | let assetIdB = $t01538915465._4 | |
412 | + | let $t01547815584 = getPoolBalances(i.caller, assetIdA, assetIdB) | |
413 | + | let balanceA = $t01547815584._1 | |
414 | + | let balanceB = $t01547815584._2 | |
415 | + | let accountBalanceA = $t01547815584._3 | |
416 | + | let accountBalanceB = $t01547815584._4 | |
417 | + | if ((size(args) != 1)) | |
418 | + | then throw("Wrong args size") | |
419 | + | else if (if ((balanceA == 0)) | |
420 | + | then true | |
421 | + | else (balanceB == 0)) | |
422 | + | then throw("Can't exchange with zero balance") | |
423 | + | else if ((0 >= minAmountToReceive)) | |
424 | + | then throw(("Minimal amount to receive must be positive. Actual: " + toString(minAmountToReceive))) | |
425 | + | else if ((size(pAmounts) != 1)) | |
426 | + | then throw("One attached payment expected") | |
427 | + | else if (!(containsElement([assetIdA, assetIdB], pmtAssetId))) | |
428 | + | then throw(((("Incorrect asset attached. Expected: " + strAssetIdA) + " or ") + strAssetIdB)) | |
429 | + | else if (if ((balanceA > accountBalanceA)) | |
430 | + | then true | |
431 | + | else (balanceB > accountBalanceB)) | |
432 | + | then $Tuple2(nil, ([ScriptTransfer(caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious(accountBalanceA, accountBalanceB, balanceA, balanceB, strAssetIdA, strAssetIdB))) | |
433 | + | else { | |
434 | + | let $t01655216610 = getFeeParams(i.caller, i.originCaller) | |
435 | + | let fee = $t01655216610._1 | |
436 | + | let govFee = $t01655216610._2 | |
437 | + | let $t01662716964 = if ((pmtAssetId == assetIdA)) | |
438 | + | then calculateFees(pmtAmount, minAmountToReceive, balanceA, balanceB, fee, govFee) | |
439 | + | else calculateFees(pmtAmount, minAmountToReceive, balanceB, balanceA, fee, govFee) | |
440 | + | let amountWithoutFee = $t01662716964._1 | |
441 | + | let amountWithFee = $t01662716964._2 | |
442 | + | let governanceReward = $t01662716964._3 | |
443 | + | let $t01698217307 = if ((pmtAssetId == assetIdA)) | |
444 | + | then $Tuple3((balanceA + pmtAmount), ((balanceB - amountWithFee) - governanceReward), assetIdB) | |
445 | + | else $Tuple3(((balanceA - amountWithFee) - governanceReward), (balanceB + pmtAmount), assetIdA) | |
446 | + | let newBalanceA = $t01698217307._1 | |
447 | + | let newBalanceB = $t01698217307._2 | |
448 | + | let assetIdSend = $t01698217307._3 | |
449 | + | let $t01732517575 = if ((pmtAssetId == assetIdA)) | |
450 | + | then $Tuple2(pmtAmount, (amountWithFee + governanceReward)) | |
451 | + | else $Tuple2((amountWithFee + governanceReward), pmtAmount) | |
452 | + | let stakeAmountA = $t01732517575._1 | |
453 | + | let stakeAmountB = $t01732517575._2 | |
454 | + | let stake1 = if (contains(stakingAssets, strAssetIdA)) | |
455 | + | then invoke(i.caller, "stakeUnstake", [(pmtAssetId == assetIdA), stakeAmountA, strAssetIdA], nil) | |
456 | + | else 0 | |
457 | + | if ((stake1 == stake1)) | |
458 | + | then { | |
459 | + | let stake2 = if (contains(stakingAssets, strAssetIdB)) | |
460 | + | then invoke(i.caller, "stakeUnstake", [(pmtAssetId == assetIdB), stakeAmountB, strAssetIdB], nil) | |
461 | + | else 0 | |
462 | + | if ((stake2 == stake2)) | |
463 | + | then $Tuple2(nil, $Tuple2([IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), ScriptTransfer(caller, amountWithFee, assetIdSend), ScriptTransfer(moneyBoxAddress, governanceReward, assetIdSend)], [amountWithFee, assetIdSend])) | |
464 | + | else throw("Strict value is not equal to itself.") | |
465 | + | } | |
466 | + | else throw("Strict value is not equal to itself.") | |
467 | + | } | |
278 | 468 | })) | |
279 | 469 | ||
280 | 470 | ||
281 | 471 | ||
282 | 472 | @Callable(i) | |
283 | - | func replenishWithTwoTokens (slippageTolerance) = callCommon("replenishWithTwoTokens", i.caller.bytes, ["false", "0"], i.payments) | |
473 | + | func replenishWithTwoTokens (callerBytes,args,pAmounts,pAssetIds) = valueOrElse(isOraclePool(toString(i.caller)), valueOrElse(isActive(), { | |
474 | + | let caller = Address(callerBytes) | |
475 | + | let pmtAssetIdA = parsePaymentAsset(pAssetIds[0]) | |
476 | + | let pmtAssetIdB = parsePaymentAsset(pAssetIds[1]) | |
477 | + | let stakeFarming = (args[0] == "true") | |
478 | + | let lockType = parseIntValue(args[1]) | |
479 | + | let $t01883818928 = getPoolAssets(i.caller) | |
480 | + | let strAssetIdA = $t01883818928._1 | |
481 | + | let strAssetIdB = $t01883818928._2 | |
482 | + | let assetIdA = $t01883818928._3 | |
483 | + | let assetIdB = $t01883818928._4 | |
484 | + | let shareAssetId = $t01883818928._5 | |
485 | + | let $t01894119065 = getPoolBalances(i.caller, assetIdA, assetIdB) | |
486 | + | let balanceA = $t01894119065._1 | |
487 | + | let balanceB = $t01894119065._2 | |
488 | + | let accountBalanceA = $t01894119065._3 | |
489 | + | let accountBalanceB = $t01894119065._4 | |
490 | + | let shareAssetSupply = $t01894119065._5 | |
491 | + | if ((size(args) != 2)) | |
492 | + | then throw("Wrong args size") | |
493 | + | else if (if ((size(pAmounts) != 2)) | |
494 | + | then (size(pAmounts) != 3) | |
495 | + | else false) | |
496 | + | then throw("Two or three payments expected") | |
497 | + | else if (if ((pmtAssetIdA != assetIdA)) | |
498 | + | then true | |
499 | + | else (pmtAssetIdB != assetIdB)) | |
500 | + | then throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB)) | |
501 | + | else if (if ((balanceA > accountBalanceA)) | |
502 | + | then true | |
503 | + | else (balanceB > accountBalanceB)) | |
504 | + | then $Tuple2(nil, ([ScriptTransfer(caller, pAmounts[0], pmtAssetIdA), ScriptTransfer(caller, pAmounts[1], pmtAssetIdB)] ++ (if ((size(pAmounts) == 3)) | |
505 | + | then [AttachedPayment(if ((pAssetIds[2] == base58'')) | |
506 | + | then unit | |
507 | + | else pAssetIds[2], pAmounts[2])] | |
508 | + | else (nil ++ suspendSuspicious(accountBalanceA, accountBalanceB, balanceA, balanceB, strAssetIdA, strAssetIdB))))) | |
509 | + | else { | |
510 | + | let $t02006620143 = getAssetInfo(pmtAssetIdA) | |
511 | + | let pmtStrAssetIdA = $t02006620143._1 | |
512 | + | let pmtAssetNameA = $t02006620143._2 | |
513 | + | let pmtDecimalsA = $t02006620143._3 | |
514 | + | let $t02016020237 = getAssetInfo(pmtAssetIdB) | |
515 | + | let pmtStrAssetIdB = $t02016020237._1 | |
516 | + | let pmtAssetNameB = $t02016020237._2 | |
517 | + | let pmtDecimalsB = $t02016020237._3 | |
518 | + | let initial = ((balanceA + balanceB) == 0) | |
519 | + | let $t02031221155 = if (initial) | |
520 | + | then $Tuple5(pAmounts[0], pAmounts[1], 0, pmtAssetIdA, 1) | |
521 | + | else { | |
522 | + | let ratioShareTokensInA = fraction(scale8, pAmounts[0], balanceA) | |
523 | + | let ratioShareTokensInB = fraction(scale8, pAmounts[1], balanceB) | |
524 | + | if ((ratioShareTokensInB > ratioShareTokensInA)) | |
525 | + | then { | |
526 | + | let pmt = fraction(pAmounts[0], balanceB, balanceA) | |
527 | + | $Tuple5(pAmounts[0], pmt, (pAmounts[1] - pmt), pmtAssetIdB, ratioShareTokensInA) | |
528 | + | } | |
529 | + | else { | |
530 | + | let pmt = fraction(pAmounts[1], balanceA, balanceB) | |
531 | + | $Tuple5(pmt, pAmounts[1], (pAmounts[0] - pmt), pmtAssetIdA, ratioShareTokensInB) | |
532 | + | } | |
533 | + | } | |
534 | + | let pmtAmountA = $t02031221155._1 | |
535 | + | let pmtAmountB = $t02031221155._2 | |
536 | + | let change = $t02031221155._3 | |
537 | + | let changeAssetId = $t02031221155._4 | |
538 | + | let shareTokenRatio = $t02031221155._5 | |
539 | + | let shareTokenToPayAmount = if (initial) | |
540 | + | then { | |
541 | + | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
542 | + | fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN), pow(10, 0, shareDecimals, 0, 0, DOWN)) | |
543 | + | } | |
544 | + | else fraction(shareTokenRatio, shareAssetSupply, scale8) | |
545 | + | if ((shareTokenToPayAmount == 0)) | |
546 | + | then throw("Too small amount to replenish") | |
547 | + | else if ((0 > change)) | |
548 | + | then throw("Change < 0") | |
549 | + | else { | |
550 | + | let stake1 = if (contains(stakingAssets, pmtStrAssetIdA)) | |
551 | + | then invoke(i.caller, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
552 | + | else 0 | |
553 | + | if ((stake1 == stake1)) | |
554 | + | then { | |
555 | + | let stake2 = if (contains(stakingAssets, pmtStrAssetIdB)) | |
556 | + | then invoke(i.caller, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
557 | + | else 0 | |
558 | + | if ((stake2 == stake2)) | |
559 | + | then { | |
560 | + | let shareTokenST = if (stakeFarming) | |
561 | + | then { | |
562 | + | let stPayments = ([AttachedPayment(shareAssetId, shareTokenToPayAmount)] ++ (if ((size(pAmounts) == 3)) | |
563 | + | then [AttachedPayment(if ((pAssetIds[2] == base58'')) | |
564 | + | then unit | |
565 | + | else pAssetIds[2], pAmounts[2])] | |
566 | + | else nil)) | |
567 | + | let reissue = invoke(i.caller, "reissueShareToken", [shareTokenToPayAmount], nil) | |
568 | + | if ((reissue == reissue)) | |
569 | + | then { | |
570 | + | let stake3 = invoke(farmingAddress, "lockShareTokensFromPool", [callerBytes, toString(i.caller), lockType], stPayments) | |
571 | + | if ((stake3 == stake3)) | |
572 | + | then nil | |
573 | + | else throw("Strict value is not equal to itself.") | |
574 | + | } | |
575 | + | else throw("Strict value is not equal to itself.") | |
576 | + | } | |
577 | + | else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(caller, shareTokenToPayAmount, shareAssetId)] | |
578 | + | $Tuple2(nil, $Tuple2(([IntegerEntry(kBalanceA, (balanceA + pmtAmountA)), IntegerEntry(kBalanceB, (balanceB + pmtAmountB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), ScriptTransfer(caller, change, changeAssetId)] ++ shareTokenST), nil)) | |
579 | + | } | |
580 | + | else throw("Strict value is not equal to itself.") | |
581 | + | } | |
582 | + | else throw("Strict value is not equal to itself.") | |
583 | + | } | |
584 | + | } | |
585 | + | })) | |
284 | 586 | ||
285 | 587 | ||
286 | 588 | ||
287 | 589 | @Callable(i) | |
288 | - | func withdraw () = callCommon("withdraw", i.caller.bytes, ["0"], i.payments) | |
590 | + | func replenishWithOneToken (callerBytes,args,pAmounts,pAssetIds) = valueOrElse(isOraclePool(toString(i.caller)), valueOrElse(isActive(), { | |
591 | + | let caller = Address(callerBytes) | |
592 | + | let pmtAssetId = parsePaymentAsset(pAssetIds[0]) | |
593 | + | let pmtAmount = pAmounts[0] | |
594 | + | let virtGetMinAmount = parseIntValue(args[0]) | |
595 | + | let stakeFarming = (args[1] == "true") | |
596 | + | let lockType = parseIntValue(args[2]) | |
597 | + | let $t02406024150 = getPoolAssets(i.caller) | |
598 | + | let strAssetIdA = $t02406024150._1 | |
599 | + | let strAssetIdB = $t02406024150._2 | |
600 | + | let assetIdA = $t02406024150._3 | |
601 | + | let assetIdB = $t02406024150._4 | |
602 | + | let shareAssetId = $t02406024150._5 | |
603 | + | let $t02416324287 = getPoolBalances(i.caller, assetIdA, assetIdB) | |
604 | + | let balanceA = $t02416324287._1 | |
605 | + | let balanceB = $t02416324287._2 | |
606 | + | let accountBalanceA = $t02416324287._3 | |
607 | + | let accountBalanceB = $t02416324287._4 | |
608 | + | let shareAssetSupply = $t02416324287._5 | |
609 | + | let initial = ((balanceA + balanceB) == 0) | |
610 | + | if ((size(args) != 3)) | |
611 | + | then throw("Wrong args size") | |
612 | + | else if (if ((size(pAmounts) != 1)) | |
613 | + | then (size(pAmounts) != 2) | |
614 | + | else false) | |
615 | + | then throw("Two or one attached assets expected") | |
616 | + | else if (if ((pmtAssetId != assetIdA)) | |
617 | + | then (pmtAssetId != assetIdB) | |
618 | + | else false) | |
619 | + | then throw(((("Incorrect asset attached. Expected: " + strAssetIdA) + " or ") + strAssetIdB)) | |
620 | + | else if (initial) | |
621 | + | then throw("For initial exchanger you need to use two tokens") | |
622 | + | else if (if ((balanceA > accountBalanceA)) | |
623 | + | then true | |
624 | + | else (balanceB > accountBalanceB)) | |
625 | + | then $Tuple2(nil, ([ScriptTransfer(caller, pmtAmount, pmtAssetId)] ++ (if ((size(pAmounts) == 2)) | |
626 | + | then [AttachedPayment(if ((pAssetIds[2] == base58'')) | |
627 | + | then unit | |
628 | + | else pAssetIds[2], pAmounts[2])] | |
629 | + | else (nil ++ suspendSuspicious(accountBalanceA, accountBalanceB, balanceA, balanceB, strAssetIdA, strAssetIdB))))) | |
630 | + | else { | |
631 | + | let $t02534325401 = getFeeParams(i.caller, i.originCaller) | |
632 | + | let fee = $t02534325401._1 | |
633 | + | let govFee = $t02534325401._2 | |
634 | + | let $t02541827624 = if ((pmtAssetId == assetIdA)) | |
635 | + | then { | |
636 | + | let virtPayAmount = calculateVirtPay(pmtAmount, balanceA, fee) | |
637 | + | let $t02569725834 = calculateFees(virtPayAmount, virtGetMinAmount, balanceA, balanceB, fee, govFee) | |
638 | + | let amountWithoutFee = $t02569725834._1 | |
639 | + | let amountWithFee = $t02569725834._2 | |
640 | + | let governanceReward = $t02569725834._3 | |
641 | + | let balanceAVirt = (balanceA + virtPayAmount) | |
642 | + | let balanceBVirt = ((balanceB + amountWithoutFee) - governanceReward) | |
643 | + | let newBalanceA = (balanceA + pmtAmount) | |
644 | + | let newBalanceB = (balanceB - governanceReward) | |
645 | + | let ratioShareTokensInA = fraction((pmtAmount - virtPayAmount), scale8, balanceAVirt) | |
646 | + | let ratioShareTokensInB = fraction(amountWithFee, scale8, balanceBVirt) | |
647 | + | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
648 | + | $Tuple7(newBalanceA, newBalanceB, shareTokenToPayAmount, governanceReward, assetIdB, strAssetIdB, strAssetIdA) | |
649 | + | } | |
650 | + | else { | |
651 | + | let virtPayAmount = calculateVirtPay(pmtAmount, balanceB, fee) | |
652 | + | let $t02672926866 = calculateFees(virtPayAmount, virtGetMinAmount, balanceB, balanceA, fee, govFee) | |
653 | + | let amountWithoutFee = $t02672926866._1 | |
654 | + | let amountWithFee = $t02672926866._2 | |
655 | + | let governanceReward = $t02672926866._3 | |
656 | + | let balanceAVirt = ((balanceA + amountWithoutFee) - governanceReward) | |
657 | + | let balanceBVirt = (balanceB + virtPayAmount) | |
658 | + | let newBalanceA = (balanceA - governanceReward) | |
659 | + | let newBalanceB = (balanceB + pmtAmount) | |
660 | + | let ratioShareTokensInA = fraction(amountWithFee, scale8, balanceAVirt) | |
661 | + | let ratioShareTokensInB = fraction((pmtAmount - virtPayAmount), scale8, balanceBVirt) | |
662 | + | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
663 | + | $Tuple7(newBalanceA, newBalanceB, shareTokenToPayAmount, governanceReward, assetIdA, strAssetIdA, strAssetIdB) | |
664 | + | } | |
665 | + | let newBalanceA = $t02541827624._1 | |
666 | + | let newBalanceB = $t02541827624._2 | |
667 | + | let shareTokenToPayAmount = $t02541827624._3 | |
668 | + | let govReward = $t02541827624._4 | |
669 | + | let govRewardAsset = $t02541827624._5 | |
670 | + | let govRewardAssetStr = $t02541827624._6 | |
671 | + | let pmtAssetIdStr = $t02541827624._7 | |
672 | + | if ((shareTokenToPayAmount == 0)) | |
673 | + | then throw("Too small amount to replenish") | |
674 | + | else { | |
675 | + | let stake1 = if (contains(stakingAssets, pmtAssetIdStr)) | |
676 | + | then invoke(i.caller, "stakeUnstake", [true, pmtAmount, pmtAssetIdStr], nil) | |
677 | + | else 0 | |
678 | + | if ((stake1 == stake1)) | |
679 | + | then { | |
680 | + | let stake2 = if (contains(stakingAssets, govRewardAssetStr)) | |
681 | + | then invoke(i.caller, "stakeUnstake", [false, govReward, govRewardAssetStr], nil) | |
682 | + | else 0 | |
683 | + | if ((stake2 == stake2)) | |
684 | + | then { | |
685 | + | let shareTokenST = if (stakeFarming) | |
686 | + | then { | |
687 | + | let stPayments = ([AttachedPayment(shareAssetId, shareTokenToPayAmount)] ++ (if ((size(pAmounts) == 2)) | |
688 | + | then [AttachedPayment(if ((pAssetIds[1] == base58'')) | |
689 | + | then unit | |
690 | + | else pAssetIds[1], pAmounts[1])] | |
691 | + | else nil)) | |
692 | + | let reissue = invoke(i.caller, "reissueShareToken", [shareTokenToPayAmount], nil) | |
693 | + | if ((reissue == reissue)) | |
694 | + | then { | |
695 | + | let stake3 = invoke(farmingAddress, "lockShareTokensFromPool", [callerBytes, toString(i.caller), lockType], stPayments) | |
696 | + | if ((stake3 == stake3)) | |
697 | + | then nil | |
698 | + | else throw("Strict value is not equal to itself.") | |
699 | + | } | |
700 | + | else throw("Strict value is not equal to itself.") | |
701 | + | } | |
702 | + | else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(caller, shareTokenToPayAmount, shareAssetId)] | |
703 | + | $Tuple2(nil, $Tuple2(([IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), ScriptTransfer(moneyBoxAddress, govReward, govRewardAsset)] ++ shareTokenST), nil)) | |
704 | + | } | |
705 | + | else throw("Strict value is not equal to itself.") | |
706 | + | } | |
707 | + | else throw("Strict value is not equal to itself.") | |
708 | + | } | |
709 | + | } | |
710 | + | })) | |
289 | 711 | ||
290 | 712 | ||
291 | 713 | ||
292 | 714 | @Callable(i) | |
293 | - | func exchange (minAmountToReceive) = callCommon("exchange", i.caller.bytes, [toString(minAmountToReceive)], i.payments) | |
715 | + | func withdraw (callerBytes,args,pAmounts,pAssetIds) = valueOrElse(isOraclePool(toString(i.caller)), valueOrElse(isActive(), { | |
716 | + | let time = lastBlock.timestamp | |
717 | + | let caller = Address(callerBytes) | |
718 | + | let $t02977829868 = getPoolAssets(i.caller) | |
719 | + | let strAssetIdA = $t02977829868._1 | |
720 | + | let strAssetIdB = $t02977829868._2 | |
721 | + | let assetIdA = $t02977829868._3 | |
722 | + | let assetIdB = $t02977829868._4 | |
723 | + | let shareAssetId = $t02977829868._5 | |
724 | + | let $t02988130005 = getPoolBalances(i.caller, assetIdA, assetIdB) | |
725 | + | let balanceA = $t02988130005._1 | |
726 | + | let balanceB = $t02988130005._2 | |
727 | + | let accountBalanceA = $t02988130005._3 | |
728 | + | let accountBalanceB = $t02988130005._4 | |
729 | + | let shareAssetSupply = $t02988130005._5 | |
730 | + | let $t03001830426 = if ((size(pAmounts) == 1)) | |
731 | + | then { | |
732 | + | let pAsset = parsePaymentAsset(pAssetIds[0]) | |
733 | + | if ((pAsset != shareAssetId)) | |
734 | + | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
735 | + | else $Tuple2(pAmounts[0], pAsset) | |
736 | + | } | |
737 | + | else $Tuple2(0, shareAssetId) | |
738 | + | let pmtAmount = $t03001830426._1 | |
739 | + | let pmtAssetId = $t03001830426._2 | |
740 | + | if ((size(args) != 1)) | |
741 | + | then throw("Wrong args size") | |
742 | + | else if ((size(pAmounts) > 1)) | |
743 | + | then throw("One attached payment expected") | |
744 | + | else if (if ((balanceA > accountBalanceA)) | |
745 | + | then true | |
746 | + | else (balanceB > accountBalanceB)) | |
747 | + | then $Tuple2(nil, ([ScriptTransfer(caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious(accountBalanceA, accountBalanceB, balanceA, balanceB, strAssetIdA, strAssetIdB))) | |
748 | + | else { | |
749 | + | let unlockAmount = parseIntValue(valueOrElse(args[0], "0")) | |
750 | + | let unlock = if ((unlockAmount > 0)) | |
751 | + | then invoke(farmingAddress, "withdrawShareTokensFromPool", [callerBytes, toString(i.caller), unlockAmount], nil) | |
752 | + | else 0 | |
753 | + | if ((unlock == unlock)) | |
754 | + | then { | |
755 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
756 | + | let amountToPayA = fraction(withdrawAmount, balanceA, shareAssetSupply) | |
757 | + | let amountToPayB = fraction(withdrawAmount, balanceB, shareAssetSupply) | |
758 | + | let stake1 = if (contains(stakingAssets, strAssetIdA)) | |
759 | + | then invoke(i.caller, "stakeUnstake", [false, amountToPayA, strAssetIdA], nil) | |
760 | + | else 0 | |
761 | + | if ((stake1 == stake1)) | |
762 | + | then { | |
763 | + | let stake2 = if (contains(stakingAssets, strAssetIdB)) | |
764 | + | then invoke(i.caller, "stakeUnstake", [false, amountToPayB, strAssetIdB], nil) | |
765 | + | else 0 | |
766 | + | if ((stake2 == stake2)) | |
767 | + | then $Tuple2([ScriptTransfer(i.caller, unlockAmount, shareAssetId)], $Tuple2([IntegerEntry(kBalanceA, (balanceA - amountToPayA)), IntegerEntry(kBalanceB, (balanceB - amountToPayB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply - withdrawAmount)), Burn(shareAssetId, withdrawAmount), ScriptTransfer(caller, amountToPayA, assetIdA), ScriptTransfer(caller, amountToPayB, assetIdB)], nil)) | |
768 | + | else throw("Strict value is not equal to itself.") | |
769 | + | } | |
770 | + | else throw("Strict value is not equal to itself.") | |
771 | + | } | |
772 | + | else throw("Strict value is not equal to itself.") | |
773 | + | } | |
774 | + | })) | |
775 | + | ||
776 | + | ||
777 | + | ||
778 | + | @Callable(i) | |
779 | + | func withdrawOneToken (callerBytes,args,pAmounts,pAssetIds) = valueOrElse(isOraclePool(toString(i.caller)), valueOrElse(isActive(), { | |
780 | + | let caller = Address(callerBytes) | |
781 | + | let withdrawAsset = if ((args[0] == "")) | |
782 | + | then unit | |
783 | + | else fromBase58String(args[0]) | |
784 | + | let $t03273732827 = getPoolAssets(i.caller) | |
785 | + | let strAssetIdA = $t03273732827._1 | |
786 | + | let strAssetIdB = $t03273732827._2 | |
787 | + | let assetIdA = $t03273732827._3 | |
788 | + | let assetIdB = $t03273732827._4 | |
789 | + | let shareAssetId = $t03273732827._5 | |
790 | + | let $t03284032964 = getPoolBalances(i.caller, assetIdA, assetIdB) | |
791 | + | let balanceA = $t03284032964._1 | |
792 | + | let balanceB = $t03284032964._2 | |
793 | + | let accountBalanceA = $t03284032964._3 | |
794 | + | let accountBalanceB = $t03284032964._4 | |
795 | + | let shareAssetSupply = $t03284032964._5 | |
796 | + | let $t03297733357 = if ((size(pAmounts) == 1)) | |
797 | + | then { | |
798 | + | let pAsset = parsePaymentAsset(pAssetIds[0]) | |
799 | + | if ((pAsset != shareAssetId)) | |
800 | + | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
801 | + | else $Tuple2(pAmounts[0], pAsset) | |
802 | + | } | |
803 | + | else $Tuple2(0, shareAssetId) | |
804 | + | let pmtAmount = $t03297733357._1 | |
805 | + | let pmtAssetId = $t03297733357._2 | |
806 | + | let virtMinToRecive = parseIntValue(args[1]) | |
807 | + | if ((size(args) != 3)) | |
808 | + | then throw("Wrong args size") | |
809 | + | else if ((size(pAmounts) > 1)) | |
810 | + | then throw("One attached payment expected") | |
811 | + | else if ((pmtAssetId != shareAssetId)) | |
812 | + | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
813 | + | else if (!(containsElement([assetIdA, assetIdB], withdrawAsset))) | |
814 | + | then throw("Incorrect withdraw asset.") | |
815 | + | else if (if ((balanceA > accountBalanceA)) | |
816 | + | then true | |
817 | + | else (balanceB > accountBalanceB)) | |
818 | + | then $Tuple2(nil, ([ScriptTransfer(caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious(accountBalanceA, accountBalanceB, balanceA, balanceB, strAssetIdA, strAssetIdB))) | |
819 | + | else { | |
820 | + | let unlockAmount = parseIntValue(valueOrElse(args[2], "0")) | |
821 | + | let unlock = if ((unlockAmount > 0)) | |
822 | + | then invoke(farmingAddress, "withdrawShareTokensFromPool", [callerBytes, toString(i.caller), unlockAmount], nil) | |
823 | + | else 0 | |
824 | + | if ((unlock == unlock)) | |
825 | + | then { | |
826 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
827 | + | let amountToPayA = fraction(withdrawAmount, balanceA, shareAssetSupply) | |
828 | + | let amountToPayB = fraction(withdrawAmount, balanceB, shareAssetSupply) | |
829 | + | let $t03470534763 = getFeeParams(i.caller, i.originCaller) | |
830 | + | let fee = $t03470534763._1 | |
831 | + | let govFee = $t03470534763._2 | |
832 | + | let $t03478035180 = if ((withdrawAsset == assetIdA)) | |
833 | + | then calculateFees(amountToPayB, virtMinToRecive, (balanceB - amountToPayB), (balanceA - amountToPayA), fee, govFee) | |
834 | + | else calculateFees(amountToPayA, virtMinToRecive, (balanceA - amountToPayA), (balanceB - amountToPayB), fee, govFee) | |
835 | + | let amountWithoutFee = $t03478035180._1 | |
836 | + | let amountWithFee = $t03478035180._2 | |
837 | + | let governanceReward = $t03478035180._3 | |
838 | + | let $t03519736543 = if ((withdrawAsset == assetIdA)) | |
839 | + | then { | |
840 | + | let unstake = if (contains(stakingAssets, strAssetIdA)) | |
841 | + | then invoke(i.caller, "stakeUnstake", [false, ((amountToPayA + amountWithFee) + governanceReward), strAssetIdA], nil) | |
842 | + | else 0 | |
843 | + | if ((unstake == unstake)) | |
844 | + | then $Tuple4((((balanceA - amountToPayA) - amountWithFee) - governanceReward), balanceB, assetIdA, [ScriptTransfer(caller, (amountToPayA + amountWithFee), assetIdA)]) | |
845 | + | else throw("Strict value is not equal to itself.") | |
846 | + | } | |
847 | + | else { | |
848 | + | let unstake = if (contains(stakingAssets, strAssetIdB)) | |
849 | + | then invoke(i.caller, "stakeUnstake", [false, ((amountToPayB + amountWithFee) + governanceReward), strAssetIdB], nil) | |
850 | + | else 0 | |
851 | + | if ((unstake == unstake)) | |
852 | + | then $Tuple4(balanceA, (((balanceB - amountToPayB) - amountWithFee) - governanceReward), assetIdB, [ScriptTransfer(caller, (amountToPayB + amountWithFee), assetIdB)]) | |
853 | + | else throw("Strict value is not equal to itself.") | |
854 | + | } | |
855 | + | let newBalanceA = $t03519736543._1 | |
856 | + | let newBalanceB = $t03519736543._2 | |
857 | + | let govRewardAssetId = $t03519736543._3 | |
858 | + | let userTransfer = $t03519736543._4 | |
859 | + | $Tuple2([ScriptTransfer(i.caller, unlockAmount, shareAssetId)], $Tuple2(([IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kShareAssetSupply, (shareAssetSupply - withdrawAmount)), Burn(shareAssetId, withdrawAmount), ScriptTransfer(moneyBoxAddress, governanceReward, govRewardAssetId)] ++ userTransfer), nil)) | |
860 | + | } | |
861 | + | else throw("Strict value is not equal to itself.") | |
862 | + | } | |
863 | + | })) | |
864 | + | ||
865 | + | ||
866 | + | ||
867 | + | @Callable(i) | |
868 | + | func takeIntoAccountExtraFunds (callerBytes,args,pAmounts,pAssetIds) = valueOrElse(isOraclePool(toString(i.caller)), valueOrElse(isActive(), { | |
869 | + | let $t03726837344 = getPoolAssets(i.caller) | |
870 | + | let strAssetIdA = $t03726837344._1 | |
871 | + | let strAssetIdB = $t03726837344._2 | |
872 | + | let assetIdA = $t03726837344._3 | |
873 | + | let assetIdB = $t03726837344._4 | |
874 | + | let $t03735737463 = getPoolBalances(i.caller, assetIdA, assetIdB) | |
875 | + | let balanceA = $t03735737463._1 | |
876 | + | let balanceB = $t03735737463._2 | |
877 | + | let accountBalanceA = $t03735737463._3 | |
878 | + | let accountBalanceB = $t03735737463._4 | |
879 | + | let amountEnrollA = (accountBalanceA - balanceA) | |
880 | + | let amountEnrollB = (accountBalanceB - balanceB) | |
881 | + | if ((size(args) != 0)) | |
882 | + | then throw("Wrong args size") | |
883 | + | else if ((moneyBoxAddress != i.originCaller)) | |
884 | + | then throw("Only the wallet can call this function") | |
885 | + | else if (if ((0 > amountEnrollA)) | |
886 | + | then true | |
887 | + | else (0 > amountEnrollB)) | |
888 | + | then suspend("Enroll amount negative") | |
889 | + | else if (if ((amountEnrollA == 0)) | |
890 | + | then (amountEnrollB == 0) | |
891 | + | else false) | |
892 | + | then throw("No money to take") | |
893 | + | else { | |
894 | + | let stake1 = if (if (contains(stakingAssets, strAssetIdA)) | |
895 | + | then (amountEnrollA > 0) | |
896 | + | else false) | |
897 | + | then invoke(i.caller, "stakeUnstake", [true, amountEnrollA, strAssetIdA], nil) | |
898 | + | else 0 | |
899 | + | if ((stake1 == stake1)) | |
900 | + | then { | |
901 | + | let stake2 = if (if (contains(stakingAssets, strAssetIdB)) | |
902 | + | then (amountEnrollB > 0) | |
903 | + | else false) | |
904 | + | then invoke(i.caller, "stakeUnstake", [true, amountEnrollB, strAssetIdB], nil) | |
905 | + | else 0 | |
906 | + | if ((stake2 == stake2)) | |
907 | + | then $Tuple2(nil, $Tuple2([IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB))], nil)) | |
908 | + | else throw("Strict value is not equal to itself.") | |
909 | + | } | |
910 | + | else throw("Strict value is not equal to itself.") | |
911 | + | } | |
912 | + | })) | |
294 | 913 | ||
295 | 914 | ||
296 | 915 | @Verifier(tx) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let version = "1.0.0" | |
5 | + | ||
6 | + | let kVersion = "version" | |
7 | + | ||
4 | 8 | let kActive = "active" | |
5 | 9 | ||
6 | - | let kActiveGlob = "active_all_contracts" | |
10 | + | let kAssetIdA = "A_asset_id" | |
11 | + | ||
12 | + | let kAssetIdB = "B_asset_id" | |
13 | + | ||
14 | + | let kBalanceA = "A_asset_balance" | |
15 | + | ||
16 | + | let kBalanceB = "B_asset_balance" | |
17 | + | ||
18 | + | let kBalanceInitA = "A_asset_init" | |
19 | + | ||
20 | + | let kBalanceInitB = "B_asset_init" | |
21 | + | ||
22 | + | let kShareAssetId = "share_asset_id" | |
23 | + | ||
24 | + | let kShareAssetSupply = "share_asset_supply" | |
25 | + | ||
26 | + | let kFee = "commission" | |
7 | 27 | ||
8 | 28 | let kCause = "shutdown_cause" | |
29 | + | ||
30 | + | let kFirstHarvest = "first_harvest" | |
31 | + | ||
32 | + | let kFirstHarvestHeight = "first_harvest_height" | |
33 | + | ||
34 | + | let kShareLimit = "share_limit_on_first_harvest" | |
35 | + | ||
36 | + | let kBasePeriod = "base_period" | |
37 | + | ||
38 | + | let kPeriodLength = "period_length" | |
39 | + | ||
40 | + | let kStartHeight = "start_height" | |
9 | 41 | ||
10 | 42 | let kUSDNAddress = "staking_usdnnsbt_address" | |
11 | 43 | ||
12 | 44 | let kEURNAddress = "staking_eurn_address" | |
13 | 45 | ||
14 | - | let kLeasingPool = "leasing_address" | |
15 | - | ||
16 | 46 | let kLeasingAmount = "leasing_amount" | |
17 | 47 | ||
18 | - | let kLeasingId = "leasing_id" | |
48 | + | let kUSDNAssetId = "usdn_asset_id" | |
49 | + | ||
50 | + | let kEURNAssetId = "eurn_asset_id" | |
51 | + | ||
52 | + | let kStakingAssets = "staking_assets" | |
53 | + | ||
54 | + | let kOracleActive = "active_all_contracts" | |
55 | + | ||
56 | + | let kDiscounts = "discounts" | |
57 | + | ||
58 | + | let kDiscountValues = "discount_values" | |
59 | + | ||
60 | + | let kUserGSwopInGov = "_GSwop_amount" | |
61 | + | ||
62 | + | let kUserSwopInGov = "_SWOP_amount" | |
63 | + | ||
64 | + | let kOraclePool = "pool_" | |
19 | 65 | ||
20 | 66 | let kAdminPubKey1 = "admin_pub_1" | |
21 | 67 | ||
22 | 68 | let kAdminPubKey2 = "admin_pub_2" | |
23 | 69 | ||
24 | 70 | let kAdminPubKey3 = "admin_pub_3" | |
25 | 71 | ||
26 | 72 | let kAdminInvokePubKey = "admin_invoke_pub" | |
27 | 73 | ||
28 | - | let | |
74 | + | let kMoneyBoxAddress = "money_box_address" | |
29 | 75 | ||
30 | - | let | |
76 | + | let kVotingAddress = "voting_address" | |
31 | 77 | ||
32 | - | let | |
78 | + | let kGovAddress = "governance_address" | |
33 | 79 | ||
34 | - | let kStakingAssets = "staking_assets" | |
35 | - | ||
36 | - | let kShareAssetId = "share_asset_id" | |
80 | + | let kFarmingAddress = "farming_address" | |
37 | 81 | ||
38 | 82 | let oracle = Address(base58'3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz') | |
39 | 83 | ||
40 | 84 | func getBase58FromOracle (key) = match getString(oracle, key) { | |
41 | 85 | case string: String => | |
42 | 86 | fromBase58String(string) | |
43 | 87 | case nothing => | |
44 | 88 | throw((key + "is empty")) | |
45 | 89 | } | |
46 | 90 | ||
47 | 91 | ||
48 | 92 | let adminPubKey1 = getBase58FromOracle(kAdminPubKey1) | |
49 | 93 | ||
50 | 94 | let adminPubKey2 = getBase58FromOracle(kAdminPubKey2) | |
51 | 95 | ||
52 | 96 | let adminPubKey3 = getBase58FromOracle(kAdminPubKey3) | |
53 | 97 | ||
54 | - | let | |
98 | + | let adminInvokePubKey = getBase58FromOracle(kAdminInvokePubKey) | |
55 | 99 | ||
56 | - | let | |
100 | + | let moneyBoxAddress = Address(getBase58FromOracle(kMoneyBoxAddress)) | |
57 | 101 | ||
58 | - | let | |
102 | + | let votingAddress = Address(getBase58FromOracle(kVotingAddress)) | |
59 | 103 | ||
60 | - | let cpmmContract = Address(getBase58FromOracle(kCpmmContract)) | |
104 | + | let govAddress = Address(getBase58FromOracle(kGovAddress)) | |
105 | + | ||
106 | + | let farmingAddress = Address(getBase58FromOracle(kFarmingAddress)) | |
61 | 107 | ||
62 | 108 | let USDN = getBase58FromOracle(kUSDNAssetId) | |
63 | 109 | ||
64 | 110 | let EURN = getBase58FromOracle(kEURNAssetId) | |
65 | 111 | ||
66 | 112 | let stakingAssets = getStringValue(oracle, kStakingAssets) | |
67 | 113 | ||
68 | - | let | |
114 | + | let stakingUSDNAddress = Address(getBase58FromOracle(kUSDNAddress)) | |
69 | 115 | ||
70 | - | let | |
116 | + | let stakingEURNAddress = Address(getBase58FromOracle(kEURNAddress)) | |
71 | 117 | ||
72 | - | func isActive () = if (if (active) | |
73 | - | then activeGlob | |
74 | - | else false) | |
75 | - | then unit | |
76 | - | else throw("DApp is inactive at this moment") | |
118 | + | let basePeriod = valueOrErrorMessage(getInteger(votingAddress, kBasePeriod), "Empty kBasePeriod") | |
119 | + | ||
120 | + | let startHeight = valueOrErrorMessage(getInteger(votingAddress, kStartHeight), "Empty kStartHeight") | |
121 | + | ||
122 | + | let periodLength = valueOrErrorMessage(getInteger(votingAddress, kPeriodLength), "Empty kPeriodLength") | |
123 | + | ||
124 | + | let firstHarvestEndPeriod = ((basePeriod + ((height - startHeight) / periodLength)) + 3) | |
125 | + | ||
126 | + | let active = getBooleanValue(oracle, kOracleActive) | |
127 | + | ||
128 | + | let feeScale6 = 1000000 | |
129 | + | ||
130 | + | let scale8 = 100000000 | |
131 | + | ||
132 | + | func accountBalance (assetId,pool) = match assetId { | |
133 | + | case id: ByteVector => | |
134 | + | assetBalance(pool, id) | |
135 | + | case waves: Unit => | |
136 | + | wavesBalance(pool).available | |
137 | + | case _ => | |
138 | + | throw("Match error") | |
139 | + | } | |
77 | 140 | ||
78 | 141 | ||
79 | - | func isGlobalCaller (caller) = if ((caller == cpmmContract)) | |
80 | - | then unit | |
81 | - | else throw("Only global Contract can invoke this function") | |
142 | + | func stakedAmount (assetId,pool) = { | |
143 | + | let stakedAmountCalculated = match assetId { | |
144 | + | case aId: ByteVector => | |
145 | + | if ((aId == USDN)) | |
146 | + | then getInteger(stakingUSDNAddress, ((("rpd_balance_" + toBase58String(aId)) + "_") + toString(pool))) | |
147 | + | else if ((aId == EURN)) | |
148 | + | then getInteger(stakingEURNAddress, ((("%s%s%s__stakingBalance__" + toBase58String(aId)) + "__") + toString(pool))) | |
149 | + | else 0 | |
150 | + | case _: Unit => | |
151 | + | valueOrElse(getInteger(pool, kLeasingAmount), 0) | |
152 | + | case _ => | |
153 | + | throw("Match error") | |
154 | + | } | |
155 | + | match stakedAmountCalculated { | |
156 | + | case i: Int => | |
157 | + | i | |
158 | + | case _ => | |
159 | + | 0 | |
160 | + | } | |
161 | + | } | |
82 | 162 | ||
83 | 163 | ||
84 | - | func isAdminCall (callerPubKey) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], callerPubKey)) | |
85 | - | then unit | |
86 | - | else throw("Only admin can call this function") | |
164 | + | func getAssetInfo (assetId) = match assetId { | |
165 | + | case id: String|ByteVector => | |
166 | + | let $t038974069 = match id { | |
167 | + | case aId: ByteVector => | |
168 | + | $Tuple2(toBase58String(aId), aId) | |
169 | + | case aId: String => | |
170 | + | $Tuple2(aId, fromBase58String(aId)) | |
171 | + | case _ => | |
172 | + | throw("Match error") | |
173 | + | } | |
174 | + | let stringId = $t038974069._1 | |
175 | + | let bytesId = $t038974069._2 | |
176 | + | let info = valueOrErrorMessage(assetInfo(bytesId), (("Asset " + stringId) + " doesn't exist")) | |
177 | + | $Tuple3(stringId, info.name, info.decimals) | |
178 | + | case waves: Unit => | |
179 | + | $Tuple3("WAVES", "WAVES", 8) | |
180 | + | case _ => | |
181 | + | throw("Match error") | |
182 | + | } | |
87 | 183 | ||
88 | 184 | ||
89 | 185 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
90 | 186 | ||
91 | 187 | ||
92 | - | func calcStakingFuncAndAddres (stake,assetId) = if (stake) | |
93 | - | then if ((assetId == USDN)) | |
94 | - | then $Tuple2("lockNeutrino", stakingUSDNAddress) | |
95 | - | else $Tuple2("startStaking", stakingEURNAddress) | |
96 | - | else if ((assetId == USDN)) | |
97 | - | then $Tuple2("unlockNeutrino", stakingUSDNAddress) | |
98 | - | else $Tuple2("stopStaking", stakingEURNAddress) | |
99 | - | ||
100 | - | ||
101 | - | func calcStakingParams (stake,amount,assetId) = if (stake) | |
102 | - | then { | |
103 | - | let $t025932659 = calcStakingFuncAndAddres(stake, assetId) | |
104 | - | let call = $t025932659._1 | |
105 | - | let stakingAddr = $t025932659._2 | |
106 | - | $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)]) | |
107 | - | } | |
108 | - | else { | |
109 | - | let $t027452811 = calcStakingFuncAndAddres(stake, assetId) | |
110 | - | let call = $t027452811._1 | |
111 | - | let stakingAddr = $t027452811._2 | |
112 | - | $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil) | |
113 | - | } | |
114 | - | ||
115 | - | ||
116 | - | func collectPayments (acc,payment) = { | |
117 | - | let $t029733016 = acc | |
118 | - | let paymentAmounts = $t029733016._1 | |
119 | - | let paymentAssetIds = $t029733016._2 | |
120 | - | $Tuple2((paymentAmounts :+ payment.amount), (paymentAssetIds :+ (if ((payment.assetId == unit)) | |
121 | - | then base58'' | |
122 | - | else payment.assetId))) | |
188 | + | func calculateFeeDiscount (userAddr) = { | |
189 | + | let swopAmount = valueOrElse(getInteger(govAddress, (toString(userAddr) + kUserSwopInGov)), 0) | |
190 | + | let gSwopAmount = valueOrElse(getInteger(govAddress, (toString(userAddr) + kUserGSwopInGov)), swopAmount) | |
191 | + | let discountValues = split(getStringValue(oracle, kDiscountValues), ",") | |
192 | + | let discounts = split(getStringValue(oracle, kDiscounts), ",") | |
193 | + | if (if ((gSwopAmount >= parseIntValue(discountValues[0]))) | |
194 | + | then (parseIntValue(discountValues[1]) > gSwopAmount) | |
195 | + | else false) | |
196 | + | then (feeScale6 - parseIntValue(discounts[0])) | |
197 | + | else if (if ((gSwopAmount >= parseIntValue(discountValues[1]))) | |
198 | + | then (parseIntValue(discountValues[2]) > gSwopAmount) | |
199 | + | else false) | |
200 | + | then (feeScale6 - parseIntValue(discounts[1])) | |
201 | + | else if (if ((gSwopAmount >= parseIntValue(discountValues[2]))) | |
202 | + | then (parseIntValue(discountValues[3]) > gSwopAmount) | |
203 | + | else false) | |
204 | + | then (feeScale6 - parseIntValue(discounts[2])) | |
205 | + | else if (if ((gSwopAmount >= parseIntValue(discountValues[3]))) | |
206 | + | then (parseIntValue(discountValues[4]) > gSwopAmount) | |
207 | + | else false) | |
208 | + | then (feeScale6 - parseIntValue(discounts[3])) | |
209 | + | else if ((gSwopAmount >= parseIntValue(discountValues[4]))) | |
210 | + | then (feeScale6 - parseIntValue(discounts[4])) | |
211 | + | else feeScale6 | |
123 | 212 | } | |
124 | 213 | ||
125 | 214 | ||
126 | - | func collectState (result,source) = match source { | |
127 | - | case e: Issue|Burn|Reissue|ScriptTransfer|BinaryEntry|BooleanEntry|StringEntry|IntegerEntry => | |
128 | - | (result :+ e) | |
129 | - | case _ => | |
130 | - | result | |
131 | - | } | |
215 | + | func calculateFees (pmtAmount,minAmountToReceive,tokenFrom,tokenTo,fee,feeGovernance) = { | |
216 | + | let amountWithoutFee = fraction(tokenTo, pmtAmount, (pmtAmount + tokenFrom)) | |
217 | + | let amountWithFee = fraction(amountWithoutFee, (feeScale6 - fee), feeScale6) | |
218 | + | let governanceReward = fraction(amountWithoutFee, feeGovernance, feeScale6) | |
219 | + | if ((minAmountToReceive > amountWithFee)) | |
220 | + | then throw(((("Calculated amount to receive " + toString(amountWithFee)) + " is less than specified minimum ") + toString(minAmountToReceive))) | |
221 | + | else $Tuple3(amountWithoutFee, amountWithFee, governanceReward) | |
222 | + | } | |
132 | 223 | ||
133 | 224 | ||
134 | - | func collectData (result,source) = match source { | |
135 | - | case v: String => | |
136 | - | (result :+ v) | |
137 | - | case v: Int => | |
138 | - | (result :+ v) | |
139 | - | case v: Boolean => | |
140 | - | (result :+ v) | |
141 | - | case v: ByteVector => | |
142 | - | (result :+ v) | |
143 | - | case v: Unit => | |
144 | - | (result :+ v) | |
145 | - | case _ => | |
146 | - | throw() | |
147 | - | } | |
225 | + | func calculateVirtPay (pmtAmount,balance,fee) = { | |
226 | + | let F = (feeScale6 - fee) | |
227 | + | let k = fraction(fee, 60, 100) | |
228 | + | let a = (scale8 + fraction((F * k), scale8, (feeScale6 * feeScale6))) | |
229 | + | let b = ((((balance + fraction(balance, F, feeScale6)) + fraction(pmtAmount, F, feeScale6)) - pmtAmount) - fraction(pmtAmount, (F * k), (feeScale6 * feeScale6))) | |
230 | + | let c = (-(toBigInt(balance)) * toBigInt(pmtAmount)) | |
231 | + | let D = ((toBigInt(b) * toBigInt(b)) - fraction((toBigInt(4) * c), toBigInt(a), toBigInt(scale8))) | |
232 | + | toInt(fraction((-(toBigInt(b)) + sqrtBigInt(D, 0, 0, DOWN)), toBigInt(scale8), toBigInt((2 * a)))) | |
233 | + | } | |
148 | 234 | ||
149 | 235 | ||
150 | - | func callCommon (funcName,caller,args,payments) = valueOrElse(isActive(), { | |
151 | - | let $t039364020 = { | |
152 | - | let $l = payments | |
153 | - | let $s = size($l) | |
154 | - | let $acc0 = $Tuple2(nil, nil) | |
155 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
156 | - | then $a | |
157 | - | else collectPayments($a, $l[$i]) | |
236 | + | func parsePaymentAsset (assetId) = if ((assetId == base58'')) | |
237 | + | then unit | |
238 | + | else assetId | |
158 | 239 | ||
159 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
160 | - | then $a | |
161 | - | else throw("List size exceeds 10") | |
162 | 240 | ||
163 | - | $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) | |
164 | - | } | |
165 | - | let paymentAmounts = $t039364020._1 | |
166 | - | let paymentAssetIds = $t039364020._2 | |
167 | - | let lockPayment = if (if ((funcName == "replenishWithTwoTokens")) | |
168 | - | then (size(payments) == 3) | |
169 | - | else false) | |
170 | - | then [payments[2]] | |
171 | - | else if (if ((funcName == "replenishWithOneToken")) | |
172 | - | then (size(payments) == 2) | |
173 | - | else false) | |
174 | - | then [payments[1]] | |
175 | - | else nil | |
176 | - | let $t042494406 = { | |
177 | - | let @ = reentrantInvoke(cpmmContract, funcName, [caller, args, paymentAmounts, paymentAssetIds], lockPayment) | |
178 | - | if ($isInstanceOf(@, "(List[Any], List[Any])")) | |
179 | - | then @ | |
180 | - | else throw(($getType(@) + " couldn't be cast to (List[Any], List[Any])")) | |
181 | - | } | |
182 | - | if (($t042494406 == $t042494406)) | |
183 | - | then { | |
184 | - | let data = $t042494406._2 | |
185 | - | let actions = $t042494406._1 | |
186 | - | let mappedData = { | |
187 | - | let $l = data | |
188 | - | let $s = size($l) | |
189 | - | let $acc0 = nil | |
190 | - | func $f1_1 ($a,$i) = if (($i >= $s)) | |
191 | - | then $a | |
192 | - | else collectData($a, $l[$i]) | |
241 | + | func suspendSuspicious (accountBalanceA,accountBalanceB,balanceA,balanceB,assetIdA,assetIdB) = suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(accountBalanceA)) + " ") + assetIdA) + ", ") + toString(accountBalanceB)) + " ") + assetIdB) + ". State: ") + toString(balanceA)) + " ") + assetIdA) + ", ") + toString(balanceB)) + " ") + assetIdB)) | |
193 | 242 | ||
194 | - | func $f1_2 ($a,$i) = if (($i >= $s)) | |
195 | - | then $a | |
196 | - | else throw("List size exceeds 10") | |
197 | 243 | ||
198 | - | $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) | |
199 | - | } | |
200 | - | let mappedActions = { | |
201 | - | let $l = actions | |
202 | - | let $s = size($l) | |
203 | - | let $acc0 = nil | |
204 | - | func $f2_1 ($a,$i) = if (($i >= $s)) | |
205 | - | then $a | |
206 | - | else collectState($a, $l[$i]) | |
244 | + | func isActive () = if (active) | |
245 | + | then unit | |
246 | + | else throw("DApp is inactive at this moment") | |
207 | 247 | ||
208 | - | func $f2_2 ($a,$i) = if (($i >= $s)) | |
209 | - | then $a | |
210 | - | else throw("List size exceeds 15") | |
211 | 248 | ||
212 | - | $f2_2($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($f2_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
213 | - | } | |
214 | - | $Tuple2(mappedActions, mappedData) | |
215 | - | } | |
216 | - | else throw("Strict value is not equal to itself.") | |
217 | - | }) | |
249 | + | func isOraclePool (poolAddress) = if (isDefined(getString(oracle, (kOraclePool + poolAddress)))) | |
250 | + | then unit | |
251 | + | else throw("DApp is not registered pool") | |
252 | + | ||
253 | + | ||
254 | + | func getPoolBalances (pool,assetIdA,assetIdB) = { | |
255 | + | let balanceA = getIntegerValue(pool, kBalanceA) | |
256 | + | let balanceB = getIntegerValue(pool, kBalanceB) | |
257 | + | let stakedAmountA = stakedAmount(assetIdA, pool) | |
258 | + | let stakedAmountB = stakedAmount(assetIdB, pool) | |
259 | + | let accountBalanceA = (accountBalance(assetIdA, pool) + stakedAmountA) | |
260 | + | let accountBalanceB = (accountBalance(assetIdB, pool) + stakedAmountB) | |
261 | + | let shareSupply = getIntegerValue(pool, kShareAssetSupply) | |
262 | + | $Tuple5(balanceA, balanceB, accountBalanceA, accountBalanceB, shareSupply) | |
263 | + | } | |
264 | + | ||
265 | + | ||
266 | + | func getPoolAssets (pool) = { | |
267 | + | let strAssetIdA = getStringValue(pool, kAssetIdA) | |
268 | + | let strAssetIdB = getStringValue(pool, kAssetIdB) | |
269 | + | let assetIdA = if ((strAssetIdA == "WAVES")) | |
270 | + | then unit | |
271 | + | else fromBase58String(strAssetIdA) | |
272 | + | let assetIdB = if ((strAssetIdB == "WAVES")) | |
273 | + | then unit | |
274 | + | else fromBase58String(strAssetIdB) | |
275 | + | let shareAssetId = fromBase58String(getStringValue(pool, kShareAssetId)) | |
276 | + | $Tuple5(strAssetIdA, strAssetIdB, assetIdA, assetIdB, shareAssetId) | |
277 | + | } | |
278 | + | ||
279 | + | ||
280 | + | func getFeeParams (pool,caller) = { | |
281 | + | let feeDiscount = calculateFeeDiscount(caller) | |
282 | + | let fee = fraction(getIntegerValue(pool, kFee), feeDiscount, feeScale6, CEILING) | |
283 | + | let govFee = fraction(fraction(fee, 40, 100), feeDiscount, feeScale6, CEILING) | |
284 | + | $Tuple2(fee, govFee) | |
285 | + | } | |
218 | 286 | ||
219 | 287 | ||
220 | 288 | @Callable(i) | |
221 | - | func callFunction (funcName,args) = callCommon(funcName, i.caller.bytes, args, i.payments) | |
289 | + | func init (callerBytes,args,pAmounts,pAssetIds) = { | |
290 | + | let caller = Address(callerBytes) | |
291 | + | let $t090769154 = $Tuple2(pAmounts[0], parsePaymentAsset(pAssetIds[0])) | |
292 | + | let pmtAmountA = $t090769154._1 | |
293 | + | let pmtAssetIdA = $t090769154._2 | |
294 | + | let $t091599237 = $Tuple2(pAmounts[1], parsePaymentAsset(pAssetIds[1])) | |
295 | + | let pmtAmountB = $t091599237._1 | |
296 | + | let pmtAssetIdB = $t091599237._2 | |
297 | + | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminInvokePubKey], i.originCallerPublicKey))) | |
298 | + | then throw("Only admin can call this function") | |
299 | + | else if ((size(args) != 1)) | |
300 | + | then throw("Wrong args size") | |
301 | + | else if (isDefined(getBoolean(caller, kActive))) | |
302 | + | then throw("DApp is already active") | |
303 | + | else if ((pmtAssetIdA == pmtAssetIdB)) | |
304 | + | then throw("Assets must be different") | |
305 | + | else { | |
306 | + | let $t096729749 = getAssetInfo(pmtAssetIdA) | |
307 | + | let pmtStrAssetIdA = $t096729749._1 | |
308 | + | let pmtAssetNameA = $t096729749._2 | |
309 | + | let pmtDecimalsA = $t096729749._3 | |
310 | + | let $t097589835 = getAssetInfo(pmtAssetIdB) | |
311 | + | let pmtStrAssetIdB = $t097589835._1 | |
312 | + | let pmtAssetNameB = $t097589835._2 | |
313 | + | let pmtDecimalsB = $t097589835._3 | |
314 | + | let firstHarvest = (args[0] == "true") | |
315 | + | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
316 | + | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
317 | + | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
318 | + | let arg1 = pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN) | |
319 | + | let arg2 = pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN) | |
320 | + | let arg3 = pow(10, 0, shareDecimals, 0, 0, DOWN) | |
321 | + | let shareInitialSupply = fraction(arg1, arg2, arg3) | |
322 | + | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
323 | + | let shareIssueId = calculateAssetId(shareIssue) | |
324 | + | let stake1 = if (contains(stakingAssets, pmtStrAssetIdA)) | |
325 | + | then invoke(i.caller, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
326 | + | else 0 | |
327 | + | if ((stake1 == stake1)) | |
328 | + | then { | |
329 | + | let stake2 = if (contains(stakingAssets, pmtStrAssetIdB)) | |
330 | + | then invoke(i.caller, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
331 | + | else 0 | |
332 | + | if ((stake2 == stake2)) | |
333 | + | then { | |
334 | + | let baseEntry = [StringEntry(kVersion, version), BooleanEntry(kActive, true), StringEntry(kAssetIdA, pmtStrAssetIdA), StringEntry(kAssetIdB, pmtStrAssetIdB), IntegerEntry(kBalanceA, pmtAmountA), IntegerEntry(kBalanceB, pmtAmountB), IntegerEntry(kFee, getIntegerValue(oracle, "base_fee_cpmm")), shareIssue, StringEntry(kShareAssetId, toBase58String(shareIssueId)), IntegerEntry(kShareAssetSupply, shareInitialSupply), ScriptTransfer(caller, shareInitialSupply, shareIssueId)] | |
335 | + | if (firstHarvest) | |
336 | + | then $Tuple2(nil, $Tuple2((baseEntry ++ [BooleanEntry(kFirstHarvest, firstHarvest), IntegerEntry(kFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]), nil)) | |
337 | + | else $Tuple2(nil, $Tuple2(baseEntry, nil)) | |
338 | + | } | |
339 | + | else throw("Strict value is not equal to itself.") | |
340 | + | } | |
341 | + | else throw("Strict value is not equal to itself.") | |
342 | + | } | |
343 | + | } | |
222 | 344 | ||
223 | 345 | ||
224 | 346 | ||
225 | 347 | @Callable(i) | |
226 | - | func shutdown () = valueOrElse(isAdminCall(i.callerPublicKey), if (!(active)) | |
227 | - | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
228 | - | else suspend("Paused by admin")) | |
348 | + | func initWithInitRatio (callerBytes,args,pAmounts,pAssetIds) = { | |
349 | + | let caller = Address(callerBytes) | |
350 | + | let $t01205612256 = $Tuple5(parseIntValue(args[0]), parseIntValue(args[1]), args[2], args[3], (args[4] == "true")) | |
351 | + | let amtAssetA = $t01205612256._1 | |
352 | + | let amtAssetB = $t01205612256._2 | |
353 | + | let assetIdAStr = $t01205612256._3 | |
354 | + | let assetIdBStr = $t01205612256._4 | |
355 | + | let firstHarvest = $t01205612256._5 | |
356 | + | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminInvokePubKey], i.originCallerPublicKey))) | |
357 | + | then throw("Only admin can call this function") | |
358 | + | else if ((size(args) != 5)) | |
359 | + | then throw("Wrong args size") | |
360 | + | else if (isDefined(getBoolean(caller, kActive))) | |
361 | + | then throw("DApp is already active") | |
362 | + | else if ((assetIdAStr == assetIdBStr)) | |
363 | + | then throw("Assets must be different") | |
364 | + | else { | |
365 | + | let $t01269112768 = getAssetInfo(assetIdAStr) | |
366 | + | let pmtStrAssetIdA = $t01269112768._1 | |
367 | + | let pmtAssetNameA = $t01269112768._2 | |
368 | + | let pmtDecimalsA = $t01269112768._3 | |
369 | + | let $t01277712854 = getAssetInfo(assetIdBStr) | |
370 | + | let pmtStrAssetIdB = $t01277712854._1 | |
371 | + | let pmtAssetNameB = $t01277712854._2 | |
372 | + | let pmtDecimalsB = $t01277712854._3 | |
373 | + | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
374 | + | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
375 | + | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
376 | + | let shareInitialSupply = 0 | |
377 | + | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
378 | + | let shareIssueId = calculateAssetId(shareIssue) | |
379 | + | let baseEntry = [StringEntry(kVersion, version), BooleanEntry(kActive, true), StringEntry(kAssetIdA, pmtStrAssetIdA), StringEntry(kAssetIdB, pmtStrAssetIdB), IntegerEntry(kBalanceInitA, amtAssetA), IntegerEntry(kBalanceInitB, amtAssetB), IntegerEntry(kBalanceA, 0), IntegerEntry(kBalanceB, 0), IntegerEntry(kFee, getIntegerValue(oracle, "base_fee_cpmm")), shareIssue, StringEntry(kShareAssetId, toBase58String(shareIssueId)), IntegerEntry(kShareAssetSupply, shareInitialSupply)] | |
380 | + | if (firstHarvest) | |
381 | + | then $Tuple2(nil, $Tuple2((baseEntry ++ [BooleanEntry(kFirstHarvest, firstHarvest), IntegerEntry(kFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]), nil)) | |
382 | + | else $Tuple2(nil, $Tuple2(baseEntry, nil)) | |
383 | + | } | |
384 | + | } | |
229 | 385 | ||
230 | 386 | ||
231 | 387 | ||
232 | 388 | @Callable(i) | |
233 | - | func activate () = valueOrElse(isAdminCall(i.callerPublicKey), if (active) | |
234 | - | then throw("DApp is already active") | |
235 | - | else [BooleanEntry(kActive, true), DeleteEntry(kCause)]) | |
389 | + | func keepLimitForFirstHarvest (callerBytes,args,pAmounts,pAssetIds) = valueOrElse(isOraclePool(toString(i.caller)), valueOrElse(isActive(), if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminInvokePubKey], i.originCallerPublicKey))) | |
390 | + | then throw("Only admin can call this function") | |
391 | + | else if ((size(args) != 1)) | |
392 | + | then throw("Wrong args size") | |
393 | + | else { | |
394 | + | let shareLimit = parseIntValue(args[0]) | |
395 | + | $Tuple2(nil, $Tuple2([IntegerEntry(kShareLimit, shareLimit)], nil)) | |
396 | + | })) | |
236 | 397 | ||
237 | 398 | ||
238 | 399 | ||
239 | 400 | @Callable(i) | |
240 | - | func stakeUnstake (stake,amount,assetIdString) = valueOrElse(isActive(), if ((i.caller != cpmmContract)) | |
241 | - | then throw("Only global Contract can invoke this function") | |
242 | - | else if ((assetIdString == "WAVES")) | |
243 | - | then { | |
244 | - | let pool = addressFromStringValue(valueOrErrorMessage(getString(oracle, kLeasingPool), "No leasing pool in oracle")) | |
245 | - | let leasingId = getBinary(this, kLeasingId) | |
246 | - | let leasingAmount = valueOrElse(getInteger(this, kLeasingAmount), 0) | |
247 | - | let newLeaseAmount = if (stake) | |
248 | - | then (leasingAmount + amount) | |
249 | - | else (leasingAmount - amount) | |
250 | - | let newLease = Lease(pool, newLeaseAmount) | |
251 | - | let newLeaseId = calculateLeaseId(newLease) | |
252 | - | let baseEtry = [newLease, BinaryEntry(kLeasingId, newLeaseId), IntegerEntry(kLeasingAmount, newLeaseAmount)] | |
253 | - | match leasingId { | |
254 | - | case lId: ByteVector => | |
255 | - | ([LeaseCancel(lId)] ++ baseEtry) | |
256 | - | case _ => | |
257 | - | baseEtry | |
258 | - | } | |
259 | - | } | |
260 | - | else { | |
261 | - | let $t064026505 = calcStakingParams(stake, amount, fromBase58String(assetIdString)) | |
262 | - | let call = $t064026505._1 | |
263 | - | let addr = $t064026505._2 | |
264 | - | let params = $t064026505._3 | |
265 | - | let payments = $t064026505._4 | |
266 | - | let inv = invoke(addr, call, params, payments) | |
267 | - | if ((inv == inv)) | |
268 | - | then nil | |
269 | - | else throw("Strict value is not equal to itself.") | |
270 | - | }) | |
271 | - | ||
272 | - | ||
273 | - | ||
274 | - | @Callable(i) | |
275 | - | func reissueShareToken (amount) = valueOrElse(isGlobalCaller(i.caller), valueOrElse(isActive(), { | |
276 | - | let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId)) | |
277 | - | [Reissue(shareAssetId, amount, true), ScriptTransfer(i.caller, amount, shareAssetId)] | |
401 | + | func exchange (callerBytes,args,pAmounts,pAssetIds) = valueOrElse(isOraclePool(toString(i.caller)), valueOrElse(isActive(), { | |
402 | + | let caller = Address(callerBytes) | |
403 | + | let $t01524015316 = $Tuple2(pAmounts[0], parsePaymentAsset(pAssetIds[0])) | |
404 | + | let pmtAmount = $t01524015316._1 | |
405 | + | let pmtAssetId = $t01524015316._2 | |
406 | + | let minAmountToReceive = parseIntValue(args[0]) | |
407 | + | let $t01538915465 = getPoolAssets(i.caller) | |
408 | + | let strAssetIdA = $t01538915465._1 | |
409 | + | let strAssetIdB = $t01538915465._2 | |
410 | + | let assetIdA = $t01538915465._3 | |
411 | + | let assetIdB = $t01538915465._4 | |
412 | + | let $t01547815584 = getPoolBalances(i.caller, assetIdA, assetIdB) | |
413 | + | let balanceA = $t01547815584._1 | |
414 | + | let balanceB = $t01547815584._2 | |
415 | + | let accountBalanceA = $t01547815584._3 | |
416 | + | let accountBalanceB = $t01547815584._4 | |
417 | + | if ((size(args) != 1)) | |
418 | + | then throw("Wrong args size") | |
419 | + | else if (if ((balanceA == 0)) | |
420 | + | then true | |
421 | + | else (balanceB == 0)) | |
422 | + | then throw("Can't exchange with zero balance") | |
423 | + | else if ((0 >= minAmountToReceive)) | |
424 | + | then throw(("Minimal amount to receive must be positive. Actual: " + toString(minAmountToReceive))) | |
425 | + | else if ((size(pAmounts) != 1)) | |
426 | + | then throw("One attached payment expected") | |
427 | + | else if (!(containsElement([assetIdA, assetIdB], pmtAssetId))) | |
428 | + | then throw(((("Incorrect asset attached. Expected: " + strAssetIdA) + " or ") + strAssetIdB)) | |
429 | + | else if (if ((balanceA > accountBalanceA)) | |
430 | + | then true | |
431 | + | else (balanceB > accountBalanceB)) | |
432 | + | then $Tuple2(nil, ([ScriptTransfer(caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious(accountBalanceA, accountBalanceB, balanceA, balanceB, strAssetIdA, strAssetIdB))) | |
433 | + | else { | |
434 | + | let $t01655216610 = getFeeParams(i.caller, i.originCaller) | |
435 | + | let fee = $t01655216610._1 | |
436 | + | let govFee = $t01655216610._2 | |
437 | + | let $t01662716964 = if ((pmtAssetId == assetIdA)) | |
438 | + | then calculateFees(pmtAmount, minAmountToReceive, balanceA, balanceB, fee, govFee) | |
439 | + | else calculateFees(pmtAmount, minAmountToReceive, balanceB, balanceA, fee, govFee) | |
440 | + | let amountWithoutFee = $t01662716964._1 | |
441 | + | let amountWithFee = $t01662716964._2 | |
442 | + | let governanceReward = $t01662716964._3 | |
443 | + | let $t01698217307 = if ((pmtAssetId == assetIdA)) | |
444 | + | then $Tuple3((balanceA + pmtAmount), ((balanceB - amountWithFee) - governanceReward), assetIdB) | |
445 | + | else $Tuple3(((balanceA - amountWithFee) - governanceReward), (balanceB + pmtAmount), assetIdA) | |
446 | + | let newBalanceA = $t01698217307._1 | |
447 | + | let newBalanceB = $t01698217307._2 | |
448 | + | let assetIdSend = $t01698217307._3 | |
449 | + | let $t01732517575 = if ((pmtAssetId == assetIdA)) | |
450 | + | then $Tuple2(pmtAmount, (amountWithFee + governanceReward)) | |
451 | + | else $Tuple2((amountWithFee + governanceReward), pmtAmount) | |
452 | + | let stakeAmountA = $t01732517575._1 | |
453 | + | let stakeAmountB = $t01732517575._2 | |
454 | + | let stake1 = if (contains(stakingAssets, strAssetIdA)) | |
455 | + | then invoke(i.caller, "stakeUnstake", [(pmtAssetId == assetIdA), stakeAmountA, strAssetIdA], nil) | |
456 | + | else 0 | |
457 | + | if ((stake1 == stake1)) | |
458 | + | then { | |
459 | + | let stake2 = if (contains(stakingAssets, strAssetIdB)) | |
460 | + | then invoke(i.caller, "stakeUnstake", [(pmtAssetId == assetIdB), stakeAmountB, strAssetIdB], nil) | |
461 | + | else 0 | |
462 | + | if ((stake2 == stake2)) | |
463 | + | then $Tuple2(nil, $Tuple2([IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), ScriptTransfer(caller, amountWithFee, assetIdSend), ScriptTransfer(moneyBoxAddress, governanceReward, assetIdSend)], [amountWithFee, assetIdSend])) | |
464 | + | else throw("Strict value is not equal to itself.") | |
465 | + | } | |
466 | + | else throw("Strict value is not equal to itself.") | |
467 | + | } | |
278 | 468 | })) | |
279 | 469 | ||
280 | 470 | ||
281 | 471 | ||
282 | 472 | @Callable(i) | |
283 | - | func replenishWithTwoTokens (slippageTolerance) = callCommon("replenishWithTwoTokens", i.caller.bytes, ["false", "0"], i.payments) | |
473 | + | func replenishWithTwoTokens (callerBytes,args,pAmounts,pAssetIds) = valueOrElse(isOraclePool(toString(i.caller)), valueOrElse(isActive(), { | |
474 | + | let caller = Address(callerBytes) | |
475 | + | let pmtAssetIdA = parsePaymentAsset(pAssetIds[0]) | |
476 | + | let pmtAssetIdB = parsePaymentAsset(pAssetIds[1]) | |
477 | + | let stakeFarming = (args[0] == "true") | |
478 | + | let lockType = parseIntValue(args[1]) | |
479 | + | let $t01883818928 = getPoolAssets(i.caller) | |
480 | + | let strAssetIdA = $t01883818928._1 | |
481 | + | let strAssetIdB = $t01883818928._2 | |
482 | + | let assetIdA = $t01883818928._3 | |
483 | + | let assetIdB = $t01883818928._4 | |
484 | + | let shareAssetId = $t01883818928._5 | |
485 | + | let $t01894119065 = getPoolBalances(i.caller, assetIdA, assetIdB) | |
486 | + | let balanceA = $t01894119065._1 | |
487 | + | let balanceB = $t01894119065._2 | |
488 | + | let accountBalanceA = $t01894119065._3 | |
489 | + | let accountBalanceB = $t01894119065._4 | |
490 | + | let shareAssetSupply = $t01894119065._5 | |
491 | + | if ((size(args) != 2)) | |
492 | + | then throw("Wrong args size") | |
493 | + | else if (if ((size(pAmounts) != 2)) | |
494 | + | then (size(pAmounts) != 3) | |
495 | + | else false) | |
496 | + | then throw("Two or three payments expected") | |
497 | + | else if (if ((pmtAssetIdA != assetIdA)) | |
498 | + | then true | |
499 | + | else (pmtAssetIdB != assetIdB)) | |
500 | + | then throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB)) | |
501 | + | else if (if ((balanceA > accountBalanceA)) | |
502 | + | then true | |
503 | + | else (balanceB > accountBalanceB)) | |
504 | + | then $Tuple2(nil, ([ScriptTransfer(caller, pAmounts[0], pmtAssetIdA), ScriptTransfer(caller, pAmounts[1], pmtAssetIdB)] ++ (if ((size(pAmounts) == 3)) | |
505 | + | then [AttachedPayment(if ((pAssetIds[2] == base58'')) | |
506 | + | then unit | |
507 | + | else pAssetIds[2], pAmounts[2])] | |
508 | + | else (nil ++ suspendSuspicious(accountBalanceA, accountBalanceB, balanceA, balanceB, strAssetIdA, strAssetIdB))))) | |
509 | + | else { | |
510 | + | let $t02006620143 = getAssetInfo(pmtAssetIdA) | |
511 | + | let pmtStrAssetIdA = $t02006620143._1 | |
512 | + | let pmtAssetNameA = $t02006620143._2 | |
513 | + | let pmtDecimalsA = $t02006620143._3 | |
514 | + | let $t02016020237 = getAssetInfo(pmtAssetIdB) | |
515 | + | let pmtStrAssetIdB = $t02016020237._1 | |
516 | + | let pmtAssetNameB = $t02016020237._2 | |
517 | + | let pmtDecimalsB = $t02016020237._3 | |
518 | + | let initial = ((balanceA + balanceB) == 0) | |
519 | + | let $t02031221155 = if (initial) | |
520 | + | then $Tuple5(pAmounts[0], pAmounts[1], 0, pmtAssetIdA, 1) | |
521 | + | else { | |
522 | + | let ratioShareTokensInA = fraction(scale8, pAmounts[0], balanceA) | |
523 | + | let ratioShareTokensInB = fraction(scale8, pAmounts[1], balanceB) | |
524 | + | if ((ratioShareTokensInB > ratioShareTokensInA)) | |
525 | + | then { | |
526 | + | let pmt = fraction(pAmounts[0], balanceB, balanceA) | |
527 | + | $Tuple5(pAmounts[0], pmt, (pAmounts[1] - pmt), pmtAssetIdB, ratioShareTokensInA) | |
528 | + | } | |
529 | + | else { | |
530 | + | let pmt = fraction(pAmounts[1], balanceA, balanceB) | |
531 | + | $Tuple5(pmt, pAmounts[1], (pAmounts[0] - pmt), pmtAssetIdA, ratioShareTokensInB) | |
532 | + | } | |
533 | + | } | |
534 | + | let pmtAmountA = $t02031221155._1 | |
535 | + | let pmtAmountB = $t02031221155._2 | |
536 | + | let change = $t02031221155._3 | |
537 | + | let changeAssetId = $t02031221155._4 | |
538 | + | let shareTokenRatio = $t02031221155._5 | |
539 | + | let shareTokenToPayAmount = if (initial) | |
540 | + | then { | |
541 | + | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
542 | + | fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN), pow(10, 0, shareDecimals, 0, 0, DOWN)) | |
543 | + | } | |
544 | + | else fraction(shareTokenRatio, shareAssetSupply, scale8) | |
545 | + | if ((shareTokenToPayAmount == 0)) | |
546 | + | then throw("Too small amount to replenish") | |
547 | + | else if ((0 > change)) | |
548 | + | then throw("Change < 0") | |
549 | + | else { | |
550 | + | let stake1 = if (contains(stakingAssets, pmtStrAssetIdA)) | |
551 | + | then invoke(i.caller, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
552 | + | else 0 | |
553 | + | if ((stake1 == stake1)) | |
554 | + | then { | |
555 | + | let stake2 = if (contains(stakingAssets, pmtStrAssetIdB)) | |
556 | + | then invoke(i.caller, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
557 | + | else 0 | |
558 | + | if ((stake2 == stake2)) | |
559 | + | then { | |
560 | + | let shareTokenST = if (stakeFarming) | |
561 | + | then { | |
562 | + | let stPayments = ([AttachedPayment(shareAssetId, shareTokenToPayAmount)] ++ (if ((size(pAmounts) == 3)) | |
563 | + | then [AttachedPayment(if ((pAssetIds[2] == base58'')) | |
564 | + | then unit | |
565 | + | else pAssetIds[2], pAmounts[2])] | |
566 | + | else nil)) | |
567 | + | let reissue = invoke(i.caller, "reissueShareToken", [shareTokenToPayAmount], nil) | |
568 | + | if ((reissue == reissue)) | |
569 | + | then { | |
570 | + | let stake3 = invoke(farmingAddress, "lockShareTokensFromPool", [callerBytes, toString(i.caller), lockType], stPayments) | |
571 | + | if ((stake3 == stake3)) | |
572 | + | then nil | |
573 | + | else throw("Strict value is not equal to itself.") | |
574 | + | } | |
575 | + | else throw("Strict value is not equal to itself.") | |
576 | + | } | |
577 | + | else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(caller, shareTokenToPayAmount, shareAssetId)] | |
578 | + | $Tuple2(nil, $Tuple2(([IntegerEntry(kBalanceA, (balanceA + pmtAmountA)), IntegerEntry(kBalanceB, (balanceB + pmtAmountB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), ScriptTransfer(caller, change, changeAssetId)] ++ shareTokenST), nil)) | |
579 | + | } | |
580 | + | else throw("Strict value is not equal to itself.") | |
581 | + | } | |
582 | + | else throw("Strict value is not equal to itself.") | |
583 | + | } | |
584 | + | } | |
585 | + | })) | |
284 | 586 | ||
285 | 587 | ||
286 | 588 | ||
287 | 589 | @Callable(i) | |
288 | - | func withdraw () = callCommon("withdraw", i.caller.bytes, ["0"], i.payments) | |
590 | + | func replenishWithOneToken (callerBytes,args,pAmounts,pAssetIds) = valueOrElse(isOraclePool(toString(i.caller)), valueOrElse(isActive(), { | |
591 | + | let caller = Address(callerBytes) | |
592 | + | let pmtAssetId = parsePaymentAsset(pAssetIds[0]) | |
593 | + | let pmtAmount = pAmounts[0] | |
594 | + | let virtGetMinAmount = parseIntValue(args[0]) | |
595 | + | let stakeFarming = (args[1] == "true") | |
596 | + | let lockType = parseIntValue(args[2]) | |
597 | + | let $t02406024150 = getPoolAssets(i.caller) | |
598 | + | let strAssetIdA = $t02406024150._1 | |
599 | + | let strAssetIdB = $t02406024150._2 | |
600 | + | let assetIdA = $t02406024150._3 | |
601 | + | let assetIdB = $t02406024150._4 | |
602 | + | let shareAssetId = $t02406024150._5 | |
603 | + | let $t02416324287 = getPoolBalances(i.caller, assetIdA, assetIdB) | |
604 | + | let balanceA = $t02416324287._1 | |
605 | + | let balanceB = $t02416324287._2 | |
606 | + | let accountBalanceA = $t02416324287._3 | |
607 | + | let accountBalanceB = $t02416324287._4 | |
608 | + | let shareAssetSupply = $t02416324287._5 | |
609 | + | let initial = ((balanceA + balanceB) == 0) | |
610 | + | if ((size(args) != 3)) | |
611 | + | then throw("Wrong args size") | |
612 | + | else if (if ((size(pAmounts) != 1)) | |
613 | + | then (size(pAmounts) != 2) | |
614 | + | else false) | |
615 | + | then throw("Two or one attached assets expected") | |
616 | + | else if (if ((pmtAssetId != assetIdA)) | |
617 | + | then (pmtAssetId != assetIdB) | |
618 | + | else false) | |
619 | + | then throw(((("Incorrect asset attached. Expected: " + strAssetIdA) + " or ") + strAssetIdB)) | |
620 | + | else if (initial) | |
621 | + | then throw("For initial exchanger you need to use two tokens") | |
622 | + | else if (if ((balanceA > accountBalanceA)) | |
623 | + | then true | |
624 | + | else (balanceB > accountBalanceB)) | |
625 | + | then $Tuple2(nil, ([ScriptTransfer(caller, pmtAmount, pmtAssetId)] ++ (if ((size(pAmounts) == 2)) | |
626 | + | then [AttachedPayment(if ((pAssetIds[2] == base58'')) | |
627 | + | then unit | |
628 | + | else pAssetIds[2], pAmounts[2])] | |
629 | + | else (nil ++ suspendSuspicious(accountBalanceA, accountBalanceB, balanceA, balanceB, strAssetIdA, strAssetIdB))))) | |
630 | + | else { | |
631 | + | let $t02534325401 = getFeeParams(i.caller, i.originCaller) | |
632 | + | let fee = $t02534325401._1 | |
633 | + | let govFee = $t02534325401._2 | |
634 | + | let $t02541827624 = if ((pmtAssetId == assetIdA)) | |
635 | + | then { | |
636 | + | let virtPayAmount = calculateVirtPay(pmtAmount, balanceA, fee) | |
637 | + | let $t02569725834 = calculateFees(virtPayAmount, virtGetMinAmount, balanceA, balanceB, fee, govFee) | |
638 | + | let amountWithoutFee = $t02569725834._1 | |
639 | + | let amountWithFee = $t02569725834._2 | |
640 | + | let governanceReward = $t02569725834._3 | |
641 | + | let balanceAVirt = (balanceA + virtPayAmount) | |
642 | + | let balanceBVirt = ((balanceB + amountWithoutFee) - governanceReward) | |
643 | + | let newBalanceA = (balanceA + pmtAmount) | |
644 | + | let newBalanceB = (balanceB - governanceReward) | |
645 | + | let ratioShareTokensInA = fraction((pmtAmount - virtPayAmount), scale8, balanceAVirt) | |
646 | + | let ratioShareTokensInB = fraction(amountWithFee, scale8, balanceBVirt) | |
647 | + | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
648 | + | $Tuple7(newBalanceA, newBalanceB, shareTokenToPayAmount, governanceReward, assetIdB, strAssetIdB, strAssetIdA) | |
649 | + | } | |
650 | + | else { | |
651 | + | let virtPayAmount = calculateVirtPay(pmtAmount, balanceB, fee) | |
652 | + | let $t02672926866 = calculateFees(virtPayAmount, virtGetMinAmount, balanceB, balanceA, fee, govFee) | |
653 | + | let amountWithoutFee = $t02672926866._1 | |
654 | + | let amountWithFee = $t02672926866._2 | |
655 | + | let governanceReward = $t02672926866._3 | |
656 | + | let balanceAVirt = ((balanceA + amountWithoutFee) - governanceReward) | |
657 | + | let balanceBVirt = (balanceB + virtPayAmount) | |
658 | + | let newBalanceA = (balanceA - governanceReward) | |
659 | + | let newBalanceB = (balanceB + pmtAmount) | |
660 | + | let ratioShareTokensInA = fraction(amountWithFee, scale8, balanceAVirt) | |
661 | + | let ratioShareTokensInB = fraction((pmtAmount - virtPayAmount), scale8, balanceBVirt) | |
662 | + | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8) | |
663 | + | $Tuple7(newBalanceA, newBalanceB, shareTokenToPayAmount, governanceReward, assetIdA, strAssetIdA, strAssetIdB) | |
664 | + | } | |
665 | + | let newBalanceA = $t02541827624._1 | |
666 | + | let newBalanceB = $t02541827624._2 | |
667 | + | let shareTokenToPayAmount = $t02541827624._3 | |
668 | + | let govReward = $t02541827624._4 | |
669 | + | let govRewardAsset = $t02541827624._5 | |
670 | + | let govRewardAssetStr = $t02541827624._6 | |
671 | + | let pmtAssetIdStr = $t02541827624._7 | |
672 | + | if ((shareTokenToPayAmount == 0)) | |
673 | + | then throw("Too small amount to replenish") | |
674 | + | else { | |
675 | + | let stake1 = if (contains(stakingAssets, pmtAssetIdStr)) | |
676 | + | then invoke(i.caller, "stakeUnstake", [true, pmtAmount, pmtAssetIdStr], nil) | |
677 | + | else 0 | |
678 | + | if ((stake1 == stake1)) | |
679 | + | then { | |
680 | + | let stake2 = if (contains(stakingAssets, govRewardAssetStr)) | |
681 | + | then invoke(i.caller, "stakeUnstake", [false, govReward, govRewardAssetStr], nil) | |
682 | + | else 0 | |
683 | + | if ((stake2 == stake2)) | |
684 | + | then { | |
685 | + | let shareTokenST = if (stakeFarming) | |
686 | + | then { | |
687 | + | let stPayments = ([AttachedPayment(shareAssetId, shareTokenToPayAmount)] ++ (if ((size(pAmounts) == 2)) | |
688 | + | then [AttachedPayment(if ((pAssetIds[1] == base58'')) | |
689 | + | then unit | |
690 | + | else pAssetIds[1], pAmounts[1])] | |
691 | + | else nil)) | |
692 | + | let reissue = invoke(i.caller, "reissueShareToken", [shareTokenToPayAmount], nil) | |
693 | + | if ((reissue == reissue)) | |
694 | + | then { | |
695 | + | let stake3 = invoke(farmingAddress, "lockShareTokensFromPool", [callerBytes, toString(i.caller), lockType], stPayments) | |
696 | + | if ((stake3 == stake3)) | |
697 | + | then nil | |
698 | + | else throw("Strict value is not equal to itself.") | |
699 | + | } | |
700 | + | else throw("Strict value is not equal to itself.") | |
701 | + | } | |
702 | + | else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(caller, shareTokenToPayAmount, shareAssetId)] | |
703 | + | $Tuple2(nil, $Tuple2(([IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), ScriptTransfer(moneyBoxAddress, govReward, govRewardAsset)] ++ shareTokenST), nil)) | |
704 | + | } | |
705 | + | else throw("Strict value is not equal to itself.") | |
706 | + | } | |
707 | + | else throw("Strict value is not equal to itself.") | |
708 | + | } | |
709 | + | } | |
710 | + | })) | |
289 | 711 | ||
290 | 712 | ||
291 | 713 | ||
292 | 714 | @Callable(i) | |
293 | - | func exchange (minAmountToReceive) = callCommon("exchange", i.caller.bytes, [toString(minAmountToReceive)], i.payments) | |
715 | + | func withdraw (callerBytes,args,pAmounts,pAssetIds) = valueOrElse(isOraclePool(toString(i.caller)), valueOrElse(isActive(), { | |
716 | + | let time = lastBlock.timestamp | |
717 | + | let caller = Address(callerBytes) | |
718 | + | let $t02977829868 = getPoolAssets(i.caller) | |
719 | + | let strAssetIdA = $t02977829868._1 | |
720 | + | let strAssetIdB = $t02977829868._2 | |
721 | + | let assetIdA = $t02977829868._3 | |
722 | + | let assetIdB = $t02977829868._4 | |
723 | + | let shareAssetId = $t02977829868._5 | |
724 | + | let $t02988130005 = getPoolBalances(i.caller, assetIdA, assetIdB) | |
725 | + | let balanceA = $t02988130005._1 | |
726 | + | let balanceB = $t02988130005._2 | |
727 | + | let accountBalanceA = $t02988130005._3 | |
728 | + | let accountBalanceB = $t02988130005._4 | |
729 | + | let shareAssetSupply = $t02988130005._5 | |
730 | + | let $t03001830426 = if ((size(pAmounts) == 1)) | |
731 | + | then { | |
732 | + | let pAsset = parsePaymentAsset(pAssetIds[0]) | |
733 | + | if ((pAsset != shareAssetId)) | |
734 | + | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
735 | + | else $Tuple2(pAmounts[0], pAsset) | |
736 | + | } | |
737 | + | else $Tuple2(0, shareAssetId) | |
738 | + | let pmtAmount = $t03001830426._1 | |
739 | + | let pmtAssetId = $t03001830426._2 | |
740 | + | if ((size(args) != 1)) | |
741 | + | then throw("Wrong args size") | |
742 | + | else if ((size(pAmounts) > 1)) | |
743 | + | then throw("One attached payment expected") | |
744 | + | else if (if ((balanceA > accountBalanceA)) | |
745 | + | then true | |
746 | + | else (balanceB > accountBalanceB)) | |
747 | + | then $Tuple2(nil, ([ScriptTransfer(caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious(accountBalanceA, accountBalanceB, balanceA, balanceB, strAssetIdA, strAssetIdB))) | |
748 | + | else { | |
749 | + | let unlockAmount = parseIntValue(valueOrElse(args[0], "0")) | |
750 | + | let unlock = if ((unlockAmount > 0)) | |
751 | + | then invoke(farmingAddress, "withdrawShareTokensFromPool", [callerBytes, toString(i.caller), unlockAmount], nil) | |
752 | + | else 0 | |
753 | + | if ((unlock == unlock)) | |
754 | + | then { | |
755 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
756 | + | let amountToPayA = fraction(withdrawAmount, balanceA, shareAssetSupply) | |
757 | + | let amountToPayB = fraction(withdrawAmount, balanceB, shareAssetSupply) | |
758 | + | let stake1 = if (contains(stakingAssets, strAssetIdA)) | |
759 | + | then invoke(i.caller, "stakeUnstake", [false, amountToPayA, strAssetIdA], nil) | |
760 | + | else 0 | |
761 | + | if ((stake1 == stake1)) | |
762 | + | then { | |
763 | + | let stake2 = if (contains(stakingAssets, strAssetIdB)) | |
764 | + | then invoke(i.caller, "stakeUnstake", [false, amountToPayB, strAssetIdB], nil) | |
765 | + | else 0 | |
766 | + | if ((stake2 == stake2)) | |
767 | + | then $Tuple2([ScriptTransfer(i.caller, unlockAmount, shareAssetId)], $Tuple2([IntegerEntry(kBalanceA, (balanceA - amountToPayA)), IntegerEntry(kBalanceB, (balanceB - amountToPayB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply - withdrawAmount)), Burn(shareAssetId, withdrawAmount), ScriptTransfer(caller, amountToPayA, assetIdA), ScriptTransfer(caller, amountToPayB, assetIdB)], nil)) | |
768 | + | else throw("Strict value is not equal to itself.") | |
769 | + | } | |
770 | + | else throw("Strict value is not equal to itself.") | |
771 | + | } | |
772 | + | else throw("Strict value is not equal to itself.") | |
773 | + | } | |
774 | + | })) | |
775 | + | ||
776 | + | ||
777 | + | ||
778 | + | @Callable(i) | |
779 | + | func withdrawOneToken (callerBytes,args,pAmounts,pAssetIds) = valueOrElse(isOraclePool(toString(i.caller)), valueOrElse(isActive(), { | |
780 | + | let caller = Address(callerBytes) | |
781 | + | let withdrawAsset = if ((args[0] == "")) | |
782 | + | then unit | |
783 | + | else fromBase58String(args[0]) | |
784 | + | let $t03273732827 = getPoolAssets(i.caller) | |
785 | + | let strAssetIdA = $t03273732827._1 | |
786 | + | let strAssetIdB = $t03273732827._2 | |
787 | + | let assetIdA = $t03273732827._3 | |
788 | + | let assetIdB = $t03273732827._4 | |
789 | + | let shareAssetId = $t03273732827._5 | |
790 | + | let $t03284032964 = getPoolBalances(i.caller, assetIdA, assetIdB) | |
791 | + | let balanceA = $t03284032964._1 | |
792 | + | let balanceB = $t03284032964._2 | |
793 | + | let accountBalanceA = $t03284032964._3 | |
794 | + | let accountBalanceB = $t03284032964._4 | |
795 | + | let shareAssetSupply = $t03284032964._5 | |
796 | + | let $t03297733357 = if ((size(pAmounts) == 1)) | |
797 | + | then { | |
798 | + | let pAsset = parsePaymentAsset(pAssetIds[0]) | |
799 | + | if ((pAsset != shareAssetId)) | |
800 | + | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
801 | + | else $Tuple2(pAmounts[0], pAsset) | |
802 | + | } | |
803 | + | else $Tuple2(0, shareAssetId) | |
804 | + | let pmtAmount = $t03297733357._1 | |
805 | + | let pmtAssetId = $t03297733357._2 | |
806 | + | let virtMinToRecive = parseIntValue(args[1]) | |
807 | + | if ((size(args) != 3)) | |
808 | + | then throw("Wrong args size") | |
809 | + | else if ((size(pAmounts) > 1)) | |
810 | + | then throw("One attached payment expected") | |
811 | + | else if ((pmtAssetId != shareAssetId)) | |
812 | + | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
813 | + | else if (!(containsElement([assetIdA, assetIdB], withdrawAsset))) | |
814 | + | then throw("Incorrect withdraw asset.") | |
815 | + | else if (if ((balanceA > accountBalanceA)) | |
816 | + | then true | |
817 | + | else (balanceB > accountBalanceB)) | |
818 | + | then $Tuple2(nil, ([ScriptTransfer(caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious(accountBalanceA, accountBalanceB, balanceA, balanceB, strAssetIdA, strAssetIdB))) | |
819 | + | else { | |
820 | + | let unlockAmount = parseIntValue(valueOrElse(args[2], "0")) | |
821 | + | let unlock = if ((unlockAmount > 0)) | |
822 | + | then invoke(farmingAddress, "withdrawShareTokensFromPool", [callerBytes, toString(i.caller), unlockAmount], nil) | |
823 | + | else 0 | |
824 | + | if ((unlock == unlock)) | |
825 | + | then { | |
826 | + | let withdrawAmount = (pmtAmount + unlockAmount) | |
827 | + | let amountToPayA = fraction(withdrawAmount, balanceA, shareAssetSupply) | |
828 | + | let amountToPayB = fraction(withdrawAmount, balanceB, shareAssetSupply) | |
829 | + | let $t03470534763 = getFeeParams(i.caller, i.originCaller) | |
830 | + | let fee = $t03470534763._1 | |
831 | + | let govFee = $t03470534763._2 | |
832 | + | let $t03478035180 = if ((withdrawAsset == assetIdA)) | |
833 | + | then calculateFees(amountToPayB, virtMinToRecive, (balanceB - amountToPayB), (balanceA - amountToPayA), fee, govFee) | |
834 | + | else calculateFees(amountToPayA, virtMinToRecive, (balanceA - amountToPayA), (balanceB - amountToPayB), fee, govFee) | |
835 | + | let amountWithoutFee = $t03478035180._1 | |
836 | + | let amountWithFee = $t03478035180._2 | |
837 | + | let governanceReward = $t03478035180._3 | |
838 | + | let $t03519736543 = if ((withdrawAsset == assetIdA)) | |
839 | + | then { | |
840 | + | let unstake = if (contains(stakingAssets, strAssetIdA)) | |
841 | + | then invoke(i.caller, "stakeUnstake", [false, ((amountToPayA + amountWithFee) + governanceReward), strAssetIdA], nil) | |
842 | + | else 0 | |
843 | + | if ((unstake == unstake)) | |
844 | + | then $Tuple4((((balanceA - amountToPayA) - amountWithFee) - governanceReward), balanceB, assetIdA, [ScriptTransfer(caller, (amountToPayA + amountWithFee), assetIdA)]) | |
845 | + | else throw("Strict value is not equal to itself.") | |
846 | + | } | |
847 | + | else { | |
848 | + | let unstake = if (contains(stakingAssets, strAssetIdB)) | |
849 | + | then invoke(i.caller, "stakeUnstake", [false, ((amountToPayB + amountWithFee) + governanceReward), strAssetIdB], nil) | |
850 | + | else 0 | |
851 | + | if ((unstake == unstake)) | |
852 | + | then $Tuple4(balanceA, (((balanceB - amountToPayB) - amountWithFee) - governanceReward), assetIdB, [ScriptTransfer(caller, (amountToPayB + amountWithFee), assetIdB)]) | |
853 | + | else throw("Strict value is not equal to itself.") | |
854 | + | } | |
855 | + | let newBalanceA = $t03519736543._1 | |
856 | + | let newBalanceB = $t03519736543._2 | |
857 | + | let govRewardAssetId = $t03519736543._3 | |
858 | + | let userTransfer = $t03519736543._4 | |
859 | + | $Tuple2([ScriptTransfer(i.caller, unlockAmount, shareAssetId)], $Tuple2(([IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kShareAssetSupply, (shareAssetSupply - withdrawAmount)), Burn(shareAssetId, withdrawAmount), ScriptTransfer(moneyBoxAddress, governanceReward, govRewardAssetId)] ++ userTransfer), nil)) | |
860 | + | } | |
861 | + | else throw("Strict value is not equal to itself.") | |
862 | + | } | |
863 | + | })) | |
864 | + | ||
865 | + | ||
866 | + | ||
867 | + | @Callable(i) | |
868 | + | func takeIntoAccountExtraFunds (callerBytes,args,pAmounts,pAssetIds) = valueOrElse(isOraclePool(toString(i.caller)), valueOrElse(isActive(), { | |
869 | + | let $t03726837344 = getPoolAssets(i.caller) | |
870 | + | let strAssetIdA = $t03726837344._1 | |
871 | + | let strAssetIdB = $t03726837344._2 | |
872 | + | let assetIdA = $t03726837344._3 | |
873 | + | let assetIdB = $t03726837344._4 | |
874 | + | let $t03735737463 = getPoolBalances(i.caller, assetIdA, assetIdB) | |
875 | + | let balanceA = $t03735737463._1 | |
876 | + | let balanceB = $t03735737463._2 | |
877 | + | let accountBalanceA = $t03735737463._3 | |
878 | + | let accountBalanceB = $t03735737463._4 | |
879 | + | let amountEnrollA = (accountBalanceA - balanceA) | |
880 | + | let amountEnrollB = (accountBalanceB - balanceB) | |
881 | + | if ((size(args) != 0)) | |
882 | + | then throw("Wrong args size") | |
883 | + | else if ((moneyBoxAddress != i.originCaller)) | |
884 | + | then throw("Only the wallet can call this function") | |
885 | + | else if (if ((0 > amountEnrollA)) | |
886 | + | then true | |
887 | + | else (0 > amountEnrollB)) | |
888 | + | then suspend("Enroll amount negative") | |
889 | + | else if (if ((amountEnrollA == 0)) | |
890 | + | then (amountEnrollB == 0) | |
891 | + | else false) | |
892 | + | then throw("No money to take") | |
893 | + | else { | |
894 | + | let stake1 = if (if (contains(stakingAssets, strAssetIdA)) | |
895 | + | then (amountEnrollA > 0) | |
896 | + | else false) | |
897 | + | then invoke(i.caller, "stakeUnstake", [true, amountEnrollA, strAssetIdA], nil) | |
898 | + | else 0 | |
899 | + | if ((stake1 == stake1)) | |
900 | + | then { | |
901 | + | let stake2 = if (if (contains(stakingAssets, strAssetIdB)) | |
902 | + | then (amountEnrollB > 0) | |
903 | + | else false) | |
904 | + | then invoke(i.caller, "stakeUnstake", [true, amountEnrollB, strAssetIdB], nil) | |
905 | + | else 0 | |
906 | + | if ((stake2 == stake2)) | |
907 | + | then $Tuple2(nil, $Tuple2([IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB))], nil)) | |
908 | + | else throw("Strict value is not equal to itself.") | |
909 | + | } | |
910 | + | else throw("Strict value is not equal to itself.") | |
911 | + | } | |
912 | + | })) | |
294 | 913 | ||
295 | 914 | ||
296 | 915 | @Verifier(tx) | |
297 | 916 | func verify () = { | |
298 | 917 | let multiSignedByAdmins = { | |
299 | 918 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
300 | 919 | then 1 | |
301 | 920 | else 0 | |
302 | 921 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
303 | 922 | then 1 | |
304 | 923 | else 0 | |
305 | 924 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
306 | 925 | then 1 | |
307 | 926 | else 0 | |
308 | 927 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
309 | 928 | } | |
310 | 929 | multiSignedByAdmins | |
311 | 930 | } | |
312 | 931 |
github/deemru/w8io/169f3d6 78.51 ms ◑