tx · 6Fs8rzUuoHKgpMcMxR6uxFxNXzdSQ8fr9Y28V6UgPTkc

3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL:  -0.01000000 Waves

2021.09.12 20:18 [1700124] smart account 3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL > SELF 0.00000000 Waves

{ "type": 13, "id": "6Fs8rzUuoHKgpMcMxR6uxFxNXzdSQ8fr9Y28V6UgPTkc", "fee": 1000000, "feeAssetId": null, "timestamp": 1631467137699, "version": 2, "chainId": 84, "sender": "3N6qtbZbSPVcvJ1pk87e9ahdsZTjHN8e5mL", "senderPublicKey": "EYAKsFBespqQveBrfmX29rsehBJrSwQ3B6yN4ADyw8Kx", "proofs": [ "62m96gY6HZHoETdECaSqdSkvUec3tx22XZD1uwMZZrQtQDZEfibKoTxi4dwLYDrbW1CmtqddTojnfoNccoWfaTUX" ], "script": "base64:AAIFAAAAAAAAAA0IAhIJCgcYGBERGAIBAAAACwAAAAAHZGlnaXRzOAAAAAAAAAAACAAAAAAGc2NhbGU4AAAAAAAF9eEAAAAAAAdzY2FsZTEyAAAAAOjUpRAAAAAAAAVhbHBoYQAAAAAAAAAAMgAAAAALYWxwaGFEaWdpdHMAAAAAAAAAAAIAAAAABGJldGEAAAAAAAK954AAAAAACmNvbW1pc3Npb24AAAAAAAAAC7gAAAAAGGNvbW1pc3Npb25TY2FsZURlbGltaXRlcgAAAAAAAA9CQAEAAAAIc2tld25lc3MAAAACAAAAAXgAAAABeQkAAGkAAAACCQAAaQAAAAIJAABkAAAAAgkAAGsAAAADBQAAAAdzY2FsZTEyBQAAAAF4BQAAAAF5CQAAawAAAAMFAAAAB3NjYWxlMTIFAAAAAXkFAAAAAXgAAAAAAAAAAAIAAAAAAAAAJxABAAAADWludmFyaWFudENhbGMAAAACAAAAAXgAAAABeQQAAAACc2sJAQAAAAhza2V3bmVzcwAAAAIFAAAAAXgFAAAAAXkJAABkAAAAAgkAAGsAAAADCQAAZAAAAAIFAAAAAX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VudFRvUmVjaWV2ZQkAA/AAAAACBQAAAAR0aGlzBQAAAA5yZWNlaXZlQXNzZXRJZAMDCQAAAAAAAAIFAAAAD2V4Y2hhbmdlQ291bnRlcgUAAAALcm91dGluZ1NpemUJAABnAAAAAgUAAAAPYW1vdW50VG9SZWNpZXZlBQAAABJtaW5BbW91bnRUb1JlY2VpdmUHCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAPYW1vdW50VG9SZWNpZXZlBQAAAA5yZWNlaXZlQXNzZXRJZAUAAAADbmlsCQAAAgAAAAECAAAAPnJvdXRpbmcgIT0gcm91dGluZ1NpemUgb3IgYW1vdW50VG9SZWNpZXZlIDwgbWluQW1vdW50VG9SZWNlaXZlAAAAAK9crnk=", "height": 1700124, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7X3LFxdPQt1bxd5JsemCmswSPgD2rUyJy6aBmT426SSi Next: 79UEBDqghBiBhmkUSbBN98tYqtzwWgC579ysBhdx5vvH Diff:
OldNewDifferences
1313
1414 let f = 46000000
1515
16-func g (h,i) = (((fraction(c, h, i) + fraction(c, i, h)) / 2) / 10000)
16+let g = 3000
17+
18+let h = 1000000
19+
20+func i (j,k) = (((fraction(c, j, k) + fraction(c, k, j)) / 2) / 10000)
1721
1822
19-func j (h,i) = {
20- let k = g(h, i)
21- (fraction((h + i), b, pow(k, a, d, e, a, CEILING)) + (2 * fraction(pow(fraction(h, i, b), 0, 5, 1, (a / 2), DOWN), pow((k - f), a, d, e, a, DOWN), b)))
23+func l (j,k) = {
24+ let m = i(j, k)
25+ (fraction((j + k), b, pow(m, a, d, e, a, CEILING)) + (2 * fraction(pow(fraction(j, k, b), 0, 5, 1, (a / 2), DOWN), pow((m - f), a, d, e, a, DOWN), b)))
2226 }
2327
2428
25-func l (m,n,o,p,q,r,s) = {
26- let t = 3000
27- let u = 1000000
28- let v = getIntegerValue(addressFromStringValue(o[0]), q[0])
29- let w = getIntegerValue(addressFromStringValue(o[0]), q[1])
30- let x = getIntegerValue(addressFromStringValue(o[1]), q[2])
31- let y = getIntegerValue(addressFromStringValue(o[1]), q[3])
32- let z = if ((p[0] == "cpmm"))
29+func n (o,p,q,r,s,t,u) = {
30+ let v = getIntegerValue(addressFromStringValue(q[0]), s[0])
31+ let w = getIntegerValue(addressFromStringValue(q[0]), s[1])
32+ let x = getIntegerValue(addressFromStringValue(q[1]), s[2])
33+ let y = getIntegerValue(addressFromStringValue(q[1]), s[3])
34+ let z = if ((r[0] == "cpmm"))
3335 then {
34- let A = fraction(w, m, (m + v))
35- fraction(A, (u - t), u)
36+ let A = fraction(w, o, (o + v))
37+ fraction(A, (h - g), h)
3638 }
37- else if ((p[0] == "flat"))
39+ else if ((r[0] == "flat"))
3840 then {
39- let B = j(v, w)
40- let C = s[0]
41- let D = j((v + m), (w - s[0]))
41+ let B = l(v, w)
42+ let C = u[0]
43+ let D = l((v + o), (w - C))
4244 if ((D >= B))
4345 then C
4446 else throw("Flat contract: invariantNew < invariant")
4547 }
4648 else throw("Incorrect exchange type")
47- let E = if ((p[1] == "cpmm"))
49+ let E = if ((r[1] == "cpmm"))
4850 then {
4951 let F = fraction(y, z, (z + x))
50- fraction(F, (u - t), u)
52+ fraction(F, (h - g), h)
5153 }
52- else if ((p[1] == "flat"))
54+ else if ((r[1] == "flat"))
5355 then {
54- let B = j(x, y)
55- let G = s[1]
56- let D = j((x + z), (y - G))
56+ let B = l(x, y)
57+ let G = u[1]
58+ let D = l((x + z), (y - G))
5759 if ((D >= B))
5860 then G
5961 else throw("Flat contract: invariantNew < invariant")
6062 }
6163 else throw("Incorrect exchange type")
62- if ((E >= n))
64+ if ((E >= p))
6365 then true
6466 else false
6567 }
6668
6769
6870 @Callable(H)
69-func routingTrade (o,p,r,s,q,I,n) = {
71+func routingTrade (q,r,t,u,s,I,p) = {
7072 let J = $Tuple2(H.payments[0].amount, H.payments[0].assetId)
71- let m = J._1
73+ let o = J._1
7274 let K = J._2
73- if (!(l(m, n, o, p, q, r, s)))
75+ if (!(n(o, p, q, r, s, t, u)))
7476 then throw("Check transaction possibilty: declined")
7577 else {
76- let L = size(o)
78+ let L = size(q)
7779 func M (N,O) = {
7880 let P = N
7981 let Q = P._1
8082 let R = P._2
8183 let S = P._3
82- if ((Q == 0))
84+ let T = if ((Q == 0))
85+ then $Tuple2(K, o)
86+ else $Tuple2(S, R)
87+ let U = T._1
88+ let V = T._2
89+ if (((if ((Q >= 0))
90+ then (L > Q)
91+ else false) == true))
8392 then {
84- let T = addressFromStringValue(O)
85- let U = if ((p[Q] == "cpmm"))
86- then invoke(T, "exchange", [r[Q]], [AttachedPayment(K, m)])
87- else if ((p[Q] == "flat"))
88- then invoke(T, "exchange", [r[Q], s[Q]], [AttachedPayment(K, m)])
93+ let W = addressFromStringValue(O)
94+ let X = if ((r[Q] == "cpmm"))
95+ then invoke(W, "exchange", [t[Q]], [AttachedPayment(U, V)])
96+ else if ((r[Q] == "flat"))
97+ then invoke(W, "exchange", [t[Q], u[Q]], [AttachedPayment(U, V)])
8998 else throw("Incorrect exchange type")
90- if ((U == U))
99+ if ((X == X))
91100 then {
92- let V = U
93- if ($isInstanceOf(V, "(Int, ByteVector)"))
101+ let Y = X
102+ if ($isInstanceOf(Y, "(Int, ByteVector)"))
94103 then {
95- let U = V
96- let W = U
97- let X = W._1
98- let Y = W._2
99- $Tuple3((Q + 1), X, Y)
104+ let X = Y
105+ let Z = X
106+ let aa = Z._1
107+ let ab = Z._2
108+ $Tuple3((Q + 1), aa, ab)
100109 }
101110 else throw("Incorrect invoke result: expected amountWithFee and assetsIdSend")
102111 }
103112 else throw("Strict value is not equal to itself.")
104113 }
105- else if (if ((Q > 0))
106- then (L > Q)
107- else false)
108- then {
109- let T = addressFromStringValue(O)
110- let Z = $Tuple2(S, R)
111- let aa = Z._1
112- let ab = Z._2
113- let U = if ((p[Q] == "cpmm"))
114- then invoke(T, "exchange", [r[Q]], [AttachedPayment(aa, ab)])
115- else if ((p[Q] == "flat"))
116- then invoke(T, "exchange", [r[Q], s[Q]], [AttachedPayment(aa, ab)])
117- else throw("Incorrect exchange type")
118- if ((U == U))
119- then {
120- let V = U
121- if ($isInstanceOf(V, "(Int, ByteVector)"))
122- then {
123- let U = V
124- let ac = U
125- let X = ac._1
126- let Y = ac._2
127- $Tuple3((Q + 1), X, Y)
128- }
129- else throw("Incorrect invoke result: expected amountWithFee and assetsIdSend")
130- }
131- else throw("Strict value is not equal to itself.")
132- }
133- else N
114+ else N
134115 }
135116
136- let ad = {
137- let ae = o
138- let af = size(ae)
139- let ag = $Tuple3(0, 0, base58'')
140- if ((af == 0))
141- then ag
117+ let ac = {
118+ let ad = q
119+ let ae = size(ad)
120+ let af = $Tuple3(0, 0, base58'')
121+ if ((ae == 0))
122+ then af
142123 else {
143- let ah = M(ag, ae[0])
144- if ((af == 1))
145- then ah
124+ let ag = M(af, ad[0])
125+ if ((ae == 1))
126+ then ag
146127 else {
147- let ai = M(ah, ae[1])
148- if ((af == 2))
149- then ai
128+ let ah = M(ag, ad[1])
129+ if ((ae == 2))
130+ then ah
150131 else {
151- let aj = M(ai, ae[2])
152- if ((af == 3))
153- then aj
132+ let ai = M(ah, ad[2])
133+ if ((ae == 3))
134+ then ai
154135 else {
155- let ak = M(aj, ae[3])
136+ let aj = M(ai, ad[3])
156137 throw("List size exceed 3")
157138 }
158139 }
159140 }
160141 }
161142 }
162- let Q = ad._1
163- let R = ad._2
164- let S = ad._3
165- let al = assetBalance(this, I)
143+ let Q = ac._1
144+ let R = ac._2
145+ let S = ac._3
146+ let ak = assetBalance(this, I)
166147 if (if ((Q == L))
167- then (al >= n)
148+ then (ak >= p)
168149 else false)
169- then [ScriptTransfer(H.caller, al, I)]
150+ then [ScriptTransfer(H.caller, ak, I)]
170151 else throw("routing != routingSize or amountToRecieve < minAmountToReceive")
171152 }
172153 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = 8
55
66 let b = 100000000
77
88 let c = 1000000000000
99
1010 let d = 50
1111
1212 let e = 2
1313
1414 let f = 46000000
1515
16-func g (h,i) = (((fraction(c, h, i) + fraction(c, i, h)) / 2) / 10000)
16+let g = 3000
17+
18+let h = 1000000
19+
20+func i (j,k) = (((fraction(c, j, k) + fraction(c, k, j)) / 2) / 10000)
1721
1822
19-func j (h,i) = {
20- let k = g(h, i)
21- (fraction((h + i), b, pow(k, a, d, e, a, CEILING)) + (2 * fraction(pow(fraction(h, i, b), 0, 5, 1, (a / 2), DOWN), pow((k - f), a, d, e, a, DOWN), b)))
23+func l (j,k) = {
24+ let m = i(j, k)
25+ (fraction((j + k), b, pow(m, a, d, e, a, CEILING)) + (2 * fraction(pow(fraction(j, k, b), 0, 5, 1, (a / 2), DOWN), pow((m - f), a, d, e, a, DOWN), b)))
2226 }
2327
2428
25-func l (m,n,o,p,q,r,s) = {
26- let t = 3000
27- let u = 1000000
28- let v = getIntegerValue(addressFromStringValue(o[0]), q[0])
29- let w = getIntegerValue(addressFromStringValue(o[0]), q[1])
30- let x = getIntegerValue(addressFromStringValue(o[1]), q[2])
31- let y = getIntegerValue(addressFromStringValue(o[1]), q[3])
32- let z = if ((p[0] == "cpmm"))
29+func n (o,p,q,r,s,t,u) = {
30+ let v = getIntegerValue(addressFromStringValue(q[0]), s[0])
31+ let w = getIntegerValue(addressFromStringValue(q[0]), s[1])
32+ let x = getIntegerValue(addressFromStringValue(q[1]), s[2])
33+ let y = getIntegerValue(addressFromStringValue(q[1]), s[3])
34+ let z = if ((r[0] == "cpmm"))
3335 then {
34- let A = fraction(w, m, (m + v))
35- fraction(A, (u - t), u)
36+ let A = fraction(w, o, (o + v))
37+ fraction(A, (h - g), h)
3638 }
37- else if ((p[0] == "flat"))
39+ else if ((r[0] == "flat"))
3840 then {
39- let B = j(v, w)
40- let C = s[0]
41- let D = j((v + m), (w - s[0]))
41+ let B = l(v, w)
42+ let C = u[0]
43+ let D = l((v + o), (w - C))
4244 if ((D >= B))
4345 then C
4446 else throw("Flat contract: invariantNew < invariant")
4547 }
4648 else throw("Incorrect exchange type")
47- let E = if ((p[1] == "cpmm"))
49+ let E = if ((r[1] == "cpmm"))
4850 then {
4951 let F = fraction(y, z, (z + x))
50- fraction(F, (u - t), u)
52+ fraction(F, (h - g), h)
5153 }
52- else if ((p[1] == "flat"))
54+ else if ((r[1] == "flat"))
5355 then {
54- let B = j(x, y)
55- let G = s[1]
56- let D = j((x + z), (y - G))
56+ let B = l(x, y)
57+ let G = u[1]
58+ let D = l((x + z), (y - G))
5759 if ((D >= B))
5860 then G
5961 else throw("Flat contract: invariantNew < invariant")
6062 }
6163 else throw("Incorrect exchange type")
62- if ((E >= n))
64+ if ((E >= p))
6365 then true
6466 else false
6567 }
6668
6769
6870 @Callable(H)
69-func routingTrade (o,p,r,s,q,I,n) = {
71+func routingTrade (q,r,t,u,s,I,p) = {
7072 let J = $Tuple2(H.payments[0].amount, H.payments[0].assetId)
71- let m = J._1
73+ let o = J._1
7274 let K = J._2
73- if (!(l(m, n, o, p, q, r, s)))
75+ if (!(n(o, p, q, r, s, t, u)))
7476 then throw("Check transaction possibilty: declined")
7577 else {
76- let L = size(o)
78+ let L = size(q)
7779 func M (N,O) = {
7880 let P = N
7981 let Q = P._1
8082 let R = P._2
8183 let S = P._3
82- if ((Q == 0))
84+ let T = if ((Q == 0))
85+ then $Tuple2(K, o)
86+ else $Tuple2(S, R)
87+ let U = T._1
88+ let V = T._2
89+ if (((if ((Q >= 0))
90+ then (L > Q)
91+ else false) == true))
8392 then {
84- let T = addressFromStringValue(O)
85- let U = if ((p[Q] == "cpmm"))
86- then invoke(T, "exchange", [r[Q]], [AttachedPayment(K, m)])
87- else if ((p[Q] == "flat"))
88- then invoke(T, "exchange", [r[Q], s[Q]], [AttachedPayment(K, m)])
93+ let W = addressFromStringValue(O)
94+ let X = if ((r[Q] == "cpmm"))
95+ then invoke(W, "exchange", [t[Q]], [AttachedPayment(U, V)])
96+ else if ((r[Q] == "flat"))
97+ then invoke(W, "exchange", [t[Q], u[Q]], [AttachedPayment(U, V)])
8998 else throw("Incorrect exchange type")
90- if ((U == U))
99+ if ((X == X))
91100 then {
92- let V = U
93- if ($isInstanceOf(V, "(Int, ByteVector)"))
101+ let Y = X
102+ if ($isInstanceOf(Y, "(Int, ByteVector)"))
94103 then {
95- let U = V
96- let W = U
97- let X = W._1
98- let Y = W._2
99- $Tuple3((Q + 1), X, Y)
104+ let X = Y
105+ let Z = X
106+ let aa = Z._1
107+ let ab = Z._2
108+ $Tuple3((Q + 1), aa, ab)
100109 }
101110 else throw("Incorrect invoke result: expected amountWithFee and assetsIdSend")
102111 }
103112 else throw("Strict value is not equal to itself.")
104113 }
105- else if (if ((Q > 0))
106- then (L > Q)
107- else false)
108- then {
109- let T = addressFromStringValue(O)
110- let Z = $Tuple2(S, R)
111- let aa = Z._1
112- let ab = Z._2
113- let U = if ((p[Q] == "cpmm"))
114- then invoke(T, "exchange", [r[Q]], [AttachedPayment(aa, ab)])
115- else if ((p[Q] == "flat"))
116- then invoke(T, "exchange", [r[Q], s[Q]], [AttachedPayment(aa, ab)])
117- else throw("Incorrect exchange type")
118- if ((U == U))
119- then {
120- let V = U
121- if ($isInstanceOf(V, "(Int, ByteVector)"))
122- then {
123- let U = V
124- let ac = U
125- let X = ac._1
126- let Y = ac._2
127- $Tuple3((Q + 1), X, Y)
128- }
129- else throw("Incorrect invoke result: expected amountWithFee and assetsIdSend")
130- }
131- else throw("Strict value is not equal to itself.")
132- }
133- else N
114+ else N
134115 }
135116
136- let ad = {
137- let ae = o
138- let af = size(ae)
139- let ag = $Tuple3(0, 0, base58'')
140- if ((af == 0))
141- then ag
117+ let ac = {
118+ let ad = q
119+ let ae = size(ad)
120+ let af = $Tuple3(0, 0, base58'')
121+ if ((ae == 0))
122+ then af
142123 else {
143- let ah = M(ag, ae[0])
144- if ((af == 1))
145- then ah
124+ let ag = M(af, ad[0])
125+ if ((ae == 1))
126+ then ag
146127 else {
147- let ai = M(ah, ae[1])
148- if ((af == 2))
149- then ai
128+ let ah = M(ag, ad[1])
129+ if ((ae == 2))
130+ then ah
150131 else {
151- let aj = M(ai, ae[2])
152- if ((af == 3))
153- then aj
132+ let ai = M(ah, ad[2])
133+ if ((ae == 3))
134+ then ai
154135 else {
155- let ak = M(aj, ae[3])
136+ let aj = M(ai, ad[3])
156137 throw("List size exceed 3")
157138 }
158139 }
159140 }
160141 }
161142 }
162- let Q = ad._1
163- let R = ad._2
164- let S = ad._3
165- let al = assetBalance(this, I)
143+ let Q = ac._1
144+ let R = ac._2
145+ let S = ac._3
146+ let ak = assetBalance(this, I)
166147 if (if ((Q == L))
167- then (al >= n)
148+ then (ak >= p)
168149 else false)
169- then [ScriptTransfer(H.caller, al, I)]
150+ then [ScriptTransfer(H.caller, ak, I)]
170151 else throw("routing != routingSize or amountToRecieve < minAmountToReceive")
171152 }
172153 }
173154
174155

github/deemru/w8io/026f985 
60.76 ms