tx · E6PjHUp4FJ81pxrb9HqppkQR1YKcMGZRJPBqP7ctP9H7 3N18bq33YEjzWkoTDhZvc7zd7eRAyv6x4aZ: -0.01400000 Waves 2021.03.07 17:37 [1427399] smart account 3N18bq33YEjzWkoTDhZvc7zd7eRAyv6x4aZ > SELF 0.00000000 Waves
{ "type": 13, "id": "E6PjHUp4FJ81pxrb9HqppkQR1YKcMGZRJPBqP7ctP9H7", "fee": 1400000, "feeAssetId": null, "timestamp": 1615127896753, "version": 1, "sender": "3N18bq33YEjzWkoTDhZvc7zd7eRAyv6x4aZ", "senderPublicKey": "71DfVUys2KXcuEivd6kRxABvVQKB5k5c48qobMB1DzKN", "proofs": [ "5AQZcnNoHHUDXBA7bVTRX8iXfzp3XgspJAgyYgTFP9Dtu57NKsq41tRUn7TA89EKNAZYCLWLojdxuRxNpaskPiWB" ], "script": "base64:AAIEAAAAAAAAACAIAhIAEgMKAQESBAoCAQESABIECgIBARIAEgASAwoBAQAAAEwAAAAAB3ZlcnNpb24CAAAABTIuMC4wAAAAAAhrVmVyc2lvbgIAAAAHdmVyc2lvbgAAAAAHa0FjdGl2ZQIAAAAGYWN0aXZlAAAAAAlrQXNzZXRJZEECAAAACkFfYXNzZXRfaWQAAAAACWtBc3NldElkQgIAAAAKQl9hc3NldF9pZAAAAAAJa0JhbGFuY2VBAgAAAA9BX2Fzc2V0X2JhbGFuY2UAAAAACWtCYWxhbmNlQgIAAAAPQl9hc3NldF9iYWxhbmNlAAAAAA1rU2hhcmVBc3NldElkAgAAAA5zaGFyZV9hc3NldF9pZAAAAAARa1NoYXJlQXNzZXRTdXBwbHkCAAAAEnNoYXJlX2Fzc2V0X3N1cHBseQAAAAAEa0ZlZQIAAAAKY29tbWlzc2lvbgAAAAASa0ZlZVNjYWxlRGVsaW1pdGVyAgAAABpjb21taXNzaW9uX3NjYWxlX2RlbGltaXRlcgAAAAAOa0ZlZUdvdmVybmFuY2UCAAAAFWNvbW1pc3Npb25fZ292ZXJuYW5jZQAAA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5jZUIJAABkAAAAAgUAAAAIYmFsYW5jZUIFAAAADWFtb3VudEVucm9sbEIJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAMbGFzdF9pbmNvbWVfBQAAAAtzdHJBc3NldElkQQUAAAANYW1vdW50RW5yb2xsQQkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACAgAAAAxsYXN0X2luY29tZV8FAAAAC3N0ckFzc2V0SWRCBQAAAA1hbW91bnRFbnJvbGxCBQAAAANuaWwAAAAApw1N9Q==", "chainId": 84, "height": 1427399, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 98aeRvJUjKgmKMk5c2hYdvZqqkKpQpSeV6mjb163EYhi Next: Hsre9GK5s6k2MVkRvBRVEQHV6jPbi1sUt9ZTrYff7qR9 Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let version = "2.0.0" | |
5 | 5 | ||
6 | - | let | |
6 | + | let kVersion = "version" | |
7 | 7 | ||
8 | - | let | |
8 | + | let kActive = "active" | |
9 | 9 | ||
10 | - | let | |
10 | + | let kAssetIdA = "A_asset_id" | |
11 | 11 | ||
12 | - | let | |
12 | + | let kAssetIdB = "B_asset_id" | |
13 | 13 | ||
14 | - | let | |
14 | + | let kBalanceA = "A_asset_balance" | |
15 | 15 | ||
16 | - | let | |
16 | + | let kBalanceB = "B_asset_balance" | |
17 | 17 | ||
18 | - | let | |
18 | + | let kShareAssetId = "share_asset_id" | |
19 | 19 | ||
20 | - | let | |
20 | + | let kShareAssetSupply = "share_asset_supply" | |
21 | 21 | ||
22 | - | let | |
22 | + | let kFee = "commission" | |
23 | 23 | ||
24 | - | let | |
24 | + | let kFeeScaleDelimiter = "commission_scale_delimiter" | |
25 | 25 | ||
26 | - | let | |
26 | + | let kFeeGovernance = "commission_governance" | |
27 | 27 | ||
28 | - | let | |
28 | + | let kInvariant = "invariant" | |
29 | 29 | ||
30 | - | let | |
30 | + | let kCause = "shutdown_cause" | |
31 | 31 | ||
32 | - | let | |
32 | + | let adm1 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4' | |
33 | 33 | ||
34 | - | let | |
34 | + | let adm2 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4' | |
35 | 35 | ||
36 | - | let | |
36 | + | let adm3 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4' | |
37 | 37 | ||
38 | - | let | |
38 | + | let admStartStop = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4' | |
39 | 39 | ||
40 | 40 | let adminPubKeyStaking = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4' | |
41 | 41 | ||
42 | - | let | |
42 | + | let govAddr = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp') | |
43 | 43 | ||
44 | 44 | let stakingAddress = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp') | |
45 | 45 | ||
47 | 47 | ||
48 | 48 | let stakingFeeInUSDN = (9 * value(value(assetInfo(USDN)).minSponsoredFee)) | |
49 | 49 | ||
50 | - | let isActive = getBooleanValue(this, | |
50 | + | let isActive = getBooleanValue(this, kActive) | |
51 | 51 | ||
52 | - | let strAssetIdA = getStringValue(this, | |
52 | + | let strAssetIdA = getStringValue(this, kAssetIdA) | |
53 | 53 | ||
54 | - | let strAssetIdB = getStringValue(this, | |
54 | + | let strAssetIdB = getStringValue(this, kAssetIdB) | |
55 | 55 | ||
56 | 56 | let assetIdA = if ((strAssetIdA == "WAVES")) | |
57 | 57 | then unit | |
79 | 79 | throw("Match error") | |
80 | 80 | } | |
81 | 81 | ||
82 | - | let balanceA = getIntegerValue(this, | |
82 | + | let balanceA = getIntegerValue(this, kBalanceA) | |
83 | 83 | ||
84 | - | let balanceB = getIntegerValue(this, | |
84 | + | let balanceB = getIntegerValue(this, kBalanceB) | |
85 | 85 | ||
86 | - | let shareAssetId = fromBase58String(getStringValue(this, | |
86 | + | let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId)) | |
87 | 87 | ||
88 | - | let shareAssetSupply = getIntegerValue(this, | |
88 | + | let shareAssetSupply = getIntegerValue(this, kShareAssetSupply) | |
89 | 89 | ||
90 | - | let invariant = getIntegerValue(this, | |
90 | + | let invariant = getIntegerValue(this, kInvariant) | |
91 | 91 | ||
92 | - | let | |
92 | + | let fee = 500 | |
93 | 93 | ||
94 | - | let | |
94 | + | let feeGovernance = 200 | |
95 | 95 | ||
96 | - | let | |
96 | + | let feeScaleDelimiter = 1000000 | |
97 | 97 | ||
98 | 98 | let scaleValue3 = 1000 | |
99 | 99 | ||
114 | 114 | let ratioThresholdMax = 100000000 | |
115 | 115 | ||
116 | 116 | let ratioThresholdMin = 99999000 | |
117 | + | ||
118 | + | let exchangeRatioLimitMin = 90000000 | |
119 | + | ||
120 | + | let exchangeRatioLimitMax = 110000000 | |
117 | 121 | ||
118 | 122 | let alpha = 50 | |
119 | 123 | ||
171 | 175 | } | |
172 | 176 | ||
173 | 177 | ||
174 | - | func | |
178 | + | func calculateHowManySendA (amountToSendEstimated,minTokenReceiveAmount,amountA,amountB,tokenReceiveAmount) = { | |
175 | 179 | let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000)) | |
176 | - | let | |
177 | - | let amountToSendStep1 = (amountToSendEstimated - ((1 * | |
178 | - | let amountToSendStep2 = (amountToSendEstimated - ((2 * | |
179 | - | let amountToSendStep3 = (amountToSendEstimated - ((3 * | |
180 | - | let amountToSendStep4 = (amountToSendEstimated - ((4 * | |
181 | - | let amountToSendStep5 = (amountToSendEstimated - ((5 * | |
182 | - | let y = ( | |
183 | - | let invariantNew = invariantCalc(( | |
180 | + | let deltaMaxAndMinSendValue = (amountToSendEstimated - minTokenReceiveAmount) | |
181 | + | let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaMaxAndMinSendValue) / 5)) | |
182 | + | let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaMaxAndMinSendValue) / 5)) | |
183 | + | let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaMaxAndMinSendValue) / 5)) | |
184 | + | let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaMaxAndMinSendValue) / 5)) | |
185 | + | let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaMaxAndMinSendValue) / 5)) | |
186 | + | let y = (amountB + tokenReceiveAmount) | |
187 | + | let invariantNew = invariantCalc((amountA - amountToSendEstimated), y) | |
184 | 188 | let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew) | |
185 | - | if ((0 >= (invariantCalc(( | |
186 | - | then throw(" | |
189 | + | if ((0 >= (invariantCalc((amountA - amountToSendStep5), y) - invariant))) | |
190 | + | then throw("err1") | |
187 | 191 | else if (if ((invariantEstimatedRatio > slippageValue)) | |
188 | 192 | then ((invariantNew - invariant) > 0) | |
189 | 193 | else false) | |
190 | 194 | then amountToSendEstimated | |
191 | - | else if (((invariantCalc(( | |
192 | - | then ((amountToSendStep1 * ( | |
193 | - | else if (((invariantCalc(( | |
194 | - | then ((amountToSendStep2 * ( | |
195 | - | else if (((invariantCalc(( | |
196 | - | then ((amountToSendStep3 * ( | |
197 | - | else if (((invariantCalc(( | |
198 | - | then ((amountToSendStep4 * ( | |
199 | - | else if (((invariantCalc(( | |
200 | - | then ((amountToSendStep5 * ( | |
201 | - | else throw(" | |
195 | + | else if (((invariantCalc((amountA - amountToSendStep1), y) - invariant) > 0)) | |
196 | + | then ((amountToSendStep1 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
197 | + | else if (((invariantCalc((amountA - amountToSendStep2), y) - invariant) > 0)) | |
198 | + | then ((amountToSendStep2 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
199 | + | else if (((invariantCalc((amountA - amountToSendStep3), y) - invariant) > 0)) | |
200 | + | then ((amountToSendStep3 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
201 | + | else if (((invariantCalc((amountA - amountToSendStep4), y) - invariant) > 0)) | |
202 | + | then ((amountToSendStep4 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
203 | + | else if (((invariantCalc((amountA - amountToSendStep5), y) - invariant) > 0)) | |
204 | + | then ((amountToSendStep5 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
205 | + | else throw("err2") | |
202 | 206 | } | |
203 | 207 | ||
204 | 208 | ||
205 | - | func | |
209 | + | func calculateHowManySendB (amountToSendEstimated,minTokenReceiveAmount,amountA,amountB,tokenReceiveAmount) = { | |
206 | 210 | let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000)) | |
207 | - | let | |
208 | - | let amountToSendStep1 = (amountToSendEstimated - ((1 * | |
209 | - | let amountToSendStep2 = (amountToSendEstimated - ((2 * | |
210 | - | let amountToSendStep3 = (amountToSendEstimated - ((3 * | |
211 | - | let amountToSendStep4 = (amountToSendEstimated - ((4 * | |
212 | - | let amountToSendStep5 = (amountToSendEstimated - ((5 * | |
213 | - | let x = ( | |
214 | - | let invariantNew = invariantCalc(x, ( | |
211 | + | let deltaMaxAndMinSendValue = (amountToSendEstimated - minTokenReceiveAmount) | |
212 | + | let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaMaxAndMinSendValue) / 5)) | |
213 | + | let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaMaxAndMinSendValue) / 5)) | |
214 | + | let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaMaxAndMinSendValue) / 5)) | |
215 | + | let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaMaxAndMinSendValue) / 5)) | |
216 | + | let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaMaxAndMinSendValue) / 5)) | |
217 | + | let x = (amountA + tokenReceiveAmount) | |
218 | + | let invariantNew = invariantCalc(x, (amountB - amountToSendEstimated)) | |
215 | 219 | let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew) | |
216 | - | if ((0 >= (invariantCalc(x, ( | |
217 | - | then throw(" | |
220 | + | if ((0 >= (invariantCalc(x, (amountB - amountToSendStep5)) - invariant))) | |
221 | + | then throw("err1") | |
218 | 222 | else if (if ((invariantEstimatedRatio > slippageValue)) | |
219 | 223 | then ((invariantNew - invariant) > 0) | |
220 | 224 | else false) | |
221 | 225 | then amountToSendEstimated | |
222 | - | else if (((invariantCalc(x, ( | |
223 | - | then ((amountToSendStep1 * ( | |
224 | - | else if (((invariantCalc(x, ( | |
225 | - | then ((amountToSendStep2 * ( | |
226 | - | else if (((invariantCalc(x, ( | |
227 | - | then ((amountToSendStep3 * ( | |
228 | - | else if (((invariantCalc(x, ( | |
229 | - | then ((amountToSendStep4 * ( | |
230 | - | else if (((invariantCalc(x, ( | |
231 | - | then ((amountToSendStep5 * ( | |
232 | - | else throw(" | |
226 | + | else if (((invariantCalc(x, (amountB - amountToSendStep1)) - invariant) > 0)) | |
227 | + | then ((amountToSendStep1 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
228 | + | else if (((invariantCalc(x, (amountB - amountToSendStep2)) - invariant) > 0)) | |
229 | + | then ((amountToSendStep2 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
230 | + | else if (((invariantCalc(x, (amountB - amountToSendStep3)) - invariant) > 0)) | |
231 | + | then ((amountToSendStep3 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
232 | + | else if (((invariantCalc(x, (amountB - amountToSendStep4)) - invariant) > 0)) | |
233 | + | then ((amountToSendStep4 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
234 | + | else if (((invariantCalc(x, (amountB - amountToSendStep5)) - invariant) > 0)) | |
235 | + | then ((amountToSendStep5 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
236 | + | else throw("err2") | |
233 | 237 | } | |
234 | 238 | ||
235 | 239 | ||
245 | 249 | } | |
246 | 250 | ||
247 | 251 | ||
248 | - | func suspend (cause) = [BooleanEntry( | |
252 | + | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
249 | 253 | ||
250 | 254 | ||
251 | 255 | func deductStakingFee (amount,assetId) = if ((assetId == USDN)) | |
284 | 288 | ||
285 | 289 | @Callable(i) | |
286 | 290 | func init () = { | |
287 | - | let $ | |
288 | - | let pmtAmountA = $ | |
289 | - | let pmtAssetIdA = $ | |
290 | - | let $ | |
291 | - | let pmtAmountB = $ | |
292 | - | let pmtAssetIdB = $ | |
293 | - | let $ | |
294 | - | let pmtStrAssetIdA = $ | |
295 | - | let pmtAssetNameA = $ | |
296 | - | let pmtDecimalsA = $ | |
297 | - | let $ | |
298 | - | let pmtStrAssetIdB = $ | |
299 | - | let pmtAssetNameB = $ | |
300 | - | let pmtDecimalsB = $ | |
301 | - | if (isDefined(getBoolean(this, | |
291 | + | let $t03696337040 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
292 | + | let pmtAmountA = $t03696337040._1 | |
293 | + | let pmtAssetIdA = $t03696337040._2 | |
294 | + | let $t03704537122 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
295 | + | let pmtAmountB = $t03704537122._1 | |
296 | + | let pmtAssetIdB = $t03704537122._2 | |
297 | + | let $t03712737204 = getAssetInfo(pmtAssetIdA) | |
298 | + | let pmtStrAssetIdA = $t03712737204._1 | |
299 | + | let pmtAssetNameA = $t03712737204._2 | |
300 | + | let pmtDecimalsA = $t03712737204._3 | |
301 | + | let $t03720937286 = getAssetInfo(pmtAssetIdB) | |
302 | + | let pmtStrAssetIdB = $t03720937286._1 | |
303 | + | let pmtAssetNameB = $t03720937286._2 | |
304 | + | let pmtDecimalsB = $t03720937286._3 | |
305 | + | if (isDefined(getBoolean(this, kActive))) | |
302 | 306 | then throwIsActive() | |
303 | 307 | else if ((pmtAssetIdA == pmtAssetIdB)) | |
304 | 308 | then throw("Assets must be different") | |
310 | 314 | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
311 | 315 | let shareIssueId = calculateAssetId(shareIssue) | |
312 | 316 | let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB) | |
313 | - | [StringEntry( | |
317 | + | [StringEntry(kVersion, version), BooleanEntry(kActive, true), StringEntry(kAssetIdA, pmtStrAssetIdA), StringEntry(kAssetIdB, pmtStrAssetIdB), IntegerEntry(kBalanceA, pmtAmountA), IntegerEntry(kBalanceB, pmtAmountB), IntegerEntry(kInvariant, invariantCalculated), IntegerEntry(kFee, fee), IntegerEntry(kFeeScaleDelimiter, feeScaleDelimiter), shareIssue, StringEntry(kShareAssetId, toBase58String(shareIssueId)), IntegerEntry(kShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)] | |
314 | 318 | } | |
315 | 319 | } | |
316 | 320 | ||
317 | 321 | ||
318 | 322 | ||
319 | 323 | @Callable(i) | |
320 | - | func replenishWithTwoTokens (slippageTolerance) = { | |
321 | - | let pmtAssetIdA = i.payments[0].assetId | |
322 | - | let pmtAssetIdB = i.payments[1].assetId | |
323 | - | let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA) | |
324 | - | let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB) | |
325 | - | let tokenRatio = fraction(fraction(balanceA, scaleValue8, pmtAmountA), scaleValue3, fraction(balanceB, scaleValue8, pmtAmountB)) | |
326 | - | let ratioShareTokensInA = fraction(pmtAmountA, scaleValue8, balanceA) | |
327 | - | let ratioShareTokensInB = fraction(pmtAmountB, scaleValue8, balanceB) | |
328 | - | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8) | |
329 | - | let invariantCalculated = invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB)) | |
330 | - | if (!(isActive)) | |
331 | - | then throwIsInactive() | |
332 | - | else if (if ((0 > slippageTolerance)) | |
333 | - | then true | |
334 | - | else (slippageTolerance > slippageToleranceDelimiter)) | |
335 | - | then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance))) | |
336 | - | else if ((size(i.payments) != 2)) | |
337 | - | then throw("Two attached assets expected") | |
338 | - | else if (if ((pmtAssetIdA != assetIdA)) | |
339 | - | then true | |
340 | - | else (pmtAssetIdB != assetIdB)) | |
341 | - | then throwAssets() | |
342 | - | else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio)) | |
324 | + | func replenishWithTwoTokens (slippageTolerance) = if ((slippageTolerance > 10)) | |
325 | + | then throw("slippage tolerance must be <= 1%") | |
326 | + | else { | |
327 | + | let pmtAssetIdA = i.payments[0].assetId | |
328 | + | let pmtAssetIdB = i.payments[1].assetId | |
329 | + | let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA) | |
330 | + | let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB) | |
331 | + | let tokenRatio = fraction(fraction(balanceA, scaleValue8, pmtAmountA), scaleValue3, fraction(balanceB, scaleValue8, pmtAmountB)) | |
332 | + | let ratioShareTokensInA = fraction(pmtAmountA, scaleValue8, balanceA) | |
333 | + | let ratioShareTokensInB = fraction(pmtAmountB, scaleValue8, balanceB) | |
334 | + | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8) | |
335 | + | let invariantCalculated = invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB)) | |
336 | + | if (!(isActive)) | |
337 | + | then throwIsInactive() | |
338 | + | else if (if ((0 > slippageTolerance)) | |
339 | + | then true | |
340 | + | else (slippageTolerance > slippageToleranceDelimiter)) | |
341 | + | then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance))) | |
342 | + | else if ((size(i.payments) != 2)) | |
343 | + | then throw("Two attached assets expected") | |
344 | + | else if (if ((pmtAssetIdA != assetIdA)) | |
343 | 345 | then true | |
344 | - | else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter))) | |
345 | - | then throw("Incorrect assets amount: amounts must have the contract ratio") | |
346 | - | else if ((shareTokenToPayAmount == 0)) | |
347 | - | then throw("Too small amount to replenish") | |
348 | - | else if (!(hasEnoughBalance)) | |
349 | - | then suspendSuspicious() | |
350 | - | else [IntegerEntry(keyBalanceA, (balanceA + pmtAmountA)), IntegerEntry(keyBalanceB, (balanceB + pmtAmountB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(keyInvariant, invariantCalculated), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)] | |
351 | - | } | |
346 | + | else (pmtAssetIdB != assetIdB)) | |
347 | + | then throwAssets() | |
348 | + | else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio)) | |
349 | + | then true | |
350 | + | else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter))) | |
351 | + | then throw("Incorrect assets amount: amounts must have the contract ratio") | |
352 | + | else if ((shareTokenToPayAmount == 0)) | |
353 | + | then throw("Too small amount to replenish") | |
354 | + | else if (!(hasEnoughBalance)) | |
355 | + | then suspendSuspicious() | |
356 | + | else [IntegerEntry(kBalanceA, (balanceA + pmtAmountA)), IntegerEntry(kBalanceB, (balanceB + pmtAmountB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kInvariant, invariantCalculated), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)] | |
357 | + | } | |
352 | 358 | ||
353 | 359 | ||
354 | 360 | ||
355 | 361 | @Callable(i) | |
356 | 362 | func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = { | |
357 | - | let $ | |
358 | - | let pmtAmount = $ | |
359 | - | let pmtAssetId = $ | |
363 | + | let $t04182841903 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
364 | + | let pmtAmount = $t04182841903._1 | |
365 | + | let pmtAssetId = $t04182841903._2 | |
360 | 366 | let pmtMinThreshold = 5000000 | |
361 | 367 | let thresholdValueForMinTolerance = 50000000 | |
362 | 368 | let tolerance = if ((thresholdValueForMinTolerance > pmtAmount)) | |
376 | 382 | then suspendSuspicious() | |
377 | 383 | else if ((pmtAssetId == assetIdA)) | |
378 | 384 | then { | |
379 | - | let | |
380 | - | let | |
381 | - | let | |
382 | - | let | |
383 | - | let invariantNew = invariantCalc( | |
385 | + | let virtReplA = (pmtAmount - virtualSwapTokenPay) | |
386 | + | let virtReplB = virtualSwapTokenGet | |
387 | + | let balanceAfterSwapA = (balanceA + virtualSwapTokenPay) | |
388 | + | let balanceAfterSwapB = (balanceB - virtualSwapTokenGet) | |
389 | + | let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB) | |
384 | 390 | let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew) | |
385 | - | if (if ((invariantEstimatedRatio > | |
391 | + | if (if ((invariantEstimatedRatio > slippageValueMinForSwap)) | |
386 | 392 | then ((invariantNew - invariant) >= 0) | |
387 | 393 | else false) | |
388 | 394 | then { | |
389 | - | let ratioVirtualBalanceToVirtualReplenish = (fraction( | |
395 | + | let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterSwapA, (scaleValue8 * scaleValue8), balanceAfterSwapB) / fraction(virtReplA, scaleValue8, virtReplB)) | |
390 | 396 | if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish)) | |
391 | 397 | then true | |
392 | 398 | else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish)) | |
393 | - | then throw(" | |
399 | + | then throw("Ratio after virtual swap incorrect") | |
394 | 400 | else { | |
395 | - | let ratioShareTokensInA = fraction((amountVirtualReplenishTokenA - 270000), scaleValue8, (balanceAfterVirtualSwapA - 270000)) | |
396 | - | let ratioShareTokensInAWithoutCommission = fraction(amountVirtualReplenishTokenA, scaleValue8, balanceAfterVirtualSwapA) | |
397 | - | let ratioShareTokensInB = fraction(deductStakingFee(amountVirtualReplenishTokenB, assetIdB), scaleValue8, balanceAfterVirtualSwapB) | |
401 | + | let ratioShareTokensInA = fraction(deductStakingFee(virtReplA, assetIdA), scaleValue8, balanceAfterSwapA) | |
402 | + | let ratioShareTokensInB = fraction(deductStakingFee(virtReplB, assetIdB), scaleValue8, balanceAfterSwapB) | |
398 | 403 | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8) | |
399 | - | let shareTokenToPayAmountToDelete = fraction(max([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8) | |
400 | 404 | let invariantCalculated = invariantCalc((balanceA + pmtAmount), balanceB) | |
401 | - | let newAmountTokenA = (balanceA + pmtAmount) | |
402 | - | let newAmountTokenB = balanceB | |
403 | - | let xGet = fraction(shareTokenToPayAmount, newAmountTokenA, (shareAssetSupply + shareTokenToPayAmount)) | |
404 | - | let yGet = fraction(shareTokenToPayAmount, newAmountTokenB, (shareAssetSupply + shareTokenToPayAmount)) | |
405 | - | let dAppThresholdAmount = fraction((newAmountTokenA + newAmountTokenB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
406 | - | if (if ((dAppThresholdAmount > newAmountTokenA)) | |
405 | + | let newBalanceA = (balanceA + pmtAmount) | |
406 | + | let newBalanceB = balanceB | |
407 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
408 | + | if (if ((dAppThresholdAmount > newBalanceA)) | |
407 | 409 | then true | |
408 | - | else (dAppThresholdAmount > | |
409 | - | then throwThreshold(dAppThresholdAmount, | |
410 | - | else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry( | |
410 | + | else (dAppThresholdAmount > newBalanceB)) | |
411 | + | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
412 | + | else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kInvariant, invariantCalculated)] | |
411 | 413 | } | |
412 | 414 | } | |
413 | - | else throw(" | |
415 | + | else throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value") | |
414 | 416 | } | |
415 | 417 | else if ((pmtAssetId == assetIdB)) | |
416 | 418 | then { | |
417 | - | let | |
418 | - | let | |
419 | - | let | |
420 | - | let | |
421 | - | let invariantNew = invariantCalc( | |
419 | + | let virtReplB = (pmtAmount - virtualSwapTokenPay) | |
420 | + | let virtReplA = virtualSwapTokenGet | |
421 | + | let balanceAfterSwapA = (balanceA - virtualSwapTokenGet) | |
422 | + | let balanceAfterSwapB = (balanceB + virtualSwapTokenPay) | |
423 | + | let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB) | |
422 | 424 | let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew) | |
423 | 425 | if (if ((invariantEstimatedRatio > slippageValueMinForSwap)) | |
424 | 426 | then ((invariantNew - invariant) >= 0) | |
425 | 427 | else false) | |
426 | 428 | then { | |
427 | - | let ratioVirtualBalanceToVirtualReplenish = (fraction( | |
429 | + | let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterSwapA, (scaleValue8 * scaleValue8), balanceAfterSwapB) / fraction(virtReplA, scaleValue8, virtReplB)) | |
428 | 430 | if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish)) | |
429 | 431 | then true | |
430 | 432 | else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish)) | |
431 | - | then throw(" | |
433 | + | then throw("Ratio after virtual swap incorrect") | |
432 | 434 | else { | |
433 | - | let ratioShareTokensInA = fraction(deductStakingFee( | |
434 | - | let ratioShareTokensInB = fraction(deductStakingFee( | |
435 | + | let ratioShareTokensInA = fraction(deductStakingFee(virtReplA, assetIdA), scaleValue8, balanceAfterSwapA) | |
436 | + | let ratioShareTokensInB = fraction(deductStakingFee(virtReplB, assetIdB), scaleValue8, balanceAfterSwapB) | |
435 | 437 | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8) | |
436 | 438 | let invariantCalculated = invariantCalc(balanceA, (balanceB + pmtAmount)) | |
437 | - | let | |
438 | - | let | |
439 | - | let dAppThresholdAmount = fraction(( | |
440 | - | if (if ((dAppThresholdAmount > | |
439 | + | let newBalanceA = balanceA | |
440 | + | let newBalanceB = (balanceB + pmtAmount) | |
441 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
442 | + | if (if ((dAppThresholdAmount > newBalanceA)) | |
441 | 443 | then true | |
442 | - | else (dAppThresholdAmount > | |
443 | - | then throwThreshold(dAppThresholdAmount, | |
444 | - | else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry( | |
444 | + | else (dAppThresholdAmount > newBalanceB)) | |
445 | + | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
446 | + | else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalculated)] | |
445 | 447 | } | |
446 | 448 | } | |
447 | - | else throw(" | |
449 | + | else throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value") | |
448 | 450 | } | |
449 | 451 | else throwAssets() | |
450 | 452 | } | |
452 | 454 | ||
453 | 455 | ||
454 | 456 | @Callable(i) | |
455 | - | func exchange (estimatedAmountToReceive,minAmountToReceive) = { | |
456 | - | let $t04992049995 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
457 | - | let pmtAmount = $t04992049995._1 | |
458 | - | let pmtAssetId = $t04992049995._2 | |
457 | + | func withdraw () = { | |
458 | + | let $t04776847911 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
459 | + | let pmtAmount = $t04776847911._1 | |
460 | + | let pmtAssetId = $t04776847911._2 | |
461 | + | let amountToPayA = deductStakingFee(fraction(pmtAmount, balanceA, shareAssetSupply), assetIdA) | |
462 | + | let amountToPayB = deductStakingFee(fraction(pmtAmount, balanceB, shareAssetSupply), assetIdB) | |
463 | + | let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB)) | |
459 | 464 | if (!(isActive)) | |
460 | 465 | then throwIsInactive() | |
461 | - | else if ((0 >= estimatedAmountToReceive)) | |
462 | - | then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive))) | |
463 | - | else if ((minAmountToReceive > estimatedAmountToReceive)) | |
464 | - | then throw(((("Minimal amount can't be greater than estimated. Estimated: " + toString(estimatedAmountToReceive)) + ". Minimal: ") + toString(minAmountToReceive))) | |
465 | - | else if ((size(i.payments) != 1)) | |
466 | - | then throw("One attached payment expected") | |
467 | - | else if (!(hasEnoughBalance)) | |
468 | - | then suspendSuspicious() | |
469 | - | else if ((pmtAssetId == assetIdA)) | |
470 | - | then { | |
471 | - | let assetIdSend = assetIdB | |
472 | - | let amountWithoutFee = calculateHowManySendTokenB(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount) | |
473 | - | let amountWithFee = fraction(amountWithoutFee, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
474 | - | let governanceReward = fraction(amountWithoutFee, commissionGovernance, commissionScaleDelimiter) | |
475 | - | let newAmountTokenA = (balanceA + pmtAmount) | |
476 | - | let newAmountTokenB = ((balanceB - amountWithFee) - governanceReward) | |
477 | - | let dAppThresholdAmount = fraction((newAmountTokenA + newAmountTokenB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
478 | - | if (if ((dAppThresholdAmount > newAmountTokenA)) | |
479 | - | then true | |
480 | - | else (dAppThresholdAmount > newAmountTokenB)) | |
481 | - | then throwThreshold(dAppThresholdAmount, newAmountTokenA, newAmountTokenB) | |
482 | - | else if (if (if ((assetIdA == USDN)) | |
483 | - | then (stakedAmountUSDN >= newAmountTokenA) | |
484 | - | else false) | |
485 | - | then true | |
486 | - | else if ((assetIdB == USDN)) | |
487 | - | then (stakedAmountUSDN >= newAmountTokenB) | |
488 | - | else false) | |
489 | - | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB) | |
490 | - | else [IntegerEntry(keyBalanceA, newAmountTokenA), IntegerEntry(keyBalanceB, newAmountTokenB), IntegerEntry(keyInvariant, invariantCalc((balanceA + pmtAmount), ((balanceB - amountWithFee) - governanceReward))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(governanceAddress, governanceReward, assetIdSend)] | |
491 | - | } | |
492 | - | else if ((pmtAssetId == assetIdB)) | |
493 | - | then { | |
494 | - | let assetIdSend = assetIdA | |
495 | - | let amountWithoutFee = calculateHowManySendTokenA(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount) | |
496 | - | let amountWithFee = fraction(amountWithoutFee, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
497 | - | let governanceReward = fraction(amountWithoutFee, commissionGovernance, commissionScaleDelimiter) | |
498 | - | let newAmountTokenA = ((balanceA - amountWithFee) - governanceReward) | |
499 | - | let newAmountTokenB = (balanceB + pmtAmount) | |
500 | - | let dAppThresholdAmount = fraction((newAmountTokenA + newAmountTokenB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
501 | - | if (if ((dAppThresholdAmount > newAmountTokenA)) | |
502 | - | then true | |
503 | - | else (dAppThresholdAmount > newAmountTokenB)) | |
504 | - | then throwThreshold(dAppThresholdAmount, newAmountTokenA, newAmountTokenB) | |
505 | - | else if (if (if ((assetIdA == USDN)) | |
506 | - | then (stakedAmountUSDN >= newAmountTokenA) | |
507 | - | else false) | |
508 | - | then true | |
509 | - | else if ((assetIdB == USDN)) | |
510 | - | then (stakedAmountUSDN >= newAmountTokenB) | |
511 | - | else false) | |
512 | - | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA) | |
513 | - | else [IntegerEntry(keyBalanceA, newAmountTokenA), IntegerEntry(keyBalanceB, newAmountTokenB), IntegerEntry(keyInvariant, invariantCalc(((balanceA - amountWithFee) - governanceReward), (balanceB + pmtAmount))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(governanceAddress, governanceReward, assetIdSend)] | |
514 | - | } | |
515 | - | else throwAssets() | |
466 | + | else if ((size(i.payments) != 1)) | |
467 | + | then throw("One attached payment expected") | |
468 | + | else if ((pmtAssetId != shareAssetId)) | |
469 | + | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
470 | + | else if (!(hasEnoughBalance)) | |
471 | + | then suspendSuspicious() | |
472 | + | else if (if ((amountToPayA > availableBalanceA)) | |
473 | + | then true | |
474 | + | else (amountToPayB > availableBalanceB)) | |
475 | + | then throwInsufficientAvailableBalances(amountToPayA, amountToPayB) | |
476 | + | else [IntegerEntry(kBalanceA, (balanceA - amountToPayA)), IntegerEntry(kBalanceB, (balanceB - amountToPayB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply - pmtAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, pmtAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
516 | 477 | } | |
517 | 478 | ||
518 | 479 | ||
519 | 480 | ||
520 | 481 | @Callable(i) | |
482 | + | func exchange (estimatedAmountToReceive,minAmountToReceive) = { | |
483 | + | let $t04919449269 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
484 | + | let pmtAmount = $t04919449269._1 | |
485 | + | let pmtAssetId = $t04919449269._2 | |
486 | + | if (if ((exchangeRatioLimitMin > fraction(minAmountToReceive, scaleValue8, pmtAmount))) | |
487 | + | then true | |
488 | + | else (fraction(estimatedAmountToReceive, scaleValue8, pmtAmount) > exchangeRatioLimitMax)) | |
489 | + | then throw("Incorrect args and pmt ratio") | |
490 | + | else if (!(isActive)) | |
491 | + | then throwIsInactive() | |
492 | + | else if ((0 >= estimatedAmountToReceive)) | |
493 | + | then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive))) | |
494 | + | else if ((minAmountToReceive > estimatedAmountToReceive)) | |
495 | + | then throw(((("Minimal amount can't be greater than estimated. Estimated: " + toString(estimatedAmountToReceive)) + ". Minimal: ") + toString(minAmountToReceive))) | |
496 | + | else if ((size(i.payments) != 1)) | |
497 | + | then throw("One attached payment expected") | |
498 | + | else if (!(hasEnoughBalance)) | |
499 | + | then suspendSuspicious() | |
500 | + | else if ((10000000 > pmtAmount)) | |
501 | + | then throw("Only swap of 10.000000 or more tokens is allowed") | |
502 | + | else if ((pmtAssetId == assetIdA)) | |
503 | + | then { | |
504 | + | let assetIdSend = assetIdB | |
505 | + | let amountWithoutFee = calculateHowManySendB(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount) | |
506 | + | let amountWithFee = fraction(amountWithoutFee, (feeScaleDelimiter - fee), feeScaleDelimiter) | |
507 | + | let governanceReward = fraction(amountWithoutFee, feeGovernance, feeScaleDelimiter) | |
508 | + | let newBalanceA = (balanceA + pmtAmount) | |
509 | + | let newBalanceB = ((balanceB - amountWithFee) - governanceReward) | |
510 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
511 | + | if (if ((dAppThresholdAmount > newBalanceA)) | |
512 | + | then true | |
513 | + | else (dAppThresholdAmount > newBalanceB)) | |
514 | + | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
515 | + | else if (if (if ((assetIdA == USDN)) | |
516 | + | then (stakedAmountUSDN >= newBalanceA) | |
517 | + | else false) | |
518 | + | then true | |
519 | + | else if ((assetIdB == USDN)) | |
520 | + | then (stakedAmountUSDN >= newBalanceB) | |
521 | + | else false) | |
522 | + | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB) | |
523 | + | else [IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc((balanceA + pmtAmount), ((balanceB - amountWithFee) - governanceReward))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(govAddr, governanceReward, assetIdSend)] | |
524 | + | } | |
525 | + | else if ((pmtAssetId == assetIdB)) | |
526 | + | then { | |
527 | + | let assetIdSend = assetIdA | |
528 | + | let amountWithoutFee = calculateHowManySendA(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount) | |
529 | + | let amountWithFee = fraction(amountWithoutFee, (feeScaleDelimiter - fee), feeScaleDelimiter) | |
530 | + | let governanceReward = fraction(amountWithoutFee, feeGovernance, feeScaleDelimiter) | |
531 | + | let newBalanceA = ((balanceA - amountWithFee) - governanceReward) | |
532 | + | let newBalanceB = (balanceB + pmtAmount) | |
533 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
534 | + | if (if ((dAppThresholdAmount > newBalanceA)) | |
535 | + | then true | |
536 | + | else (dAppThresholdAmount > newBalanceB)) | |
537 | + | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
538 | + | else if (if (if ((assetIdA == USDN)) | |
539 | + | then (stakedAmountUSDN >= newBalanceA) | |
540 | + | else false) | |
541 | + | then true | |
542 | + | else if ((assetIdB == USDN)) | |
543 | + | then (stakedAmountUSDN >= newBalanceB) | |
544 | + | else false) | |
545 | + | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA) | |
546 | + | else [IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc(((balanceA - amountWithFee) - governanceReward), (balanceB + pmtAmount))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(govAddr, governanceReward, assetIdSend)] | |
547 | + | } | |
548 | + | else throwAssets() | |
549 | + | } | |
550 | + | ||
551 | + | ||
552 | + | ||
553 | + | @Callable(i) | |
554 | + | func shutdown () = if (!(isActive)) | |
555 | + | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
556 | + | else if (!(containsElement([adm1, adm2, adm3, admStartStop], i.callerPublicKey))) | |
557 | + | then throwOnlyAdmin() | |
558 | + | else suspend("Paused by admin") | |
559 | + | ||
560 | + | ||
561 | + | ||
562 | + | @Callable(i) | |
563 | + | func activate () = if (isActive) | |
564 | + | then throwIsActive() | |
565 | + | else if (!(containsElement([adm1, adm2, adm3, admStartStop], i.callerPublicKey))) | |
566 | + | then throwOnlyAdmin() | |
567 | + | else [BooleanEntry(kActive, true), DeleteEntry(kCause)] | |
568 | + | ||
569 | + | ||
570 | + | ||
571 | + | @Callable(i) | |
521 | 572 | func takeIntoAccountExtraFunds (amountLeave) = { | |
522 | - | let | |
523 | - | let | |
524 | - | let amountEnrollA = ( | |
573 | + | let uncountableA = (accountBalanceWithStakedA - balanceA) | |
574 | + | let uncountableB = (accountBalanceWithStakedB - balanceB) | |
575 | + | let amountEnrollA = (uncountableA - (if ((assetIdA == USDN)) | |
525 | 576 | then amountLeave | |
526 | 577 | else 0)) | |
527 | - | let amountEnrollB = ( | |
578 | + | let amountEnrollB = (uncountableB - (if ((assetIdB == USDN)) | |
528 | 579 | then amountLeave | |
529 | 580 | else 0)) | |
530 | 581 | if (!(isActive)) | |
531 | 582 | then throwIsInactive() | |
532 | - | else if ( | |
583 | + | else if ((i.caller != this)) | |
533 | 584 | then throwOnlyAdmin() | |
534 | 585 | else if ((0 > amountLeave)) | |
535 | 586 | then throw(("Argument 'amountLeave' cannot be negative. Actual: " + toString(amountLeave))) | |
536 | - | else if (if ((0 > | |
587 | + | else if (if ((0 > uncountableA)) | |
537 | 588 | then true | |
538 | - | else (0 > | |
589 | + | else (0 > uncountableB)) | |
539 | 590 | then suspend("Enroll amount negative") | |
540 | 591 | else if (if ((0 > amountEnrollA)) | |
541 | 592 | then true | |
542 | 593 | else (0 > amountEnrollB)) | |
543 | 594 | then throw("Too large amountLeave") | |
544 | - | else [IntegerEntry( | |
595 | + | else [IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)] | |
545 | 596 | } | |
546 | 597 | ||
547 | 598 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let version = "2.0.0" | |
5 | 5 | ||
6 | - | let | |
6 | + | let kVersion = "version" | |
7 | 7 | ||
8 | - | let | |
8 | + | let kActive = "active" | |
9 | 9 | ||
10 | - | let | |
10 | + | let kAssetIdA = "A_asset_id" | |
11 | 11 | ||
12 | - | let | |
12 | + | let kAssetIdB = "B_asset_id" | |
13 | 13 | ||
14 | - | let | |
14 | + | let kBalanceA = "A_asset_balance" | |
15 | 15 | ||
16 | - | let | |
16 | + | let kBalanceB = "B_asset_balance" | |
17 | 17 | ||
18 | - | let | |
18 | + | let kShareAssetId = "share_asset_id" | |
19 | 19 | ||
20 | - | let | |
20 | + | let kShareAssetSupply = "share_asset_supply" | |
21 | 21 | ||
22 | - | let | |
22 | + | let kFee = "commission" | |
23 | 23 | ||
24 | - | let | |
24 | + | let kFeeScaleDelimiter = "commission_scale_delimiter" | |
25 | 25 | ||
26 | - | let | |
26 | + | let kFeeGovernance = "commission_governance" | |
27 | 27 | ||
28 | - | let | |
28 | + | let kInvariant = "invariant" | |
29 | 29 | ||
30 | - | let | |
30 | + | let kCause = "shutdown_cause" | |
31 | 31 | ||
32 | - | let | |
32 | + | let adm1 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4' | |
33 | 33 | ||
34 | - | let | |
34 | + | let adm2 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4' | |
35 | 35 | ||
36 | - | let | |
36 | + | let adm3 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4' | |
37 | 37 | ||
38 | - | let | |
38 | + | let admStartStop = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4' | |
39 | 39 | ||
40 | 40 | let adminPubKeyStaking = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4' | |
41 | 41 | ||
42 | - | let | |
42 | + | let govAddr = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp') | |
43 | 43 | ||
44 | 44 | let stakingAddress = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp') | |
45 | 45 | ||
46 | 46 | let USDN = base58'3FUNGbzfNsQ1AZfvumCUqARXvpjjLQrvCzorYuDryQAq' | |
47 | 47 | ||
48 | 48 | let stakingFeeInUSDN = (9 * value(value(assetInfo(USDN)).minSponsoredFee)) | |
49 | 49 | ||
50 | - | let isActive = getBooleanValue(this, | |
50 | + | let isActive = getBooleanValue(this, kActive) | |
51 | 51 | ||
52 | - | let strAssetIdA = getStringValue(this, | |
52 | + | let strAssetIdA = getStringValue(this, kAssetIdA) | |
53 | 53 | ||
54 | - | let strAssetIdB = getStringValue(this, | |
54 | + | let strAssetIdB = getStringValue(this, kAssetIdB) | |
55 | 55 | ||
56 | 56 | let assetIdA = if ((strAssetIdA == "WAVES")) | |
57 | 57 | then unit | |
58 | 58 | else fromBase58String(strAssetIdA) | |
59 | 59 | ||
60 | 60 | let assetIdB = if ((strAssetIdB == "WAVES")) | |
61 | 61 | then unit | |
62 | 62 | else fromBase58String(strAssetIdB) | |
63 | 63 | ||
64 | 64 | let assetNameA = match assetIdA { | |
65 | 65 | case id: ByteVector => | |
66 | 66 | value(assetInfo(id)).name | |
67 | 67 | case waves: Unit => | |
68 | 68 | "WAVES" | |
69 | 69 | case _ => | |
70 | 70 | throw("Match error") | |
71 | 71 | } | |
72 | 72 | ||
73 | 73 | let assetNameB = match assetIdB { | |
74 | 74 | case id: ByteVector => | |
75 | 75 | value(assetInfo(id)).name | |
76 | 76 | case waves: Unit => | |
77 | 77 | "WAVES" | |
78 | 78 | case _ => | |
79 | 79 | throw("Match error") | |
80 | 80 | } | |
81 | 81 | ||
82 | - | let balanceA = getIntegerValue(this, | |
82 | + | let balanceA = getIntegerValue(this, kBalanceA) | |
83 | 83 | ||
84 | - | let balanceB = getIntegerValue(this, | |
84 | + | let balanceB = getIntegerValue(this, kBalanceB) | |
85 | 85 | ||
86 | - | let shareAssetId = fromBase58String(getStringValue(this, | |
86 | + | let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId)) | |
87 | 87 | ||
88 | - | let shareAssetSupply = getIntegerValue(this, | |
88 | + | let shareAssetSupply = getIntegerValue(this, kShareAssetSupply) | |
89 | 89 | ||
90 | - | let invariant = getIntegerValue(this, | |
90 | + | let invariant = getIntegerValue(this, kInvariant) | |
91 | 91 | ||
92 | - | let | |
92 | + | let fee = 500 | |
93 | 93 | ||
94 | - | let | |
94 | + | let feeGovernance = 200 | |
95 | 95 | ||
96 | - | let | |
96 | + | let feeScaleDelimiter = 1000000 | |
97 | 97 | ||
98 | 98 | let scaleValue3 = 1000 | |
99 | 99 | ||
100 | 100 | let scaleValue8 = 100000000 | |
101 | 101 | ||
102 | 102 | let scaleValue12 = 1000000000000 | |
103 | 103 | ||
104 | 104 | let slippageToleranceDelimiter = 1000 | |
105 | 105 | ||
106 | 106 | let scaleValue8Digits = 8 | |
107 | 107 | ||
108 | 108 | let scaleValue12Digits = 12 | |
109 | 109 | ||
110 | 110 | let dAppThreshold = 50 | |
111 | 111 | ||
112 | 112 | let dAppThresholdDelimiter = 100 | |
113 | 113 | ||
114 | 114 | let ratioThresholdMax = 100000000 | |
115 | 115 | ||
116 | 116 | let ratioThresholdMin = 99999000 | |
117 | + | ||
118 | + | let exchangeRatioLimitMin = 90000000 | |
119 | + | ||
120 | + | let exchangeRatioLimitMax = 110000000 | |
117 | 121 | ||
118 | 122 | let alpha = 50 | |
119 | 123 | ||
120 | 124 | let alphaDigits = 2 | |
121 | 125 | ||
122 | 126 | let beta = 46000000 | |
123 | 127 | ||
124 | 128 | let betaDigits = 8 | |
125 | 129 | ||
126 | 130 | func accountBalance (assetId) = match assetId { | |
127 | 131 | case id: ByteVector => | |
128 | 132 | assetBalance(this, id) | |
129 | 133 | case waves: Unit => | |
130 | 134 | wavesBalance(this).available | |
131 | 135 | case _ => | |
132 | 136 | throw("Match error") | |
133 | 137 | } | |
134 | 138 | ||
135 | 139 | ||
136 | 140 | let stakedAmountUSDN = match getInteger(stakingAddress, ((("rpd_balance_" + toBase58String(USDN)) + "_") + toString(this))) { | |
137 | 141 | case staked: Int => | |
138 | 142 | staked | |
139 | 143 | case nothing: Unit => | |
140 | 144 | 0 | |
141 | 145 | case _ => | |
142 | 146 | throw("Match error") | |
143 | 147 | } | |
144 | 148 | ||
145 | 149 | let availableBalanceA = (balanceA - (if ((assetIdA == USDN)) | |
146 | 150 | then stakedAmountUSDN | |
147 | 151 | else 0)) | |
148 | 152 | ||
149 | 153 | let availableBalanceB = (balanceB - (if ((assetIdB == USDN)) | |
150 | 154 | then stakedAmountUSDN | |
151 | 155 | else 0)) | |
152 | 156 | ||
153 | 157 | let accountBalanceWithStakedA = (accountBalance(assetIdA) + (if ((assetIdA == USDN)) | |
154 | 158 | then stakedAmountUSDN | |
155 | 159 | else 0)) | |
156 | 160 | ||
157 | 161 | let accountBalanceWithStakedB = (accountBalance(assetIdB) + (if ((assetIdB == USDN)) | |
158 | 162 | then stakedAmountUSDN | |
159 | 163 | else 0)) | |
160 | 164 | ||
161 | 165 | let hasEnoughBalance = if ((accountBalanceWithStakedA >= balanceA)) | |
162 | 166 | then (accountBalanceWithStakedB >= balanceB) | |
163 | 167 | else false | |
164 | 168 | ||
165 | 169 | func skewness (x,y) = (((fraction(scaleValue12, x, y) + fraction(scaleValue12, y, x)) / 2) / 10000) | |
166 | 170 | ||
167 | 171 | ||
168 | 172 | func invariantCalc (x,y) = { | |
169 | 173 | let sk = skewness(x, y) | |
170 | 174 | (fraction((x + y), scaleValue8, pow(sk, scaleValue8Digits, alpha, alphaDigits, scaleValue8Digits, UP)) + (2 * fraction(pow(fraction(x, y, scaleValue8), 0, 5, 1, (scaleValue8Digits / 2), DOWN), pow((sk - beta), scaleValue8Digits, alpha, alphaDigits, scaleValue8Digits, DOWN), scaleValue8))) | |
171 | 175 | } | |
172 | 176 | ||
173 | 177 | ||
174 | - | func | |
178 | + | func calculateHowManySendA (amountToSendEstimated,minTokenReceiveAmount,amountA,amountB,tokenReceiveAmount) = { | |
175 | 179 | let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000)) | |
176 | - | let | |
177 | - | let amountToSendStep1 = (amountToSendEstimated - ((1 * | |
178 | - | let amountToSendStep2 = (amountToSendEstimated - ((2 * | |
179 | - | let amountToSendStep3 = (amountToSendEstimated - ((3 * | |
180 | - | let amountToSendStep4 = (amountToSendEstimated - ((4 * | |
181 | - | let amountToSendStep5 = (amountToSendEstimated - ((5 * | |
182 | - | let y = ( | |
183 | - | let invariantNew = invariantCalc(( | |
180 | + | let deltaMaxAndMinSendValue = (amountToSendEstimated - minTokenReceiveAmount) | |
181 | + | let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaMaxAndMinSendValue) / 5)) | |
182 | + | let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaMaxAndMinSendValue) / 5)) | |
183 | + | let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaMaxAndMinSendValue) / 5)) | |
184 | + | let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaMaxAndMinSendValue) / 5)) | |
185 | + | let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaMaxAndMinSendValue) / 5)) | |
186 | + | let y = (amountB + tokenReceiveAmount) | |
187 | + | let invariantNew = invariantCalc((amountA - amountToSendEstimated), y) | |
184 | 188 | let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew) | |
185 | - | if ((0 >= (invariantCalc(( | |
186 | - | then throw(" | |
189 | + | if ((0 >= (invariantCalc((amountA - amountToSendStep5), y) - invariant))) | |
190 | + | then throw("err1") | |
187 | 191 | else if (if ((invariantEstimatedRatio > slippageValue)) | |
188 | 192 | then ((invariantNew - invariant) > 0) | |
189 | 193 | else false) | |
190 | 194 | then amountToSendEstimated | |
191 | - | else if (((invariantCalc(( | |
192 | - | then ((amountToSendStep1 * ( | |
193 | - | else if (((invariantCalc(( | |
194 | - | then ((amountToSendStep2 * ( | |
195 | - | else if (((invariantCalc(( | |
196 | - | then ((amountToSendStep3 * ( | |
197 | - | else if (((invariantCalc(( | |
198 | - | then ((amountToSendStep4 * ( | |
199 | - | else if (((invariantCalc(( | |
200 | - | then ((amountToSendStep5 * ( | |
201 | - | else throw(" | |
195 | + | else if (((invariantCalc((amountA - amountToSendStep1), y) - invariant) > 0)) | |
196 | + | then ((amountToSendStep1 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
197 | + | else if (((invariantCalc((amountA - amountToSendStep2), y) - invariant) > 0)) | |
198 | + | then ((amountToSendStep2 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
199 | + | else if (((invariantCalc((amountA - amountToSendStep3), y) - invariant) > 0)) | |
200 | + | then ((amountToSendStep3 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
201 | + | else if (((invariantCalc((amountA - amountToSendStep4), y) - invariant) > 0)) | |
202 | + | then ((amountToSendStep4 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
203 | + | else if (((invariantCalc((amountA - amountToSendStep5), y) - invariant) > 0)) | |
204 | + | then ((amountToSendStep5 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
205 | + | else throw("err2") | |
202 | 206 | } | |
203 | 207 | ||
204 | 208 | ||
205 | - | func | |
209 | + | func calculateHowManySendB (amountToSendEstimated,minTokenReceiveAmount,amountA,amountB,tokenReceiveAmount) = { | |
206 | 210 | let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000)) | |
207 | - | let | |
208 | - | let amountToSendStep1 = (amountToSendEstimated - ((1 * | |
209 | - | let amountToSendStep2 = (amountToSendEstimated - ((2 * | |
210 | - | let amountToSendStep3 = (amountToSendEstimated - ((3 * | |
211 | - | let amountToSendStep4 = (amountToSendEstimated - ((4 * | |
212 | - | let amountToSendStep5 = (amountToSendEstimated - ((5 * | |
213 | - | let x = ( | |
214 | - | let invariantNew = invariantCalc(x, ( | |
211 | + | let deltaMaxAndMinSendValue = (amountToSendEstimated - minTokenReceiveAmount) | |
212 | + | let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaMaxAndMinSendValue) / 5)) | |
213 | + | let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaMaxAndMinSendValue) / 5)) | |
214 | + | let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaMaxAndMinSendValue) / 5)) | |
215 | + | let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaMaxAndMinSendValue) / 5)) | |
216 | + | let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaMaxAndMinSendValue) / 5)) | |
217 | + | let x = (amountA + tokenReceiveAmount) | |
218 | + | let invariantNew = invariantCalc(x, (amountB - amountToSendEstimated)) | |
215 | 219 | let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew) | |
216 | - | if ((0 >= (invariantCalc(x, ( | |
217 | - | then throw(" | |
220 | + | if ((0 >= (invariantCalc(x, (amountB - amountToSendStep5)) - invariant))) | |
221 | + | then throw("err1") | |
218 | 222 | else if (if ((invariantEstimatedRatio > slippageValue)) | |
219 | 223 | then ((invariantNew - invariant) > 0) | |
220 | 224 | else false) | |
221 | 225 | then amountToSendEstimated | |
222 | - | else if (((invariantCalc(x, ( | |
223 | - | then ((amountToSendStep1 * ( | |
224 | - | else if (((invariantCalc(x, ( | |
225 | - | then ((amountToSendStep2 * ( | |
226 | - | else if (((invariantCalc(x, ( | |
227 | - | then ((amountToSendStep3 * ( | |
228 | - | else if (((invariantCalc(x, ( | |
229 | - | then ((amountToSendStep4 * ( | |
230 | - | else if (((invariantCalc(x, ( | |
231 | - | then ((amountToSendStep5 * ( | |
232 | - | else throw(" | |
226 | + | else if (((invariantCalc(x, (amountB - amountToSendStep1)) - invariant) > 0)) | |
227 | + | then ((amountToSendStep1 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
228 | + | else if (((invariantCalc(x, (amountB - amountToSendStep2)) - invariant) > 0)) | |
229 | + | then ((amountToSendStep2 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
230 | + | else if (((invariantCalc(x, (amountB - amountToSendStep3)) - invariant) > 0)) | |
231 | + | then ((amountToSendStep3 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
232 | + | else if (((invariantCalc(x, (amountB - amountToSendStep4)) - invariant) > 0)) | |
233 | + | then ((amountToSendStep4 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
234 | + | else if (((invariantCalc(x, (amountB - amountToSendStep5)) - invariant) > 0)) | |
235 | + | then ((amountToSendStep5 * (feeScaleDelimiter - fee)) / feeScaleDelimiter) | |
236 | + | else throw("err2") | |
233 | 237 | } | |
234 | 238 | ||
235 | 239 | ||
236 | 240 | func getAssetInfo (assetId) = match assetId { | |
237 | 241 | case id: ByteVector => | |
238 | 242 | let stringId = toBase58String(id) | |
239 | 243 | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
240 | 244 | $Tuple3(stringId, info.name, info.decimals) | |
241 | 245 | case waves: Unit => | |
242 | 246 | $Tuple3("WAVES", "WAVES", 8) | |
243 | 247 | case _ => | |
244 | 248 | throw("Match error") | |
245 | 249 | } | |
246 | 250 | ||
247 | 251 | ||
248 | - | func suspend (cause) = [BooleanEntry( | |
252 | + | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
249 | 253 | ||
250 | 254 | ||
251 | 255 | func deductStakingFee (amount,assetId) = if ((assetId == USDN)) | |
252 | 256 | then { | |
253 | 257 | let result = (amount - stakingFeeInUSDN) | |
254 | 258 | if ((0 >= result)) | |
255 | 259 | then throw((((("Insufficient amount " + toString(amount)) + " to deduct staking fee ") + toString(stakingFeeInUSDN)) + " USD-N")) | |
256 | 260 | else result | |
257 | 261 | } | |
258 | 262 | else amount | |
259 | 263 | ||
260 | 264 | ||
261 | 265 | func throwIsActive () = throw("DApp is already active") | |
262 | 266 | ||
263 | 267 | ||
264 | 268 | func throwIsInactive () = throw("DApp is inactive at this moment") | |
265 | 269 | ||
266 | 270 | ||
267 | 271 | func throwOnlyAdmin () = throw("Only admin can call this function") | |
268 | 272 | ||
269 | 273 | ||
270 | 274 | func throwAssets () = throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB)) | |
271 | 275 | ||
272 | 276 | ||
273 | 277 | func throwThreshold (threshold,amountA,amountB) = throw(((((((((("New balance in assets of the DApp is less than threshold " + toString(threshold)) + ": ") + toString(amountA)) + " ") + assetNameA) + ", ") + toString(amountB)) + " ") + assetNameB)) | |
274 | 278 | ||
275 | 279 | ||
276 | 280 | func throwInsufficientAvailableBalance (amount,available,assetName) = throw((((((((("Insufficient DApp balance to pay " + toString(amount)) + " ") + assetName) + " due to staking. Available: ") + toString(available)) + " ") + assetName) + ". Please contact support in Telegram: https://t.me/swopfisupport")) | |
277 | 281 | ||
278 | 282 | ||
279 | 283 | func throwInsufficientAvailableBalances (amountA,amountB) = throw((((((((((((((((("Insufficient DApp balance to pay " + toString(amountA)) + " ") + assetNameA) + " and ") + toString(amountB)) + " ") + assetNameB) + " due to staking. Available: ") + toString(availableBalanceA)) + " ") + assetNameA) + " and ") + toString(availableBalanceB)) + " ") + assetNameB) + ". Please contact support in Telegram: https://t.me/swopfisupport")) | |
280 | 284 | ||
281 | 285 | ||
282 | 286 | func suspendSuspicious () = suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB) + ". State: ") + toString(accountBalance(assetIdA))) + " ") + assetNameA) + ", ") + toString(accountBalance(assetIdB))) + " ") + assetNameB)) | |
283 | 287 | ||
284 | 288 | ||
285 | 289 | @Callable(i) | |
286 | 290 | func init () = { | |
287 | - | let $ | |
288 | - | let pmtAmountA = $ | |
289 | - | let pmtAssetIdA = $ | |
290 | - | let $ | |
291 | - | let pmtAmountB = $ | |
292 | - | let pmtAssetIdB = $ | |
293 | - | let $ | |
294 | - | let pmtStrAssetIdA = $ | |
295 | - | let pmtAssetNameA = $ | |
296 | - | let pmtDecimalsA = $ | |
297 | - | let $ | |
298 | - | let pmtStrAssetIdB = $ | |
299 | - | let pmtAssetNameB = $ | |
300 | - | let pmtDecimalsB = $ | |
301 | - | if (isDefined(getBoolean(this, | |
291 | + | let $t03696337040 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
292 | + | let pmtAmountA = $t03696337040._1 | |
293 | + | let pmtAssetIdA = $t03696337040._2 | |
294 | + | let $t03704537122 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
295 | + | let pmtAmountB = $t03704537122._1 | |
296 | + | let pmtAssetIdB = $t03704537122._2 | |
297 | + | let $t03712737204 = getAssetInfo(pmtAssetIdA) | |
298 | + | let pmtStrAssetIdA = $t03712737204._1 | |
299 | + | let pmtAssetNameA = $t03712737204._2 | |
300 | + | let pmtDecimalsA = $t03712737204._3 | |
301 | + | let $t03720937286 = getAssetInfo(pmtAssetIdB) | |
302 | + | let pmtStrAssetIdB = $t03720937286._1 | |
303 | + | let pmtAssetNameB = $t03720937286._2 | |
304 | + | let pmtDecimalsB = $t03720937286._3 | |
305 | + | if (isDefined(getBoolean(this, kActive))) | |
302 | 306 | then throwIsActive() | |
303 | 307 | else if ((pmtAssetIdA == pmtAssetIdB)) | |
304 | 308 | then throw("Assets must be different") | |
305 | 309 | else { | |
306 | 310 | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
307 | 311 | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
308 | 312 | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
309 | 313 | let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, HALFDOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, HALFDOWN), pow(10, 0, shareDecimals, 0, 0, HALFDOWN)) | |
310 | 314 | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
311 | 315 | let shareIssueId = calculateAssetId(shareIssue) | |
312 | 316 | let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB) | |
313 | - | [StringEntry( | |
317 | + | [StringEntry(kVersion, version), BooleanEntry(kActive, true), StringEntry(kAssetIdA, pmtStrAssetIdA), StringEntry(kAssetIdB, pmtStrAssetIdB), IntegerEntry(kBalanceA, pmtAmountA), IntegerEntry(kBalanceB, pmtAmountB), IntegerEntry(kInvariant, invariantCalculated), IntegerEntry(kFee, fee), IntegerEntry(kFeeScaleDelimiter, feeScaleDelimiter), shareIssue, StringEntry(kShareAssetId, toBase58String(shareIssueId)), IntegerEntry(kShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)] | |
314 | 318 | } | |
315 | 319 | } | |
316 | 320 | ||
317 | 321 | ||
318 | 322 | ||
319 | 323 | @Callable(i) | |
320 | - | func replenishWithTwoTokens (slippageTolerance) = { | |
321 | - | let pmtAssetIdA = i.payments[0].assetId | |
322 | - | let pmtAssetIdB = i.payments[1].assetId | |
323 | - | let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA) | |
324 | - | let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB) | |
325 | - | let tokenRatio = fraction(fraction(balanceA, scaleValue8, pmtAmountA), scaleValue3, fraction(balanceB, scaleValue8, pmtAmountB)) | |
326 | - | let ratioShareTokensInA = fraction(pmtAmountA, scaleValue8, balanceA) | |
327 | - | let ratioShareTokensInB = fraction(pmtAmountB, scaleValue8, balanceB) | |
328 | - | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8) | |
329 | - | let invariantCalculated = invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB)) | |
330 | - | if (!(isActive)) | |
331 | - | then throwIsInactive() | |
332 | - | else if (if ((0 > slippageTolerance)) | |
333 | - | then true | |
334 | - | else (slippageTolerance > slippageToleranceDelimiter)) | |
335 | - | then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance))) | |
336 | - | else if ((size(i.payments) != 2)) | |
337 | - | then throw("Two attached assets expected") | |
338 | - | else if (if ((pmtAssetIdA != assetIdA)) | |
339 | - | then true | |
340 | - | else (pmtAssetIdB != assetIdB)) | |
341 | - | then throwAssets() | |
342 | - | else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio)) | |
324 | + | func replenishWithTwoTokens (slippageTolerance) = if ((slippageTolerance > 10)) | |
325 | + | then throw("slippage tolerance must be <= 1%") | |
326 | + | else { | |
327 | + | let pmtAssetIdA = i.payments[0].assetId | |
328 | + | let pmtAssetIdB = i.payments[1].assetId | |
329 | + | let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA) | |
330 | + | let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB) | |
331 | + | let tokenRatio = fraction(fraction(balanceA, scaleValue8, pmtAmountA), scaleValue3, fraction(balanceB, scaleValue8, pmtAmountB)) | |
332 | + | let ratioShareTokensInA = fraction(pmtAmountA, scaleValue8, balanceA) | |
333 | + | let ratioShareTokensInB = fraction(pmtAmountB, scaleValue8, balanceB) | |
334 | + | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8) | |
335 | + | let invariantCalculated = invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB)) | |
336 | + | if (!(isActive)) | |
337 | + | then throwIsInactive() | |
338 | + | else if (if ((0 > slippageTolerance)) | |
339 | + | then true | |
340 | + | else (slippageTolerance > slippageToleranceDelimiter)) | |
341 | + | then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance))) | |
342 | + | else if ((size(i.payments) != 2)) | |
343 | + | then throw("Two attached assets expected") | |
344 | + | else if (if ((pmtAssetIdA != assetIdA)) | |
343 | 345 | then true | |
344 | - | else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter))) | |
345 | - | then throw("Incorrect assets amount: amounts must have the contract ratio") | |
346 | - | else if ((shareTokenToPayAmount == 0)) | |
347 | - | then throw("Too small amount to replenish") | |
348 | - | else if (!(hasEnoughBalance)) | |
349 | - | then suspendSuspicious() | |
350 | - | else [IntegerEntry(keyBalanceA, (balanceA + pmtAmountA)), IntegerEntry(keyBalanceB, (balanceB + pmtAmountB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(keyInvariant, invariantCalculated), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)] | |
351 | - | } | |
346 | + | else (pmtAssetIdB != assetIdB)) | |
347 | + | then throwAssets() | |
348 | + | else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio)) | |
349 | + | then true | |
350 | + | else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter))) | |
351 | + | then throw("Incorrect assets amount: amounts must have the contract ratio") | |
352 | + | else if ((shareTokenToPayAmount == 0)) | |
353 | + | then throw("Too small amount to replenish") | |
354 | + | else if (!(hasEnoughBalance)) | |
355 | + | then suspendSuspicious() | |
356 | + | else [IntegerEntry(kBalanceA, (balanceA + pmtAmountA)), IntegerEntry(kBalanceB, (balanceB + pmtAmountB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kInvariant, invariantCalculated), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)] | |
357 | + | } | |
352 | 358 | ||
353 | 359 | ||
354 | 360 | ||
355 | 361 | @Callable(i) | |
356 | 362 | func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = { | |
357 | - | let $ | |
358 | - | let pmtAmount = $ | |
359 | - | let pmtAssetId = $ | |
363 | + | let $t04182841903 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
364 | + | let pmtAmount = $t04182841903._1 | |
365 | + | let pmtAssetId = $t04182841903._2 | |
360 | 366 | let pmtMinThreshold = 5000000 | |
361 | 367 | let thresholdValueForMinTolerance = 50000000 | |
362 | 368 | let tolerance = if ((thresholdValueForMinTolerance > pmtAmount)) | |
363 | 369 | then 100000 | |
364 | 370 | else 1 | |
365 | 371 | let slippageValueMinForReplenish = (scaleValue8 - ((scaleValue8 * tolerance) / 10000000)) | |
366 | 372 | let slippageValueMaxForReplenish = (scaleValue8 + ((scaleValue8 * tolerance) / 10000000)) | |
367 | 373 | let slippageValueMinForSwap = (scaleValue8 - ((scaleValue8 * 1) / 10000000)) | |
368 | 374 | let slippageValueMaxForSwap = (scaleValue8 + ((scaleValue8 * 1) / 10000000)) | |
369 | 375 | if (!(isActive)) | |
370 | 376 | then throwIsInactive() | |
371 | 377 | else if ((pmtMinThreshold > pmtAmount)) | |
372 | 378 | then throw((((("Payment amount " + toString(pmtAmount)) + " does not exceed the minimum amount of ") + toString(pmtMinThreshold)) + " tokens")) | |
373 | 379 | else if ((size(i.payments) != 1)) | |
374 | 380 | then throw("One attached payment expected") | |
375 | 381 | else if (!(hasEnoughBalance)) | |
376 | 382 | then suspendSuspicious() | |
377 | 383 | else if ((pmtAssetId == assetIdA)) | |
378 | 384 | then { | |
379 | - | let | |
380 | - | let | |
381 | - | let | |
382 | - | let | |
383 | - | let invariantNew = invariantCalc( | |
385 | + | let virtReplA = (pmtAmount - virtualSwapTokenPay) | |
386 | + | let virtReplB = virtualSwapTokenGet | |
387 | + | let balanceAfterSwapA = (balanceA + virtualSwapTokenPay) | |
388 | + | let balanceAfterSwapB = (balanceB - virtualSwapTokenGet) | |
389 | + | let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB) | |
384 | 390 | let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew) | |
385 | - | if (if ((invariantEstimatedRatio > | |
391 | + | if (if ((invariantEstimatedRatio > slippageValueMinForSwap)) | |
386 | 392 | then ((invariantNew - invariant) >= 0) | |
387 | 393 | else false) | |
388 | 394 | then { | |
389 | - | let ratioVirtualBalanceToVirtualReplenish = (fraction( | |
395 | + | let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterSwapA, (scaleValue8 * scaleValue8), balanceAfterSwapB) / fraction(virtReplA, scaleValue8, virtReplB)) | |
390 | 396 | if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish)) | |
391 | 397 | then true | |
392 | 398 | else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish)) | |
393 | - | then throw(" | |
399 | + | then throw("Ratio after virtual swap incorrect") | |
394 | 400 | else { | |
395 | - | let ratioShareTokensInA = fraction((amountVirtualReplenishTokenA - 270000), scaleValue8, (balanceAfterVirtualSwapA - 270000)) | |
396 | - | let ratioShareTokensInAWithoutCommission = fraction(amountVirtualReplenishTokenA, scaleValue8, balanceAfterVirtualSwapA) | |
397 | - | let ratioShareTokensInB = fraction(deductStakingFee(amountVirtualReplenishTokenB, assetIdB), scaleValue8, balanceAfterVirtualSwapB) | |
401 | + | let ratioShareTokensInA = fraction(deductStakingFee(virtReplA, assetIdA), scaleValue8, balanceAfterSwapA) | |
402 | + | let ratioShareTokensInB = fraction(deductStakingFee(virtReplB, assetIdB), scaleValue8, balanceAfterSwapB) | |
398 | 403 | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8) | |
399 | - | let shareTokenToPayAmountToDelete = fraction(max([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8) | |
400 | 404 | let invariantCalculated = invariantCalc((balanceA + pmtAmount), balanceB) | |
401 | - | let newAmountTokenA = (balanceA + pmtAmount) | |
402 | - | let newAmountTokenB = balanceB | |
403 | - | let xGet = fraction(shareTokenToPayAmount, newAmountTokenA, (shareAssetSupply + shareTokenToPayAmount)) | |
404 | - | let yGet = fraction(shareTokenToPayAmount, newAmountTokenB, (shareAssetSupply + shareTokenToPayAmount)) | |
405 | - | let dAppThresholdAmount = fraction((newAmountTokenA + newAmountTokenB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
406 | - | if (if ((dAppThresholdAmount > newAmountTokenA)) | |
405 | + | let newBalanceA = (balanceA + pmtAmount) | |
406 | + | let newBalanceB = balanceB | |
407 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
408 | + | if (if ((dAppThresholdAmount > newBalanceA)) | |
407 | 409 | then true | |
408 | - | else (dAppThresholdAmount > | |
409 | - | then throwThreshold(dAppThresholdAmount, | |
410 | - | else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry( | |
410 | + | else (dAppThresholdAmount > newBalanceB)) | |
411 | + | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
412 | + | else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kInvariant, invariantCalculated)] | |
411 | 413 | } | |
412 | 414 | } | |
413 | - | else throw(" | |
415 | + | else throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value") | |
414 | 416 | } | |
415 | 417 | else if ((pmtAssetId == assetIdB)) | |
416 | 418 | then { | |
417 | - | let | |
418 | - | let | |
419 | - | let | |
420 | - | let | |
421 | - | let invariantNew = invariantCalc( | |
419 | + | let virtReplB = (pmtAmount - virtualSwapTokenPay) | |
420 | + | let virtReplA = virtualSwapTokenGet | |
421 | + | let balanceAfterSwapA = (balanceA - virtualSwapTokenGet) | |
422 | + | let balanceAfterSwapB = (balanceB + virtualSwapTokenPay) | |
423 | + | let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB) | |
422 | 424 | let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew) | |
423 | 425 | if (if ((invariantEstimatedRatio > slippageValueMinForSwap)) | |
424 | 426 | then ((invariantNew - invariant) >= 0) | |
425 | 427 | else false) | |
426 | 428 | then { | |
427 | - | let ratioVirtualBalanceToVirtualReplenish = (fraction( | |
429 | + | let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterSwapA, (scaleValue8 * scaleValue8), balanceAfterSwapB) / fraction(virtReplA, scaleValue8, virtReplB)) | |
428 | 430 | if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish)) | |
429 | 431 | then true | |
430 | 432 | else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish)) | |
431 | - | then throw(" | |
433 | + | then throw("Ratio after virtual swap incorrect") | |
432 | 434 | else { | |
433 | - | let ratioShareTokensInA = fraction(deductStakingFee( | |
434 | - | let ratioShareTokensInB = fraction(deductStakingFee( | |
435 | + | let ratioShareTokensInA = fraction(deductStakingFee(virtReplA, assetIdA), scaleValue8, balanceAfterSwapA) | |
436 | + | let ratioShareTokensInB = fraction(deductStakingFee(virtReplB, assetIdB), scaleValue8, balanceAfterSwapB) | |
435 | 437 | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8) | |
436 | 438 | let invariantCalculated = invariantCalc(balanceA, (balanceB + pmtAmount)) | |
437 | - | let | |
438 | - | let | |
439 | - | let dAppThresholdAmount = fraction(( | |
440 | - | if (if ((dAppThresholdAmount > | |
439 | + | let newBalanceA = balanceA | |
440 | + | let newBalanceB = (balanceB + pmtAmount) | |
441 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
442 | + | if (if ((dAppThresholdAmount > newBalanceA)) | |
441 | 443 | then true | |
442 | - | else (dAppThresholdAmount > | |
443 | - | then throwThreshold(dAppThresholdAmount, | |
444 | - | else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry( | |
444 | + | else (dAppThresholdAmount > newBalanceB)) | |
445 | + | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
446 | + | else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalculated)] | |
445 | 447 | } | |
446 | 448 | } | |
447 | - | else throw(" | |
449 | + | else throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value") | |
448 | 450 | } | |
449 | 451 | else throwAssets() | |
450 | 452 | } | |
451 | 453 | ||
452 | 454 | ||
453 | 455 | ||
454 | 456 | @Callable(i) | |
455 | - | func exchange (estimatedAmountToReceive,minAmountToReceive) = { | |
456 | - | let $t04992049995 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
457 | - | let pmtAmount = $t04992049995._1 | |
458 | - | let pmtAssetId = $t04992049995._2 | |
457 | + | func withdraw () = { | |
458 | + | let $t04776847911 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
459 | + | let pmtAmount = $t04776847911._1 | |
460 | + | let pmtAssetId = $t04776847911._2 | |
461 | + | let amountToPayA = deductStakingFee(fraction(pmtAmount, balanceA, shareAssetSupply), assetIdA) | |
462 | + | let amountToPayB = deductStakingFee(fraction(pmtAmount, balanceB, shareAssetSupply), assetIdB) | |
463 | + | let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB)) | |
459 | 464 | if (!(isActive)) | |
460 | 465 | then throwIsInactive() | |
461 | - | else if ((0 >= estimatedAmountToReceive)) | |
462 | - | then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive))) | |
463 | - | else if ((minAmountToReceive > estimatedAmountToReceive)) | |
464 | - | then throw(((("Minimal amount can't be greater than estimated. Estimated: " + toString(estimatedAmountToReceive)) + ". Minimal: ") + toString(minAmountToReceive))) | |
465 | - | else if ((size(i.payments) != 1)) | |
466 | - | then throw("One attached payment expected") | |
467 | - | else if (!(hasEnoughBalance)) | |
468 | - | then suspendSuspicious() | |
469 | - | else if ((pmtAssetId == assetIdA)) | |
470 | - | then { | |
471 | - | let assetIdSend = assetIdB | |
472 | - | let amountWithoutFee = calculateHowManySendTokenB(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount) | |
473 | - | let amountWithFee = fraction(amountWithoutFee, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
474 | - | let governanceReward = fraction(amountWithoutFee, commissionGovernance, commissionScaleDelimiter) | |
475 | - | let newAmountTokenA = (balanceA + pmtAmount) | |
476 | - | let newAmountTokenB = ((balanceB - amountWithFee) - governanceReward) | |
477 | - | let dAppThresholdAmount = fraction((newAmountTokenA + newAmountTokenB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
478 | - | if (if ((dAppThresholdAmount > newAmountTokenA)) | |
479 | - | then true | |
480 | - | else (dAppThresholdAmount > newAmountTokenB)) | |
481 | - | then throwThreshold(dAppThresholdAmount, newAmountTokenA, newAmountTokenB) | |
482 | - | else if (if (if ((assetIdA == USDN)) | |
483 | - | then (stakedAmountUSDN >= newAmountTokenA) | |
484 | - | else false) | |
485 | - | then true | |
486 | - | else if ((assetIdB == USDN)) | |
487 | - | then (stakedAmountUSDN >= newAmountTokenB) | |
488 | - | else false) | |
489 | - | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB) | |
490 | - | else [IntegerEntry(keyBalanceA, newAmountTokenA), IntegerEntry(keyBalanceB, newAmountTokenB), IntegerEntry(keyInvariant, invariantCalc((balanceA + pmtAmount), ((balanceB - amountWithFee) - governanceReward))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(governanceAddress, governanceReward, assetIdSend)] | |
491 | - | } | |
492 | - | else if ((pmtAssetId == assetIdB)) | |
493 | - | then { | |
494 | - | let assetIdSend = assetIdA | |
495 | - | let amountWithoutFee = calculateHowManySendTokenA(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount) | |
496 | - | let amountWithFee = fraction(amountWithoutFee, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
497 | - | let governanceReward = fraction(amountWithoutFee, commissionGovernance, commissionScaleDelimiter) | |
498 | - | let newAmountTokenA = ((balanceA - amountWithFee) - governanceReward) | |
499 | - | let newAmountTokenB = (balanceB + pmtAmount) | |
500 | - | let dAppThresholdAmount = fraction((newAmountTokenA + newAmountTokenB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
501 | - | if (if ((dAppThresholdAmount > newAmountTokenA)) | |
502 | - | then true | |
503 | - | else (dAppThresholdAmount > newAmountTokenB)) | |
504 | - | then throwThreshold(dAppThresholdAmount, newAmountTokenA, newAmountTokenB) | |
505 | - | else if (if (if ((assetIdA == USDN)) | |
506 | - | then (stakedAmountUSDN >= newAmountTokenA) | |
507 | - | else false) | |
508 | - | then true | |
509 | - | else if ((assetIdB == USDN)) | |
510 | - | then (stakedAmountUSDN >= newAmountTokenB) | |
511 | - | else false) | |
512 | - | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA) | |
513 | - | else [IntegerEntry(keyBalanceA, newAmountTokenA), IntegerEntry(keyBalanceB, newAmountTokenB), IntegerEntry(keyInvariant, invariantCalc(((balanceA - amountWithFee) - governanceReward), (balanceB + pmtAmount))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(governanceAddress, governanceReward, assetIdSend)] | |
514 | - | } | |
515 | - | else throwAssets() | |
466 | + | else if ((size(i.payments) != 1)) | |
467 | + | then throw("One attached payment expected") | |
468 | + | else if ((pmtAssetId != shareAssetId)) | |
469 | + | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
470 | + | else if (!(hasEnoughBalance)) | |
471 | + | then suspendSuspicious() | |
472 | + | else if (if ((amountToPayA > availableBalanceA)) | |
473 | + | then true | |
474 | + | else (amountToPayB > availableBalanceB)) | |
475 | + | then throwInsufficientAvailableBalances(amountToPayA, amountToPayB) | |
476 | + | else [IntegerEntry(kBalanceA, (balanceA - amountToPayA)), IntegerEntry(kBalanceB, (balanceB - amountToPayB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply - pmtAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, pmtAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
516 | 477 | } | |
517 | 478 | ||
518 | 479 | ||
519 | 480 | ||
520 | 481 | @Callable(i) | |
482 | + | func exchange (estimatedAmountToReceive,minAmountToReceive) = { | |
483 | + | let $t04919449269 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
484 | + | let pmtAmount = $t04919449269._1 | |
485 | + | let pmtAssetId = $t04919449269._2 | |
486 | + | if (if ((exchangeRatioLimitMin > fraction(minAmountToReceive, scaleValue8, pmtAmount))) | |
487 | + | then true | |
488 | + | else (fraction(estimatedAmountToReceive, scaleValue8, pmtAmount) > exchangeRatioLimitMax)) | |
489 | + | then throw("Incorrect args and pmt ratio") | |
490 | + | else if (!(isActive)) | |
491 | + | then throwIsInactive() | |
492 | + | else if ((0 >= estimatedAmountToReceive)) | |
493 | + | then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive))) | |
494 | + | else if ((minAmountToReceive > estimatedAmountToReceive)) | |
495 | + | then throw(((("Minimal amount can't be greater than estimated. Estimated: " + toString(estimatedAmountToReceive)) + ". Minimal: ") + toString(minAmountToReceive))) | |
496 | + | else if ((size(i.payments) != 1)) | |
497 | + | then throw("One attached payment expected") | |
498 | + | else if (!(hasEnoughBalance)) | |
499 | + | then suspendSuspicious() | |
500 | + | else if ((10000000 > pmtAmount)) | |
501 | + | then throw("Only swap of 10.000000 or more tokens is allowed") | |
502 | + | else if ((pmtAssetId == assetIdA)) | |
503 | + | then { | |
504 | + | let assetIdSend = assetIdB | |
505 | + | let amountWithoutFee = calculateHowManySendB(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount) | |
506 | + | let amountWithFee = fraction(amountWithoutFee, (feeScaleDelimiter - fee), feeScaleDelimiter) | |
507 | + | let governanceReward = fraction(amountWithoutFee, feeGovernance, feeScaleDelimiter) | |
508 | + | let newBalanceA = (balanceA + pmtAmount) | |
509 | + | let newBalanceB = ((balanceB - amountWithFee) - governanceReward) | |
510 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
511 | + | if (if ((dAppThresholdAmount > newBalanceA)) | |
512 | + | then true | |
513 | + | else (dAppThresholdAmount > newBalanceB)) | |
514 | + | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
515 | + | else if (if (if ((assetIdA == USDN)) | |
516 | + | then (stakedAmountUSDN >= newBalanceA) | |
517 | + | else false) | |
518 | + | then true | |
519 | + | else if ((assetIdB == USDN)) | |
520 | + | then (stakedAmountUSDN >= newBalanceB) | |
521 | + | else false) | |
522 | + | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB) | |
523 | + | else [IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc((balanceA + pmtAmount), ((balanceB - amountWithFee) - governanceReward))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(govAddr, governanceReward, assetIdSend)] | |
524 | + | } | |
525 | + | else if ((pmtAssetId == assetIdB)) | |
526 | + | then { | |
527 | + | let assetIdSend = assetIdA | |
528 | + | let amountWithoutFee = calculateHowManySendA(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount) | |
529 | + | let amountWithFee = fraction(amountWithoutFee, (feeScaleDelimiter - fee), feeScaleDelimiter) | |
530 | + | let governanceReward = fraction(amountWithoutFee, feeGovernance, feeScaleDelimiter) | |
531 | + | let newBalanceA = ((balanceA - amountWithFee) - governanceReward) | |
532 | + | let newBalanceB = (balanceB + pmtAmount) | |
533 | + | let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
534 | + | if (if ((dAppThresholdAmount > newBalanceA)) | |
535 | + | then true | |
536 | + | else (dAppThresholdAmount > newBalanceB)) | |
537 | + | then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB) | |
538 | + | else if (if (if ((assetIdA == USDN)) | |
539 | + | then (stakedAmountUSDN >= newBalanceA) | |
540 | + | else false) | |
541 | + | then true | |
542 | + | else if ((assetIdB == USDN)) | |
543 | + | then (stakedAmountUSDN >= newBalanceB) | |
544 | + | else false) | |
545 | + | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA) | |
546 | + | else [IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc(((balanceA - amountWithFee) - governanceReward), (balanceB + pmtAmount))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(govAddr, governanceReward, assetIdSend)] | |
547 | + | } | |
548 | + | else throwAssets() | |
549 | + | } | |
550 | + | ||
551 | + | ||
552 | + | ||
553 | + | @Callable(i) | |
554 | + | func shutdown () = if (!(isActive)) | |
555 | + | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
556 | + | else if (!(containsElement([adm1, adm2, adm3, admStartStop], i.callerPublicKey))) | |
557 | + | then throwOnlyAdmin() | |
558 | + | else suspend("Paused by admin") | |
559 | + | ||
560 | + | ||
561 | + | ||
562 | + | @Callable(i) | |
563 | + | func activate () = if (isActive) | |
564 | + | then throwIsActive() | |
565 | + | else if (!(containsElement([adm1, adm2, adm3, admStartStop], i.callerPublicKey))) | |
566 | + | then throwOnlyAdmin() | |
567 | + | else [BooleanEntry(kActive, true), DeleteEntry(kCause)] | |
568 | + | ||
569 | + | ||
570 | + | ||
571 | + | @Callable(i) | |
521 | 572 | func takeIntoAccountExtraFunds (amountLeave) = { | |
522 | - | let | |
523 | - | let | |
524 | - | let amountEnrollA = ( | |
573 | + | let uncountableA = (accountBalanceWithStakedA - balanceA) | |
574 | + | let uncountableB = (accountBalanceWithStakedB - balanceB) | |
575 | + | let amountEnrollA = (uncountableA - (if ((assetIdA == USDN)) | |
525 | 576 | then amountLeave | |
526 | 577 | else 0)) | |
527 | - | let amountEnrollB = ( | |
578 | + | let amountEnrollB = (uncountableB - (if ((assetIdB == USDN)) | |
528 | 579 | then amountLeave | |
529 | 580 | else 0)) | |
530 | 581 | if (!(isActive)) | |
531 | 582 | then throwIsInactive() | |
532 | - | else if ( | |
583 | + | else if ((i.caller != this)) | |
533 | 584 | then throwOnlyAdmin() | |
534 | 585 | else if ((0 > amountLeave)) | |
535 | 586 | then throw(("Argument 'amountLeave' cannot be negative. Actual: " + toString(amountLeave))) | |
536 | - | else if (if ((0 > | |
587 | + | else if (if ((0 > uncountableA)) | |
537 | 588 | then true | |
538 | - | else (0 > | |
589 | + | else (0 > uncountableB)) | |
539 | 590 | then suspend("Enroll amount negative") | |
540 | 591 | else if (if ((0 > amountEnrollA)) | |
541 | 592 | then true | |
542 | 593 | else (0 > amountEnrollB)) | |
543 | 594 | then throw("Too large amountLeave") | |
544 | - | else [IntegerEntry( | |
595 | + | else [IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)] | |
545 | 596 | } | |
546 | 597 | ||
547 | 598 |
github/deemru/w8io/169f3d6 143.88 ms ◑