tx · 8y9JJ95njDLc2aTHC9yCRvSWVVY6tgM9DsckQxJsp3RB

3N18bq33YEjzWkoTDhZvc7zd7eRAyv6x4aZ:  -0.01400000 Waves

2021.03.07 17:20 [1427381] smart account 3N18bq33YEjzWkoTDhZvc7zd7eRAyv6x4aZ > SELF 0.00000000 Waves

{ "type": 13, "id": "8y9JJ95njDLc2aTHC9yCRvSWVVY6tgM9DsckQxJsp3RB", "fee": 1400000, "feeAssetId": null, "timestamp": 1615126885026, "version": 1, "sender": "3N18bq33YEjzWkoTDhZvc7zd7eRAyv6x4aZ", "senderPublicKey": "71DfVUys2KXcuEivd6kRxABvVQKB5k5c48qobMB1DzKN", "proofs": [ "5RJFCbDqqKy6cBFsNaV9pfYVvASEeqtLsVviCcQnAz2cPJ9qTjckgPtERANdtSZFgYj4rBeJ4NzTxyscQ197ZCzt" ], "script": "base64:AAIEAAAAAAAAABoIAhIAEgMKAQESBAoCAQESBAoCAQESAwoBAQAAAEoAAAAAB3ZlcnNpb24CAAAABTIuMC4wAAAAAAprZXlWZXJzaW9uAgAAAAd2ZXJzaW9uAAAAAAlrZXlBY3RpdmUCAAAABmFjdGl2ZQAAAAALa2V5QXNzZXRJZEECAAAACkFfYXNzZXRfaWQAAAAAC2tleUFzc2V0SWRCAgAAAApCX2Fzc2V0X2lkAAAAAAtrZXlCYWxhbmNlQQIAAAAPQV9hc3NldF9iYWxhbmNlAAAAAAtrZXlCYWxhbmNlQgIAAAAPQl9hc3NldF9iYWxhbmNlAAAAAA9rZXlTaGFyZUFzc2V0SWQCAAAADnNoYXJlX2Fzc2V0X2lkAAAAABNrZXlTaGFyZUFzc2V0U3VwcGx5AgAAABJzaGFyZV9hc3NldF9zdXBwbHkAAAAADWtleUNvbW1pc3Npb24CAAAACmNvbW1pc3Npb24AAAAAG2tleUNvbW1pc3Npb25TY2FsZURlbGltaXRlcgIAAAAaY29tbWlzc2lvbl9zY2FsZV9kZWxpbWl0ZXIAAAAAF2tleUNvbW1pc3Npb25Hb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AAAAAAAAAABQAAAA1hbW91bnRFbnJvbGxCCQAAAgAAAAECAAAAFVRvbyBsYXJnZSBhbW91bnRMZWF2ZQkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAALa2V5QmFsYW5jZUEJAABkAAAAAgUAAAAIYmFsYW5jZUEFAAAADWFtb3VudEVucm9sbEEJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAAC2tleUJhbGFuY2VCCQAAZAAAAAIFAAAACGJhbGFuY2VCBQAAAA1hbW91bnRFbnJvbGxCBQAAAANuaWwAAAAA8WwIYg==", "chainId": 84, "height": 1427381, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 28EmePggwTkGWLhme7YgGg3qMXNec9JzwSoWJR2ogemC Next: BNtv4PQa8EXSrzAnfNNzzXJDLDks5AM4xixcmKwHwKwe Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let version = "2.0.0"
55
6-let kVersion = "version"
6+let keyVersion = "version"
77
8-let kActive = "active"
8+let keyActive = "active"
99
10-let kAssetIdA = "A_asset_id"
10+let keyAssetIdA = "A_asset_id"
1111
12-let kAssetIdB = "B_asset_id"
12+let keyAssetIdB = "B_asset_id"
1313
14-let kBalanceA = "A_asset_balance"
14+let keyBalanceA = "A_asset_balance"
1515
16-let kBalanceB = "B_asset_balance"
16+let keyBalanceB = "B_asset_balance"
1717
18-let kShareAssetId = "share_asset_id"
18+let keyShareAssetId = "share_asset_id"
1919
20-let kShareAssetSupply = "share_asset_supply"
20+let keyShareAssetSupply = "share_asset_supply"
2121
22-let kFee = "commission"
22+let keyCommission = "commission"
2323
24-let kFeeScaleDelimiter = "commission_scale_delimiter"
24+let keyCommissionScaleDelimiter = "commission_scale_delimiter"
2525
26-let kInvariant = "invariant"
26+let keyCommissionGovernance = "commission_governance"
2727
28-let kCause = "shutdown_cause"
28+let keyInvariant = "invariant"
2929
30-let adm1 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
30+let keyCause = "shutdown_cause"
3131
32-let adm2 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
32+let adminPubKey1 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3333
34-let adm3 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
34+let adminPubKey2 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3535
36-let admStartStop = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
36+let adminPubKey3 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3737
38-let admStaking = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
38+let adminPubKeyStartStop = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3939
40-let govAddr = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp')
40+let adminPubKeyStaking = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
41+
42+let governanceAddress = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp')
4143
4244 let stakingAddress = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp')
4345
4547
4648 let stakingFeeInUSDN = (9 * value(value(assetInfo(USDN)).minSponsoredFee))
4749
48-let isActive = getBooleanValue(this, kActive)
50+let isActive = getBooleanValue(this, keyActive)
4951
50-let strAssetIdA = getStringValue(this, kAssetIdA)
52+let strAssetIdA = getStringValue(this, keyAssetIdA)
5153
52-let strAssetIdB = getStringValue(this, kAssetIdB)
54+let strAssetIdB = getStringValue(this, keyAssetIdB)
5355
5456 let assetIdA = if ((strAssetIdA == "WAVES"))
5557 then unit
7779 throw("Match error")
7880 }
7981
80-let balanceA = getIntegerValue(this, kBalanceA)
82+let balanceA = getIntegerValue(this, keyBalanceA)
8183
82-let balanceB = getIntegerValue(this, kBalanceB)
84+let balanceB = getIntegerValue(this, keyBalanceB)
8385
84-let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId))
86+let shareAssetId = fromBase58String(getStringValue(this, keyShareAssetId))
8587
86-let shareAssetSupply = getIntegerValue(this, kShareAssetSupply)
88+let shareAssetSupply = getIntegerValue(this, keyShareAssetSupply)
8789
88-let invariant = getIntegerValue(this, kInvariant)
90+let invariant = getIntegerValue(this, keyInvariant)
8991
90-let fee = 500
92+let commission = 500
9193
92-let feeGovernance = 200
94+let commissionGovernance = 200
9395
94-let feeScale6 = 1000000
96+let commissionScaleDelimiter = 1000000
9597
96-let scale3 = 1000
98+let scaleValue3 = 1000
9799
98-let scale8 = 100000000
100+let scaleValue8 = 100000000
99101
100-let scale12 = 1000000000000
102+let scaleValue12 = 1000000000000
101103
102-let slippageScale3 = 1000
104+let slippageToleranceDelimiter = 1000
103105
104-let digits8 = 8
106+let scaleValue8Digits = 8
107+
108+let scaleValue12Digits = 12
105109
106110 let dAppThreshold = 50
107111
108-let dAppThresholdScale2 = 100
112+let dAppThresholdDelimiter = 100
109113
110-let exchangeRatioLimitMin = 90000000
114+let ratioThresholdMax = 100000000
111115
112-let exchangeRatioLimitMax = 110000000
116+let ratioThresholdMin = 99999000
113117
114118 let alpha = 50
115119
116120 let alphaDigits = 2
117121
118122 let beta = 46000000
123+
124+let betaDigits = 8
119125
120126 func accountBalance (assetId) = match assetId {
121127 case id: ByteVector =>
156162 then (accountBalanceWithStakedB >= balanceB)
157163 else false
158164
159-func skewness (x,y) = (((fraction(scale12, x, y) + fraction(scale12, y, x)) / 2) / 10000)
165+func skewness (x,y) = (((fraction(scaleValue12, x, y) + fraction(scaleValue12, y, x)) / 2) / 10000)
160166
161167
162168 func invariantCalc (x,y) = {
163169 let sk = skewness(x, y)
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)))
170+ (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)))
165171 }
166172
167173
168-func calculateSendAmount (amountToSendEstimated,minTokenReceiveAmount,tokenReceiveAmount,tokenId) = {
169- let slippageValue = (scale8 - ((scale8 * 1) / 10000000))
174+func calculateHowManySendTokenA (amountToSendEstimated,minTokenReceiveAmount,amountTokenA,amountTokenB,tokenReceiveAmount) = {
175+ let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000))
170176 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")
177+ let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaBetweenMaxAndMinSendValue) / 5))
178+ let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaBetweenMaxAndMinSendValue) / 5))
179+ let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaBetweenMaxAndMinSendValue) / 5))
180+ let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaBetweenMaxAndMinSendValue) / 5))
181+ let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaBetweenMaxAndMinSendValue) / 5))
182+ let y = (amountTokenB + tokenReceiveAmount)
183+ let invariantNew = invariantCalc((amountTokenA - amountToSendEstimated), y)
184+ let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
185+ if ((0 >= (invariantCalc((amountTokenA - amountToSendStep5), y) - invariant)))
186+ then throw("minTokenReceiveAmount too large.err1")
229187 else if (if ((invariantEstimatedRatio > slippageValue))
230- then (invariantNew > invariant)
188+ then ((invariantNew - invariant) > 0)
231189 else false)
232190 then amountToSendEstimated
233- else ((stepAmount * (feeScale6 - fee)) / feeScale6)
191+ else if (((invariantCalc((amountTokenA - amountToSendStep1), y) - invariant) > 0))
192+ then ((amountToSendStep1 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
193+ else if (((invariantCalc((amountTokenA - amountToSendStep2), y) - invariant) > 0))
194+ then ((amountToSendStep2 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
195+ else if (((invariantCalc((amountTokenA - amountToSendStep3), y) - invariant) > 0))
196+ then ((amountToSendStep3 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
197+ else if (((invariantCalc((amountTokenA - amountToSendStep4), y) - invariant) > 0))
198+ then ((amountToSendStep4 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
199+ else if (((invariantCalc((amountTokenA - amountToSendStep5), y) - invariant) > 0))
200+ then ((amountToSendStep5 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
201+ else throw("something went wrong while working with amountToSendStep. err2")
202+ }
203+
204+
205+func calculateHowManySendTokenB (amountToSendEstimated,minTokenReceiveAmount,amountTokenA,amountTokenB,tokenReceiveAmount) = {
206+ let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000))
207+ let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenReceiveAmount)
208+ let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaBetweenMaxAndMinSendValue) / 5))
209+ let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaBetweenMaxAndMinSendValue) / 5))
210+ let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaBetweenMaxAndMinSendValue) / 5))
211+ let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaBetweenMaxAndMinSendValue) / 5))
212+ let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaBetweenMaxAndMinSendValue) / 5))
213+ let x = (amountTokenA + tokenReceiveAmount)
214+ let invariantNew = invariantCalc(x, (amountTokenB - amountToSendEstimated))
215+ let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
216+ if ((0 >= (invariantCalc(x, (amountTokenB - amountToSendStep5)) - invariant)))
217+ then throw("minTokenReceiveAmount too large.err1")
218+ else if (if ((invariantEstimatedRatio > slippageValue))
219+ then ((invariantNew - invariant) > 0)
220+ else false)
221+ then amountToSendEstimated
222+ else if (((invariantCalc(x, (amountTokenB - amountToSendStep1)) - invariant) > 0))
223+ then ((amountToSendStep1 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
224+ else if (((invariantCalc(x, (amountTokenB - amountToSendStep2)) - invariant) > 0))
225+ then ((amountToSendStep2 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
226+ else if (((invariantCalc(x, (amountTokenB - amountToSendStep3)) - invariant) > 0))
227+ then ((amountToSendStep3 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
228+ else if (((invariantCalc(x, (amountTokenB - amountToSendStep4)) - invariant) > 0))
229+ then ((amountToSendStep4 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
230+ else if (((invariantCalc(x, (amountTokenB - amountToSendStep5)) - invariant) > 0))
231+ then ((amountToSendStep5 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
232+ else throw("something went wrong while working with amountToSendStep. err2")
234233 }
235234
236235
246245 }
247246
248247
249-func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)]
248+func suspend (cause) = [BooleanEntry(keyActive, false), StringEntry(keyCause, cause)]
250249
251250
252251 func deductStakingFee (amount,assetId) = if ((assetId == USDN))
285284
286285 @Callable(i)
287286 func init () = {
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
302- if (isDefined(getBoolean(this, kActive)))
287+ let $t03744437521 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
288+ let pmtAmountA = $t03744437521._1
289+ let pmtAssetIdA = $t03744437521._2
290+ let $t03752637603 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
291+ let pmtAmountB = $t03752637603._1
292+ let pmtAssetIdB = $t03752637603._2
293+ let $t03760837685 = getAssetInfo(pmtAssetIdA)
294+ let pmtStrAssetIdA = $t03760837685._1
295+ let pmtAssetNameA = $t03760837685._2
296+ let pmtDecimalsA = $t03760837685._3
297+ let $t03769037767 = getAssetInfo(pmtAssetIdB)
298+ let pmtStrAssetIdB = $t03769037767._1
299+ let pmtAssetNameB = $t03769037767._2
300+ let pmtDecimalsB = $t03769037767._3
301+ if (isDefined(getBoolean(this, keyActive)))
303302 then throwIsActive()
304303 else if ((pmtAssetIdA == pmtAssetIdB))
305304 then throw("Assets must be different")
311310 let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true)
312311 let shareIssueId = calculateAssetId(shareIssue)
313312 let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB)
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)]
313+[StringEntry(keyVersion, version), BooleanEntry(keyActive, true), StringEntry(keyAssetIdA, pmtStrAssetIdA), StringEntry(keyAssetIdB, pmtStrAssetIdB), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyInvariant, invariantCalculated), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter), shareIssue, StringEntry(keyShareAssetId, toBase58String(shareIssueId)), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)]
315314 }
316315 }
317316
323322 let pmtAssetIdB = i.payments[1].assetId
324323 let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA)
325324 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)
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)
330329 let invariantCalculated = invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB))
331330 if (!(isActive))
332331 then throwIsInactive()
333332 else if (if ((0 > slippageTolerance))
334333 then true
335- else (slippageTolerance > 10))
336- then throw("Slippage tolerance must be <= 1%")
334+ else (slippageTolerance > slippageToleranceDelimiter))
335+ then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance)))
337336 else if ((size(i.payments) != 2))
338337 then throw("Two attached assets expected")
339338 else if (if ((pmtAssetIdA != assetIdA))
340339 then true
341340 else (pmtAssetIdB != assetIdB))
342341 then throwAssets()
343- else if (if ((((scale3 * (slippageScale3 - slippageTolerance)) / slippageScale3) > tokenRatio))
342+ else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio))
344343 then true
345- else (tokenRatio > ((scale3 * (slippageScale3 + slippageTolerance)) / slippageScale3)))
344+ else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter)))
346345 then throw("Incorrect assets amount: amounts must have the contract ratio")
347346 else if ((shareTokenToPayAmount == 0))
348347 then throw("Too small amount to replenish")
349348 else if (!(hasEnoughBalance))
350349 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)]
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)]
352351 }
353352
354353
355354
356355 @Callable(i)
357356 func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = {
358- let $t01315713232 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
359- let pmtAmount = $t01315713232._1
360- let pmtAssetId = $t01315713232._2
357+ let $t04229442369 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
358+ let pmtAmount = $t04229442369._1
359+ let pmtAssetId = $t04229442369._2
361360 let pmtMinThreshold = 5000000
362361 let thresholdValueForMinTolerance = 50000000
363362 let tolerance = if ((thresholdValueForMinTolerance > pmtAmount))
364363 then 100000
365364 else 1
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))
365+ let slippageValueMinForReplenish = (scaleValue8 - ((scaleValue8 * tolerance) / 10000000))
366+ let slippageValueMaxForReplenish = (scaleValue8 + ((scaleValue8 * tolerance) / 10000000))
367+ let slippageValueMinForSwap = (scaleValue8 - ((scaleValue8 * 1) / 10000000))
368+ let slippageValueMaxForSwap = (scaleValue8 + ((scaleValue8 * 1) / 10000000))
370369 if (!(isActive))
371370 then throwIsInactive()
372371 else if ((pmtMinThreshold > pmtAmount))
375374 then throw("One attached payment expected")
376375 else if (!(hasEnoughBalance))
377376 then suspendSuspicious()
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)
396- let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB)
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))
377+ else if ((pmtAssetId == assetIdA))
378+ then {
379+ let amountVirtualReplenishTokenA = (pmtAmount - virtualSwapTokenPay)
380+ let amountVirtualReplenishTokenB = virtualSwapTokenGet
381+ let balanceAfterVirtualSwapA = (balanceA + virtualSwapTokenPay)
382+ let balanceAfterVirtualSwapB = (balanceB - virtualSwapTokenGet)
383+ let invariantNew = invariantCalc(balanceAfterVirtualSwapA, balanceAfterVirtualSwapB)
384+ let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
385+ if (if ((invariantEstimatedRatio >= slippageValueMinForSwap))
386+ then ((invariantNew - invariant) >= 0)
387+ else false)
388+ then {
389+ let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterVirtualSwapA, (scaleValue8 * scaleValue8), balanceAfterVirtualSwapB) / fraction(amountVirtualReplenishTokenA, scaleValue8, amountVirtualReplenishTokenB))
390+ if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish))
409391 then true
410- else (dAppThresholdAmount > newBalanceB))
411- then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB)
392+ else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish))
393+ then throw("swop with virtualSwapTokenPay and virtualSwapTokenGet possible, but ratio after virtual swap incorrect")
412394 else {
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- }
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)
398+ let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
399+ let shareTokenToPayAmountToDelete = fraction(max([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
400+ 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))
407+ then true
408+ else (dAppThresholdAmount > newAmountTokenB))
409+ then throwThreshold(dAppThresholdAmount, newAmountTokenA, newAmountTokenB)
410+ else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(keyBalanceA, newAmountTokenA), IntegerEntry(keyInvariant, invariantCalculated)]
423411 }
412+ }
413+ else throw("incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
424414 }
425- }
426-
427-
428-
429-@Callable(i)
430-func withdraw () = {
431- let $t01770817851 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
432- let pmtAmount = $t01770817851._1
433- let pmtAssetId = $t01770817851._2
434- let amountToPayA = deductStakingFee(fraction(pmtAmount, balanceA, shareAssetSupply), assetIdA)
435- let amountToPayB = deductStakingFee(fraction(pmtAmount, balanceB, shareAssetSupply), assetIdB)
436- let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB))
437- if (!(isActive))
438- then throwIsInactive()
439- else if ((size(i.payments) != 1))
440- then throw("One attached payment expected")
441- else if ((pmtAssetId != shareAssetId))
442- then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId)))
443- else if (!(hasEnoughBalance))
444- then suspendSuspicious()
445- else if (if ((amountToPayA > availableBalanceA))
446- then true
447- else (amountToPayB > availableBalanceB))
448- then throwInsufficientAvailableBalances(amountToPayA, amountToPayB)
449- 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)]
415+ else if ((pmtAssetId == assetIdB))
416+ then {
417+ let amountVirtualReplenishTokenB = (pmtAmount - virtualSwapTokenPay)
418+ let amountVirtualReplenishTokenA = virtualSwapTokenGet
419+ let balanceAfterVirtualSwapA = (balanceA - virtualSwapTokenGet)
420+ let balanceAfterVirtualSwapB = (balanceB + virtualSwapTokenPay)
421+ let invariantNew = invariantCalc(balanceAfterVirtualSwapA, balanceAfterVirtualSwapB)
422+ let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
423+ if (if ((invariantEstimatedRatio > slippageValueMinForSwap))
424+ then ((invariantNew - invariant) >= 0)
425+ else false)
426+ then {
427+ let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterVirtualSwapA, (scaleValue8 * scaleValue8), balanceAfterVirtualSwapB) / fraction(amountVirtualReplenishTokenA, scaleValue8, amountVirtualReplenishTokenB))
428+ if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish))
429+ then true
430+ else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish))
431+ then throw("swop with virtualSwapTokenPay and virtualSwapTokenGet possible, but ratio after virtual swap incorrect")
432+ else {
433+ let ratioShareTokensInA = fraction(deductStakingFee(amountVirtualReplenishTokenA, assetIdA), scaleValue8, balanceAfterVirtualSwapA)
434+ let ratioShareTokensInB = fraction(deductStakingFee(amountVirtualReplenishTokenB, assetIdB), scaleValue8, balanceAfterVirtualSwapB)
435+ let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
436+ let invariantCalculated = invariantCalc(balanceA, (balanceB + pmtAmount))
437+ let newAmountTokenA = balanceA
438+ let newAmountTokenB = (balanceB + pmtAmount)
439+ let dAppThresholdAmount = fraction((newAmountTokenA + newAmountTokenB), dAppThreshold, (2 * dAppThresholdDelimiter))
440+ if (if ((dAppThresholdAmount > newAmountTokenA))
441+ then true
442+ else (dAppThresholdAmount > newAmountTokenB))
443+ then throwThreshold(dAppThresholdAmount, newAmountTokenA, newAmountTokenB)
444+ else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(keyBalanceB, newAmountTokenB), IntegerEntry(keyInvariant, invariantCalculated)]
445+ }
446+ }
447+ else throw("incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
448+ }
449+ else throwAssets()
450450 }
451451
452452
453453
454454 @Callable(i)
455455 func exchange (estimatedAmountToReceive,minAmountToReceive) = {
456- let $t01913419209 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
457- let pmtAmount = $t01913419209._1
458- let pmtAssetId = $t01913419209._2
456+ let $t04992249997 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
457+ let pmtAmount = $t04992249997._1
458+ let pmtAssetId = $t04992249997._2
459459 if (!(isActive))
460460 then throwIsInactive()
461461 else if ((0 >= estimatedAmountToReceive))
466466 then throw("One attached payment expected")
467467 else if (!(hasEnoughBalance))
468468 then suspendSuspicious()
469- else if (if ((pmtAssetId != assetIdA))
470- then (pmtAssetId != assetIdB)
471- else false)
472- then throwAssets()
473- else if ((10000000 > pmtAmount))
474- then throw("Only swap of 10.000000 or more tokens is allowed")
475- else if (if ((exchangeRatioLimitMin > fraction(scale8, minAmountToReceive, pmtAmount)))
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))
476479 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))
492- if (if ((dAppThresholdAmount > newBalanceA))
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)
493508 then true
494- else (dAppThresholdAmount > newBalanceB))
495- then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB)
496- else if (if (if ((assetIdA == USDN))
497- then (sendAssetId == assetIdA)
509+ else if ((assetIdB == USDN))
510+ then (stakedAmountUSDN >= newAmountTokenB)
498511 else false)
499- then (stakedAmountUSDN >= newBalanceA)
500- else false)
501- then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA)
502- else if (if (if ((assetIdB == USDN))
503- then (sendAssetId == assetIdB)
504- else false)
505- then (stakedAmountUSDN >= newBalanceB)
506- else false)
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)]
509- }
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()
510516 }
511517
512518
513519
514520 @Callable(i)
515-func shutdown () = if (!(isActive))
516- then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified")))
517- else if (!(containsElement([adm1, adm2, adm3, admStartStop], i.callerPublicKey)))
518- then throwOnlyAdmin()
519- else suspend("Paused by admin")
520-
521-
522-
523-@Callable(i)
524-func activate () = if (isActive)
525- then throwIsActive()
526- else if (!(containsElement([adm1, adm2, adm3, admStartStop], i.callerPublicKey)))
527- then throwOnlyAdmin()
528- else [BooleanEntry(kActive, true), DeleteEntry(kCause)]
529-
530-
531-
532-@Callable(i)
533521 func takeIntoAccountExtraFunds (amountLeave) = {
534- let uncountableA = (accountBalanceWithStakedA - balanceA)
535- let uncountableB = (accountBalanceWithStakedB - balanceB)
536- let amountEnrollA = (uncountableA - (if ((assetIdA == USDN))
522+ let uncountableAmountEnrollAssetA = (accountBalanceWithStakedA - balanceA)
523+ let uncountableAmountEnrollAssetB = (accountBalanceWithStakedB - balanceB)
524+ let amountEnrollA = (uncountableAmountEnrollAssetA - (if ((assetIdA == USDN))
537525 then amountLeave
538526 else 0))
539- let amountEnrollB = (uncountableB - (if ((assetIdB == USDN))
527+ let amountEnrollB = (uncountableAmountEnrollAssetB - (if ((assetIdB == USDN))
540528 then amountLeave
541529 else 0))
542530 if (!(isActive))
543531 then throwIsInactive()
544- else if ((i.caller != this))
532+ else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStaking], i.callerPublicKey)))
545533 then throwOnlyAdmin()
546534 else if ((0 > amountLeave))
547535 then throw(("Argument 'amountLeave' cannot be negative. Actual: " + toString(amountLeave)))
548- else if (if ((0 > uncountableA))
536+ else if (if ((0 > uncountableAmountEnrollAssetA))
549537 then true
550- else (0 > uncountableB))
538+ else (0 > uncountableAmountEnrollAssetB))
551539 then suspend("Enroll amount negative")
552540 else if (if ((0 > amountEnrollA))
553541 then true
554542 else (0 > amountEnrollB))
555543 then throw("Too large amountLeave")
556- else [IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)]
544+ else [IntegerEntry(keyBalanceA, (balanceA + amountEnrollA)), IntegerEntry(keyBalanceB, (balanceB + amountEnrollB))]
557545 }
558546
559547
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let version = "2.0.0"
55
6-let kVersion = "version"
6+let keyVersion = "version"
77
8-let kActive = "active"
8+let keyActive = "active"
99
10-let kAssetIdA = "A_asset_id"
10+let keyAssetIdA = "A_asset_id"
1111
12-let kAssetIdB = "B_asset_id"
12+let keyAssetIdB = "B_asset_id"
1313
14-let kBalanceA = "A_asset_balance"
14+let keyBalanceA = "A_asset_balance"
1515
16-let kBalanceB = "B_asset_balance"
16+let keyBalanceB = "B_asset_balance"
1717
18-let kShareAssetId = "share_asset_id"
18+let keyShareAssetId = "share_asset_id"
1919
20-let kShareAssetSupply = "share_asset_supply"
20+let keyShareAssetSupply = "share_asset_supply"
2121
22-let kFee = "commission"
22+let keyCommission = "commission"
2323
24-let kFeeScaleDelimiter = "commission_scale_delimiter"
24+let keyCommissionScaleDelimiter = "commission_scale_delimiter"
2525
26-let kInvariant = "invariant"
26+let keyCommissionGovernance = "commission_governance"
2727
28-let kCause = "shutdown_cause"
28+let keyInvariant = "invariant"
2929
30-let adm1 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
30+let keyCause = "shutdown_cause"
3131
32-let adm2 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
32+let adminPubKey1 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3333
34-let adm3 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
34+let adminPubKey2 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3535
36-let admStartStop = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
36+let adminPubKey3 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3737
38-let admStaking = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
38+let adminPubKeyStartStop = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3939
40-let govAddr = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp')
40+let adminPubKeyStaking = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
41+
42+let governanceAddress = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp')
4143
4244 let stakingAddress = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp')
4345
4446 let USDN = base58'3FUNGbzfNsQ1AZfvumCUqARXvpjjLQrvCzorYuDryQAq'
4547
4648 let stakingFeeInUSDN = (9 * value(value(assetInfo(USDN)).minSponsoredFee))
4749
48-let isActive = getBooleanValue(this, kActive)
50+let isActive = getBooleanValue(this, keyActive)
4951
50-let strAssetIdA = getStringValue(this, kAssetIdA)
52+let strAssetIdA = getStringValue(this, keyAssetIdA)
5153
52-let strAssetIdB = getStringValue(this, kAssetIdB)
54+let strAssetIdB = getStringValue(this, keyAssetIdB)
5355
5456 let assetIdA = if ((strAssetIdA == "WAVES"))
5557 then unit
5658 else fromBase58String(strAssetIdA)
5759
5860 let assetIdB = if ((strAssetIdB == "WAVES"))
5961 then unit
6062 else fromBase58String(strAssetIdB)
6163
6264 let assetNameA = match assetIdA {
6365 case id: ByteVector =>
6466 value(assetInfo(id)).name
6567 case waves: Unit =>
6668 "WAVES"
6769 case _ =>
6870 throw("Match error")
6971 }
7072
7173 let assetNameB = match assetIdB {
7274 case id: ByteVector =>
7375 value(assetInfo(id)).name
7476 case waves: Unit =>
7577 "WAVES"
7678 case _ =>
7779 throw("Match error")
7880 }
7981
80-let balanceA = getIntegerValue(this, kBalanceA)
82+let balanceA = getIntegerValue(this, keyBalanceA)
8183
82-let balanceB = getIntegerValue(this, kBalanceB)
84+let balanceB = getIntegerValue(this, keyBalanceB)
8385
84-let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId))
86+let shareAssetId = fromBase58String(getStringValue(this, keyShareAssetId))
8587
86-let shareAssetSupply = getIntegerValue(this, kShareAssetSupply)
88+let shareAssetSupply = getIntegerValue(this, keyShareAssetSupply)
8789
88-let invariant = getIntegerValue(this, kInvariant)
90+let invariant = getIntegerValue(this, keyInvariant)
8991
90-let fee = 500
92+let commission = 500
9193
92-let feeGovernance = 200
94+let commissionGovernance = 200
9395
94-let feeScale6 = 1000000
96+let commissionScaleDelimiter = 1000000
9597
96-let scale3 = 1000
98+let scaleValue3 = 1000
9799
98-let scale8 = 100000000
100+let scaleValue8 = 100000000
99101
100-let scale12 = 1000000000000
102+let scaleValue12 = 1000000000000
101103
102-let slippageScale3 = 1000
104+let slippageToleranceDelimiter = 1000
103105
104-let digits8 = 8
106+let scaleValue8Digits = 8
107+
108+let scaleValue12Digits = 12
105109
106110 let dAppThreshold = 50
107111
108-let dAppThresholdScale2 = 100
112+let dAppThresholdDelimiter = 100
109113
110-let exchangeRatioLimitMin = 90000000
114+let ratioThresholdMax = 100000000
111115
112-let exchangeRatioLimitMax = 110000000
116+let ratioThresholdMin = 99999000
113117
114118 let alpha = 50
115119
116120 let alphaDigits = 2
117121
118122 let beta = 46000000
123+
124+let betaDigits = 8
119125
120126 func accountBalance (assetId) = match assetId {
121127 case id: ByteVector =>
122128 assetBalance(this, id)
123129 case waves: Unit =>
124130 wavesBalance(this).available
125131 case _ =>
126132 throw("Match error")
127133 }
128134
129135
130136 let stakedAmountUSDN = match getInteger(stakingAddress, ((("rpd_balance_" + toBase58String(USDN)) + "_") + toString(this))) {
131137 case staked: Int =>
132138 staked
133139 case nothing: Unit =>
134140 0
135141 case _ =>
136142 throw("Match error")
137143 }
138144
139145 let availableBalanceA = (balanceA - (if ((assetIdA == USDN))
140146 then stakedAmountUSDN
141147 else 0))
142148
143149 let availableBalanceB = (balanceB - (if ((assetIdB == USDN))
144150 then stakedAmountUSDN
145151 else 0))
146152
147153 let accountBalanceWithStakedA = (accountBalance(assetIdA) + (if ((assetIdA == USDN))
148154 then stakedAmountUSDN
149155 else 0))
150156
151157 let accountBalanceWithStakedB = (accountBalance(assetIdB) + (if ((assetIdB == USDN))
152158 then stakedAmountUSDN
153159 else 0))
154160
155161 let hasEnoughBalance = if ((accountBalanceWithStakedA >= balanceA))
156162 then (accountBalanceWithStakedB >= balanceB)
157163 else false
158164
159-func skewness (x,y) = (((fraction(scale12, x, y) + fraction(scale12, y, x)) / 2) / 10000)
165+func skewness (x,y) = (((fraction(scaleValue12, x, y) + fraction(scaleValue12, y, x)) / 2) / 10000)
160166
161167
162168 func invariantCalc (x,y) = {
163169 let sk = skewness(x, y)
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)))
170+ (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)))
165171 }
166172
167173
168-func calculateSendAmount (amountToSendEstimated,minTokenReceiveAmount,tokenReceiveAmount,tokenId) = {
169- let slippageValue = (scale8 - ((scale8 * 1) / 10000000))
174+func calculateHowManySendTokenA (amountToSendEstimated,minTokenReceiveAmount,amountTokenA,amountTokenB,tokenReceiveAmount) = {
175+ let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000))
170176 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")
177+ let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaBetweenMaxAndMinSendValue) / 5))
178+ let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaBetweenMaxAndMinSendValue) / 5))
179+ let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaBetweenMaxAndMinSendValue) / 5))
180+ let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaBetweenMaxAndMinSendValue) / 5))
181+ let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaBetweenMaxAndMinSendValue) / 5))
182+ let y = (amountTokenB + tokenReceiveAmount)
183+ let invariantNew = invariantCalc((amountTokenA - amountToSendEstimated), y)
184+ let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
185+ if ((0 >= (invariantCalc((amountTokenA - amountToSendStep5), y) - invariant)))
186+ then throw("minTokenReceiveAmount too large.err1")
229187 else if (if ((invariantEstimatedRatio > slippageValue))
230- then (invariantNew > invariant)
188+ then ((invariantNew - invariant) > 0)
231189 else false)
232190 then amountToSendEstimated
233- else ((stepAmount * (feeScale6 - fee)) / feeScale6)
191+ else if (((invariantCalc((amountTokenA - amountToSendStep1), y) - invariant) > 0))
192+ then ((amountToSendStep1 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
193+ else if (((invariantCalc((amountTokenA - amountToSendStep2), y) - invariant) > 0))
194+ then ((amountToSendStep2 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
195+ else if (((invariantCalc((amountTokenA - amountToSendStep3), y) - invariant) > 0))
196+ then ((amountToSendStep3 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
197+ else if (((invariantCalc((amountTokenA - amountToSendStep4), y) - invariant) > 0))
198+ then ((amountToSendStep4 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
199+ else if (((invariantCalc((amountTokenA - amountToSendStep5), y) - invariant) > 0))
200+ then ((amountToSendStep5 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
201+ else throw("something went wrong while working with amountToSendStep. err2")
202+ }
203+
204+
205+func calculateHowManySendTokenB (amountToSendEstimated,minTokenReceiveAmount,amountTokenA,amountTokenB,tokenReceiveAmount) = {
206+ let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000))
207+ let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenReceiveAmount)
208+ let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaBetweenMaxAndMinSendValue) / 5))
209+ let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaBetweenMaxAndMinSendValue) / 5))
210+ let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaBetweenMaxAndMinSendValue) / 5))
211+ let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaBetweenMaxAndMinSendValue) / 5))
212+ let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaBetweenMaxAndMinSendValue) / 5))
213+ let x = (amountTokenA + tokenReceiveAmount)
214+ let invariantNew = invariantCalc(x, (amountTokenB - amountToSendEstimated))
215+ let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
216+ if ((0 >= (invariantCalc(x, (amountTokenB - amountToSendStep5)) - invariant)))
217+ then throw("minTokenReceiveAmount too large.err1")
218+ else if (if ((invariantEstimatedRatio > slippageValue))
219+ then ((invariantNew - invariant) > 0)
220+ else false)
221+ then amountToSendEstimated
222+ else if (((invariantCalc(x, (amountTokenB - amountToSendStep1)) - invariant) > 0))
223+ then ((amountToSendStep1 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
224+ else if (((invariantCalc(x, (amountTokenB - amountToSendStep2)) - invariant) > 0))
225+ then ((amountToSendStep2 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
226+ else if (((invariantCalc(x, (amountTokenB - amountToSendStep3)) - invariant) > 0))
227+ then ((amountToSendStep3 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
228+ else if (((invariantCalc(x, (amountTokenB - amountToSendStep4)) - invariant) > 0))
229+ then ((amountToSendStep4 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
230+ else if (((invariantCalc(x, (amountTokenB - amountToSendStep5)) - invariant) > 0))
231+ then ((amountToSendStep5 * (commissionScaleDelimiter - commission)) / commissionScaleDelimiter)
232+ else throw("something went wrong while working with amountToSendStep. err2")
234233 }
235234
236235
237236 func getAssetInfo (assetId) = match assetId {
238237 case id: ByteVector =>
239238 let stringId = toBase58String(id)
240239 let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist"))
241240 $Tuple3(stringId, info.name, info.decimals)
242241 case waves: Unit =>
243242 $Tuple3("WAVES", "WAVES", 8)
244243 case _ =>
245244 throw("Match error")
246245 }
247246
248247
249-func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)]
248+func suspend (cause) = [BooleanEntry(keyActive, false), StringEntry(keyCause, cause)]
250249
251250
252251 func deductStakingFee (amount,assetId) = if ((assetId == USDN))
253252 then {
254253 let result = (amount - stakingFeeInUSDN)
255254 if ((0 >= result))
256255 then throw((((("Insufficient amount " + toString(amount)) + " to deduct staking fee ") + toString(stakingFeeInUSDN)) + " USD-N"))
257256 else result
258257 }
259258 else amount
260259
261260
262261 func throwIsActive () = throw("DApp is already active")
263262
264263
265264 func throwIsInactive () = throw("DApp is inactive at this moment")
266265
267266
268267 func throwOnlyAdmin () = throw("Only admin can call this function")
269268
270269
271270 func throwAssets () = throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB))
272271
273272
274273 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))
275274
276275
277276 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"))
278277
279278
280279 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"))
281280
282281
283282 func suspendSuspicious () = suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB) + ". State: ") + toString(accountBalance(assetIdA))) + " ") + assetNameA) + ", ") + toString(accountBalance(assetIdB))) + " ") + assetNameB))
284283
285284
286285 @Callable(i)
287286 func init () = {
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
302- if (isDefined(getBoolean(this, kActive)))
287+ let $t03744437521 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
288+ let pmtAmountA = $t03744437521._1
289+ let pmtAssetIdA = $t03744437521._2
290+ let $t03752637603 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
291+ let pmtAmountB = $t03752637603._1
292+ let pmtAssetIdB = $t03752637603._2
293+ let $t03760837685 = getAssetInfo(pmtAssetIdA)
294+ let pmtStrAssetIdA = $t03760837685._1
295+ let pmtAssetNameA = $t03760837685._2
296+ let pmtDecimalsA = $t03760837685._3
297+ let $t03769037767 = getAssetInfo(pmtAssetIdB)
298+ let pmtStrAssetIdB = $t03769037767._1
299+ let pmtAssetNameB = $t03769037767._2
300+ let pmtDecimalsB = $t03769037767._3
301+ if (isDefined(getBoolean(this, keyActive)))
303302 then throwIsActive()
304303 else if ((pmtAssetIdA == pmtAssetIdB))
305304 then throw("Assets must be different")
306305 else {
307306 let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7))
308307 let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this))
309308 let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2)
310309 let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, HALFDOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, HALFDOWN), pow(10, 0, shareDecimals, 0, 0, HALFDOWN))
311310 let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true)
312311 let shareIssueId = calculateAssetId(shareIssue)
313312 let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB)
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)]
313+[StringEntry(keyVersion, version), BooleanEntry(keyActive, true), StringEntry(keyAssetIdA, pmtStrAssetIdA), StringEntry(keyAssetIdB, pmtStrAssetIdB), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyInvariant, invariantCalculated), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter), shareIssue, StringEntry(keyShareAssetId, toBase58String(shareIssueId)), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)]
315314 }
316315 }
317316
318317
319318
320319 @Callable(i)
321320 func replenishWithTwoTokens (slippageTolerance) = {
322321 let pmtAssetIdA = i.payments[0].assetId
323322 let pmtAssetIdB = i.payments[1].assetId
324323 let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA)
325324 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)
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)
330329 let invariantCalculated = invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB))
331330 if (!(isActive))
332331 then throwIsInactive()
333332 else if (if ((0 > slippageTolerance))
334333 then true
335- else (slippageTolerance > 10))
336- then throw("Slippage tolerance must be <= 1%")
334+ else (slippageTolerance > slippageToleranceDelimiter))
335+ then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance)))
337336 else if ((size(i.payments) != 2))
338337 then throw("Two attached assets expected")
339338 else if (if ((pmtAssetIdA != assetIdA))
340339 then true
341340 else (pmtAssetIdB != assetIdB))
342341 then throwAssets()
343- else if (if ((((scale3 * (slippageScale3 - slippageTolerance)) / slippageScale3) > tokenRatio))
342+ else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio))
344343 then true
345- else (tokenRatio > ((scale3 * (slippageScale3 + slippageTolerance)) / slippageScale3)))
344+ else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter)))
346345 then throw("Incorrect assets amount: amounts must have the contract ratio")
347346 else if ((shareTokenToPayAmount == 0))
348347 then throw("Too small amount to replenish")
349348 else if (!(hasEnoughBalance))
350349 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)]
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)]
352351 }
353352
354353
355354
356355 @Callable(i)
357356 func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = {
358- let $t01315713232 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
359- let pmtAmount = $t01315713232._1
360- let pmtAssetId = $t01315713232._2
357+ let $t04229442369 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
358+ let pmtAmount = $t04229442369._1
359+ let pmtAssetId = $t04229442369._2
361360 let pmtMinThreshold = 5000000
362361 let thresholdValueForMinTolerance = 50000000
363362 let tolerance = if ((thresholdValueForMinTolerance > pmtAmount))
364363 then 100000
365364 else 1
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))
365+ let slippageValueMinForReplenish = (scaleValue8 - ((scaleValue8 * tolerance) / 10000000))
366+ let slippageValueMaxForReplenish = (scaleValue8 + ((scaleValue8 * tolerance) / 10000000))
367+ let slippageValueMinForSwap = (scaleValue8 - ((scaleValue8 * 1) / 10000000))
368+ let slippageValueMaxForSwap = (scaleValue8 + ((scaleValue8 * 1) / 10000000))
370369 if (!(isActive))
371370 then throwIsInactive()
372371 else if ((pmtMinThreshold > pmtAmount))
373372 then throw((((("Payment amount " + toString(pmtAmount)) + " does not exceed the minimum amount of ") + toString(pmtMinThreshold)) + " tokens"))
374373 else if ((size(i.payments) != 1))
375374 then throw("One attached payment expected")
376375 else if (!(hasEnoughBalance))
377376 then suspendSuspicious()
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)
396- let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB)
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))
377+ else if ((pmtAssetId == assetIdA))
378+ then {
379+ let amountVirtualReplenishTokenA = (pmtAmount - virtualSwapTokenPay)
380+ let amountVirtualReplenishTokenB = virtualSwapTokenGet
381+ let balanceAfterVirtualSwapA = (balanceA + virtualSwapTokenPay)
382+ let balanceAfterVirtualSwapB = (balanceB - virtualSwapTokenGet)
383+ let invariantNew = invariantCalc(balanceAfterVirtualSwapA, balanceAfterVirtualSwapB)
384+ let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
385+ if (if ((invariantEstimatedRatio >= slippageValueMinForSwap))
386+ then ((invariantNew - invariant) >= 0)
387+ else false)
388+ then {
389+ let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterVirtualSwapA, (scaleValue8 * scaleValue8), balanceAfterVirtualSwapB) / fraction(amountVirtualReplenishTokenA, scaleValue8, amountVirtualReplenishTokenB))
390+ if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish))
409391 then true
410- else (dAppThresholdAmount > newBalanceB))
411- then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB)
392+ else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish))
393+ then throw("swop with virtualSwapTokenPay and virtualSwapTokenGet possible, but ratio after virtual swap incorrect")
412394 else {
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- }
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)
398+ let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
399+ let shareTokenToPayAmountToDelete = fraction(max([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
400+ 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))
407+ then true
408+ else (dAppThresholdAmount > newAmountTokenB))
409+ then throwThreshold(dAppThresholdAmount, newAmountTokenA, newAmountTokenB)
410+ else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(keyBalanceA, newAmountTokenA), IntegerEntry(keyInvariant, invariantCalculated)]
423411 }
412+ }
413+ else throw("incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
424414 }
425- }
426-
427-
428-
429-@Callable(i)
430-func withdraw () = {
431- let $t01770817851 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
432- let pmtAmount = $t01770817851._1
433- let pmtAssetId = $t01770817851._2
434- let amountToPayA = deductStakingFee(fraction(pmtAmount, balanceA, shareAssetSupply), assetIdA)
435- let amountToPayB = deductStakingFee(fraction(pmtAmount, balanceB, shareAssetSupply), assetIdB)
436- let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB))
437- if (!(isActive))
438- then throwIsInactive()
439- else if ((size(i.payments) != 1))
440- then throw("One attached payment expected")
441- else if ((pmtAssetId != shareAssetId))
442- then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId)))
443- else if (!(hasEnoughBalance))
444- then suspendSuspicious()
445- else if (if ((amountToPayA > availableBalanceA))
446- then true
447- else (amountToPayB > availableBalanceB))
448- then throwInsufficientAvailableBalances(amountToPayA, amountToPayB)
449- 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)]
415+ else if ((pmtAssetId == assetIdB))
416+ then {
417+ let amountVirtualReplenishTokenB = (pmtAmount - virtualSwapTokenPay)
418+ let amountVirtualReplenishTokenA = virtualSwapTokenGet
419+ let balanceAfterVirtualSwapA = (balanceA - virtualSwapTokenGet)
420+ let balanceAfterVirtualSwapB = (balanceB + virtualSwapTokenPay)
421+ let invariantNew = invariantCalc(balanceAfterVirtualSwapA, balanceAfterVirtualSwapB)
422+ let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
423+ if (if ((invariantEstimatedRatio > slippageValueMinForSwap))
424+ then ((invariantNew - invariant) >= 0)
425+ else false)
426+ then {
427+ let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterVirtualSwapA, (scaleValue8 * scaleValue8), balanceAfterVirtualSwapB) / fraction(amountVirtualReplenishTokenA, scaleValue8, amountVirtualReplenishTokenB))
428+ if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish))
429+ then true
430+ else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish))
431+ then throw("swop with virtualSwapTokenPay and virtualSwapTokenGet possible, but ratio after virtual swap incorrect")
432+ else {
433+ let ratioShareTokensInA = fraction(deductStakingFee(amountVirtualReplenishTokenA, assetIdA), scaleValue8, balanceAfterVirtualSwapA)
434+ let ratioShareTokensInB = fraction(deductStakingFee(amountVirtualReplenishTokenB, assetIdB), scaleValue8, balanceAfterVirtualSwapB)
435+ let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
436+ let invariantCalculated = invariantCalc(balanceA, (balanceB + pmtAmount))
437+ let newAmountTokenA = balanceA
438+ let newAmountTokenB = (balanceB + pmtAmount)
439+ let dAppThresholdAmount = fraction((newAmountTokenA + newAmountTokenB), dAppThreshold, (2 * dAppThresholdDelimiter))
440+ if (if ((dAppThresholdAmount > newAmountTokenA))
441+ then true
442+ else (dAppThresholdAmount > newAmountTokenB))
443+ then throwThreshold(dAppThresholdAmount, newAmountTokenA, newAmountTokenB)
444+ else [Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(keyBalanceB, newAmountTokenB), IntegerEntry(keyInvariant, invariantCalculated)]
445+ }
446+ }
447+ else throw("incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
448+ }
449+ else throwAssets()
450450 }
451451
452452
453453
454454 @Callable(i)
455455 func exchange (estimatedAmountToReceive,minAmountToReceive) = {
456- let $t01913419209 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
457- let pmtAmount = $t01913419209._1
458- let pmtAssetId = $t01913419209._2
456+ let $t04992249997 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
457+ let pmtAmount = $t04992249997._1
458+ let pmtAssetId = $t04992249997._2
459459 if (!(isActive))
460460 then throwIsInactive()
461461 else if ((0 >= estimatedAmountToReceive))
462462 then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive)))
463463 else if ((minAmountToReceive > estimatedAmountToReceive))
464464 then throw(((("Minimal amount can't be greater than estimated. Estimated: " + toString(estimatedAmountToReceive)) + ". Minimal: ") + toString(minAmountToReceive)))
465465 else if ((size(i.payments) != 1))
466466 then throw("One attached payment expected")
467467 else if (!(hasEnoughBalance))
468468 then suspendSuspicious()
469- else if (if ((pmtAssetId != assetIdA))
470- then (pmtAssetId != assetIdB)
471- else false)
472- then throwAssets()
473- else if ((10000000 > pmtAmount))
474- then throw("Only swap of 10.000000 or more tokens is allowed")
475- else if (if ((exchangeRatioLimitMin > fraction(scale8, minAmountToReceive, pmtAmount)))
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))
476479 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))
492- if (if ((dAppThresholdAmount > newBalanceA))
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)
493508 then true
494- else (dAppThresholdAmount > newBalanceB))
495- then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB)
496- else if (if (if ((assetIdA == USDN))
497- then (sendAssetId == assetIdA)
509+ else if ((assetIdB == USDN))
510+ then (stakedAmountUSDN >= newAmountTokenB)
498511 else false)
499- then (stakedAmountUSDN >= newBalanceA)
500- else false)
501- then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA)
502- else if (if (if ((assetIdB == USDN))
503- then (sendAssetId == assetIdB)
504- else false)
505- then (stakedAmountUSDN >= newBalanceB)
506- else false)
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)]
509- }
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()
510516 }
511517
512518
513519
514520 @Callable(i)
515-func shutdown () = if (!(isActive))
516- then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified")))
517- else if (!(containsElement([adm1, adm2, adm3, admStartStop], i.callerPublicKey)))
518- then throwOnlyAdmin()
519- else suspend("Paused by admin")
520-
521-
522-
523-@Callable(i)
524-func activate () = if (isActive)
525- then throwIsActive()
526- else if (!(containsElement([adm1, adm2, adm3, admStartStop], i.callerPublicKey)))
527- then throwOnlyAdmin()
528- else [BooleanEntry(kActive, true), DeleteEntry(kCause)]
529-
530-
531-
532-@Callable(i)
533521 func takeIntoAccountExtraFunds (amountLeave) = {
534- let uncountableA = (accountBalanceWithStakedA - balanceA)
535- let uncountableB = (accountBalanceWithStakedB - balanceB)
536- let amountEnrollA = (uncountableA - (if ((assetIdA == USDN))
522+ let uncountableAmountEnrollAssetA = (accountBalanceWithStakedA - balanceA)
523+ let uncountableAmountEnrollAssetB = (accountBalanceWithStakedB - balanceB)
524+ let amountEnrollA = (uncountableAmountEnrollAssetA - (if ((assetIdA == USDN))
537525 then amountLeave
538526 else 0))
539- let amountEnrollB = (uncountableB - (if ((assetIdB == USDN))
527+ let amountEnrollB = (uncountableAmountEnrollAssetB - (if ((assetIdB == USDN))
540528 then amountLeave
541529 else 0))
542530 if (!(isActive))
543531 then throwIsInactive()
544- else if ((i.caller != this))
532+ else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStaking], i.callerPublicKey)))
545533 then throwOnlyAdmin()
546534 else if ((0 > amountLeave))
547535 then throw(("Argument 'amountLeave' cannot be negative. Actual: " + toString(amountLeave)))
548- else if (if ((0 > uncountableA))
536+ else if (if ((0 > uncountableAmountEnrollAssetA))
549537 then true
550- else (0 > uncountableB))
538+ else (0 > uncountableAmountEnrollAssetB))
551539 then suspend("Enroll amount negative")
552540 else if (if ((0 > amountEnrollA))
553541 then true
554542 else (0 > amountEnrollB))
555543 then throw("Too large amountLeave")
556- else [IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)]
544+ else [IntegerEntry(keyBalanceA, (balanceA + amountEnrollA)), IntegerEntry(keyBalanceB, (balanceB + amountEnrollB))]
557545 }
558546
559547

github/deemru/w8io/169f3d6 
111.41 ms