tx · 6HQdUQoyT8irZdogvakgS6twP8dkNaQzRc6nw1jPHD4f

3N18bq33YEjzWkoTDhZvc7zd7eRAyv6x4aZ:  -0.01400000 Waves

2021.03.07 17:46 [1427409] smart account 3N18bq33YEjzWkoTDhZvc7zd7eRAyv6x4aZ > SELF 0.00000000 Waves

{ "type": 13, "id": "6HQdUQoyT8irZdogvakgS6twP8dkNaQzRc6nw1jPHD4f", "fee": 1400000, "feeAssetId": null, "timestamp": 1615128376428, "version": 1, "sender": "3N18bq33YEjzWkoTDhZvc7zd7eRAyv6x4aZ", "senderPublicKey": "71DfVUys2KXcuEivd6kRxABvVQKB5k5c48qobMB1DzKN", "proofs": [ "Y4CaxaXAa69wsNBkHGwUfBJe38oNyVGrT2LJqV7U8ANLFWVjdynvTaQ1k75XJhKUjZ5HZ1YKa7LW3z3MitaBUJT" ], "script": "base64:AAIEAAAAAAAAACAIAhIAEgMKAQESBAoCAQESABIECgIBARIAEgASAwoBAQAAAEYAAAAAB3ZlcnNpb24CAAAABTIuMC4wAAAAAAhrVmVyc2lvbgIAAAAHdmVyc2lvbgAAAAAHa0FjdGl2ZQIAAAAGYWN0aXZlAAAAAAlrQXNzZXRJZEECAAAACkFfYXNzZXRfaWQAAAAACWtBc3NldElkQgIAAAAKQl9hc3NldF9pZAAAAAAJa0JhbGFuY2VBAgAAAA9BX2Fzc2V0X2JhbGFuY2UAAAAACWtCYWxhbmNlQgIAAAAPQl9hc3NldF9iYWxhbmNlAAAAAA1rU2hhcmVBc3NldElkAgAAAA5zaGFyZV9hc3NldF9pZAAAAAARa1NoYXJlQXNzZXRTdXBwbHkCAAAAEnNoYXJlX2Fzc2V0X3N1cHBseQAAAAAEa0ZlZQIAAAAKY29tbWlzc2lvbgAAAAASa0ZlZVNjYWxlRGVsaW1pdGVyAgAAABpjb21taXNzaW9uX3NjYWxlX2RlbGltaXRlcgAAAAAKa0ludmFyaWFudAIAAAAJaW52YXJpYW50AAAAAAZrQ2F1c2UCAAAADnNodXRkb3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JvbGxCCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAICAAAADGxhc3RfaW5jb21lXwUAAAALc3RyQXNzZXRJZEEFAAAADWFtb3VudEVucm9sbEEJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAMbGFzdF9pbmNvbWVfBQAAAAtzdHJBc3NldElkQgUAAAANYW1vdW50RW5yb2xsQgUAAAADbmlsAAAAAKMJbAc=", "chainId": 84, "height": 1427409, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HFjqkfFk9wzLDSfysw5LF7PnrGbxWh6DDV2U3YLSLRV9 Next: none Diff:
OldNewDifferences
2323
2424 let kFeeScaleDelimiter = "commission_scale_delimiter"
2525
26-let kFeeGovernance = "commission_governance"
27-
2826 let kInvariant = "invariant"
2927
3028 let kCause = "shutdown_cause"
3735
3836 let admStartStop = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3937
40-let adminPubKeyStaking = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
38+let admStaking = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
4139
4240 let govAddr = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp')
4341
9391
9492 let feeGovernance = 200
9593
96-let feeScaleDelimiter = 1000000
94+let feeScale6 = 1000000
9795
98-let scaleValue3 = 1000
96+let scale3 = 1000
9997
100-let scaleValue8 = 100000000
98+let scale8 = 100000000
10199
102-let scaleValue12 = 1000000000000
100+let scale12 = 1000000000000
103101
104-let slippageToleranceDelimiter = 1000
102+let slippageScale3 = 1000
105103
106-let scaleValue8Digits = 8
107-
108-let scaleValue12Digits = 12
104+let digits8 = 8
109105
110106 let dAppThreshold = 50
111107
112-let dAppThresholdDelimiter = 100
113-
114-let ratioThresholdMax = 100000000
115-
116-let ratioThresholdMin = 99999000
108+let dAppThresholdScale2 = 100
117109
118110 let exchangeRatioLimitMin = 90000000
119111
124116 let alphaDigits = 2
125117
126118 let beta = 46000000
127-
128-let betaDigits = 8
129119
130120 func accountBalance (assetId) = match assetId {
131121 case id: ByteVector =>
166156 then (accountBalanceWithStakedB >= balanceB)
167157 else false
168158
169-func skewness (x,y) = (((fraction(scaleValue12, x, y) + fraction(scaleValue12, y, x)) / 2) / 10000)
159+func skewness (x,y) = (((fraction(scale12, x, y) + fraction(scale12, y, x)) / 2) / 10000)
170160
171161
172162 func invariantCalc (x,y) = {
173163 let sk = skewness(x, y)
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)))
164+ (fraction((x + y), scale8, pow(sk, digits8, alpha, alphaDigits, digits8, UP)) + (2 * fraction(pow(fraction(x, y, scale8), 0, 5, 1, (digits8 / 2), DOWN), pow((sk - beta), digits8, alpha, alphaDigits, digits8, DOWN), scale8)))
175165 }
176166
177167
178-func calculateHowManySendA (amountToSendEstimated,minTokenReceiveAmount,amountA,amountB,tokenReceiveAmount) = {
179- let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000))
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)
188- let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
189- if ((0 >= (invariantCalc((amountA - amountToSendStep5), y) - invariant)))
190- then throw("err1")
168+func calculateSendAmount (amountToSendEstimated,minTokenReceiveAmount,tokenReceiveAmount,tokenId) = {
169+ let slippageValue = (scale8 - ((scale8 * 1) / 10000000))
170+ let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenReceiveAmount)
171+ let x = (balanceA + tokenReceiveAmount)
172+ let y = (balanceB + tokenReceiveAmount)
173+ let invariantNew = if ((tokenId == assetIdA))
174+ then invariantCalc(x, (balanceB - amountToSendEstimated))
175+ else if ((tokenId == assetIdB))
176+ then invariantCalc((balanceA - amountToSendEstimated), y)
177+ else throw("Wrong asset in payment")
178+ let invariantEstimatedRatio = fraction(scale8, invariant, invariantNew)
179+ func getStepAmount (acc,step) = if (true)
180+ then throw(((toString(acc) + " ") + toString(step)))
181+ else {
182+ let amountToSend = (amountToSendEstimated - ((step * deltaBetweenMaxAndMinSendValue) / 5))
183+ let stepInvariant = if ((tokenId == assetIdA))
184+ then invariantCalc(x, (balanceB - amountToSend))
185+ else invariantCalc((balanceA - amountToSend), y)
186+ if (true)
187+ then amountToSend
188+ else acc
189+ }
190+
191+ let stepAmount = {
192+ let $list58655908 = [1, 2, 3, 4, 5]
193+ let $size58655908 = size($list58655908)
194+ let $acc058655908 = -1
195+ if (($size58655908 == 0))
196+ then $acc058655908
197+ else {
198+ let $acc158655908 = getStepAmount($acc058655908, $list58655908[0])
199+ if (($size58655908 == 1))
200+ then $acc158655908
201+ else {
202+ let $acc258655908 = getStepAmount($acc158655908, $list58655908[1])
203+ if (($size58655908 == 2))
204+ then $acc258655908
205+ else {
206+ let $acc358655908 = getStepAmount($acc258655908, $list58655908[2])
207+ if (($size58655908 == 3))
208+ then $acc358655908
209+ else {
210+ let $acc458655908 = getStepAmount($acc358655908, $list58655908[3])
211+ if (($size58655908 == 4))
212+ then $acc458655908
213+ else {
214+ let $acc558655908 = getStepAmount($acc458655908, $list58655908[4])
215+ if (($size58655908 == 5))
216+ then $acc558655908
217+ else {
218+ let $acc658655908 = getStepAmount($acc558655908, $list58655908[5])
219+ throw("List size exceed 5")
220+ }
221+ }
222+ }
223+ }
224+ }
225+ }
226+ }
227+ if ((0 > stepAmount))
228+ then throw("something went wrong while working with amountToSend")
191229 else if (if ((invariantEstimatedRatio > slippageValue))
192- then ((invariantNew - invariant) > 0)
230+ then (invariantNew > invariant)
193231 else false)
194232 then amountToSendEstimated
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")
206- }
207-
208-
209-func calculateHowManySendB (amountToSendEstimated,minTokenReceiveAmount,amountA,amountB,tokenReceiveAmount) = {
210- let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000))
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))
219- let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
220- if ((0 >= (invariantCalc(x, (amountB - amountToSendStep5)) - invariant)))
221- then throw("err1")
222- else if (if ((invariantEstimatedRatio > slippageValue))
223- then ((invariantNew - invariant) > 0)
224- else false)
225- then amountToSendEstimated
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+ else ((stepAmount * (feeScale6 - fee)) / feeScale6)
237234 }
238235
239236
288285
289286 @Callable(i)
290287 func init () = {
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
288+ let $t086198696 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
289+ let pmtAmountA = $t086198696._1
290+ let pmtAssetIdA = $t086198696._2
291+ let $t087018778 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
292+ let pmtAmountB = $t087018778._1
293+ let pmtAssetIdB = $t087018778._2
294+ let $t087838860 = getAssetInfo(pmtAssetIdA)
295+ let pmtStrAssetIdA = $t087838860._1
296+ let pmtAssetNameA = $t087838860._2
297+ let pmtDecimalsA = $t087838860._3
298+ let $t088658942 = getAssetInfo(pmtAssetIdB)
299+ let pmtStrAssetIdB = $t088658942._1
300+ let pmtAssetNameB = $t088658942._2
301+ let pmtDecimalsB = $t088658942._3
305302 if (isDefined(getBoolean(this, kActive)))
306303 then throwIsActive()
307304 else if ((pmtAssetIdA == pmtAssetIdB))
314311 let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true)
315312 let shareIssueId = calculateAssetId(shareIssue)
316313 let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB)
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+[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, feeScale6), shareIssue, StringEntry(kShareAssetId, toBase58String(shareIssueId)), IntegerEntry(kShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)]
318315 }
319316 }
320317
321318
322319
323320 @Callable(i)
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))
321+func replenishWithTwoTokens (slippageTolerance) = {
322+ let pmtAssetIdA = i.payments[0].assetId
323+ let pmtAssetIdB = i.payments[1].assetId
324+ let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA)
325+ let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB)
326+ let tokenRatio = fraction(fraction(scale8, balanceA, pmtAmountA), scale3, fraction(scale8, balanceB, pmtAmountB))
327+ let ratioShareTokensInA = fraction(scale8, pmtAmountA, balanceA)
328+ let ratioShareTokensInB = fraction(scale8, pmtAmountB, balanceB)
329+ let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8)
330+ let invariantCalculated = invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB))
331+ if (!(isActive))
332+ then throwIsInactive()
333+ else if (if ((0 > slippageTolerance))
334+ then true
335+ else (slippageTolerance > 10))
336+ then throw("Slippage tolerance must be <= 1%")
337+ else if ((size(i.payments) != 2))
338+ then throw("Two attached assets expected")
339+ else if (if ((pmtAssetIdA != assetIdA))
340+ then true
341+ else (pmtAssetIdB != assetIdB))
342+ then throwAssets()
343+ else if (if ((((scale3 * (slippageScale3 - slippageTolerance)) / slippageScale3) > tokenRatio))
345344 then true
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- }
345+ else (tokenRatio > ((scale3 * (slippageScale3 + slippageTolerance)) / slippageScale3)))
346+ then throw("Incorrect assets amount: amounts must have the contract ratio")
347+ else if ((shareTokenToPayAmount == 0))
348+ then throw("Too small amount to replenish")
349+ else if (!(hasEnoughBalance))
350+ then suspendSuspicious()
351+ 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)]
352+ }
358353
359354
360355
361356 @Callable(i)
362357 func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = {
363- let $t04182841903 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
364- let pmtAmount = $t04182841903._1
365- let pmtAssetId = $t04182841903._2
358+ let $t01315713232 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
359+ let pmtAmount = $t01315713232._1
360+ let pmtAssetId = $t01315713232._2
366361 let pmtMinThreshold = 5000000
367362 let thresholdValueForMinTolerance = 50000000
368363 let tolerance = if ((thresholdValueForMinTolerance > pmtAmount))
369364 then 100000
370365 else 1
371- let slippageValueMinForReplenish = (scaleValue8 - ((scaleValue8 * tolerance) / 10000000))
372- let slippageValueMaxForReplenish = (scaleValue8 + ((scaleValue8 * tolerance) / 10000000))
373- let slippageValueMinForSwap = (scaleValue8 - ((scaleValue8 * 1) / 10000000))
374- let slippageValueMaxForSwap = (scaleValue8 + ((scaleValue8 * 1) / 10000000))
366+ let slippageValueMinForReplenish = (scale8 - ((scale8 * tolerance) / 10000000))
367+ let slippageValueMaxForReplenish = (scale8 + ((scale8 * tolerance) / 10000000))
368+ let slippageValueMinForSwap = (scale8 - ((scale8 * 1) / 10000000))
369+ let slippageValueMaxForSwap = (scale8 + ((scale8 * 1) / 10000000))
375370 if (!(isActive))
376371 then throwIsInactive()
377372 else if ((pmtMinThreshold > pmtAmount))
380375 then throw("One attached payment expected")
381376 else if (!(hasEnoughBalance))
382377 then suspendSuspicious()
383- else if ((pmtAssetId == assetIdA))
384- then {
385- let virtReplA = (pmtAmount - virtualSwapTokenPay)
386- let virtReplB = virtualSwapTokenGet
387- let balanceAfterSwapA = (balanceA + virtualSwapTokenPay)
388- let balanceAfterSwapB = (balanceB - virtualSwapTokenGet)
378+ else if (if ((pmtAssetId != assetIdA))
379+ then (pmtAssetId != assetIdB)
380+ else false)
381+ then throwAssets()
382+ else {
383+ let $t01423414999 = if ((pmtAssetId == assetIdA))
384+ then $Tuple7((pmtAmount - virtualSwapTokenPay), virtualSwapTokenGet, (balanceA + virtualSwapTokenPay), (balanceB - virtualSwapTokenGet), invariantCalc((balanceA + pmtAmount), balanceB), (balanceA + pmtAmount), balanceB)
385+ else $Tuple7(virtualSwapTokenGet, (pmtAmount - virtualSwapTokenPay), (balanceA - virtualSwapTokenGet), (balanceB + virtualSwapTokenPay), invariantCalc(balanceA, (balanceB + pmtAmount)), balanceA, (balanceB + pmtAmount))
386+ let virtualReplenishA = $t01423414999._1
387+ let virtualReplenishB = $t01423414999._2
388+ let balanceAfterSwapA = $t01423414999._3
389+ let balanceAfterSwapB = $t01423414999._4
390+ let invariantCalculated = $t01423414999._5
391+ let newBalanceA = $t01423414999._6
392+ let newBalanceB = $t01423414999._7
393+ let newBalanceEntry = if ((pmtAssetId == assetIdA))
394+ then IntegerEntry(kBalanceA, newBalanceA)
395+ else IntegerEntry(kBalanceB, newBalanceB)
389396 let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB)
390- let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
391- if (if ((invariantEstimatedRatio > slippageValueMinForSwap))
392- then ((invariantNew - invariant) >= 0)
393- else false)
394- then {
395- let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterSwapA, (scaleValue8 * scaleValue8), balanceAfterSwapB) / fraction(virtReplA, scaleValue8, virtReplB))
396- if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish))
397+ let invariantEstimatedRatio = fraction(scale8, invariant, invariantNew)
398+ let ratioVirtualBalanceToVirtualReplenish = (fraction((scale8 * scale8), balanceAfterSwapA, balanceAfterSwapB) / fraction(scale8, virtualReplenishA, virtualReplenishB))
399+ let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2))
400+ if (if ((slippageValueMinForSwap >= invariantEstimatedRatio))
401+ then true
402+ else (invariant > invariantNew))
403+ then throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
404+ else if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish))
405+ then true
406+ else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish))
407+ then throw("Swap with virtualSwapTokenPay and virtualSwapTokenGet is possible, but ratio after virtual swap is incorrect")
408+ else if (if ((dAppThresholdAmount > newBalanceA))
397409 then true
398- else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish))
399- then throw("Ratio after virtual swap incorrect")
410+ else (dAppThresholdAmount > newBalanceB))
411+ then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB)
400412 else {
401- let ratioShareTokensInA = fraction(deductStakingFee(virtReplA, assetIdA), scaleValue8, balanceAfterSwapA)
402- let ratioShareTokensInB = fraction(deductStakingFee(virtReplB, assetIdB), scaleValue8, balanceAfterSwapB)
403- let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
404- let invariantCalculated = invariantCalc((balanceA + pmtAmount), balanceB)
405- let newBalanceA = (balanceA + pmtAmount)
406- let newBalanceB = balanceB
407- let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter))
408- if (if ((dAppThresholdAmount > newBalanceA))
409- then true
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)]
413+ let ratioShareTokensInA = fraction(deductStakingFee(virtualReplenishA, assetIdA), scale8, balanceAfterSwapA)
414+ let ratioShareTokensInB = fraction(deductStakingFee(virtualReplenishB, assetIdB), scale8, balanceAfterSwapB)
415+ if (true)
416+ then throw(toString(value(value(assetInfo(USDN)).minSponsoredFee)))
417+ else {
418+ let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8)
419+ if (true)
420+ then throw(toString(shareTokenToPayAmount))
421+ else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), newBalanceEntry, IntegerEntry(kInvariant, invariantCalculated)]
422+ }
413423 }
414- }
415- else throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
416424 }
417- else if ((pmtAssetId == assetIdB))
418- then {
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)
424- let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
425- if (if ((invariantEstimatedRatio > slippageValueMinForSwap))
426- then ((invariantNew - invariant) >= 0)
427- else false)
428- then {
429- let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterSwapA, (scaleValue8 * scaleValue8), balanceAfterSwapB) / fraction(virtReplA, scaleValue8, virtReplB))
430- if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish))
431- then true
432- else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish))
433- then throw("Ratio after virtual swap incorrect")
434- else {
435- let ratioShareTokensInA = fraction(deductStakingFee(virtReplA, assetIdA), scaleValue8, balanceAfterSwapA)
436- let ratioShareTokensInB = fraction(deductStakingFee(virtReplB, assetIdB), scaleValue8, balanceAfterSwapB)
437- let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
438- let invariantCalculated = invariantCalc(balanceA, (balanceB + pmtAmount))
439- let newBalanceA = balanceA
440- let newBalanceB = (balanceB + pmtAmount)
441- let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter))
442- if (if ((dAppThresholdAmount > newBalanceA))
443- then true
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)]
447- }
448- }
449- else throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
450- }
451- else throwAssets()
452425 }
453426
454427
455428
456429 @Callable(i)
457430 func withdraw () = {
458- let $t04776847911 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
459- let pmtAmount = $t04776847911._1
460- let pmtAssetId = $t04776847911._2
431+ let $t01770817851 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
432+ let pmtAmount = $t01770817851._1
433+ let pmtAssetId = $t01770817851._2
461434 let amountToPayA = deductStakingFee(fraction(pmtAmount, balanceA, shareAssetSupply), assetIdA)
462435 let amountToPayB = deductStakingFee(fraction(pmtAmount, balanceB, shareAssetSupply), assetIdB)
463436 let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB))
480453
481454 @Callable(i)
482455 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()
456+ let $t01913419209 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
457+ let pmtAmount = $t01913419209._1
458+ let pmtAssetId = $t01913419209._2
459+ if (!(isActive))
460+ 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 (if ((pmtAssetId != assetIdA))
470+ then (pmtAssetId != assetIdB)
471+ else false)
472+ then throwAssets()
500473 else if ((10000000 > pmtAmount))
501474 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))
475+ else if (if ((exchangeRatioLimitMin > fraction(scale8, minAmountToReceive, pmtAmount)))
476+ then true
477+ else (fraction(scale8, estimatedAmountToReceive, pmtAmount) > exchangeRatioLimitMax))
478+ then throw("Incorrect args and pmt ratio")
479+ else {
480+ let sendAssetId = if ((pmtAssetId == assetIdA))
481+ then assetIdB
482+ else assetIdA
483+ let amountWithoutFee = calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, pmtAmount, pmtAssetId)
484+ let amountWithFee = fraction(amountWithoutFee, (feeScale6 - fee), feeScale6)
485+ let governanceReward = fraction(amountWithoutFee, feeGovernance, feeScale6)
486+ let $t02058920850 = if ((pmtAssetId == assetIdA))
487+ then $Tuple2((balanceA + pmtAmount), ((balanceB - amountWithFee) - governanceReward))
488+ else $Tuple2(((balanceA - amountWithFee) - governanceReward), (balanceB + pmtAmount))
489+ let newBalanceA = $t02058920850._1
490+ let newBalanceB = $t02058920850._2
491+ let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2))
511492 if (if ((dAppThresholdAmount > newBalanceA))
512493 then true
513494 else (dAppThresholdAmount > newBalanceB))
514495 then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB)
515496 else if (if (if ((assetIdA == USDN))
497+ then (sendAssetId == assetIdA)
498+ else false)
516499 then (stakedAmountUSDN >= newBalanceA)
517500 else false)
518- then true
519- else if ((assetIdB == USDN))
501+ then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA)
502+ else if (if (if ((assetIdB == USDN))
503+ then (sendAssetId == assetIdB)
504+ else false)
520505 then (stakedAmountUSDN >= newBalanceB)
521506 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)]
507+ then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB)
508+ else [IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc(newBalanceA, newBalanceB)), ScriptTransfer(i.caller, amountWithFee, sendAssetId), ScriptTransfer(govAddr, governanceReward, sendAssetId)]
524509 }
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()
549510 }
550511
551512
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let version = "2.0.0"
55
66 let kVersion = "version"
77
88 let kActive = "active"
99
1010 let kAssetIdA = "A_asset_id"
1111
1212 let kAssetIdB = "B_asset_id"
1313
1414 let kBalanceA = "A_asset_balance"
1515
1616 let kBalanceB = "B_asset_balance"
1717
1818 let kShareAssetId = "share_asset_id"
1919
2020 let kShareAssetSupply = "share_asset_supply"
2121
2222 let kFee = "commission"
2323
2424 let kFeeScaleDelimiter = "commission_scale_delimiter"
2525
26-let kFeeGovernance = "commission_governance"
27-
2826 let kInvariant = "invariant"
2927
3028 let kCause = "shutdown_cause"
3129
3230 let adm1 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3331
3432 let adm2 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3533
3634 let adm3 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3735
3836 let admStartStop = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3937
40-let adminPubKeyStaking = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
38+let admStaking = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
4139
4240 let govAddr = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp')
4341
4442 let stakingAddress = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp')
4543
4644 let USDN = base58'3FUNGbzfNsQ1AZfvumCUqARXvpjjLQrvCzorYuDryQAq'
4745
4846 let stakingFeeInUSDN = (9 * value(value(assetInfo(USDN)).minSponsoredFee))
4947
5048 let isActive = getBooleanValue(this, kActive)
5149
5250 let strAssetIdA = getStringValue(this, kAssetIdA)
5351
5452 let strAssetIdB = getStringValue(this, kAssetIdB)
5553
5654 let assetIdA = if ((strAssetIdA == "WAVES"))
5755 then unit
5856 else fromBase58String(strAssetIdA)
5957
6058 let assetIdB = if ((strAssetIdB == "WAVES"))
6159 then unit
6260 else fromBase58String(strAssetIdB)
6361
6462 let assetNameA = match assetIdA {
6563 case id: ByteVector =>
6664 value(assetInfo(id)).name
6765 case waves: Unit =>
6866 "WAVES"
6967 case _ =>
7068 throw("Match error")
7169 }
7270
7371 let assetNameB = match assetIdB {
7472 case id: ByteVector =>
7573 value(assetInfo(id)).name
7674 case waves: Unit =>
7775 "WAVES"
7876 case _ =>
7977 throw("Match error")
8078 }
8179
8280 let balanceA = getIntegerValue(this, kBalanceA)
8381
8482 let balanceB = getIntegerValue(this, kBalanceB)
8583
8684 let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId))
8785
8886 let shareAssetSupply = getIntegerValue(this, kShareAssetSupply)
8987
9088 let invariant = getIntegerValue(this, kInvariant)
9189
9290 let fee = 500
9391
9492 let feeGovernance = 200
9593
96-let feeScaleDelimiter = 1000000
94+let feeScale6 = 1000000
9795
98-let scaleValue3 = 1000
96+let scale3 = 1000
9997
100-let scaleValue8 = 100000000
98+let scale8 = 100000000
10199
102-let scaleValue12 = 1000000000000
100+let scale12 = 1000000000000
103101
104-let slippageToleranceDelimiter = 1000
102+let slippageScale3 = 1000
105103
106-let scaleValue8Digits = 8
107-
108-let scaleValue12Digits = 12
104+let digits8 = 8
109105
110106 let dAppThreshold = 50
111107
112-let dAppThresholdDelimiter = 100
113-
114-let ratioThresholdMax = 100000000
115-
116-let ratioThresholdMin = 99999000
108+let dAppThresholdScale2 = 100
117109
118110 let exchangeRatioLimitMin = 90000000
119111
120112 let exchangeRatioLimitMax = 110000000
121113
122114 let alpha = 50
123115
124116 let alphaDigits = 2
125117
126118 let beta = 46000000
127-
128-let betaDigits = 8
129119
130120 func accountBalance (assetId) = match assetId {
131121 case id: ByteVector =>
132122 assetBalance(this, id)
133123 case waves: Unit =>
134124 wavesBalance(this).available
135125 case _ =>
136126 throw("Match error")
137127 }
138128
139129
140130 let stakedAmountUSDN = match getInteger(stakingAddress, ((("rpd_balance_" + toBase58String(USDN)) + "_") + toString(this))) {
141131 case staked: Int =>
142132 staked
143133 case nothing: Unit =>
144134 0
145135 case _ =>
146136 throw("Match error")
147137 }
148138
149139 let availableBalanceA = (balanceA - (if ((assetIdA == USDN))
150140 then stakedAmountUSDN
151141 else 0))
152142
153143 let availableBalanceB = (balanceB - (if ((assetIdB == USDN))
154144 then stakedAmountUSDN
155145 else 0))
156146
157147 let accountBalanceWithStakedA = (accountBalance(assetIdA) + (if ((assetIdA == USDN))
158148 then stakedAmountUSDN
159149 else 0))
160150
161151 let accountBalanceWithStakedB = (accountBalance(assetIdB) + (if ((assetIdB == USDN))
162152 then stakedAmountUSDN
163153 else 0))
164154
165155 let hasEnoughBalance = if ((accountBalanceWithStakedA >= balanceA))
166156 then (accountBalanceWithStakedB >= balanceB)
167157 else false
168158
169-func skewness (x,y) = (((fraction(scaleValue12, x, y) + fraction(scaleValue12, y, x)) / 2) / 10000)
159+func skewness (x,y) = (((fraction(scale12, x, y) + fraction(scale12, y, x)) / 2) / 10000)
170160
171161
172162 func invariantCalc (x,y) = {
173163 let sk = skewness(x, y)
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)))
164+ (fraction((x + y), scale8, pow(sk, digits8, alpha, alphaDigits, digits8, UP)) + (2 * fraction(pow(fraction(x, y, scale8), 0, 5, 1, (digits8 / 2), DOWN), pow((sk - beta), digits8, alpha, alphaDigits, digits8, DOWN), scale8)))
175165 }
176166
177167
178-func calculateHowManySendA (amountToSendEstimated,minTokenReceiveAmount,amountA,amountB,tokenReceiveAmount) = {
179- let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000))
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)
188- let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
189- if ((0 >= (invariantCalc((amountA - amountToSendStep5), y) - invariant)))
190- then throw("err1")
168+func calculateSendAmount (amountToSendEstimated,minTokenReceiveAmount,tokenReceiveAmount,tokenId) = {
169+ let slippageValue = (scale8 - ((scale8 * 1) / 10000000))
170+ let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenReceiveAmount)
171+ let x = (balanceA + tokenReceiveAmount)
172+ let y = (balanceB + tokenReceiveAmount)
173+ let invariantNew = if ((tokenId == assetIdA))
174+ then invariantCalc(x, (balanceB - amountToSendEstimated))
175+ else if ((tokenId == assetIdB))
176+ then invariantCalc((balanceA - amountToSendEstimated), y)
177+ else throw("Wrong asset in payment")
178+ let invariantEstimatedRatio = fraction(scale8, invariant, invariantNew)
179+ func getStepAmount (acc,step) = if (true)
180+ then throw(((toString(acc) + " ") + toString(step)))
181+ else {
182+ let amountToSend = (amountToSendEstimated - ((step * deltaBetweenMaxAndMinSendValue) / 5))
183+ let stepInvariant = if ((tokenId == assetIdA))
184+ then invariantCalc(x, (balanceB - amountToSend))
185+ else invariantCalc((balanceA - amountToSend), y)
186+ if (true)
187+ then amountToSend
188+ else acc
189+ }
190+
191+ let stepAmount = {
192+ let $list58655908 = [1, 2, 3, 4, 5]
193+ let $size58655908 = size($list58655908)
194+ let $acc058655908 = -1
195+ if (($size58655908 == 0))
196+ then $acc058655908
197+ else {
198+ let $acc158655908 = getStepAmount($acc058655908, $list58655908[0])
199+ if (($size58655908 == 1))
200+ then $acc158655908
201+ else {
202+ let $acc258655908 = getStepAmount($acc158655908, $list58655908[1])
203+ if (($size58655908 == 2))
204+ then $acc258655908
205+ else {
206+ let $acc358655908 = getStepAmount($acc258655908, $list58655908[2])
207+ if (($size58655908 == 3))
208+ then $acc358655908
209+ else {
210+ let $acc458655908 = getStepAmount($acc358655908, $list58655908[3])
211+ if (($size58655908 == 4))
212+ then $acc458655908
213+ else {
214+ let $acc558655908 = getStepAmount($acc458655908, $list58655908[4])
215+ if (($size58655908 == 5))
216+ then $acc558655908
217+ else {
218+ let $acc658655908 = getStepAmount($acc558655908, $list58655908[5])
219+ throw("List size exceed 5")
220+ }
221+ }
222+ }
223+ }
224+ }
225+ }
226+ }
227+ if ((0 > stepAmount))
228+ then throw("something went wrong while working with amountToSend")
191229 else if (if ((invariantEstimatedRatio > slippageValue))
192- then ((invariantNew - invariant) > 0)
230+ then (invariantNew > invariant)
193231 else false)
194232 then amountToSendEstimated
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")
206- }
207-
208-
209-func calculateHowManySendB (amountToSendEstimated,minTokenReceiveAmount,amountA,amountB,tokenReceiveAmount) = {
210- let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000))
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))
219- let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
220- if ((0 >= (invariantCalc(x, (amountB - amountToSendStep5)) - invariant)))
221- then throw("err1")
222- else if (if ((invariantEstimatedRatio > slippageValue))
223- then ((invariantNew - invariant) > 0)
224- else false)
225- then amountToSendEstimated
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+ else ((stepAmount * (feeScale6 - fee)) / feeScale6)
237234 }
238235
239236
240237 func getAssetInfo (assetId) = match assetId {
241238 case id: ByteVector =>
242239 let stringId = toBase58String(id)
243240 let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist"))
244241 $Tuple3(stringId, info.name, info.decimals)
245242 case waves: Unit =>
246243 $Tuple3("WAVES", "WAVES", 8)
247244 case _ =>
248245 throw("Match error")
249246 }
250247
251248
252249 func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)]
253250
254251
255252 func deductStakingFee (amount,assetId) = if ((assetId == USDN))
256253 then {
257254 let result = (amount - stakingFeeInUSDN)
258255 if ((0 >= result))
259256 then throw((((("Insufficient amount " + toString(amount)) + " to deduct staking fee ") + toString(stakingFeeInUSDN)) + " USD-N"))
260257 else result
261258 }
262259 else amount
263260
264261
265262 func throwIsActive () = throw("DApp is already active")
266263
267264
268265 func throwIsInactive () = throw("DApp is inactive at this moment")
269266
270267
271268 func throwOnlyAdmin () = throw("Only admin can call this function")
272269
273270
274271 func throwAssets () = throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB))
275272
276273
277274 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))
278275
279276
280277 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"))
281278
282279
283280 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"))
284281
285282
286283 func suspendSuspicious () = suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB) + ". State: ") + toString(accountBalance(assetIdA))) + " ") + assetNameA) + ", ") + toString(accountBalance(assetIdB))) + " ") + assetNameB))
287284
288285
289286 @Callable(i)
290287 func init () = {
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
288+ let $t086198696 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
289+ let pmtAmountA = $t086198696._1
290+ let pmtAssetIdA = $t086198696._2
291+ let $t087018778 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
292+ let pmtAmountB = $t087018778._1
293+ let pmtAssetIdB = $t087018778._2
294+ let $t087838860 = getAssetInfo(pmtAssetIdA)
295+ let pmtStrAssetIdA = $t087838860._1
296+ let pmtAssetNameA = $t087838860._2
297+ let pmtDecimalsA = $t087838860._3
298+ let $t088658942 = getAssetInfo(pmtAssetIdB)
299+ let pmtStrAssetIdB = $t088658942._1
300+ let pmtAssetNameB = $t088658942._2
301+ let pmtDecimalsB = $t088658942._3
305302 if (isDefined(getBoolean(this, kActive)))
306303 then throwIsActive()
307304 else if ((pmtAssetIdA == pmtAssetIdB))
308305 then throw("Assets must be different")
309306 else {
310307 let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7))
311308 let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this))
312309 let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2)
313310 let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, HALFDOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, HALFDOWN), pow(10, 0, shareDecimals, 0, 0, HALFDOWN))
314311 let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true)
315312 let shareIssueId = calculateAssetId(shareIssue)
316313 let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB)
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+[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, feeScale6), shareIssue, StringEntry(kShareAssetId, toBase58String(shareIssueId)), IntegerEntry(kShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)]
318315 }
319316 }
320317
321318
322319
323320 @Callable(i)
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))
321+func replenishWithTwoTokens (slippageTolerance) = {
322+ let pmtAssetIdA = i.payments[0].assetId
323+ let pmtAssetIdB = i.payments[1].assetId
324+ let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA)
325+ let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB)
326+ let tokenRatio = fraction(fraction(scale8, balanceA, pmtAmountA), scale3, fraction(scale8, balanceB, pmtAmountB))
327+ let ratioShareTokensInA = fraction(scale8, pmtAmountA, balanceA)
328+ let ratioShareTokensInB = fraction(scale8, pmtAmountB, balanceB)
329+ let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8)
330+ let invariantCalculated = invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB))
331+ if (!(isActive))
332+ then throwIsInactive()
333+ else if (if ((0 > slippageTolerance))
334+ then true
335+ else (slippageTolerance > 10))
336+ then throw("Slippage tolerance must be <= 1%")
337+ else if ((size(i.payments) != 2))
338+ then throw("Two attached assets expected")
339+ else if (if ((pmtAssetIdA != assetIdA))
340+ then true
341+ else (pmtAssetIdB != assetIdB))
342+ then throwAssets()
343+ else if (if ((((scale3 * (slippageScale3 - slippageTolerance)) / slippageScale3) > tokenRatio))
345344 then true
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- }
345+ else (tokenRatio > ((scale3 * (slippageScale3 + slippageTolerance)) / slippageScale3)))
346+ then throw("Incorrect assets amount: amounts must have the contract ratio")
347+ else if ((shareTokenToPayAmount == 0))
348+ then throw("Too small amount to replenish")
349+ else if (!(hasEnoughBalance))
350+ then suspendSuspicious()
351+ 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)]
352+ }
358353
359354
360355
361356 @Callable(i)
362357 func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = {
363- let $t04182841903 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
364- let pmtAmount = $t04182841903._1
365- let pmtAssetId = $t04182841903._2
358+ let $t01315713232 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
359+ let pmtAmount = $t01315713232._1
360+ let pmtAssetId = $t01315713232._2
366361 let pmtMinThreshold = 5000000
367362 let thresholdValueForMinTolerance = 50000000
368363 let tolerance = if ((thresholdValueForMinTolerance > pmtAmount))
369364 then 100000
370365 else 1
371- let slippageValueMinForReplenish = (scaleValue8 - ((scaleValue8 * tolerance) / 10000000))
372- let slippageValueMaxForReplenish = (scaleValue8 + ((scaleValue8 * tolerance) / 10000000))
373- let slippageValueMinForSwap = (scaleValue8 - ((scaleValue8 * 1) / 10000000))
374- let slippageValueMaxForSwap = (scaleValue8 + ((scaleValue8 * 1) / 10000000))
366+ let slippageValueMinForReplenish = (scale8 - ((scale8 * tolerance) / 10000000))
367+ let slippageValueMaxForReplenish = (scale8 + ((scale8 * tolerance) / 10000000))
368+ let slippageValueMinForSwap = (scale8 - ((scale8 * 1) / 10000000))
369+ let slippageValueMaxForSwap = (scale8 + ((scale8 * 1) / 10000000))
375370 if (!(isActive))
376371 then throwIsInactive()
377372 else if ((pmtMinThreshold > pmtAmount))
378373 then throw((((("Payment amount " + toString(pmtAmount)) + " does not exceed the minimum amount of ") + toString(pmtMinThreshold)) + " tokens"))
379374 else if ((size(i.payments) != 1))
380375 then throw("One attached payment expected")
381376 else if (!(hasEnoughBalance))
382377 then suspendSuspicious()
383- else if ((pmtAssetId == assetIdA))
384- then {
385- let virtReplA = (pmtAmount - virtualSwapTokenPay)
386- let virtReplB = virtualSwapTokenGet
387- let balanceAfterSwapA = (balanceA + virtualSwapTokenPay)
388- let balanceAfterSwapB = (balanceB - virtualSwapTokenGet)
378+ else if (if ((pmtAssetId != assetIdA))
379+ then (pmtAssetId != assetIdB)
380+ else false)
381+ then throwAssets()
382+ else {
383+ let $t01423414999 = if ((pmtAssetId == assetIdA))
384+ then $Tuple7((pmtAmount - virtualSwapTokenPay), virtualSwapTokenGet, (balanceA + virtualSwapTokenPay), (balanceB - virtualSwapTokenGet), invariantCalc((balanceA + pmtAmount), balanceB), (balanceA + pmtAmount), balanceB)
385+ else $Tuple7(virtualSwapTokenGet, (pmtAmount - virtualSwapTokenPay), (balanceA - virtualSwapTokenGet), (balanceB + virtualSwapTokenPay), invariantCalc(balanceA, (balanceB + pmtAmount)), balanceA, (balanceB + pmtAmount))
386+ let virtualReplenishA = $t01423414999._1
387+ let virtualReplenishB = $t01423414999._2
388+ let balanceAfterSwapA = $t01423414999._3
389+ let balanceAfterSwapB = $t01423414999._4
390+ let invariantCalculated = $t01423414999._5
391+ let newBalanceA = $t01423414999._6
392+ let newBalanceB = $t01423414999._7
393+ let newBalanceEntry = if ((pmtAssetId == assetIdA))
394+ then IntegerEntry(kBalanceA, newBalanceA)
395+ else IntegerEntry(kBalanceB, newBalanceB)
389396 let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB)
390- let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
391- if (if ((invariantEstimatedRatio > slippageValueMinForSwap))
392- then ((invariantNew - invariant) >= 0)
393- else false)
394- then {
395- let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterSwapA, (scaleValue8 * scaleValue8), balanceAfterSwapB) / fraction(virtReplA, scaleValue8, virtReplB))
396- if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish))
397+ let invariantEstimatedRatio = fraction(scale8, invariant, invariantNew)
398+ let ratioVirtualBalanceToVirtualReplenish = (fraction((scale8 * scale8), balanceAfterSwapA, balanceAfterSwapB) / fraction(scale8, virtualReplenishA, virtualReplenishB))
399+ let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2))
400+ if (if ((slippageValueMinForSwap >= invariantEstimatedRatio))
401+ then true
402+ else (invariant > invariantNew))
403+ then throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
404+ else if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish))
405+ then true
406+ else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish))
407+ then throw("Swap with virtualSwapTokenPay and virtualSwapTokenGet is possible, but ratio after virtual swap is incorrect")
408+ else if (if ((dAppThresholdAmount > newBalanceA))
397409 then true
398- else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish))
399- then throw("Ratio after virtual swap incorrect")
410+ else (dAppThresholdAmount > newBalanceB))
411+ then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB)
400412 else {
401- let ratioShareTokensInA = fraction(deductStakingFee(virtReplA, assetIdA), scaleValue8, balanceAfterSwapA)
402- let ratioShareTokensInB = fraction(deductStakingFee(virtReplB, assetIdB), scaleValue8, balanceAfterSwapB)
403- let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
404- let invariantCalculated = invariantCalc((balanceA + pmtAmount), balanceB)
405- let newBalanceA = (balanceA + pmtAmount)
406- let newBalanceB = balanceB
407- let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter))
408- if (if ((dAppThresholdAmount > newBalanceA))
409- then true
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)]
413+ let ratioShareTokensInA = fraction(deductStakingFee(virtualReplenishA, assetIdA), scale8, balanceAfterSwapA)
414+ let ratioShareTokensInB = fraction(deductStakingFee(virtualReplenishB, assetIdB), scale8, balanceAfterSwapB)
415+ if (true)
416+ then throw(toString(value(value(assetInfo(USDN)).minSponsoredFee)))
417+ else {
418+ let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scale8)
419+ if (true)
420+ then throw(toString(shareTokenToPayAmount))
421+ else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), newBalanceEntry, IntegerEntry(kInvariant, invariantCalculated)]
422+ }
413423 }
414- }
415- else throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
416424 }
417- else if ((pmtAssetId == assetIdB))
418- then {
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)
424- let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
425- if (if ((invariantEstimatedRatio > slippageValueMinForSwap))
426- then ((invariantNew - invariant) >= 0)
427- else false)
428- then {
429- let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterSwapA, (scaleValue8 * scaleValue8), balanceAfterSwapB) / fraction(virtReplA, scaleValue8, virtReplB))
430- if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish))
431- then true
432- else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish))
433- then throw("Ratio after virtual swap incorrect")
434- else {
435- let ratioShareTokensInA = fraction(deductStakingFee(virtReplA, assetIdA), scaleValue8, balanceAfterSwapA)
436- let ratioShareTokensInB = fraction(deductStakingFee(virtReplB, assetIdB), scaleValue8, balanceAfterSwapB)
437- let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
438- let invariantCalculated = invariantCalc(balanceA, (balanceB + pmtAmount))
439- let newBalanceA = balanceA
440- let newBalanceB = (balanceB + pmtAmount)
441- let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter))
442- if (if ((dAppThresholdAmount > newBalanceA))
443- then true
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)]
447- }
448- }
449- else throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
450- }
451- else throwAssets()
452425 }
453426
454427
455428
456429 @Callable(i)
457430 func withdraw () = {
458- let $t04776847911 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
459- let pmtAmount = $t04776847911._1
460- let pmtAssetId = $t04776847911._2
431+ let $t01770817851 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
432+ let pmtAmount = $t01770817851._1
433+ let pmtAssetId = $t01770817851._2
461434 let amountToPayA = deductStakingFee(fraction(pmtAmount, balanceA, shareAssetSupply), assetIdA)
462435 let amountToPayB = deductStakingFee(fraction(pmtAmount, balanceB, shareAssetSupply), assetIdB)
463436 let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB))
464437 if (!(isActive))
465438 then throwIsInactive()
466439 else if ((size(i.payments) != 1))
467440 then throw("One attached payment expected")
468441 else if ((pmtAssetId != shareAssetId))
469442 then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId)))
470443 else if (!(hasEnoughBalance))
471444 then suspendSuspicious()
472445 else if (if ((amountToPayA > availableBalanceA))
473446 then true
474447 else (amountToPayB > availableBalanceB))
475448 then throwInsufficientAvailableBalances(amountToPayA, amountToPayB)
476449 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)]
477450 }
478451
479452
480453
481454 @Callable(i)
482455 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()
456+ let $t01913419209 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
457+ let pmtAmount = $t01913419209._1
458+ let pmtAssetId = $t01913419209._2
459+ if (!(isActive))
460+ 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 (if ((pmtAssetId != assetIdA))
470+ then (pmtAssetId != assetIdB)
471+ else false)
472+ then throwAssets()
500473 else if ((10000000 > pmtAmount))
501474 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))
475+ else if (if ((exchangeRatioLimitMin > fraction(scale8, minAmountToReceive, pmtAmount)))
476+ then true
477+ else (fraction(scale8, estimatedAmountToReceive, pmtAmount) > exchangeRatioLimitMax))
478+ then throw("Incorrect args and pmt ratio")
479+ else {
480+ let sendAssetId = if ((pmtAssetId == assetIdA))
481+ then assetIdB
482+ else assetIdA
483+ let amountWithoutFee = calculateSendAmount(estimatedAmountToReceive, minAmountToReceive, pmtAmount, pmtAssetId)
484+ let amountWithFee = fraction(amountWithoutFee, (feeScale6 - fee), feeScale6)
485+ let governanceReward = fraction(amountWithoutFee, feeGovernance, feeScale6)
486+ let $t02058920850 = if ((pmtAssetId == assetIdA))
487+ then $Tuple2((balanceA + pmtAmount), ((balanceB - amountWithFee) - governanceReward))
488+ else $Tuple2(((balanceA - amountWithFee) - governanceReward), (balanceB + pmtAmount))
489+ let newBalanceA = $t02058920850._1
490+ let newBalanceB = $t02058920850._2
491+ let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdScale2))
511492 if (if ((dAppThresholdAmount > newBalanceA))
512493 then true
513494 else (dAppThresholdAmount > newBalanceB))
514495 then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB)
515496 else if (if (if ((assetIdA == USDN))
497+ then (sendAssetId == assetIdA)
498+ else false)
516499 then (stakedAmountUSDN >= newBalanceA)
517500 else false)
518- then true
519- else if ((assetIdB == USDN))
501+ then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA)
502+ else if (if (if ((assetIdB == USDN))
503+ then (sendAssetId == assetIdB)
504+ else false)
520505 then (stakedAmountUSDN >= newBalanceB)
521506 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)]
507+ then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB)
508+ else [IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc(newBalanceA, newBalanceB)), ScriptTransfer(i.caller, amountWithFee, sendAssetId), ScriptTransfer(govAddr, governanceReward, sendAssetId)]
524509 }
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()
549510 }
550511
551512
552513
553514 @Callable(i)
554515 func shutdown () = if (!(isActive))
555516 then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified")))
556517 else if (!(containsElement([adm1, adm2, adm3, admStartStop], i.callerPublicKey)))
557518 then throwOnlyAdmin()
558519 else suspend("Paused by admin")
559520
560521
561522
562523 @Callable(i)
563524 func activate () = if (isActive)
564525 then throwIsActive()
565526 else if (!(containsElement([adm1, adm2, adm3, admStartStop], i.callerPublicKey)))
566527 then throwOnlyAdmin()
567528 else [BooleanEntry(kActive, true), DeleteEntry(kCause)]
568529
569530
570531
571532 @Callable(i)
572533 func takeIntoAccountExtraFunds (amountLeave) = {
573534 let uncountableA = (accountBalanceWithStakedA - balanceA)
574535 let uncountableB = (accountBalanceWithStakedB - balanceB)
575536 let amountEnrollA = (uncountableA - (if ((assetIdA == USDN))
576537 then amountLeave
577538 else 0))
578539 let amountEnrollB = (uncountableB - (if ((assetIdB == USDN))
579540 then amountLeave
580541 else 0))
581542 if (!(isActive))
582543 then throwIsInactive()
583544 else if ((i.caller != this))
584545 then throwOnlyAdmin()
585546 else if ((0 > amountLeave))
586547 then throw(("Argument 'amountLeave' cannot be negative. Actual: " + toString(amountLeave)))
587548 else if (if ((0 > uncountableA))
588549 then true
589550 else (0 > uncountableB))
590551 then suspend("Enroll amount negative")
591552 else if (if ((0 > amountEnrollA))
592553 then true
593554 else (0 > amountEnrollB))
594555 then throw("Too large amountLeave")
595556 else [IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)]
596557 }
597558
598559

github/deemru/w8io/169f3d6 
98.60 ms