tx · J1oT2zq5ecigcLuuSDfcrV2XmV7y8ewebrBc1cUtPv1m 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL: -0.01000000 Waves 2021.09.12 19:43 [1700092] smart account 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL > SELF 0.00000000 Waves
{ "type": 13, "id": "J1oT2zq5ecigcLuuSDfcrV2XmV7y8ewebrBc1cUtPv1m", "fee": 1000000, "feeAssetId": null, "timestamp": 1631465020864, "version": 2, "chainId": 84, "sender": "3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL", "senderPublicKey": "EYAKsFBespqQveBrfmX29rsehBJrSwQ3B6yN4ADyw8Kx", "proofs": [ "2W5z4LRx8DMn36uhXLSX1t6qhx7CacUVQGqfYv7bbnQdCVgXSwyKZKrbyKB62XpJugorjjWQffH7CfiRinbvXAnP" ], "script": "base64:AAIFAAAAAAAAAA0IAhIJCgcYGBERGAIBAAAACQAAAAAHZGlnaXRzOAAAAAAAAAAACAAAAAAGc2NhbGU4AAAAAAAF9eEAAAAAAAdzY2FsZTEyAAAAAOjUpRAAAAAAAAVhbHBoYQAAAAAAAAAAMgAAAAALYWxwaGFEaWdpdHMAAAAAAAAAAAIAAAAABGJldGEAAAAAAAK954ABAAAACHNrZXduZXNzAAAAAgAAAAF4AAAAAXkJAABpAAAAAgkAAGkAAAACCQAAZAAAAAIJAABrAAAAAwUAAAAHc2NhbGUxMgUAAAABeAUAAAABeQkAAGsAAAADBQAAAAdzY2FsZTEyBQAAAAF5BQAAAAF4AAAAAAAAAAACAAAAAAAAACcQAQAAAA1pbnZhcmlhbnRDYWxjAAAAAgAAAAF4AAAAAXkEAAAAAnNrCQEAAAAIc2tld25lc3MAAAACBQAAAAF4BQAAAAF5CQAAZAAAAAIJAABrAAAAAwkAAGQAAAACBQAAAAF4BQAAAAF5BQAAAAZzY2FsZTgJAABsAAAABgUAAAACc2sFAAAAB2RpZ2l0czgFAAAABWFscGhhBQAAAAthbHBoY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AAACXzMEAAAAD2Ftb3VudFRvUmVjaWV2ZQkAA/AAAAACBQAAAAR0aGlzBQAAAA5yZWNlaXZlQXNzZXRJZAMDCQAAAAAAAAIFAAAAD2V4Y2hhbmdlQ291bnRlcgUAAAALcm91dGluZ1NpemUJAABnAAAAAgUAAAAPYW1vdW50VG9SZWNpZXZlBQAAABJtaW5BbW91bnRUb1JlY2VpdmUHCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAPYW1vdW50VG9SZWNpZXZlBQAAAA5yZWNlaXZlQXNzZXRJZAUAAAADbmlsCQAAAgAAAAECAAAAPnJvdXRpbmcgIT0gcm91dGluZ1NpemUgb3IgYW1vdW50VG9SZWNpZXZlIDwgbWluQW1vdW50VG9SZWNlaXZlAAAAAJ+dP9k=", "height": 1700092, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6CoGrzaJZUahx98SML7CJY5yK3uZfPXFx43PPhmbJ4tU Next: 3vaq6DDtiEi3KmR3cUeBf33CxsEFBV6ZjcdqoiHMd8EM Diff:
Old | New | Differences | |
---|---|---|---|
54 | 54 | } | |
55 | 55 | else throw("Incorrect exchange type") | |
56 | 56 | if (true) | |
57 | - | then throw(((toString( | |
57 | + | then throw(((toString(getFrom2TradeWithFee) + " ") + toString(minAmountToReceive))) | |
58 | 58 | else if ((getFrom2TradeWithFee >= minAmountToReceive)) | |
59 | 59 | then true | |
60 | 60 | else false |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let digits8 = 8 | |
5 | 5 | ||
6 | 6 | let scale8 = 100000000 | |
7 | 7 | ||
8 | 8 | let scale12 = 1000000000000 | |
9 | 9 | ||
10 | 10 | let alpha = 50 | |
11 | 11 | ||
12 | 12 | let alphaDigits = 2 | |
13 | 13 | ||
14 | 14 | let beta = 46000000 | |
15 | 15 | ||
16 | 16 | func skewness (x,y) = (((fraction(scale12, x, y) + fraction(scale12, y, x)) / 2) / 10000) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func invariantCalc (x,y) = { | |
20 | 20 | let sk = skewness(x, y) | |
21 | 21 | (fraction((x + y), scale8, pow(sk, digits8, alpha, alphaDigits, digits8, CEILING)) + (2 * fraction(pow(fraction(x, y, scale8), 0, 5, 1, (digits8 / 2), DOWN), pow((sk - beta), digits8, alpha, alphaDigits, digits8, DOWN), scale8))) | |
22 | 22 | } | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func checkPossibilty (pmtAmount,minAmountToReceive,exchangers,exchangersType,routingAssetsKeys,args1,args2) = { | |
26 | 26 | let commission = 3000 | |
27 | 27 | let commissionScaleDelimiter = 1000000 | |
28 | 28 | let dApp1TokenPay = getIntegerValue(addressFromStringValue(exchangers[0]), routingAssetsKeys[0]) | |
29 | 29 | let dApp1TokenGet = getIntegerValue(addressFromStringValue(exchangers[0]), routingAssetsKeys[1]) | |
30 | 30 | let dApp2TokenPay = getIntegerValue(addressFromStringValue(exchangers[1]), routingAssetsKeys[2]) | |
31 | 31 | let dApp2TokenGet = getIntegerValue(addressFromStringValue(exchangers[1]), routingAssetsKeys[3]) | |
32 | 32 | let getFrom1TradeWithFee = if ((exchangersType[0] == "cpmm")) | |
33 | 33 | then { | |
34 | 34 | let getFrom1Trade = fraction(dApp1TokenGet, pmtAmount, (pmtAmount + dApp1TokenPay)) | |
35 | 35 | fraction(getFrom1Trade, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
36 | 36 | } | |
37 | 37 | else if ((exchangersType[0] == "flat")) | |
38 | 38 | then { | |
39 | 39 | let invariant = invariantCalc(dApp1TokenPay, dApp1TokenGet) | |
40 | 40 | let invariantNew = invariantCalc((dApp1TokenPay + pmtAmount), (dApp1TokenGet - args2[0])) | |
41 | 41 | args2[0] | |
42 | 42 | } | |
43 | 43 | else throw("Incorrect exchange type") | |
44 | 44 | let getFrom2TradeWithFee = if ((exchangersType[1] == "cpmm")) | |
45 | 45 | then { | |
46 | 46 | let getFrom2Trade = fraction(dApp2TokenGet, getFrom1TradeWithFee, (getFrom1TradeWithFee + dApp2TokenPay)) | |
47 | 47 | fraction(getFrom2Trade, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
48 | 48 | } | |
49 | 49 | else if ((exchangersType[1] == "flat")) | |
50 | 50 | then { | |
51 | 51 | let invariant = invariantCalc(dApp2TokenPay, dApp2TokenGet) | |
52 | 52 | let invariantNew = invariantCalc((dApp2TokenPay + getFrom1TradeWithFee), (dApp2TokenGet - args2[1])) | |
53 | 53 | args2[1] | |
54 | 54 | } | |
55 | 55 | else throw("Incorrect exchange type") | |
56 | 56 | if (true) | |
57 | - | then throw(((toString( | |
57 | + | then throw(((toString(getFrom2TradeWithFee) + " ") + toString(minAmountToReceive))) | |
58 | 58 | else if ((getFrom2TradeWithFee >= minAmountToReceive)) | |
59 | 59 | then true | |
60 | 60 | else false | |
61 | 61 | } | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | @Callable(i) | |
65 | 65 | func routingTrade (exchangers,exchangersType,args1,args2,routingAssetsKeys,receiveAssetId,minAmountToReceive) = { | |
66 | 66 | let $t035513625 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
67 | 67 | let pmtAmount = $t035513625._1 | |
68 | 68 | let pmtAssetId = $t035513625._2 | |
69 | 69 | if (!(checkPossibilty(pmtAmount, minAmountToReceive, exchangers, exchangersType, routingAssetsKeys, args1, args2))) | |
70 | 70 | then throw("Check transaction possibilty: declined") | |
71 | 71 | else { | |
72 | 72 | let routingSize = size(exchangers) | |
73 | 73 | func exchangeFold (accumulated,exchanger) = { | |
74 | 74 | let $t039243987 = accumulated | |
75 | 75 | let exchangeCounter = $t039243987._1 | |
76 | 76 | let amountsWithFee = $t039243987._2 | |
77 | 77 | let assetsIdSend = $t039243987._3 | |
78 | 78 | if ((exchangeCounter == 0)) | |
79 | 79 | then { | |
80 | 80 | let exchangerAddress = addressFromStringValue(exchanger) | |
81 | 81 | let inv = if ((exchangersType[exchangeCounter] == "cpmm")) | |
82 | 82 | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
83 | 83 | else if ((exchangersType[exchangeCounter] == "flat")) | |
84 | 84 | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter], args2[exchangeCounter]], [AttachedPayment(pmtAssetId, pmtAmount)]) | |
85 | 85 | else throw("Incorrect exchange type") | |
86 | 86 | if ((inv == inv)) | |
87 | 87 | then match inv { | |
88 | 88 | case inv: (Int, ByteVector) => | |
89 | 89 | let $t046834721 = inv | |
90 | 90 | let amountWithFee = $t046834721._1 | |
91 | 91 | let assetIdSend = $t046834721._2 | |
92 | 92 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
93 | 93 | case _ => | |
94 | 94 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
95 | 95 | } | |
96 | 96 | else throw("Strict value is not equal to itself.") | |
97 | 97 | } | |
98 | 98 | else if (if ((exchangeCounter > 0)) | |
99 | 99 | then (routingSize > exchangeCounter) | |
100 | 100 | else false) | |
101 | 101 | then { | |
102 | 102 | let exchangerAddress = addressFromStringValue(exchanger) | |
103 | 103 | let $t050675133 = $Tuple2(assetsIdSend, amountsWithFee) | |
104 | 104 | let pmtAssetIdRout = $t050675133._1 | |
105 | 105 | let pmtAmountRout = $t050675133._2 | |
106 | 106 | let inv = if ((exchangersType[exchangeCounter] == "cpmm")) | |
107 | 107 | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
108 | 108 | else if ((exchangersType[exchangeCounter] == "flat")) | |
109 | 109 | then invoke(exchangerAddress, "exchange", [args1[exchangeCounter], args2[exchangeCounter]], [AttachedPayment(pmtAssetIdRout, pmtAmountRout)]) | |
110 | 110 | else throw("Incorrect exchange type") | |
111 | 111 | if ((inv == inv)) | |
112 | 112 | then match inv { | |
113 | 113 | case inv: (Int, ByteVector) => | |
114 | 114 | let $t057385776 = inv | |
115 | 115 | let amountWithFee = $t057385776._1 | |
116 | 116 | let assetIdSend = $t057385776._2 | |
117 | 117 | $Tuple3((exchangeCounter + 1), amountWithFee, assetIdSend) | |
118 | 118 | case _ => | |
119 | 119 | throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
120 | 120 | } | |
121 | 121 | else throw("Strict value is not equal to itself.") | |
122 | 122 | } | |
123 | 123 | else accumulated | |
124 | 124 | } | |
125 | 125 | ||
126 | 126 | let $t060146115 = { | |
127 | 127 | let $list60666115 = exchangers | |
128 | 128 | let $size60666115 = size($list60666115) | |
129 | 129 | let $acc060666115 = $Tuple3(0, 0, base58'') | |
130 | 130 | if (($size60666115 == 0)) | |
131 | 131 | then $acc060666115 | |
132 | 132 | else { | |
133 | 133 | let $acc160666115 = exchangeFold($acc060666115, $list60666115[0]) | |
134 | 134 | if (($size60666115 == 1)) | |
135 | 135 | then $acc160666115 | |
136 | 136 | else { | |
137 | 137 | let $acc260666115 = exchangeFold($acc160666115, $list60666115[1]) | |
138 | 138 | if (($size60666115 == 2)) | |
139 | 139 | then $acc260666115 | |
140 | 140 | else { | |
141 | 141 | let $acc360666115 = exchangeFold($acc260666115, $list60666115[2]) | |
142 | 142 | if (($size60666115 == 3)) | |
143 | 143 | then $acc360666115 | |
144 | 144 | else { | |
145 | 145 | let $acc460666115 = exchangeFold($acc360666115, $list60666115[3]) | |
146 | 146 | throw("List size exceed 3") | |
147 | 147 | } | |
148 | 148 | } | |
149 | 149 | } | |
150 | 150 | } | |
151 | 151 | } | |
152 | 152 | let exchangeCounter = $t060146115._1 | |
153 | 153 | let amountsWithFee = $t060146115._2 | |
154 | 154 | let assetsIdSend = $t060146115._3 | |
155 | 155 | let amountToRecieve = assetBalance(this, receiveAssetId) | |
156 | 156 | if (if ((exchangeCounter == routingSize)) | |
157 | 157 | then (amountToRecieve >= minAmountToReceive) | |
158 | 158 | else false) | |
159 | 159 | then [ScriptTransfer(i.caller, amountToRecieve, receiveAssetId)] | |
160 | 160 | else throw("routing != routingSize or amountToRecieve < minAmountToReceive") | |
161 | 161 | } | |
162 | 162 | } | |
163 | 163 | ||
164 | 164 |
github/deemru/w8io/026f985 47.03 ms ◑