tx · 6XCSoHMEw1PqHASMEo4uHaDKufucMyGek4y9iJGpzNA 3MyCUjugUE6yBLnbq4KD3pcYwGvUiYptbzq: -0.01400000 Waves 2020.10.27 23:02 [1239478] smart account 3MyCUjugUE6yBLnbq4KD3pcYwGvUiYptbzq > SELF 0.00000000 Waves
{ "type": 13, "id": "6XCSoHMEw1PqHASMEo4uHaDKufucMyGek4y9iJGpzNA", "fee": 1400000, "feeAssetId": null, "timestamp": 1603829025850, "version": 1, "sender": "3MyCUjugUE6yBLnbq4KD3pcYwGvUiYptbzq", "senderPublicKey": "74f9QkKR4W4G8X38P7nfgsZTSnoA3NvHnUKpk55MiGiu", "proofs": [ "23HTTQTm44tcukfFsd4r8TPBhZHY6wN8QsoKtz586x7jdaW5qcWxHmBHku5reQoQExM69S8VXKxTm1SUwNWBbuFy" ], "script": "base64:AAIEAAAAAAAAABQIAhIAEgASBAoCAQESABIECgIBAQAAACEAAAAAEWdvdmVybmFuY2VBZGRyZXNzCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFTEGD9WeF2fOxrGFzNlM5RF0HdkHwbkAeKAAAAAAhJZFRva2VuQQkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwIAAAANYXNzZXRJZFRva2VuQQAAAAAISWRUb2tlbkIJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAABHRoaXMCAAAADWFzc2V0SWRUb2tlbkIAAAAADElkVG9rZW5TaGFyZQkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwIAAAAOc2hhcmVfdG9rZW5faWQAAAAAEWRBcHBUb2tlbnNBbW91bnRBCQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzAgAAAAxhbW91bnRUb2tlbkEAAAAAEWRBcHBUb2tlbnNBbW91bnRCCQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzAgAAAAxhbW91bnRUb2tlbkI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BQAAAA9uZXdBbW91bnRUb2tlbkEGCQAAZgAAAAIFAAAAE2RBcHBUaHJlc2hvbGRBbW91bnQFAAAAD25ld0Ftb3VudFRva2VuQgkAAAIAAAABAgAAAENiYWxhbmNlIGVycm9yOiBuZXcgZEFwcCB0b2tlbnMgYW1vdW50IGxlc3MgdGhhbiBkQXBwVGhyZXNob2xkQW1vdW50CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACAgAAAAxhbW91bnRUb2tlbkEFAAAAD25ld0Ftb3VudFRva2VuQQkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgIAAAAMYW1vdW50VG9rZW5CBQAAAA9uZXdBbW91bnRUb2tlbkIJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAICAAAACWludmFyaWFudAkBAAAADWludmFyaWFudENhbGMAAAACCQAAZAAAAAIFAAAADGFtb3VudFRva2VuQQUAAAASdG9rZW5SZWNlaXZlQW1vdW50CQAAZQAAAAIJAABlAAAAAgUAAAAMYW1vdW50VG9rZW5CBQAAABZ0b2tlblNlbmRBbW91bnRXaXRoRmVlBQAAABN0b2tlblNlbmRHb3Zlcm5hbmNlCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgUAAAAWdG9rZW5TZW5kQW1vdW50V2l0aEZlZQUAAAALYXNzZXRJZFNlbmQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAARZ292ZXJuYW5jZUFkZHJlc3MFAAAAE3Rva2VuU2VuZEdvdmVybmFuY2UFAAAAC2Fzc2V0SWRTZW5kBQAAAANuaWwJAAACAAAAAQIAAAAUQXNzZXQgaXMgbm90IGFsbG93ZWQAAAAAiEXTXw==", "chainId": 84, "height": 1239478, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9UcyYWDmLPo5ithqED5vrpnyob2rQNPQDpax4k5PRY4s Next: GnfUfbZDbTWXaEirvibXDzZ6s7viGQjM2BLa7jHMb76d Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let governanceAddress = Address(base58' | |
4 | + | let governanceAddress = Address(base58'3MS55nqhYKLbLZmRExmUN3H6RSWkr9c2VC5') | |
5 | 5 | ||
6 | 6 | let IdTokenA = getStringValue(this, "assetIdTokenA") | |
7 | 7 | ||
15 | 15 | ||
16 | 16 | let tokenShareSupply = getIntegerValue(this, "share_token_supply") | |
17 | 17 | ||
18 | - | let | |
18 | + | let dAppThreshold = 80 | |
19 | 19 | ||
20 | - | let | |
20 | + | let dAppThresholdDelimiter = 100 | |
21 | 21 | ||
22 | 22 | let comission = 500 | |
23 | 23 | ||
29 | 29 | ||
30 | 30 | let invariant = getIntegerValue(this, "invariant") | |
31 | 31 | ||
32 | + | let scaleValue3 = 1000 | |
33 | + | ||
32 | 34 | let scaleValue8 = 100000000 | |
33 | 35 | ||
34 | 36 | let scaleValue8Digits = 8 | |
35 | 37 | ||
36 | 38 | let scaleValue12 = 1000000000000 | |
39 | + | ||
40 | + | let scaleValue12Digits = 12 | |
37 | 41 | ||
38 | 42 | let ratioThresholdMax = 100000000 | |
39 | 43 | ||
63 | 67 | ||
64 | 68 | func invariantCalc (x,y) = { | |
65 | 69 | let sk = skeweness(x, y) | |
66 | - | (fraction((x + y), scaleValue8, pow(sk, scaleValue8Digits, alpha, alphaDigits, 8, UP)) + (2 * fraction(fraction( | |
70 | + | (fraction((x + y), scaleValue8, pow(sk, scaleValue8Digits, alpha, alphaDigits, 8, UP)) + (2 * fraction(pow(fraction(x, y, scaleValue8), 0, 5, 1, (scaleValue8Digits / 2), DOWN), pow((sk - beta), scaleValue8Digits, alpha, alphaDigits, scaleValue8Digits, DOWN), scaleValue8))) | |
67 | 71 | } | |
68 | 72 | ||
69 | 73 | ||
70 | 74 | func calculateHowManySendTokenA (amountToSendEstimated,minTokenRecieveAmount,amountTokenA,amountTokenB,tokenReceiveAmount) = { | |
71 | 75 | let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000)) | |
72 | - | let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantCalc((amountTokenA - amountToSendEstimated), (amountTokenB + tokenReceiveAmount))) | |
73 | - | if (if ((invariantEstimatedRatio > slippageValue)) | |
74 | - | then (scaleValue8 > invariantEstimatedRatio) | |
75 | - | else false) | |
76 | - | then amountToSendEstimated | |
76 | + | let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenRecieveAmount) | |
77 | + | let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaBetweenMaxAndMinSendValue) / 5)) | |
78 | + | let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaBetweenMaxAndMinSendValue) / 5)) | |
79 | + | let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaBetweenMaxAndMinSendValue) / 5)) | |
80 | + | let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaBetweenMaxAndMinSendValue) / 5)) | |
81 | + | let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaBetweenMaxAndMinSendValue) / 5)) | |
82 | + | if ((0 > (invariantCalc((amountTokenA - amountToSendStep5), (amountTokenB + tokenReceiveAmount)) - invariant))) | |
83 | + | then throw("minTokenRecieveAmount too large.err1") | |
77 | 84 | else { | |
78 | - | let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenRecieveAmount) | |
79 | - | let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaBetweenMaxAndMinSendValue) / 5)) | |
80 | - | let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaBetweenMaxAndMinSendValue) / 5)) | |
81 | - | let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaBetweenMaxAndMinSendValue) / 5)) | |
82 | - | let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaBetweenMaxAndMinSendValue) / 5)) | |
83 | - | let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaBetweenMaxAndMinSendValue) / 5)) | |
84 | - | if ((0 > (invariantCalc((amountTokenA - amountToSendStep5), (amountTokenB + tokenReceiveAmount)) - invariant))) | |
85 | - | then throw("minTokenRecieveAmount too large. err1") | |
85 | + | let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantCalc((amountTokenA - amountToSendEstimated), (amountTokenB + tokenReceiveAmount))) | |
86 | + | if (if ((invariantEstimatedRatio > slippageValue)) | |
87 | + | then (scaleValue8 > invariantEstimatedRatio) | |
88 | + | else false) | |
89 | + | then amountToSendEstimated | |
86 | 90 | else if (((invariantCalc((amountTokenA - amountToSendStep1), (amountTokenB + tokenReceiveAmount)) - invariant) > 0)) | |
87 | 91 | then ((amountToSendStep1 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
88 | 92 | else if (((invariantCalc((amountTokenA - amountToSendStep2), (amountTokenB + tokenReceiveAmount)) - invariant) > 0)) | |
100 | 104 | ||
101 | 105 | func calculateHowManySendTokenB (amountToSendEstimated,minTokenRecieveAmount,amountTokenA,amountTokenB,tokenReceiveAmount) = { | |
102 | 106 | let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000)) | |
107 | + | let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenRecieveAmount) | |
108 | + | let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaBetweenMaxAndMinSendValue) / 5)) | |
109 | + | let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaBetweenMaxAndMinSendValue) / 5)) | |
110 | + | let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaBetweenMaxAndMinSendValue) / 5)) | |
111 | + | let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaBetweenMaxAndMinSendValue) / 5)) | |
112 | + | let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaBetweenMaxAndMinSendValue) / 5)) | |
103 | 113 | let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendEstimated))) | |
104 | 114 | if (if ((invariantEstimatedRatio > slippageValue)) | |
105 | 115 | then (scaleValue8 > invariantEstimatedRatio) | |
106 | 116 | else false) | |
107 | 117 | then amountToSendEstimated | |
108 | - | else { | |
109 | - | let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenRecieveAmount) | |
110 | - | let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaBetweenMaxAndMinSendValue) / 5)) | |
111 | - | let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaBetweenMaxAndMinSendValue) / 5)) | |
112 | - | let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaBetweenMaxAndMinSendValue) / 5)) | |
113 | - | let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaBetweenMaxAndMinSendValue) / 5)) | |
114 | - | let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaBetweenMaxAndMinSendValue) / 5)) | |
115 | - | if ((0 > (invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep5)) - invariant))) | |
116 | - | then throw("price has changed dramatically. err1") | |
117 | - | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep1)) - invariant) > 0)) | |
118 | - | then ((amountToSendStep1 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
119 | - | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep2)) - invariant) > 0)) | |
120 | - | then ((amountToSendStep2 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
121 | - | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep3)) - invariant) > 0)) | |
122 | - | then ((amountToSendStep3 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
123 | - | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep4)) - invariant) > 0)) | |
124 | - | then ((amountToSendStep4 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
125 | - | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep5)) - invariant) > 0)) | |
126 | - | then ((amountToSendStep5 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
127 | - | else throw("price has changed dramatically. err2") | |
128 | - | } | |
118 | + | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep1)) - invariant) > 0)) | |
119 | + | then ((amountToSendStep1 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
120 | + | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep2)) - invariant) > 0)) | |
121 | + | then ((amountToSendStep2 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
122 | + | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep3)) - invariant) > 0)) | |
123 | + | then ((amountToSendStep3 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
124 | + | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep4)) - invariant) > 0)) | |
125 | + | then ((amountToSendStep4 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
126 | + | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep5)) - invariant) > 0)) | |
127 | + | then ((amountToSendStep5 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
128 | + | else throw("price has changed dramatically. err2") | |
129 | 129 | } | |
130 | 130 | ||
131 | 131 | ||
197 | 197 | else (assetIdReceivedB != assetIdTokenB)) | |
198 | 198 | then throw("incorrect assets") | |
199 | 199 | else { | |
200 | - | let tokenRatio = (fraction( | |
201 | - | if (!((tokenRatio == | |
200 | + | let tokenRatio = (fraction(dAppTokensAmountA, (1000000000000 * scaleValue3), tokenReceiveAmountA) / fraction(dAppTokensAmountB, 1000000000000, tokenReceiveAmountB)) | |
201 | + | if (!((tokenRatio == scaleValue3))) | |
202 | 202 | then throw("incorrect assets amount: amounts must have the contract ratio") | |
203 | 203 | else { | |
204 | 204 | let shareTokenToPayAmount = fraction(tokenReceiveAmountA, tokenShareSupply, dAppTokensAmountA) | |
301 | 301 | let assetIdSend = assetIdTokenA | |
302 | 302 | let newAmountTokenA = ((amountTokenA - tokenSendAmountWithFee) - tokenSendGovernance) | |
303 | 303 | let newAmountTokenB = (amountTokenB + tokenReceiveAmount) | |
304 | + | let dAppThresholdAmount = fraction((dAppTokensAmountA + dAppTokensAmountB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
304 | 305 | if (if ((dAppThresholdAmount > newAmountTokenA)) | |
305 | 306 | then true | |
306 | 307 | else (dAppThresholdAmount > newAmountTokenB)) | |
315 | 316 | let assetIdSend = assetIdTokenB | |
316 | 317 | let newAmountTokenA = (amountTokenA + tokenReceiveAmount) | |
317 | 318 | let newAmountTokenB = ((amountTokenB - tokenSendAmountWithFee) - tokenSendGovernance) | |
319 | + | let dAppThresholdAmount = fraction((dAppTokensAmountA + dAppTokensAmountB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
318 | 320 | if (if ((dAppThresholdAmount > newAmountTokenA)) | |
319 | 321 | then true | |
320 | 322 | else (dAppThresholdAmount > newAmountTokenB)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let governanceAddress = Address(base58' | |
4 | + | let governanceAddress = Address(base58'3MS55nqhYKLbLZmRExmUN3H6RSWkr9c2VC5') | |
5 | 5 | ||
6 | 6 | let IdTokenA = getStringValue(this, "assetIdTokenA") | |
7 | 7 | ||
8 | 8 | let IdTokenB = getStringValue(this, "assetIdTokenB") | |
9 | 9 | ||
10 | 10 | let IdTokenShare = getStringValue(this, "share_token_id") | |
11 | 11 | ||
12 | 12 | let dAppTokensAmountA = getIntegerValue(this, "amountTokenA") | |
13 | 13 | ||
14 | 14 | let dAppTokensAmountB = getIntegerValue(this, "amountTokenB") | |
15 | 15 | ||
16 | 16 | let tokenShareSupply = getIntegerValue(this, "share_token_supply") | |
17 | 17 | ||
18 | - | let | |
18 | + | let dAppThreshold = 80 | |
19 | 19 | ||
20 | - | let | |
20 | + | let dAppThresholdDelimiter = 100 | |
21 | 21 | ||
22 | 22 | let comission = 500 | |
23 | 23 | ||
24 | 24 | let commisionGovernance = 200 | |
25 | 25 | ||
26 | 26 | let comissionScaleDelimiter = 1000000 | |
27 | 27 | ||
28 | 28 | let version = "2.0.0" | |
29 | 29 | ||
30 | 30 | let invariant = getIntegerValue(this, "invariant") | |
31 | 31 | ||
32 | + | let scaleValue3 = 1000 | |
33 | + | ||
32 | 34 | let scaleValue8 = 100000000 | |
33 | 35 | ||
34 | 36 | let scaleValue8Digits = 8 | |
35 | 37 | ||
36 | 38 | let scaleValue12 = 1000000000000 | |
39 | + | ||
40 | + | let scaleValue12Digits = 12 | |
37 | 41 | ||
38 | 42 | let ratioThresholdMax = 100000000 | |
39 | 43 | ||
40 | 44 | let ratioThresholdMin = 99999000 | |
41 | 45 | ||
42 | 46 | let alpha = 50 | |
43 | 47 | ||
44 | 48 | let alphaDigits = 2 | |
45 | 49 | ||
46 | 50 | let beta = 46000000 | |
47 | 51 | ||
48 | 52 | let betaDigits = 8 | |
49 | 53 | ||
50 | 54 | func assetId (asset) = if ((asset == "WAVES")) | |
51 | 55 | then unit | |
52 | 56 | else fromBase58String(asset) | |
53 | 57 | ||
54 | 58 | ||
55 | 59 | let assetIdTokenA = assetId(IdTokenA) | |
56 | 60 | ||
57 | 61 | let assetIdTokenB = assetId(IdTokenB) | |
58 | 62 | ||
59 | 63 | let assetIdTokenShare = fromBase58String(IdTokenShare) | |
60 | 64 | ||
61 | 65 | func skeweness (x,y) = (((fraction(scaleValue12, x, y) + fraction(scaleValue12, y, x)) / 2) / 10000) | |
62 | 66 | ||
63 | 67 | ||
64 | 68 | func invariantCalc (x,y) = { | |
65 | 69 | let sk = skeweness(x, y) | |
66 | - | (fraction((x + y), scaleValue8, pow(sk, scaleValue8Digits, alpha, alphaDigits, 8, UP)) + (2 * fraction(fraction( | |
70 | + | (fraction((x + y), scaleValue8, pow(sk, scaleValue8Digits, alpha, alphaDigits, 8, UP)) + (2 * fraction(pow(fraction(x, y, scaleValue8), 0, 5, 1, (scaleValue8Digits / 2), DOWN), pow((sk - beta), scaleValue8Digits, alpha, alphaDigits, scaleValue8Digits, DOWN), scaleValue8))) | |
67 | 71 | } | |
68 | 72 | ||
69 | 73 | ||
70 | 74 | func calculateHowManySendTokenA (amountToSendEstimated,minTokenRecieveAmount,amountTokenA,amountTokenB,tokenReceiveAmount) = { | |
71 | 75 | let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000)) | |
72 | - | let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantCalc((amountTokenA - amountToSendEstimated), (amountTokenB + tokenReceiveAmount))) | |
73 | - | if (if ((invariantEstimatedRatio > slippageValue)) | |
74 | - | then (scaleValue8 > invariantEstimatedRatio) | |
75 | - | else false) | |
76 | - | then amountToSendEstimated | |
76 | + | let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenRecieveAmount) | |
77 | + | let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaBetweenMaxAndMinSendValue) / 5)) | |
78 | + | let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaBetweenMaxAndMinSendValue) / 5)) | |
79 | + | let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaBetweenMaxAndMinSendValue) / 5)) | |
80 | + | let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaBetweenMaxAndMinSendValue) / 5)) | |
81 | + | let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaBetweenMaxAndMinSendValue) / 5)) | |
82 | + | if ((0 > (invariantCalc((amountTokenA - amountToSendStep5), (amountTokenB + tokenReceiveAmount)) - invariant))) | |
83 | + | then throw("minTokenRecieveAmount too large.err1") | |
77 | 84 | else { | |
78 | - | let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenRecieveAmount) | |
79 | - | let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaBetweenMaxAndMinSendValue) / 5)) | |
80 | - | let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaBetweenMaxAndMinSendValue) / 5)) | |
81 | - | let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaBetweenMaxAndMinSendValue) / 5)) | |
82 | - | let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaBetweenMaxAndMinSendValue) / 5)) | |
83 | - | let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaBetweenMaxAndMinSendValue) / 5)) | |
84 | - | if ((0 > (invariantCalc((amountTokenA - amountToSendStep5), (amountTokenB + tokenReceiveAmount)) - invariant))) | |
85 | - | then throw("minTokenRecieveAmount too large. err1") | |
85 | + | let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantCalc((amountTokenA - amountToSendEstimated), (amountTokenB + tokenReceiveAmount))) | |
86 | + | if (if ((invariantEstimatedRatio > slippageValue)) | |
87 | + | then (scaleValue8 > invariantEstimatedRatio) | |
88 | + | else false) | |
89 | + | then amountToSendEstimated | |
86 | 90 | else if (((invariantCalc((amountTokenA - amountToSendStep1), (amountTokenB + tokenReceiveAmount)) - invariant) > 0)) | |
87 | 91 | then ((amountToSendStep1 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
88 | 92 | else if (((invariantCalc((amountTokenA - amountToSendStep2), (amountTokenB + tokenReceiveAmount)) - invariant) > 0)) | |
89 | 93 | then ((amountToSendStep2 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
90 | 94 | else if (((invariantCalc((amountTokenA - amountToSendStep3), (amountTokenB + tokenReceiveAmount)) - invariant) > 0)) | |
91 | 95 | then ((amountToSendStep3 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
92 | 96 | else if (((invariantCalc((amountTokenA - amountToSendStep4), (amountTokenB + tokenReceiveAmount)) - invariant) > 0)) | |
93 | 97 | then ((amountToSendStep4 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
94 | 98 | else if (((invariantCalc((amountTokenA - amountToSendStep5), (amountTokenB + tokenReceiveAmount)) - invariant) > 0)) | |
95 | 99 | then ((amountToSendStep5 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
96 | 100 | else throw("price has changed dramatically. err2") | |
97 | 101 | } | |
98 | 102 | } | |
99 | 103 | ||
100 | 104 | ||
101 | 105 | func calculateHowManySendTokenB (amountToSendEstimated,minTokenRecieveAmount,amountTokenA,amountTokenB,tokenReceiveAmount) = { | |
102 | 106 | let slippageValue = (scaleValue8 - ((scaleValue8 * 1) / 10000000)) | |
107 | + | let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenRecieveAmount) | |
108 | + | let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaBetweenMaxAndMinSendValue) / 5)) | |
109 | + | let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaBetweenMaxAndMinSendValue) / 5)) | |
110 | + | let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaBetweenMaxAndMinSendValue) / 5)) | |
111 | + | let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaBetweenMaxAndMinSendValue) / 5)) | |
112 | + | let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaBetweenMaxAndMinSendValue) / 5)) | |
103 | 113 | let invariantEstimatedRatio = fraction(invariant, scaleValue8, invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendEstimated))) | |
104 | 114 | if (if ((invariantEstimatedRatio > slippageValue)) | |
105 | 115 | then (scaleValue8 > invariantEstimatedRatio) | |
106 | 116 | else false) | |
107 | 117 | then amountToSendEstimated | |
108 | - | else { | |
109 | - | let deltaBetweenMaxAndMinSendValue = (amountToSendEstimated - minTokenRecieveAmount) | |
110 | - | let amountToSendStep1 = (amountToSendEstimated - ((1 * deltaBetweenMaxAndMinSendValue) / 5)) | |
111 | - | let amountToSendStep2 = (amountToSendEstimated - ((2 * deltaBetweenMaxAndMinSendValue) / 5)) | |
112 | - | let amountToSendStep3 = (amountToSendEstimated - ((3 * deltaBetweenMaxAndMinSendValue) / 5)) | |
113 | - | let amountToSendStep4 = (amountToSendEstimated - ((4 * deltaBetweenMaxAndMinSendValue) / 5)) | |
114 | - | let amountToSendStep5 = (amountToSendEstimated - ((5 * deltaBetweenMaxAndMinSendValue) / 5)) | |
115 | - | if ((0 > (invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep5)) - invariant))) | |
116 | - | then throw("price has changed dramatically. err1") | |
117 | - | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep1)) - invariant) > 0)) | |
118 | - | then ((amountToSendStep1 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
119 | - | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep2)) - invariant) > 0)) | |
120 | - | then ((amountToSendStep2 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
121 | - | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep3)) - invariant) > 0)) | |
122 | - | then ((amountToSendStep3 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
123 | - | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep4)) - invariant) > 0)) | |
124 | - | then ((amountToSendStep4 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
125 | - | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep5)) - invariant) > 0)) | |
126 | - | then ((amountToSendStep5 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
127 | - | else throw("price has changed dramatically. err2") | |
128 | - | } | |
118 | + | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep1)) - invariant) > 0)) | |
119 | + | then ((amountToSendStep1 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
120 | + | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep2)) - invariant) > 0)) | |
121 | + | then ((amountToSendStep2 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
122 | + | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep3)) - invariant) > 0)) | |
123 | + | then ((amountToSendStep3 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
124 | + | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep4)) - invariant) > 0)) | |
125 | + | then ((amountToSendStep4 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
126 | + | else if (((invariantCalc((amountTokenA + tokenReceiveAmount), (amountTokenB - amountToSendStep5)) - invariant) > 0)) | |
127 | + | then ((amountToSendStep5 * (comissionScaleDelimiter - comission)) / comissionScaleDelimiter) | |
128 | + | else throw("price has changed dramatically. err2") | |
129 | 129 | } | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | @Callable(contextObj) | |
133 | 133 | func fund () = { | |
134 | 134 | let paymentA = value(contextObj.payments[0]) | |
135 | 135 | let paymentB = value(contextObj.payments[1]) | |
136 | 136 | let assetIdReceivedA = paymentA.assetId | |
137 | 137 | let tokenReceiveAmountA = paymentA.amount | |
138 | 138 | let assetIdReceivedB = paymentB.assetId | |
139 | 139 | let tokenReceiveAmountB = paymentB.amount | |
140 | 140 | let digitTokenA = match assetIdReceivedA { | |
141 | 141 | case p: Unit => | |
142 | 142 | 8 | |
143 | 143 | case p: ByteVector => | |
144 | 144 | value(assetInfo(p)).decimals | |
145 | 145 | case _ => | |
146 | 146 | throw("Match error") | |
147 | 147 | } | |
148 | 148 | let digitTokenB = match assetIdReceivedB { | |
149 | 149 | case p: Unit => | |
150 | 150 | 8 | |
151 | 151 | case p: ByteVector => | |
152 | 152 | value(assetInfo(p)).decimals | |
153 | 153 | case _ => | |
154 | 154 | throw("Match error") | |
155 | 155 | } | |
156 | 156 | if (isDefined(getBoolean(this, "status"))) | |
157 | 157 | then throw("already active") | |
158 | 158 | else { | |
159 | 159 | let shareTokenName = ("ShareT_" + takeRight(toString(this), 5)) | |
160 | 160 | let digitsInShareToken = ((digitTokenA + digitTokenB) / 2) | |
161 | 161 | let shareTokenInitialAmount = fraction(pow(tokenReceiveAmountA, digitTokenA, 5, 1, digitTokenA, HALFDOWN), pow(tokenReceiveAmountB, digitTokenB, 5, 1, digitTokenB, HALFDOWN), pow(10, 0, digitsInShareToken, 0, 0, HALFDOWN)) | |
162 | 162 | let shareTokenAssetId = calculateAssetId(Issue(shareTokenName, shareTokenName, shareTokenInitialAmount, digitsInShareToken, true)) | |
163 | 163 | let assetIdTokenStringA = match assetIdReceivedA { | |
164 | 164 | case t: Unit => | |
165 | 165 | "WAVES" | |
166 | 166 | case t: ByteVector => | |
167 | 167 | toBase58String(value(assetIdReceivedA)) | |
168 | 168 | case _ => | |
169 | 169 | throw("Match error") | |
170 | 170 | } | |
171 | 171 | let assetIdTokenStringB = match assetIdReceivedB { | |
172 | 172 | case t: Unit => | |
173 | 173 | "WAVES" | |
174 | 174 | case t: ByteVector => | |
175 | 175 | toBase58String(value(assetIdReceivedB)) | |
176 | 176 | case _ => | |
177 | 177 | throw("Match error") | |
178 | 178 | } | |
179 | 179 | let invariantCalcualated = invariantCalc(tokenReceiveAmountA, tokenReceiveAmountB) | |
180 | 180 | [IntegerEntry("amountTokenA", tokenReceiveAmountA), IntegerEntry("amountTokenB", tokenReceiveAmountB), StringEntry("assetIdTokenA", assetIdTokenStringA), StringEntry("assetIdTokenB", assetIdTokenStringB), IntegerEntry("invariant", invariantCalcualated), BooleanEntry("status", true), IntegerEntry("comission", comission), IntegerEntry("comissionScaleDelimiter", comissionScaleDelimiter), StringEntry("version", version), Issue(shareTokenName, shareTokenName, shareTokenInitialAmount, digitsInShareToken, true), ScriptTransfer(contextObj.caller, shareTokenInitialAmount, shareTokenAssetId), StringEntry("share_token_id", toBase58String(shareTokenAssetId)), IntegerEntry("share_token_supply", shareTokenInitialAmount)] | |
181 | 181 | } | |
182 | 182 | } | |
183 | 183 | ||
184 | 184 | ||
185 | 185 | ||
186 | 186 | @Callable(contextObj) | |
187 | 187 | func replenishmentWithTwoToken () = { | |
188 | 188 | let paymentA = value(contextObj.payments[0]) | |
189 | 189 | let paymentB = value(contextObj.payments[1]) | |
190 | 190 | let assetIdReceivedA = paymentA.assetId | |
191 | 191 | let tokenReceiveAmountA = paymentA.amount | |
192 | 192 | let assetIdReceivedB = paymentB.assetId | |
193 | 193 | let tokenReceiveAmountB = paymentB.amount | |
194 | 194 | let invariantCalcualated = invariantCalc((dAppTokensAmountA + tokenReceiveAmountA), (dAppTokensAmountB + tokenReceiveAmountB)) | |
195 | 195 | if (if ((assetIdReceivedA != assetIdTokenA)) | |
196 | 196 | then true | |
197 | 197 | else (assetIdReceivedB != assetIdTokenB)) | |
198 | 198 | then throw("incorrect assets") | |
199 | 199 | else { | |
200 | - | let tokenRatio = (fraction( | |
201 | - | if (!((tokenRatio == | |
200 | + | let tokenRatio = (fraction(dAppTokensAmountA, (1000000000000 * scaleValue3), tokenReceiveAmountA) / fraction(dAppTokensAmountB, 1000000000000, tokenReceiveAmountB)) | |
201 | + | if (!((tokenRatio == scaleValue3))) | |
202 | 202 | then throw("incorrect assets amount: amounts must have the contract ratio") | |
203 | 203 | else { | |
204 | 204 | let shareTokenToPayAmount = fraction(tokenReceiveAmountA, tokenShareSupply, dAppTokensAmountA) | |
205 | 205 | if ((shareTokenToPayAmount == 0)) | |
206 | 206 | then throw("you try replansish with very small amount") | |
207 | 207 | else [Reissue(assetIdTokenShare, shareTokenToPayAmount, true), ScriptTransfer(contextObj.caller, shareTokenToPayAmount, assetIdTokenShare), IntegerEntry("share_token_supply", (tokenShareSupply + shareTokenToPayAmount)), IntegerEntry("amountTokenA", (dAppTokensAmountA + tokenReceiveAmountA)), IntegerEntry("amountTokenB", (dAppTokensAmountB + tokenReceiveAmountB)), IntegerEntry("invariant", invariantCalcualated)] | |
208 | 208 | } | |
209 | 209 | } | |
210 | 210 | } | |
211 | 211 | ||
212 | 212 | ||
213 | 213 | ||
214 | 214 | @Callable(contextObj) | |
215 | 215 | func replanishmentWithOneToken (tokenAamountWithOldInvariantNewPrice,tokenBamountWithOldInvariantNewPrice) = { | |
216 | 216 | let payment = value(contextObj.payments[0]) | |
217 | 217 | let assetIdReceived = payment.assetId | |
218 | 218 | let tokenReceiveAmount = payment.amount | |
219 | 219 | if ((assetIdReceived == assetIdTokenA)) | |
220 | 220 | then { | |
221 | 221 | let newAmountTokenA = (dAppTokensAmountA + tokenReceiveAmount) | |
222 | 222 | let newInvariant = invariantCalc(newAmountTokenA, dAppTokensAmountB) | |
223 | 223 | let priceAtoBwith8digits = fraction(newAmountTokenA, scaleValue8, dAppTokensAmountB) | |
224 | 224 | let isCorrectPriceRation = fraction(tokenBamountWithOldInvariantNewPrice, priceAtoBwith8digits, tokenAamountWithOldInvariantNewPrice) | |
225 | 225 | if (if ((isCorrectPriceRation > ratioThresholdMax)) | |
226 | 226 | then true | |
227 | 227 | else (ratioThresholdMin > isCorrectPriceRation)) | |
228 | 228 | then throw("incorrect function args: price") | |
229 | 229 | else { | |
230 | 230 | let calculatedInvariantWithNewPrice = invariantCalc(tokenAamountWithOldInvariantNewPrice, tokenBamountWithOldInvariantNewPrice) | |
231 | 231 | let isCorrectInvariantRation = fraction(calculatedInvariantWithNewPrice, scaleValue8, invariant) | |
232 | 232 | if (if ((isCorrectInvariantRation > ratioThresholdMax)) | |
233 | 233 | then true | |
234 | 234 | else (ratioThresholdMin > isCorrectInvariantRation)) | |
235 | 235 | then throw("incorrect function args: invariant") | |
236 | 236 | else { | |
237 | 237 | let newTokenShareSupply = fraction(tokenBamountWithOldInvariantNewPrice, tokenShareSupply, dAppTokensAmountB) | |
238 | 238 | let shareTokenToPayAmount = (newTokenShareSupply - tokenShareSupply) | |
239 | 239 | [Reissue(assetIdTokenShare, shareTokenToPayAmount, true), ScriptTransfer(contextObj.caller, shareTokenToPayAmount, assetIdTokenShare), IntegerEntry("share_token_supply", (tokenShareSupply + shareTokenToPayAmount)), IntegerEntry("amountTokenA", newAmountTokenA), IntegerEntry("invariant", newInvariant)] | |
240 | 240 | } | |
241 | 241 | } | |
242 | 242 | } | |
243 | 243 | else if ((assetIdReceived == assetIdTokenB)) | |
244 | 244 | then { | |
245 | 245 | let newAmountTokenB = (dAppTokensAmountB + tokenReceiveAmount) | |
246 | 246 | let newInvariant = invariantCalc(dAppTokensAmountA, newAmountTokenB) | |
247 | 247 | let priceAtoBwith8digits = fraction(dAppTokensAmountA, scaleValue8, newAmountTokenB) | |
248 | 248 | let isCorrectPriceRation = fraction(tokenBamountWithOldInvariantNewPrice, priceAtoBwith8digits, tokenAamountWithOldInvariantNewPrice) | |
249 | 249 | if (if ((isCorrectPriceRation > ratioThresholdMax)) | |
250 | 250 | then true | |
251 | 251 | else (ratioThresholdMin > isCorrectPriceRation)) | |
252 | 252 | then throw("incorrect function args: price") | |
253 | 253 | else { | |
254 | 254 | let calculatedInvariantWithNewPrice = invariantCalc(tokenAamountWithOldInvariantNewPrice, tokenBamountWithOldInvariantNewPrice) | |
255 | 255 | let isCorrectInvariantRation = fraction(calculatedInvariantWithNewPrice, scaleValue8, invariant) | |
256 | 256 | if (if ((isCorrectInvariantRation > ratioThresholdMax)) | |
257 | 257 | then true | |
258 | 258 | else (ratioThresholdMin > isCorrectInvariantRation)) | |
259 | 259 | then throw("incorrect function args: invariant") | |
260 | 260 | else { | |
261 | 261 | let newTokenShareSupply = fraction(tokenBamountWithOldInvariantNewPrice, tokenShareSupply, dAppTokensAmountB) | |
262 | 262 | let shareTokenToPayAmount = (newTokenShareSupply - tokenShareSupply) | |
263 | 263 | [Reissue(assetIdTokenShare, shareTokenToPayAmount, true), ScriptTransfer(contextObj.caller, shareTokenToPayAmount, assetIdTokenShare), IntegerEntry("share_token_supply", (tokenShareSupply + shareTokenToPayAmount)), IntegerEntry("amountTokenB", newAmountTokenB), IntegerEntry("invariant", newInvariant)] | |
264 | 264 | } | |
265 | 265 | } | |
266 | 266 | } | |
267 | 267 | else throw("incorrect assets in payment") | |
268 | 268 | } | |
269 | 269 | ||
270 | 270 | ||
271 | 271 | ||
272 | 272 | @Callable(contextObj) | |
273 | 273 | func withdraw () = { | |
274 | 274 | let payment = value(contextObj.payments[0]) | |
275 | 275 | let assetIdReceived = payment.assetId | |
276 | 276 | let tokenReceiveAmount = payment.amount | |
277 | 277 | let tokensToPayA = fraction(tokenReceiveAmount, dAppTokensAmountA, tokenShareSupply) | |
278 | 278 | let tokensToPayB = fraction(tokenReceiveAmount, dAppTokensAmountB, tokenShareSupply) | |
279 | 279 | let invariantCalcualated = invariantCalc((dAppTokensAmountA - tokensToPayA), (dAppTokensAmountB - tokensToPayB)) | |
280 | 280 | if ((getBooleanValue(this, "status") != true)) | |
281 | 281 | then throw("status: Unactive") | |
282 | 282 | else [IntegerEntry("amountTokenA", (dAppTokensAmountA - tokensToPayA)), IntegerEntry("amountTokenB", (dAppTokensAmountB - tokensToPayB)), IntegerEntry("share_token_supply", (tokenShareSupply - tokenReceiveAmount)), ScriptTransfer(contextObj.caller, tokensToPayA, assetIdTokenA), ScriptTransfer(contextObj.caller, tokensToPayB, assetIdTokenB), Burn(assetIdTokenShare, tokenReceiveAmount), IntegerEntry("invariant", invariantCalcualated)] | |
283 | 283 | } | |
284 | 284 | ||
285 | 285 | ||
286 | 286 | ||
287 | 287 | @Callable(contextObj) | |
288 | 288 | func exchanger (amountToSendEstimated,minTokenRecieveAmount) = { | |
289 | 289 | let amountTokenB = getIntegerValue(this, "amountTokenB") | |
290 | 290 | let amountTokenA = getIntegerValue(this, "amountTokenA") | |
291 | 291 | let payment = value(contextObj.payments[0]) | |
292 | 292 | let assetIdReceived = payment.assetId | |
293 | 293 | let tokenReceiveAmount = payment.amount | |
294 | 294 | if ((getBooleanValue(this, "status") != true)) | |
295 | 295 | then throw("status: Unactive") | |
296 | 296 | else if ((assetIdReceived == assetIdTokenB)) | |
297 | 297 | then { | |
298 | 298 | let tokenSendAmountWithoutFee = calculateHowManySendTokenA(amountToSendEstimated, minTokenRecieveAmount, amountTokenA, amountTokenB, tokenReceiveAmount) | |
299 | 299 | let tokenSendAmountWithFee = fraction(tokenSendAmountWithoutFee, (comissionScaleDelimiter - comission), comissionScaleDelimiter) | |
300 | 300 | let tokenSendGovernance = fraction(tokenSendAmountWithoutFee, commisionGovernance, comissionScaleDelimiter) | |
301 | 301 | let assetIdSend = assetIdTokenA | |
302 | 302 | let newAmountTokenA = ((amountTokenA - tokenSendAmountWithFee) - tokenSendGovernance) | |
303 | 303 | let newAmountTokenB = (amountTokenB + tokenReceiveAmount) | |
304 | + | let dAppThresholdAmount = fraction((dAppTokensAmountA + dAppTokensAmountB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
304 | 305 | if (if ((dAppThresholdAmount > newAmountTokenA)) | |
305 | 306 | then true | |
306 | 307 | else (dAppThresholdAmount > newAmountTokenB)) | |
307 | 308 | then throw("balance error: new dApp tokens amount less than dAppThresholdAmount") | |
308 | 309 | else [IntegerEntry("amountTokenA", newAmountTokenA), IntegerEntry("amountTokenB", newAmountTokenB), IntegerEntry("invariant", invariantCalc(((amountTokenA - tokenSendAmountWithFee) - tokenSendGovernance), (amountTokenB + tokenReceiveAmount))), ScriptTransfer(contextObj.caller, tokenSendAmountWithFee, assetIdSend), ScriptTransfer(governanceAddress, tokenSendGovernance, assetIdSend)] | |
309 | 310 | } | |
310 | 311 | else if ((assetIdReceived == assetIdTokenA)) | |
311 | 312 | then { | |
312 | 313 | let tokenSendAmountWithoutFee = calculateHowManySendTokenB(amountToSendEstimated, minTokenRecieveAmount, amountTokenA, amountTokenB, tokenReceiveAmount) | |
313 | 314 | let tokenSendAmountWithFee = fraction(tokenSendAmountWithoutFee, (comissionScaleDelimiter - comission), comissionScaleDelimiter) | |
314 | 315 | let tokenSendGovernance = fraction(tokenSendAmountWithoutFee, commisionGovernance, comissionScaleDelimiter) | |
315 | 316 | let assetIdSend = assetIdTokenB | |
316 | 317 | let newAmountTokenA = (amountTokenA + tokenReceiveAmount) | |
317 | 318 | let newAmountTokenB = ((amountTokenB - tokenSendAmountWithFee) - tokenSendGovernance) | |
319 | + | let dAppThresholdAmount = fraction((dAppTokensAmountA + dAppTokensAmountB), dAppThreshold, (2 * dAppThresholdDelimiter)) | |
318 | 320 | if (if ((dAppThresholdAmount > newAmountTokenA)) | |
319 | 321 | then true | |
320 | 322 | else (dAppThresholdAmount > newAmountTokenB)) | |
321 | 323 | then throw("balance error: new dApp tokens amount less than dAppThresholdAmount") | |
322 | 324 | else [IntegerEntry("amountTokenA", newAmountTokenA), IntegerEntry("amountTokenB", newAmountTokenB), IntegerEntry("invariant", invariantCalc((amountTokenA + tokenReceiveAmount), ((amountTokenB - tokenSendAmountWithFee) - tokenSendGovernance))), ScriptTransfer(contextObj.caller, tokenSendAmountWithFee, assetIdSend), ScriptTransfer(governanceAddress, tokenSendGovernance, assetIdSend)] | |
323 | 325 | } | |
324 | 326 | else throw("Asset is not allowed") | |
325 | 327 | } | |
326 | 328 | ||
327 | 329 |
github/deemru/w8io/026f985 52.04 ms ◑