tx · E6PjHUp4FJ81pxrb9HqppkQR1YKcMGZRJPBqP7ctP9H7

3N18bq33YEjzWkoTDhZvc7zd7eRAyv6x4aZ:  -0.01400000 Waves

2021.03.07 17:37 [1427399] smart account 3N18bq33YEjzWkoTDhZvc7zd7eRAyv6x4aZ > SELF 0.00000000 Waves

{ "type": 13, "id": "E6PjHUp4FJ81pxrb9HqppkQR1YKcMGZRJPBqP7ctP9H7", "fee": 1400000, "feeAssetId": null, "timestamp": 1615127896753, "version": 1, "sender": "3N18bq33YEjzWkoTDhZvc7zd7eRAyv6x4aZ", "senderPublicKey": "71DfVUys2KXcuEivd6kRxABvVQKB5k5c48qobMB1DzKN", "proofs": [ "5AQZcnNoHHUDXBA7bVTRX8iXfzp3XgspJAgyYgTFP9Dtu57NKsq41tRUn7TA89EKNAZYCLWLojdxuRxNpaskPiWB" ], "script": "base64:AAIEAAAAAAAAACAIAhIAEgMKAQESBAoCAQESABIECgIBARIAEgASAwoBAQAAAEwAAAAAB3ZlcnNpb24CAAAABTIuMC4wAAAAAAhrVmVyc2lvbgIAAAAHdmVyc2lvbgAAAAAHa0FjdGl2ZQIAAAAGYWN0aXZlAAAAAAlrQXNzZXRJZEECAAAACkFfYXNzZXRfaWQAAAAACWtBc3NldElkQgIAAAAKQl9hc3NldF9pZAAAAAAJa0JhbGFuY2VBAgAAAA9BX2Fzc2V0X2JhbGFuY2UAAAAACWtCYWxhbmNlQgIAAAAPQl9hc3NldF9iYWxhbmNlAAAAAA1rU2hhcmVBc3NldElkAgAAAA5zaGFyZV9hc3NldF9pZAAAAAARa1NoYXJlQXNzZXRTdXBwbHkCAAAAEnNoYXJlX2Fzc2V0X3N1cHBseQAAAAAEa0ZlZQIAAAAKY29tbWlzc2lvbgAAAAASa0ZlZVNjYWxlRGVsaW1pdGVyAgAAABpjb21taXNzaW9uX3NjYWxlX2RlbGltaXRlcgAAAAAOa0ZlZUdvdmVybmFuY2UCAAAAFWNvbW1pc3Npb25fZ292ZXJuYW5jZQAA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W5jZUIJAABkAAAAAgUAAAAIYmFsYW5jZUIFAAAADWFtb3VudEVucm9sbEIJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAMbGFzdF9pbmNvbWVfBQAAAAtzdHJBc3NldElkQQUAAAANYW1vdW50RW5yb2xsQQkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACAgAAAAxsYXN0X2luY29tZV8FAAAAC3N0ckFzc2V0SWRCBQAAAA1hbW91bnRFbnJvbGxCBQAAAANuaWwAAAAApw1N9Q==", "chainId": 84, "height": 1427399, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 98aeRvJUjKgmKMk5c2hYdvZqqkKpQpSeV6mjb163EYhi Next: Hsre9GK5s6k2MVkRvBRVEQHV6jPbi1sUt9ZTrYff7qR9 Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let version = "2.0.0"
55
6-let keyVersion = "version"
6+let kVersion = "version"
77
8-let keyActive = "active"
8+let kActive = "active"
99
10-let keyAssetIdA = "A_asset_id"
10+let kAssetIdA = "A_asset_id"
1111
12-let keyAssetIdB = "B_asset_id"
12+let kAssetIdB = "B_asset_id"
1313
14-let keyBalanceA = "A_asset_balance"
14+let kBalanceA = "A_asset_balance"
1515
16-let keyBalanceB = "B_asset_balance"
16+let kBalanceB = "B_asset_balance"
1717
18-let keyShareAssetId = "share_asset_id"
18+let kShareAssetId = "share_asset_id"
1919
20-let keyShareAssetSupply = "share_asset_supply"
20+let kShareAssetSupply = "share_asset_supply"
2121
22-let keyCommission = "commission"
22+let kFee = "commission"
2323
24-let keyCommissionScaleDelimiter = "commission_scale_delimiter"
24+let kFeeScaleDelimiter = "commission_scale_delimiter"
2525
26-let keyCommissionGovernance = "commission_governance"
26+let kFeeGovernance = "commission_governance"
2727
28-let keyInvariant = "invariant"
28+let kInvariant = "invariant"
2929
30-let keyCause = "shutdown_cause"
30+let kCause = "shutdown_cause"
3131
32-let adminPubKey1 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
32+let adm1 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3333
34-let adminPubKey2 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
34+let adm2 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3535
36-let adminPubKey3 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
36+let adm3 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3737
38-let adminPubKeyStartStop = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
38+let admStartStop = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3939
4040 let adminPubKeyStaking = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
4141
42-let governanceAddress = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp')
42+let govAddr = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp')
4343
4444 let stakingAddress = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp')
4545
4747
4848 let stakingFeeInUSDN = (9 * value(value(assetInfo(USDN)).minSponsoredFee))
4949
50-let isActive = getBooleanValue(this, keyActive)
50+let isActive = getBooleanValue(this, kActive)
5151
52-let strAssetIdA = getStringValue(this, keyAssetIdA)
52+let strAssetIdA = getStringValue(this, kAssetIdA)
5353
54-let strAssetIdB = getStringValue(this, keyAssetIdB)
54+let strAssetIdB = getStringValue(this, kAssetIdB)
5555
5656 let assetIdA = if ((strAssetIdA == "WAVES"))
5757 then unit
7979 throw("Match error")
8080 }
8181
82-let balanceA = getIntegerValue(this, keyBalanceA)
82+let balanceA = getIntegerValue(this, kBalanceA)
8383
84-let balanceB = getIntegerValue(this, keyBalanceB)
84+let balanceB = getIntegerValue(this, kBalanceB)
8585
86-let shareAssetId = fromBase58String(getStringValue(this, keyShareAssetId))
86+let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId))
8787
88-let shareAssetSupply = getIntegerValue(this, keyShareAssetSupply)
88+let shareAssetSupply = getIntegerValue(this, kShareAssetSupply)
8989
90-let invariant = getIntegerValue(this, keyInvariant)
90+let invariant = getIntegerValue(this, kInvariant)
9191
92-let commission = 500
92+let fee = 500
9393
94-let commissionGovernance = 200
94+let feeGovernance = 200
9595
96-let commissionScaleDelimiter = 1000000
96+let feeScaleDelimiter = 1000000
9797
9898 let scaleValue3 = 1000
9999
114114 let ratioThresholdMax = 100000000
115115
116116 let ratioThresholdMin = 99999000
117+
118+let exchangeRatioLimitMin = 90000000
119+
120+let exchangeRatioLimitMax = 110000000
117121
118122 let alpha = 50
119123
171175 }
172176
173177
174-func calculateHowManySendTokenA (amountToSendEstimated,minTokenReceiveAmount,amountTokenA,amountTokenB,tokenReceiveAmount) = {
178+func calculateHowManySendA (amountToSendEstimated,minTokenReceiveAmount,amountA,amountB,tokenReceiveAmount) = {
175179 let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000))
176- let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenReceiveAmount)
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)
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)
184188 let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
185- if ((0 >= (invariantCalc((amountTokenA - amountToSendStep5), y) - invariant)))
186- then throw("minTokenReceiveAmount too large.err1")
189+ if ((0 >= (invariantCalc((amountA - amountToSendStep5), y) - invariant)))
190+ then throw("err1")
187191 else if (if ((invariantEstimatedRatio > slippageValue))
188192 then ((invariantNew - invariant) > 0)
189193 else false)
190194 then amountToSendEstimated
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")
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")
202206 }
203207
204208
205-func calculateHowManySendTokenB (amountToSendEstimated,minTokenReceiveAmount,amountTokenA,amountTokenB,tokenReceiveAmount) = {
209+func calculateHowManySendB (amountToSendEstimated,minTokenReceiveAmount,amountA,amountB,tokenReceiveAmount) = {
206210 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))
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))
215219 let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
216- if ((0 >= (invariantCalc(x, (amountTokenB - amountToSendStep5)) - invariant)))
217- then throw("minTokenReceiveAmount too large.err1")
220+ if ((0 >= (invariantCalc(x, (amountB - amountToSendStep5)) - invariant)))
221+ then throw("err1")
218222 else if (if ((invariantEstimatedRatio > slippageValue))
219223 then ((invariantNew - invariant) > 0)
220224 else false)
221225 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")
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")
233237 }
234238
235239
245249 }
246250
247251
248-func suspend (cause) = [BooleanEntry(keyActive, false), StringEntry(keyCause, cause)]
252+func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)]
249253
250254
251255 func deductStakingFee (amount,assetId) = if ((assetId == USDN))
284288
285289 @Callable(i)
286290 func init () = {
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)))
291+ let $t03696337040 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
292+ let pmtAmountA = $t03696337040._1
293+ let pmtAssetIdA = $t03696337040._2
294+ let $t03704537122 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
295+ let pmtAmountB = $t03704537122._1
296+ let pmtAssetIdB = $t03704537122._2
297+ let $t03712737204 = getAssetInfo(pmtAssetIdA)
298+ let pmtStrAssetIdA = $t03712737204._1
299+ let pmtAssetNameA = $t03712737204._2
300+ let pmtDecimalsA = $t03712737204._3
301+ let $t03720937286 = getAssetInfo(pmtAssetIdB)
302+ let pmtStrAssetIdB = $t03720937286._1
303+ let pmtAssetNameB = $t03720937286._2
304+ let pmtDecimalsB = $t03720937286._3
305+ if (isDefined(getBoolean(this, kActive)))
302306 then throwIsActive()
303307 else if ((pmtAssetIdA == pmtAssetIdB))
304308 then throw("Assets must be different")
310314 let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true)
311315 let shareIssueId = calculateAssetId(shareIssue)
312316 let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB)
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)]
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)]
314318 }
315319 }
316320
317321
318322
319323 @Callable(i)
320-func replenishWithTwoTokens (slippageTolerance) = {
321- let pmtAssetIdA = i.payments[0].assetId
322- let pmtAssetIdB = i.payments[1].assetId
323- let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA)
324- let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB)
325- let tokenRatio = fraction(fraction(balanceA, scaleValue8, pmtAmountA), scaleValue3, fraction(balanceB, scaleValue8, pmtAmountB))
326- let ratioShareTokensInA = fraction(pmtAmountA, scaleValue8, balanceA)
327- let ratioShareTokensInB = fraction(pmtAmountB, scaleValue8, balanceB)
328- let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
329- let invariantCalculated = invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB))
330- if (!(isActive))
331- then throwIsInactive()
332- else if (if ((0 > slippageTolerance))
333- then true
334- else (slippageTolerance > slippageToleranceDelimiter))
335- then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance)))
336- else if ((size(i.payments) != 2))
337- then throw("Two attached assets expected")
338- else if (if ((pmtAssetIdA != assetIdA))
339- then true
340- else (pmtAssetIdB != assetIdB))
341- then throwAssets()
342- else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio))
324+func replenishWithTwoTokens (slippageTolerance) = if ((slippageTolerance > 10))
325+ then throw("slippage tolerance must be <= 1%")
326+ else {
327+ let pmtAssetIdA = i.payments[0].assetId
328+ let pmtAssetIdB = i.payments[1].assetId
329+ let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA)
330+ let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB)
331+ let tokenRatio = fraction(fraction(balanceA, scaleValue8, pmtAmountA), scaleValue3, fraction(balanceB, scaleValue8, pmtAmountB))
332+ let ratioShareTokensInA = fraction(pmtAmountA, scaleValue8, balanceA)
333+ let ratioShareTokensInB = fraction(pmtAmountB, scaleValue8, balanceB)
334+ let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
335+ let invariantCalculated = invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB))
336+ if (!(isActive))
337+ then throwIsInactive()
338+ else if (if ((0 > slippageTolerance))
339+ then true
340+ else (slippageTolerance > slippageToleranceDelimiter))
341+ then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance)))
342+ else if ((size(i.payments) != 2))
343+ then throw("Two attached assets expected")
344+ else if (if ((pmtAssetIdA != assetIdA))
343345 then true
344- else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter)))
345- then throw("Incorrect assets amount: amounts must have the contract ratio")
346- else if ((shareTokenToPayAmount == 0))
347- then throw("Too small amount to replenish")
348- else if (!(hasEnoughBalance))
349- then suspendSuspicious()
350- else [IntegerEntry(keyBalanceA, (balanceA + pmtAmountA)), IntegerEntry(keyBalanceB, (balanceB + pmtAmountB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(keyInvariant, invariantCalculated), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)]
351- }
346+ else (pmtAssetIdB != assetIdB))
347+ then throwAssets()
348+ else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio))
349+ then true
350+ else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter)))
351+ then throw("Incorrect assets amount: amounts must have the contract ratio")
352+ else if ((shareTokenToPayAmount == 0))
353+ then throw("Too small amount to replenish")
354+ else if (!(hasEnoughBalance))
355+ then suspendSuspicious()
356+ else [IntegerEntry(kBalanceA, (balanceA + pmtAmountA)), IntegerEntry(kBalanceB, (balanceB + pmtAmountB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kInvariant, invariantCalculated), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)]
357+ }
352358
353359
354360
355361 @Callable(i)
356362 func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = {
357- let $t04229442369 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
358- let pmtAmount = $t04229442369._1
359- let pmtAssetId = $t04229442369._2
363+ let $t04182841903 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
364+ let pmtAmount = $t04182841903._1
365+ let pmtAssetId = $t04182841903._2
360366 let pmtMinThreshold = 5000000
361367 let thresholdValueForMinTolerance = 50000000
362368 let tolerance = if ((thresholdValueForMinTolerance > pmtAmount))
376382 then suspendSuspicious()
377383 else if ((pmtAssetId == assetIdA))
378384 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)
385+ let virtReplA = (pmtAmount - virtualSwapTokenPay)
386+ let virtReplB = virtualSwapTokenGet
387+ let balanceAfterSwapA = (balanceA + virtualSwapTokenPay)
388+ let balanceAfterSwapB = (balanceB - virtualSwapTokenGet)
389+ let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB)
384390 let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
385- if (if ((invariantEstimatedRatio >= slippageValueMinForSwap))
391+ if (if ((invariantEstimatedRatio > slippageValueMinForSwap))
386392 then ((invariantNew - invariant) >= 0)
387393 else false)
388394 then {
389- let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterVirtualSwapA, (scaleValue8 * scaleValue8), balanceAfterVirtualSwapB) / fraction(amountVirtualReplenishTokenA, scaleValue8, amountVirtualReplenishTokenB))
395+ let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterSwapA, (scaleValue8 * scaleValue8), balanceAfterSwapB) / fraction(virtReplA, scaleValue8, virtReplB))
390396 if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish))
391397 then true
392398 else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish))
393- then throw("swop with virtualSwapTokenPay and virtualSwapTokenGet possible, but ratio after virtual swap incorrect")
399+ then throw("Ratio after virtual swap incorrect")
394400 else {
395- let ratioShareTokensInA = fraction((amountVirtualReplenishTokenA - 270000), scaleValue8, (balanceAfterVirtualSwapA - 270000))
396- let ratioShareTokensInAWithoutCommission = fraction(amountVirtualReplenishTokenA, scaleValue8, balanceAfterVirtualSwapA)
397- let ratioShareTokensInB = fraction(deductStakingFee(amountVirtualReplenishTokenB, assetIdB), scaleValue8, balanceAfterVirtualSwapB)
401+ let ratioShareTokensInA = fraction(deductStakingFee(virtReplA, assetIdA), scaleValue8, balanceAfterSwapA)
402+ let ratioShareTokensInB = fraction(deductStakingFee(virtReplB, assetIdB), scaleValue8, balanceAfterSwapB)
398403 let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
399- let shareTokenToPayAmountToDelete = fraction(max([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
400404 let invariantCalculated = invariantCalc((balanceA + pmtAmount), balanceB)
401- let newAmountTokenA = (balanceA + pmtAmount)
402- let newAmountTokenB = balanceB
403- let xGet = fraction(shareTokenToPayAmount, newAmountTokenA, (shareAssetSupply + shareTokenToPayAmount))
404- let yGet = fraction(shareTokenToPayAmount, newAmountTokenB, (shareAssetSupply + shareTokenToPayAmount))
405- let dAppThresholdAmount = fraction((newAmountTokenA + newAmountTokenB), dAppThreshold, (2 * dAppThresholdDelimiter))
406- if (if ((dAppThresholdAmount > newAmountTokenA))
405+ let newBalanceA = (balanceA + pmtAmount)
406+ let newBalanceB = balanceB
407+ let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter))
408+ if (if ((dAppThresholdAmount > newBalanceA))
407409 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)]
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)]
411413 }
412414 }
413- else throw("incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
415+ else throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
414416 }
415417 else if ((pmtAssetId == assetIdB))
416418 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)
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)
422424 let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
423425 if (if ((invariantEstimatedRatio > slippageValueMinForSwap))
424426 then ((invariantNew - invariant) >= 0)
425427 else false)
426428 then {
427- let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterVirtualSwapA, (scaleValue8 * scaleValue8), balanceAfterVirtualSwapB) / fraction(amountVirtualReplenishTokenA, scaleValue8, amountVirtualReplenishTokenB))
429+ let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterSwapA, (scaleValue8 * scaleValue8), balanceAfterSwapB) / fraction(virtReplA, scaleValue8, virtReplB))
428430 if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish))
429431 then true
430432 else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish))
431- then throw("swop with virtualSwapTokenPay and virtualSwapTokenGet possible, but ratio after virtual swap incorrect")
433+ then throw("Ratio after virtual swap incorrect")
432434 else {
433- let ratioShareTokensInA = fraction(deductStakingFee(amountVirtualReplenishTokenA, assetIdA), scaleValue8, balanceAfterVirtualSwapA)
434- let ratioShareTokensInB = fraction(deductStakingFee(amountVirtualReplenishTokenB, assetIdB), scaleValue8, balanceAfterVirtualSwapB)
435+ let ratioShareTokensInA = fraction(deductStakingFee(virtReplA, assetIdA), scaleValue8, balanceAfterSwapA)
436+ let ratioShareTokensInB = fraction(deductStakingFee(virtReplB, assetIdB), scaleValue8, balanceAfterSwapB)
435437 let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
436438 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))
439+ let newBalanceA = balanceA
440+ let newBalanceB = (balanceB + pmtAmount)
441+ let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter))
442+ if (if ((dAppThresholdAmount > newBalanceA))
441443 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)]
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)]
445447 }
446448 }
447- else throw("incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
449+ else throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
448450 }
449451 else throwAssets()
450452 }
452454
453455
454456 @Callable(i)
455-func exchange (estimatedAmountToReceive,minAmountToReceive) = {
456- let $t04992049995 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
457- let pmtAmount = $t04992049995._1
458- let pmtAssetId = $t04992049995._2
457+func withdraw () = {
458+ let $t04776847911 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
459+ let pmtAmount = $t04776847911._1
460+ let pmtAssetId = $t04776847911._2
461+ let amountToPayA = deductStakingFee(fraction(pmtAmount, balanceA, shareAssetSupply), assetIdA)
462+ let amountToPayB = deductStakingFee(fraction(pmtAmount, balanceB, shareAssetSupply), assetIdB)
463+ let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB))
459464 if (!(isActive))
460465 then throwIsInactive()
461- else if ((0 >= estimatedAmountToReceive))
462- then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive)))
463- else if ((minAmountToReceive > estimatedAmountToReceive))
464- then throw(((("Minimal amount can't be greater than estimated. Estimated: " + toString(estimatedAmountToReceive)) + ". Minimal: ") + toString(minAmountToReceive)))
465- else if ((size(i.payments) != 1))
466- then throw("One attached payment expected")
467- else if (!(hasEnoughBalance))
468- then suspendSuspicious()
469- else if ((pmtAssetId == assetIdA))
470- then {
471- let assetIdSend = assetIdB
472- let amountWithoutFee = calculateHowManySendTokenB(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount)
473- let amountWithFee = fraction(amountWithoutFee, (commissionScaleDelimiter - commission), commissionScaleDelimiter)
474- let governanceReward = fraction(amountWithoutFee, commissionGovernance, commissionScaleDelimiter)
475- let newAmountTokenA = (balanceA + pmtAmount)
476- let newAmountTokenB = ((balanceB - amountWithFee) - governanceReward)
477- let dAppThresholdAmount = fraction((newAmountTokenA + newAmountTokenB), dAppThreshold, (2 * dAppThresholdDelimiter))
478- if (if ((dAppThresholdAmount > newAmountTokenA))
479- then true
480- else (dAppThresholdAmount > newAmountTokenB))
481- then throwThreshold(dAppThresholdAmount, newAmountTokenA, newAmountTokenB)
482- else if (if (if ((assetIdA == USDN))
483- then (stakedAmountUSDN >= newAmountTokenA)
484- else false)
485- then true
486- else if ((assetIdB == USDN))
487- then (stakedAmountUSDN >= newAmountTokenB)
488- else false)
489- then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB)
490- else [IntegerEntry(keyBalanceA, newAmountTokenA), IntegerEntry(keyBalanceB, newAmountTokenB), IntegerEntry(keyInvariant, invariantCalc((balanceA + pmtAmount), ((balanceB - amountWithFee) - governanceReward))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(governanceAddress, governanceReward, assetIdSend)]
491- }
492- else if ((pmtAssetId == assetIdB))
493- then {
494- let assetIdSend = assetIdA
495- let amountWithoutFee = calculateHowManySendTokenA(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount)
496- let amountWithFee = fraction(amountWithoutFee, (commissionScaleDelimiter - commission), commissionScaleDelimiter)
497- let governanceReward = fraction(amountWithoutFee, commissionGovernance, commissionScaleDelimiter)
498- let newAmountTokenA = ((balanceA - amountWithFee) - governanceReward)
499- let newAmountTokenB = (balanceB + pmtAmount)
500- let dAppThresholdAmount = fraction((newAmountTokenA + newAmountTokenB), dAppThreshold, (2 * dAppThresholdDelimiter))
501- if (if ((dAppThresholdAmount > newAmountTokenA))
502- then true
503- else (dAppThresholdAmount > newAmountTokenB))
504- then throwThreshold(dAppThresholdAmount, newAmountTokenA, newAmountTokenB)
505- else if (if (if ((assetIdA == USDN))
506- then (stakedAmountUSDN >= newAmountTokenA)
507- else false)
508- then true
509- else if ((assetIdB == USDN))
510- then (stakedAmountUSDN >= newAmountTokenB)
511- else false)
512- then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA)
513- else [IntegerEntry(keyBalanceA, newAmountTokenA), IntegerEntry(keyBalanceB, newAmountTokenB), IntegerEntry(keyInvariant, invariantCalc(((balanceA - amountWithFee) - governanceReward), (balanceB + pmtAmount))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(governanceAddress, governanceReward, assetIdSend)]
514- }
515- else throwAssets()
466+ else if ((size(i.payments) != 1))
467+ then throw("One attached payment expected")
468+ else if ((pmtAssetId != shareAssetId))
469+ then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId)))
470+ else if (!(hasEnoughBalance))
471+ then suspendSuspicious()
472+ else if (if ((amountToPayA > availableBalanceA))
473+ then true
474+ else (amountToPayB > availableBalanceB))
475+ then throwInsufficientAvailableBalances(amountToPayA, amountToPayB)
476+ else [IntegerEntry(kBalanceA, (balanceA - amountToPayA)), IntegerEntry(kBalanceB, (balanceB - amountToPayB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply - pmtAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, pmtAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)]
516477 }
517478
518479
519480
520481 @Callable(i)
482+func exchange (estimatedAmountToReceive,minAmountToReceive) = {
483+ let $t04919449269 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
484+ let pmtAmount = $t04919449269._1
485+ let pmtAssetId = $t04919449269._2
486+ if (if ((exchangeRatioLimitMin > fraction(minAmountToReceive, scaleValue8, pmtAmount)))
487+ then true
488+ else (fraction(estimatedAmountToReceive, scaleValue8, pmtAmount) > exchangeRatioLimitMax))
489+ then throw("Incorrect args and pmt ratio")
490+ else if (!(isActive))
491+ then throwIsInactive()
492+ else if ((0 >= estimatedAmountToReceive))
493+ then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive)))
494+ else if ((minAmountToReceive > estimatedAmountToReceive))
495+ then throw(((("Minimal amount can't be greater than estimated. Estimated: " + toString(estimatedAmountToReceive)) + ". Minimal: ") + toString(minAmountToReceive)))
496+ else if ((size(i.payments) != 1))
497+ then throw("One attached payment expected")
498+ else if (!(hasEnoughBalance))
499+ then suspendSuspicious()
500+ else if ((10000000 > pmtAmount))
501+ then throw("Only swap of 10.000000 or more tokens is allowed")
502+ else if ((pmtAssetId == assetIdA))
503+ then {
504+ let assetIdSend = assetIdB
505+ let amountWithoutFee = calculateHowManySendB(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount)
506+ let amountWithFee = fraction(amountWithoutFee, (feeScaleDelimiter - fee), feeScaleDelimiter)
507+ let governanceReward = fraction(amountWithoutFee, feeGovernance, feeScaleDelimiter)
508+ let newBalanceA = (balanceA + pmtAmount)
509+ let newBalanceB = ((balanceB - amountWithFee) - governanceReward)
510+ let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter))
511+ if (if ((dAppThresholdAmount > newBalanceA))
512+ then true
513+ else (dAppThresholdAmount > newBalanceB))
514+ then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB)
515+ else if (if (if ((assetIdA == USDN))
516+ then (stakedAmountUSDN >= newBalanceA)
517+ else false)
518+ then true
519+ else if ((assetIdB == USDN))
520+ then (stakedAmountUSDN >= newBalanceB)
521+ else false)
522+ then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB)
523+ else [IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc((balanceA + pmtAmount), ((balanceB - amountWithFee) - governanceReward))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(govAddr, governanceReward, assetIdSend)]
524+ }
525+ else if ((pmtAssetId == assetIdB))
526+ then {
527+ let assetIdSend = assetIdA
528+ let amountWithoutFee = calculateHowManySendA(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount)
529+ let amountWithFee = fraction(amountWithoutFee, (feeScaleDelimiter - fee), feeScaleDelimiter)
530+ let governanceReward = fraction(amountWithoutFee, feeGovernance, feeScaleDelimiter)
531+ let newBalanceA = ((balanceA - amountWithFee) - governanceReward)
532+ let newBalanceB = (balanceB + pmtAmount)
533+ let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter))
534+ if (if ((dAppThresholdAmount > newBalanceA))
535+ then true
536+ else (dAppThresholdAmount > newBalanceB))
537+ then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB)
538+ else if (if (if ((assetIdA == USDN))
539+ then (stakedAmountUSDN >= newBalanceA)
540+ else false)
541+ then true
542+ else if ((assetIdB == USDN))
543+ then (stakedAmountUSDN >= newBalanceB)
544+ else false)
545+ then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA)
546+ else [IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc(((balanceA - amountWithFee) - governanceReward), (balanceB + pmtAmount))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(govAddr, governanceReward, assetIdSend)]
547+ }
548+ else throwAssets()
549+ }
550+
551+
552+
553+@Callable(i)
554+func shutdown () = if (!(isActive))
555+ then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified")))
556+ else if (!(containsElement([adm1, adm2, adm3, admStartStop], i.callerPublicKey)))
557+ then throwOnlyAdmin()
558+ else suspend("Paused by admin")
559+
560+
561+
562+@Callable(i)
563+func activate () = if (isActive)
564+ then throwIsActive()
565+ else if (!(containsElement([adm1, adm2, adm3, admStartStop], i.callerPublicKey)))
566+ then throwOnlyAdmin()
567+ else [BooleanEntry(kActive, true), DeleteEntry(kCause)]
568+
569+
570+
571+@Callable(i)
521572 func takeIntoAccountExtraFunds (amountLeave) = {
522- let uncountableAmountEnrollAssetA = (accountBalanceWithStakedA - balanceA)
523- let uncountableAmountEnrollAssetB = (accountBalanceWithStakedB - balanceB)
524- let amountEnrollA = (uncountableAmountEnrollAssetA - (if ((assetIdA == USDN))
573+ let uncountableA = (accountBalanceWithStakedA - balanceA)
574+ let uncountableB = (accountBalanceWithStakedB - balanceB)
575+ let amountEnrollA = (uncountableA - (if ((assetIdA == USDN))
525576 then amountLeave
526577 else 0))
527- let amountEnrollB = (uncountableAmountEnrollAssetB - (if ((assetIdB == USDN))
578+ let amountEnrollB = (uncountableB - (if ((assetIdB == USDN))
528579 then amountLeave
529580 else 0))
530581 if (!(isActive))
531582 then throwIsInactive()
532- else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStaking], i.callerPublicKey)))
583+ else if ((i.caller != this))
533584 then throwOnlyAdmin()
534585 else if ((0 > amountLeave))
535586 then throw(("Argument 'amountLeave' cannot be negative. Actual: " + toString(amountLeave)))
536- else if (if ((0 > uncountableAmountEnrollAssetA))
587+ else if (if ((0 > uncountableA))
537588 then true
538- else (0 > uncountableAmountEnrollAssetB))
589+ else (0 > uncountableB))
539590 then suspend("Enroll amount negative")
540591 else if (if ((0 > amountEnrollA))
541592 then true
542593 else (0 > amountEnrollB))
543594 then throw("Too large amountLeave")
544- else [IntegerEntry(keyBalanceA, (balanceA + amountEnrollA)), IntegerEntry(keyBalanceB, (balanceB + amountEnrollB))]
595+ else [IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)]
545596 }
546597
547598
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let version = "2.0.0"
55
6-let keyVersion = "version"
6+let kVersion = "version"
77
8-let keyActive = "active"
8+let kActive = "active"
99
10-let keyAssetIdA = "A_asset_id"
10+let kAssetIdA = "A_asset_id"
1111
12-let keyAssetIdB = "B_asset_id"
12+let kAssetIdB = "B_asset_id"
1313
14-let keyBalanceA = "A_asset_balance"
14+let kBalanceA = "A_asset_balance"
1515
16-let keyBalanceB = "B_asset_balance"
16+let kBalanceB = "B_asset_balance"
1717
18-let keyShareAssetId = "share_asset_id"
18+let kShareAssetId = "share_asset_id"
1919
20-let keyShareAssetSupply = "share_asset_supply"
20+let kShareAssetSupply = "share_asset_supply"
2121
22-let keyCommission = "commission"
22+let kFee = "commission"
2323
24-let keyCommissionScaleDelimiter = "commission_scale_delimiter"
24+let kFeeScaleDelimiter = "commission_scale_delimiter"
2525
26-let keyCommissionGovernance = "commission_governance"
26+let kFeeGovernance = "commission_governance"
2727
28-let keyInvariant = "invariant"
28+let kInvariant = "invariant"
2929
30-let keyCause = "shutdown_cause"
30+let kCause = "shutdown_cause"
3131
32-let adminPubKey1 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
32+let adm1 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3333
34-let adminPubKey2 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
34+let adm2 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3535
36-let adminPubKey3 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
36+let adm3 = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3737
38-let adminPubKeyStartStop = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
38+let admStartStop = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
3939
4040 let adminPubKeyStaking = base58'7FhFLst7Htn4uYxGH7xYMTAmbydLVoiZef3eFghi7CG4'
4141
42-let governanceAddress = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp')
42+let govAddr = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp')
4343
4444 let stakingAddress = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp')
4545
4646 let USDN = base58'3FUNGbzfNsQ1AZfvumCUqARXvpjjLQrvCzorYuDryQAq'
4747
4848 let stakingFeeInUSDN = (9 * value(value(assetInfo(USDN)).minSponsoredFee))
4949
50-let isActive = getBooleanValue(this, keyActive)
50+let isActive = getBooleanValue(this, kActive)
5151
52-let strAssetIdA = getStringValue(this, keyAssetIdA)
52+let strAssetIdA = getStringValue(this, kAssetIdA)
5353
54-let strAssetIdB = getStringValue(this, keyAssetIdB)
54+let strAssetIdB = getStringValue(this, kAssetIdB)
5555
5656 let assetIdA = if ((strAssetIdA == "WAVES"))
5757 then unit
5858 else fromBase58String(strAssetIdA)
5959
6060 let assetIdB = if ((strAssetIdB == "WAVES"))
6161 then unit
6262 else fromBase58String(strAssetIdB)
6363
6464 let assetNameA = match assetIdA {
6565 case id: ByteVector =>
6666 value(assetInfo(id)).name
6767 case waves: Unit =>
6868 "WAVES"
6969 case _ =>
7070 throw("Match error")
7171 }
7272
7373 let assetNameB = match assetIdB {
7474 case id: ByteVector =>
7575 value(assetInfo(id)).name
7676 case waves: Unit =>
7777 "WAVES"
7878 case _ =>
7979 throw("Match error")
8080 }
8181
82-let balanceA = getIntegerValue(this, keyBalanceA)
82+let balanceA = getIntegerValue(this, kBalanceA)
8383
84-let balanceB = getIntegerValue(this, keyBalanceB)
84+let balanceB = getIntegerValue(this, kBalanceB)
8585
86-let shareAssetId = fromBase58String(getStringValue(this, keyShareAssetId))
86+let shareAssetId = fromBase58String(getStringValue(this, kShareAssetId))
8787
88-let shareAssetSupply = getIntegerValue(this, keyShareAssetSupply)
88+let shareAssetSupply = getIntegerValue(this, kShareAssetSupply)
8989
90-let invariant = getIntegerValue(this, keyInvariant)
90+let invariant = getIntegerValue(this, kInvariant)
9191
92-let commission = 500
92+let fee = 500
9393
94-let commissionGovernance = 200
94+let feeGovernance = 200
9595
96-let commissionScaleDelimiter = 1000000
96+let feeScaleDelimiter = 1000000
9797
9898 let scaleValue3 = 1000
9999
100100 let scaleValue8 = 100000000
101101
102102 let scaleValue12 = 1000000000000
103103
104104 let slippageToleranceDelimiter = 1000
105105
106106 let scaleValue8Digits = 8
107107
108108 let scaleValue12Digits = 12
109109
110110 let dAppThreshold = 50
111111
112112 let dAppThresholdDelimiter = 100
113113
114114 let ratioThresholdMax = 100000000
115115
116116 let ratioThresholdMin = 99999000
117+
118+let exchangeRatioLimitMin = 90000000
119+
120+let exchangeRatioLimitMax = 110000000
117121
118122 let alpha = 50
119123
120124 let alphaDigits = 2
121125
122126 let beta = 46000000
123127
124128 let betaDigits = 8
125129
126130 func accountBalance (assetId) = match assetId {
127131 case id: ByteVector =>
128132 assetBalance(this, id)
129133 case waves: Unit =>
130134 wavesBalance(this).available
131135 case _ =>
132136 throw("Match error")
133137 }
134138
135139
136140 let stakedAmountUSDN = match getInteger(stakingAddress, ((("rpd_balance_" + toBase58String(USDN)) + "_") + toString(this))) {
137141 case staked: Int =>
138142 staked
139143 case nothing: Unit =>
140144 0
141145 case _ =>
142146 throw("Match error")
143147 }
144148
145149 let availableBalanceA = (balanceA - (if ((assetIdA == USDN))
146150 then stakedAmountUSDN
147151 else 0))
148152
149153 let availableBalanceB = (balanceB - (if ((assetIdB == USDN))
150154 then stakedAmountUSDN
151155 else 0))
152156
153157 let accountBalanceWithStakedA = (accountBalance(assetIdA) + (if ((assetIdA == USDN))
154158 then stakedAmountUSDN
155159 else 0))
156160
157161 let accountBalanceWithStakedB = (accountBalance(assetIdB) + (if ((assetIdB == USDN))
158162 then stakedAmountUSDN
159163 else 0))
160164
161165 let hasEnoughBalance = if ((accountBalanceWithStakedA >= balanceA))
162166 then (accountBalanceWithStakedB >= balanceB)
163167 else false
164168
165169 func skewness (x,y) = (((fraction(scaleValue12, x, y) + fraction(scaleValue12, y, x)) / 2) / 10000)
166170
167171
168172 func invariantCalc (x,y) = {
169173 let sk = skewness(x, y)
170174 (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)))
171175 }
172176
173177
174-func calculateHowManySendTokenA (amountToSendEstimated,minTokenReceiveAmount,amountTokenA,amountTokenB,tokenReceiveAmount) = {
178+func calculateHowManySendA (amountToSendEstimated,minTokenReceiveAmount,amountA,amountB,tokenReceiveAmount) = {
175179 let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000))
176- let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenReceiveAmount)
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)
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)
184188 let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
185- if ((0 >= (invariantCalc((amountTokenA - amountToSendStep5), y) - invariant)))
186- then throw("minTokenReceiveAmount too large.err1")
189+ if ((0 >= (invariantCalc((amountA - amountToSendStep5), y) - invariant)))
190+ then throw("err1")
187191 else if (if ((invariantEstimatedRatio > slippageValue))
188192 then ((invariantNew - invariant) > 0)
189193 else false)
190194 then amountToSendEstimated
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")
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")
202206 }
203207
204208
205-func calculateHowManySendTokenB (amountToSendEstimated,minTokenReceiveAmount,amountTokenA,amountTokenB,tokenReceiveAmount) = {
209+func calculateHowManySendB (amountToSendEstimated,minTokenReceiveAmount,amountA,amountB,tokenReceiveAmount) = {
206210 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))
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))
215219 let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
216- if ((0 >= (invariantCalc(x, (amountTokenB - amountToSendStep5)) - invariant)))
217- then throw("minTokenReceiveAmount too large.err1")
220+ if ((0 >= (invariantCalc(x, (amountB - amountToSendStep5)) - invariant)))
221+ then throw("err1")
218222 else if (if ((invariantEstimatedRatio > slippageValue))
219223 then ((invariantNew - invariant) > 0)
220224 else false)
221225 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")
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")
233237 }
234238
235239
236240 func getAssetInfo (assetId) = match assetId {
237241 case id: ByteVector =>
238242 let stringId = toBase58String(id)
239243 let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist"))
240244 $Tuple3(stringId, info.name, info.decimals)
241245 case waves: Unit =>
242246 $Tuple3("WAVES", "WAVES", 8)
243247 case _ =>
244248 throw("Match error")
245249 }
246250
247251
248-func suspend (cause) = [BooleanEntry(keyActive, false), StringEntry(keyCause, cause)]
252+func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)]
249253
250254
251255 func deductStakingFee (amount,assetId) = if ((assetId == USDN))
252256 then {
253257 let result = (amount - stakingFeeInUSDN)
254258 if ((0 >= result))
255259 then throw((((("Insufficient amount " + toString(amount)) + " to deduct staking fee ") + toString(stakingFeeInUSDN)) + " USD-N"))
256260 else result
257261 }
258262 else amount
259263
260264
261265 func throwIsActive () = throw("DApp is already active")
262266
263267
264268 func throwIsInactive () = throw("DApp is inactive at this moment")
265269
266270
267271 func throwOnlyAdmin () = throw("Only admin can call this function")
268272
269273
270274 func throwAssets () = throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB))
271275
272276
273277 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))
274278
275279
276280 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"))
277281
278282
279283 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"))
280284
281285
282286 func suspendSuspicious () = suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB) + ". State: ") + toString(accountBalance(assetIdA))) + " ") + assetNameA) + ", ") + toString(accountBalance(assetIdB))) + " ") + assetNameB))
283287
284288
285289 @Callable(i)
286290 func init () = {
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)))
291+ let $t03696337040 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
292+ let pmtAmountA = $t03696337040._1
293+ let pmtAssetIdA = $t03696337040._2
294+ let $t03704537122 = $Tuple2(i.payments[1].amount, i.payments[1].assetId)
295+ let pmtAmountB = $t03704537122._1
296+ let pmtAssetIdB = $t03704537122._2
297+ let $t03712737204 = getAssetInfo(pmtAssetIdA)
298+ let pmtStrAssetIdA = $t03712737204._1
299+ let pmtAssetNameA = $t03712737204._2
300+ let pmtDecimalsA = $t03712737204._3
301+ let $t03720937286 = getAssetInfo(pmtAssetIdB)
302+ let pmtStrAssetIdB = $t03720937286._1
303+ let pmtAssetNameB = $t03720937286._2
304+ let pmtDecimalsB = $t03720937286._3
305+ if (isDefined(getBoolean(this, kActive)))
302306 then throwIsActive()
303307 else if ((pmtAssetIdA == pmtAssetIdB))
304308 then throw("Assets must be different")
305309 else {
306310 let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7))
307311 let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this))
308312 let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2)
309313 let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, HALFDOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, HALFDOWN), pow(10, 0, shareDecimals, 0, 0, HALFDOWN))
310314 let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true)
311315 let shareIssueId = calculateAssetId(shareIssue)
312316 let invariantCalculated = invariantCalc(pmtAmountA, pmtAmountB)
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)]
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)]
314318 }
315319 }
316320
317321
318322
319323 @Callable(i)
320-func replenishWithTwoTokens (slippageTolerance) = {
321- let pmtAssetIdA = i.payments[0].assetId
322- let pmtAssetIdB = i.payments[1].assetId
323- let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA)
324- let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB)
325- let tokenRatio = fraction(fraction(balanceA, scaleValue8, pmtAmountA), scaleValue3, fraction(balanceB, scaleValue8, pmtAmountB))
326- let ratioShareTokensInA = fraction(pmtAmountA, scaleValue8, balanceA)
327- let ratioShareTokensInB = fraction(pmtAmountB, scaleValue8, balanceB)
328- let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
329- let invariantCalculated = invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB))
330- if (!(isActive))
331- then throwIsInactive()
332- else if (if ((0 > slippageTolerance))
333- then true
334- else (slippageTolerance > slippageToleranceDelimiter))
335- then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance)))
336- else if ((size(i.payments) != 2))
337- then throw("Two attached assets expected")
338- else if (if ((pmtAssetIdA != assetIdA))
339- then true
340- else (pmtAssetIdB != assetIdB))
341- then throwAssets()
342- else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio))
324+func replenishWithTwoTokens (slippageTolerance) = if ((slippageTolerance > 10))
325+ then throw("slippage tolerance must be <= 1%")
326+ else {
327+ let pmtAssetIdA = i.payments[0].assetId
328+ let pmtAssetIdB = i.payments[1].assetId
329+ let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA)
330+ let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB)
331+ let tokenRatio = fraction(fraction(balanceA, scaleValue8, pmtAmountA), scaleValue3, fraction(balanceB, scaleValue8, pmtAmountB))
332+ let ratioShareTokensInA = fraction(pmtAmountA, scaleValue8, balanceA)
333+ let ratioShareTokensInB = fraction(pmtAmountB, scaleValue8, balanceB)
334+ let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
335+ let invariantCalculated = invariantCalc((balanceA + pmtAmountA), (balanceB + pmtAmountB))
336+ if (!(isActive))
337+ then throwIsInactive()
338+ else if (if ((0 > slippageTolerance))
339+ then true
340+ else (slippageTolerance > slippageToleranceDelimiter))
341+ then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance)))
342+ else if ((size(i.payments) != 2))
343+ then throw("Two attached assets expected")
344+ else if (if ((pmtAssetIdA != assetIdA))
343345 then true
344- else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter)))
345- then throw("Incorrect assets amount: amounts must have the contract ratio")
346- else if ((shareTokenToPayAmount == 0))
347- then throw("Too small amount to replenish")
348- else if (!(hasEnoughBalance))
349- then suspendSuspicious()
350- else [IntegerEntry(keyBalanceA, (balanceA + pmtAmountA)), IntegerEntry(keyBalanceB, (balanceB + pmtAmountB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(keyInvariant, invariantCalculated), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)]
351- }
346+ else (pmtAssetIdB != assetIdB))
347+ then throwAssets()
348+ else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio))
349+ then true
350+ else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter)))
351+ then throw("Incorrect assets amount: amounts must have the contract ratio")
352+ else if ((shareTokenToPayAmount == 0))
353+ then throw("Too small amount to replenish")
354+ else if (!(hasEnoughBalance))
355+ then suspendSuspicious()
356+ else [IntegerEntry(kBalanceA, (balanceA + pmtAmountA)), IntegerEntry(kBalanceB, (balanceB + pmtAmountB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), IntegerEntry(kInvariant, invariantCalculated), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)]
357+ }
352358
353359
354360
355361 @Callable(i)
356362 func replenishWithOneToken (virtualSwapTokenPay,virtualSwapTokenGet) = {
357- let $t04229442369 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
358- let pmtAmount = $t04229442369._1
359- let pmtAssetId = $t04229442369._2
363+ let $t04182841903 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
364+ let pmtAmount = $t04182841903._1
365+ let pmtAssetId = $t04182841903._2
360366 let pmtMinThreshold = 5000000
361367 let thresholdValueForMinTolerance = 50000000
362368 let tolerance = if ((thresholdValueForMinTolerance > pmtAmount))
363369 then 100000
364370 else 1
365371 let slippageValueMinForReplenish = (scaleValue8 - ((scaleValue8 * tolerance) / 10000000))
366372 let slippageValueMaxForReplenish = (scaleValue8 + ((scaleValue8 * tolerance) / 10000000))
367373 let slippageValueMinForSwap = (scaleValue8 - ((scaleValue8 * 1) / 10000000))
368374 let slippageValueMaxForSwap = (scaleValue8 + ((scaleValue8 * 1) / 10000000))
369375 if (!(isActive))
370376 then throwIsInactive()
371377 else if ((pmtMinThreshold > pmtAmount))
372378 then throw((((("Payment amount " + toString(pmtAmount)) + " does not exceed the minimum amount of ") + toString(pmtMinThreshold)) + " tokens"))
373379 else if ((size(i.payments) != 1))
374380 then throw("One attached payment expected")
375381 else if (!(hasEnoughBalance))
376382 then suspendSuspicious()
377383 else if ((pmtAssetId == assetIdA))
378384 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)
385+ let virtReplA = (pmtAmount - virtualSwapTokenPay)
386+ let virtReplB = virtualSwapTokenGet
387+ let balanceAfterSwapA = (balanceA + virtualSwapTokenPay)
388+ let balanceAfterSwapB = (balanceB - virtualSwapTokenGet)
389+ let invariantNew = invariantCalc(balanceAfterSwapA, balanceAfterSwapB)
384390 let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
385- if (if ((invariantEstimatedRatio >= slippageValueMinForSwap))
391+ if (if ((invariantEstimatedRatio > slippageValueMinForSwap))
386392 then ((invariantNew - invariant) >= 0)
387393 else false)
388394 then {
389- let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterVirtualSwapA, (scaleValue8 * scaleValue8), balanceAfterVirtualSwapB) / fraction(amountVirtualReplenishTokenA, scaleValue8, amountVirtualReplenishTokenB))
395+ let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterSwapA, (scaleValue8 * scaleValue8), balanceAfterSwapB) / fraction(virtReplA, scaleValue8, virtReplB))
390396 if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish))
391397 then true
392398 else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish))
393- then throw("swop with virtualSwapTokenPay and virtualSwapTokenGet possible, but ratio after virtual swap incorrect")
399+ then throw("Ratio after virtual swap incorrect")
394400 else {
395- let ratioShareTokensInA = fraction((amountVirtualReplenishTokenA - 270000), scaleValue8, (balanceAfterVirtualSwapA - 270000))
396- let ratioShareTokensInAWithoutCommission = fraction(amountVirtualReplenishTokenA, scaleValue8, balanceAfterVirtualSwapA)
397- let ratioShareTokensInB = fraction(deductStakingFee(amountVirtualReplenishTokenB, assetIdB), scaleValue8, balanceAfterVirtualSwapB)
401+ let ratioShareTokensInA = fraction(deductStakingFee(virtReplA, assetIdA), scaleValue8, balanceAfterSwapA)
402+ let ratioShareTokensInB = fraction(deductStakingFee(virtReplB, assetIdB), scaleValue8, balanceAfterSwapB)
398403 let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
399- let shareTokenToPayAmountToDelete = fraction(max([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
400404 let invariantCalculated = invariantCalc((balanceA + pmtAmount), balanceB)
401- let newAmountTokenA = (balanceA + pmtAmount)
402- let newAmountTokenB = balanceB
403- let xGet = fraction(shareTokenToPayAmount, newAmountTokenA, (shareAssetSupply + shareTokenToPayAmount))
404- let yGet = fraction(shareTokenToPayAmount, newAmountTokenB, (shareAssetSupply + shareTokenToPayAmount))
405- let dAppThresholdAmount = fraction((newAmountTokenA + newAmountTokenB), dAppThreshold, (2 * dAppThresholdDelimiter))
406- if (if ((dAppThresholdAmount > newAmountTokenA))
405+ let newBalanceA = (balanceA + pmtAmount)
406+ let newBalanceB = balanceB
407+ let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter))
408+ if (if ((dAppThresholdAmount > newBalanceA))
407409 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)]
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)]
411413 }
412414 }
413- else throw("incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
415+ else throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
414416 }
415417 else if ((pmtAssetId == assetIdB))
416418 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)
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)
422424 let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantNew)
423425 if (if ((invariantEstimatedRatio > slippageValueMinForSwap))
424426 then ((invariantNew - invariant) >= 0)
425427 else false)
426428 then {
427- let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterVirtualSwapA, (scaleValue8 * scaleValue8), balanceAfterVirtualSwapB) / fraction(amountVirtualReplenishTokenA, scaleValue8, amountVirtualReplenishTokenB))
429+ let ratioVirtualBalanceToVirtualReplenish = (fraction(balanceAfterSwapA, (scaleValue8 * scaleValue8), balanceAfterSwapB) / fraction(virtReplA, scaleValue8, virtReplB))
428430 if (if ((slippageValueMinForReplenish > ratioVirtualBalanceToVirtualReplenish))
429431 then true
430432 else (ratioVirtualBalanceToVirtualReplenish > slippageValueMaxForReplenish))
431- then throw("swop with virtualSwapTokenPay and virtualSwapTokenGet possible, but ratio after virtual swap incorrect")
433+ then throw("Ratio after virtual swap incorrect")
432434 else {
433- let ratioShareTokensInA = fraction(deductStakingFee(amountVirtualReplenishTokenA, assetIdA), scaleValue8, balanceAfterVirtualSwapA)
434- let ratioShareTokensInB = fraction(deductStakingFee(amountVirtualReplenishTokenB, assetIdB), scaleValue8, balanceAfterVirtualSwapB)
435+ let ratioShareTokensInA = fraction(deductStakingFee(virtReplA, assetIdA), scaleValue8, balanceAfterSwapA)
436+ let ratioShareTokensInB = fraction(deductStakingFee(virtReplB, assetIdB), scaleValue8, balanceAfterSwapB)
435437 let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8)
436438 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))
439+ let newBalanceA = balanceA
440+ let newBalanceB = (balanceB + pmtAmount)
441+ let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter))
442+ if (if ((dAppThresholdAmount > newBalanceA))
441443 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)]
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)]
445447 }
446448 }
447- else throw("incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
449+ else throw("Incorrect virtualSwapTokenPay or virtualSwapTokenGet value")
448450 }
449451 else throwAssets()
450452 }
451453
452454
453455
454456 @Callable(i)
455-func exchange (estimatedAmountToReceive,minAmountToReceive) = {
456- let $t04992049995 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
457- let pmtAmount = $t04992049995._1
458- let pmtAssetId = $t04992049995._2
457+func withdraw () = {
458+ let $t04776847911 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
459+ let pmtAmount = $t04776847911._1
460+ let pmtAssetId = $t04776847911._2
461+ let amountToPayA = deductStakingFee(fraction(pmtAmount, balanceA, shareAssetSupply), assetIdA)
462+ let amountToPayB = deductStakingFee(fraction(pmtAmount, balanceB, shareAssetSupply), assetIdB)
463+ let invariantCalculated = invariantCalc((balanceA - amountToPayA), (balanceB - amountToPayB))
459464 if (!(isActive))
460465 then throwIsInactive()
461- else if ((0 >= estimatedAmountToReceive))
462- then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive)))
463- else if ((minAmountToReceive > estimatedAmountToReceive))
464- then throw(((("Minimal amount can't be greater than estimated. Estimated: " + toString(estimatedAmountToReceive)) + ". Minimal: ") + toString(minAmountToReceive)))
465- else if ((size(i.payments) != 1))
466- then throw("One attached payment expected")
467- else if (!(hasEnoughBalance))
468- then suspendSuspicious()
469- else if ((pmtAssetId == assetIdA))
470- then {
471- let assetIdSend = assetIdB
472- let amountWithoutFee = calculateHowManySendTokenB(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount)
473- let amountWithFee = fraction(amountWithoutFee, (commissionScaleDelimiter - commission), commissionScaleDelimiter)
474- let governanceReward = fraction(amountWithoutFee, commissionGovernance, commissionScaleDelimiter)
475- let newAmountTokenA = (balanceA + pmtAmount)
476- let newAmountTokenB = ((balanceB - amountWithFee) - governanceReward)
477- let dAppThresholdAmount = fraction((newAmountTokenA + newAmountTokenB), dAppThreshold, (2 * dAppThresholdDelimiter))
478- if (if ((dAppThresholdAmount > newAmountTokenA))
479- then true
480- else (dAppThresholdAmount > newAmountTokenB))
481- then throwThreshold(dAppThresholdAmount, newAmountTokenA, newAmountTokenB)
482- else if (if (if ((assetIdA == USDN))
483- then (stakedAmountUSDN >= newAmountTokenA)
484- else false)
485- then true
486- else if ((assetIdB == USDN))
487- then (stakedAmountUSDN >= newAmountTokenB)
488- else false)
489- then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB)
490- else [IntegerEntry(keyBalanceA, newAmountTokenA), IntegerEntry(keyBalanceB, newAmountTokenB), IntegerEntry(keyInvariant, invariantCalc((balanceA + pmtAmount), ((balanceB - amountWithFee) - governanceReward))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(governanceAddress, governanceReward, assetIdSend)]
491- }
492- else if ((pmtAssetId == assetIdB))
493- then {
494- let assetIdSend = assetIdA
495- let amountWithoutFee = calculateHowManySendTokenA(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount)
496- let amountWithFee = fraction(amountWithoutFee, (commissionScaleDelimiter - commission), commissionScaleDelimiter)
497- let governanceReward = fraction(amountWithoutFee, commissionGovernance, commissionScaleDelimiter)
498- let newAmountTokenA = ((balanceA - amountWithFee) - governanceReward)
499- let newAmountTokenB = (balanceB + pmtAmount)
500- let dAppThresholdAmount = fraction((newAmountTokenA + newAmountTokenB), dAppThreshold, (2 * dAppThresholdDelimiter))
501- if (if ((dAppThresholdAmount > newAmountTokenA))
502- then true
503- else (dAppThresholdAmount > newAmountTokenB))
504- then throwThreshold(dAppThresholdAmount, newAmountTokenA, newAmountTokenB)
505- else if (if (if ((assetIdA == USDN))
506- then (stakedAmountUSDN >= newAmountTokenA)
507- else false)
508- then true
509- else if ((assetIdB == USDN))
510- then (stakedAmountUSDN >= newAmountTokenB)
511- else false)
512- then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA)
513- else [IntegerEntry(keyBalanceA, newAmountTokenA), IntegerEntry(keyBalanceB, newAmountTokenB), IntegerEntry(keyInvariant, invariantCalc(((balanceA - amountWithFee) - governanceReward), (balanceB + pmtAmount))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(governanceAddress, governanceReward, assetIdSend)]
514- }
515- else throwAssets()
466+ else if ((size(i.payments) != 1))
467+ then throw("One attached payment expected")
468+ else if ((pmtAssetId != shareAssetId))
469+ then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId)))
470+ else if (!(hasEnoughBalance))
471+ then suspendSuspicious()
472+ else if (if ((amountToPayA > availableBalanceA))
473+ then true
474+ else (amountToPayB > availableBalanceB))
475+ then throwInsufficientAvailableBalances(amountToPayA, amountToPayB)
476+ else [IntegerEntry(kBalanceA, (balanceA - amountToPayA)), IntegerEntry(kBalanceB, (balanceB - amountToPayB)), IntegerEntry(kShareAssetSupply, (shareAssetSupply - pmtAmount)), IntegerEntry(kInvariant, invariantCalculated), Burn(shareAssetId, pmtAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)]
516477 }
517478
518479
519480
520481 @Callable(i)
482+func exchange (estimatedAmountToReceive,minAmountToReceive) = {
483+ let $t04919449269 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
484+ let pmtAmount = $t04919449269._1
485+ let pmtAssetId = $t04919449269._2
486+ if (if ((exchangeRatioLimitMin > fraction(minAmountToReceive, scaleValue8, pmtAmount)))
487+ then true
488+ else (fraction(estimatedAmountToReceive, scaleValue8, pmtAmount) > exchangeRatioLimitMax))
489+ then throw("Incorrect args and pmt ratio")
490+ else if (!(isActive))
491+ then throwIsInactive()
492+ else if ((0 >= estimatedAmountToReceive))
493+ then throw(("Estimated amount must be positive. Actual: " + toString(estimatedAmountToReceive)))
494+ else if ((minAmountToReceive > estimatedAmountToReceive))
495+ then throw(((("Minimal amount can't be greater than estimated. Estimated: " + toString(estimatedAmountToReceive)) + ". Minimal: ") + toString(minAmountToReceive)))
496+ else if ((size(i.payments) != 1))
497+ then throw("One attached payment expected")
498+ else if (!(hasEnoughBalance))
499+ then suspendSuspicious()
500+ else if ((10000000 > pmtAmount))
501+ then throw("Only swap of 10.000000 or more tokens is allowed")
502+ else if ((pmtAssetId == assetIdA))
503+ then {
504+ let assetIdSend = assetIdB
505+ let amountWithoutFee = calculateHowManySendB(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount)
506+ let amountWithFee = fraction(amountWithoutFee, (feeScaleDelimiter - fee), feeScaleDelimiter)
507+ let governanceReward = fraction(amountWithoutFee, feeGovernance, feeScaleDelimiter)
508+ let newBalanceA = (balanceA + pmtAmount)
509+ let newBalanceB = ((balanceB - amountWithFee) - governanceReward)
510+ let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter))
511+ if (if ((dAppThresholdAmount > newBalanceA))
512+ then true
513+ else (dAppThresholdAmount > newBalanceB))
514+ then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB)
515+ else if (if (if ((assetIdA == USDN))
516+ then (stakedAmountUSDN >= newBalanceA)
517+ else false)
518+ then true
519+ else if ((assetIdB == USDN))
520+ then (stakedAmountUSDN >= newBalanceB)
521+ else false)
522+ then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB)
523+ else [IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc((balanceA + pmtAmount), ((balanceB - amountWithFee) - governanceReward))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(govAddr, governanceReward, assetIdSend)]
524+ }
525+ else if ((pmtAssetId == assetIdB))
526+ then {
527+ let assetIdSend = assetIdA
528+ let amountWithoutFee = calculateHowManySendA(estimatedAmountToReceive, minAmountToReceive, balanceA, balanceB, pmtAmount)
529+ let amountWithFee = fraction(amountWithoutFee, (feeScaleDelimiter - fee), feeScaleDelimiter)
530+ let governanceReward = fraction(amountWithoutFee, feeGovernance, feeScaleDelimiter)
531+ let newBalanceA = ((balanceA - amountWithFee) - governanceReward)
532+ let newBalanceB = (balanceB + pmtAmount)
533+ let dAppThresholdAmount = fraction((newBalanceA + newBalanceB), dAppThreshold, (2 * dAppThresholdDelimiter))
534+ if (if ((dAppThresholdAmount > newBalanceA))
535+ then true
536+ else (dAppThresholdAmount > newBalanceB))
537+ then throwThreshold(dAppThresholdAmount, newBalanceA, newBalanceB)
538+ else if (if (if ((assetIdA == USDN))
539+ then (stakedAmountUSDN >= newBalanceA)
540+ else false)
541+ then true
542+ else if ((assetIdB == USDN))
543+ then (stakedAmountUSDN >= newBalanceB)
544+ else false)
545+ then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA)
546+ else [IntegerEntry(kBalanceA, newBalanceA), IntegerEntry(kBalanceB, newBalanceB), IntegerEntry(kInvariant, invariantCalc(((balanceA - amountWithFee) - governanceReward), (balanceB + pmtAmount))), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(govAddr, governanceReward, assetIdSend)]
547+ }
548+ else throwAssets()
549+ }
550+
551+
552+
553+@Callable(i)
554+func shutdown () = if (!(isActive))
555+ then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified")))
556+ else if (!(containsElement([adm1, adm2, adm3, admStartStop], i.callerPublicKey)))
557+ then throwOnlyAdmin()
558+ else suspend("Paused by admin")
559+
560+
561+
562+@Callable(i)
563+func activate () = if (isActive)
564+ then throwIsActive()
565+ else if (!(containsElement([adm1, adm2, adm3, admStartStop], i.callerPublicKey)))
566+ then throwOnlyAdmin()
567+ else [BooleanEntry(kActive, true), DeleteEntry(kCause)]
568+
569+
570+
571+@Callable(i)
521572 func takeIntoAccountExtraFunds (amountLeave) = {
522- let uncountableAmountEnrollAssetA = (accountBalanceWithStakedA - balanceA)
523- let uncountableAmountEnrollAssetB = (accountBalanceWithStakedB - balanceB)
524- let amountEnrollA = (uncountableAmountEnrollAssetA - (if ((assetIdA == USDN))
573+ let uncountableA = (accountBalanceWithStakedA - balanceA)
574+ let uncountableB = (accountBalanceWithStakedB - balanceB)
575+ let amountEnrollA = (uncountableA - (if ((assetIdA == USDN))
525576 then amountLeave
526577 else 0))
527- let amountEnrollB = (uncountableAmountEnrollAssetB - (if ((assetIdB == USDN))
578+ let amountEnrollB = (uncountableB - (if ((assetIdB == USDN))
528579 then amountLeave
529580 else 0))
530581 if (!(isActive))
531582 then throwIsInactive()
532- else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStaking], i.callerPublicKey)))
583+ else if ((i.caller != this))
533584 then throwOnlyAdmin()
534585 else if ((0 > amountLeave))
535586 then throw(("Argument 'amountLeave' cannot be negative. Actual: " + toString(amountLeave)))
536- else if (if ((0 > uncountableAmountEnrollAssetA))
587+ else if (if ((0 > uncountableA))
537588 then true
538- else (0 > uncountableAmountEnrollAssetB))
589+ else (0 > uncountableB))
539590 then suspend("Enroll amount negative")
540591 else if (if ((0 > amountEnrollA))
541592 then true
542593 else (0 > amountEnrollB))
543594 then throw("Too large amountLeave")
544- else [IntegerEntry(keyBalanceA, (balanceA + amountEnrollA)), IntegerEntry(keyBalanceB, (balanceB + amountEnrollB))]
595+ else [IntegerEntry(kBalanceA, (balanceA + amountEnrollA)), IntegerEntry(kBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)]
545596 }
546597
547598

github/deemru/w8io/169f3d6 
143.88 ms