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:AAIFAAAAAAAAAA0IAhIJCgcYGBERGAIBAAAACwAAAAAHZGlnaXRzOAAAAAAAAAAACAAAAAAGc2NhbGU4AAAAAAAF9eEAAAAAAAdzY2FsZTEyAAAAAOjUpRAAAAAAAAVhbHBoYQAAAAAAAAAAMgAAAAALYWxwaGFEaWdpdHMAAAAAAAAAAAIAAAAABGJldGEAAAAAAAK954AAAAAACmNvbW1pc3Npb24AAAAAAAAAC7gAAAAAGGNvbW1pc3Npb25TY2FsZURlbGltaXRlcgAAAAAAAA9CQAEAAAAIc2tld25lc3MAAAACAAAAAXgAAAABeQkAAGkAAAACCQAAaQAAAAIJAABkAAAAAgkAAGsAAAADBQAAAAdzY2FsZTEyBQAAAAF4BQAAAAF5CQAAawAAAAMFAAAAB3NjYWxlMTIFAAAAAXkFAAAAAXgAAAAAAAAAAAIAAAAAAAAAJxABAAAADWludmFyaWFudENhbGMAAAACAAAAAXgAAAABeQQAAAACc2sJAQAAAAhza2V3bmVzcwAAAAIFAAAAAXgFAAAAAXkJAABkAAAAAgkAAGsAAAADCQAAZAAAAAIFAAAAAXg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udFRvUmVjaWV2ZQkAA/AAAAACBQAAAAR0aGlzBQAAAA5yZWNlaXZlQXNzZXRJZAMDCQAAAAAAAAIFAAAAD2V4Y2hhbmdlQ291bnRlcgUAAAALcm91dGluZ1NpemUJAABnAAAAAgUAAAAPYW1vdW50VG9SZWNpZXZlBQAAABJtaW5BbW91bnRUb1JlY2VpdmUHCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAPYW1vdW50VG9SZWNpZXZlBQAAAA5yZWNlaXZlQXNzZXRJZAUAAAADbmlsCQAAAgAAAAECAAAAPnJvdXRpbmcgIT0gcm91dGluZ1NpemUgb3IgYW1vdW50VG9SZWNpZXZlIDwgbWluQW1vdW50VG9SZWNlaXZlAAAAAK9crnk=", "height": 1700124, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7X3LFxdPQt1bxd5JsemCmswSPgD2rUyJy6aBmT426SSi Next: 79UEBDqghBiBhmkUSbBN98tYqtzwWgC579ysBhdx5vvH Diff:
Old | New | Differences | |
---|---|---|---|
13 | 13 | ||
14 | 14 | let f = 46000000 | |
15 | 15 | ||
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) | |
17 | 21 | ||
18 | 22 | ||
19 | - | func | |
20 | - | let | |
21 | - | (fraction(( | |
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))) | |
22 | 26 | } | |
23 | 27 | ||
24 | 28 | ||
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")) | |
33 | 35 | then { | |
34 | - | let A = fraction(w, | |
35 | - | fraction(A, ( | |
36 | + | let A = fraction(w, o, (o + v)) | |
37 | + | fraction(A, (h - g), h) | |
36 | 38 | } | |
37 | - | else if (( | |
39 | + | else if ((r[0] == "flat")) | |
38 | 40 | then { | |
39 | - | let B = | |
40 | - | let C = | |
41 | - | let D = | |
41 | + | let B = l(v, w) | |
42 | + | let C = u[0] | |
43 | + | let D = l((v + o), (w - C)) | |
42 | 44 | if ((D >= B)) | |
43 | 45 | then C | |
44 | 46 | else throw("Flat contract: invariantNew < invariant") | |
45 | 47 | } | |
46 | 48 | else throw("Incorrect exchange type") | |
47 | - | let E = if (( | |
49 | + | let E = if ((r[1] == "cpmm")) | |
48 | 50 | then { | |
49 | 51 | let F = fraction(y, z, (z + x)) | |
50 | - | fraction(F, ( | |
52 | + | fraction(F, (h - g), h) | |
51 | 53 | } | |
52 | - | else if (( | |
54 | + | else if ((r[1] == "flat")) | |
53 | 55 | then { | |
54 | - | let B = | |
55 | - | let G = | |
56 | - | let D = | |
56 | + | let B = l(x, y) | |
57 | + | let G = u[1] | |
58 | + | let D = l((x + z), (y - G)) | |
57 | 59 | if ((D >= B)) | |
58 | 60 | then G | |
59 | 61 | else throw("Flat contract: invariantNew < invariant") | |
60 | 62 | } | |
61 | 63 | else throw("Incorrect exchange type") | |
62 | - | if ((E >= | |
64 | + | if ((E >= p)) | |
63 | 65 | then true | |
64 | 66 | else false | |
65 | 67 | } | |
66 | 68 | ||
67 | 69 | ||
68 | 70 | @Callable(H) | |
69 | - | func routingTrade ( | |
71 | + | func routingTrade (q,r,t,u,s,I,p) = { | |
70 | 72 | let J = $Tuple2(H.payments[0].amount, H.payments[0].assetId) | |
71 | - | let | |
73 | + | let o = J._1 | |
72 | 74 | let K = J._2 | |
73 | - | if (!( | |
75 | + | if (!(n(o, p, q, r, s, t, u))) | |
74 | 76 | then throw("Check transaction possibilty: declined") | |
75 | 77 | else { | |
76 | - | let L = size( | |
78 | + | let L = size(q) | |
77 | 79 | func M (N,O) = { | |
78 | 80 | let P = N | |
79 | 81 | let Q = P._1 | |
80 | 82 | let R = P._2 | |
81 | 83 | 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)) | |
83 | 92 | then { | |
84 | - | let | |
85 | - | let | |
86 | - | then invoke( | |
87 | - | else if (( | |
88 | - | then invoke( | |
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)]) | |
89 | 98 | else throw("Incorrect exchange type") | |
90 | - | if (( | |
99 | + | if ((X == X)) | |
91 | 100 | then { | |
92 | - | let | |
93 | - | if ($isInstanceOf( | |
101 | + | let Y = X | |
102 | + | if ($isInstanceOf(Y, "(Int, ByteVector)")) | |
94 | 103 | then { | |
95 | - | let | |
96 | - | let | |
97 | - | let | |
98 | - | let | |
99 | - | $Tuple3((Q + 1), | |
104 | + | let X = Y | |
105 | + | let Z = X | |
106 | + | let aa = Z._1 | |
107 | + | let ab = Z._2 | |
108 | + | $Tuple3((Q + 1), aa, ab) | |
100 | 109 | } | |
101 | 110 | else throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
102 | 111 | } | |
103 | 112 | else throw("Strict value is not equal to itself.") | |
104 | 113 | } | |
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 | |
134 | 115 | } | |
135 | 116 | ||
136 | - | let | |
137 | - | let | |
138 | - | let | |
139 | - | let | |
140 | - | if (( | |
141 | - | then | |
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 | |
142 | 123 | else { | |
143 | - | let | |
144 | - | if (( | |
145 | - | then | |
124 | + | let ag = M(af, ad[0]) | |
125 | + | if ((ae == 1)) | |
126 | + | then ag | |
146 | 127 | else { | |
147 | - | let | |
148 | - | if (( | |
149 | - | then | |
128 | + | let ah = M(ag, ad[1]) | |
129 | + | if ((ae == 2)) | |
130 | + | then ah | |
150 | 131 | else { | |
151 | - | let | |
152 | - | if (( | |
153 | - | then | |
132 | + | let ai = M(ah, ad[2]) | |
133 | + | if ((ae == 3)) | |
134 | + | then ai | |
154 | 135 | else { | |
155 | - | let | |
136 | + | let aj = M(ai, ad[3]) | |
156 | 137 | throw("List size exceed 3") | |
157 | 138 | } | |
158 | 139 | } | |
159 | 140 | } | |
160 | 141 | } | |
161 | 142 | } | |
162 | - | let Q = | |
163 | - | let R = | |
164 | - | let S = | |
165 | - | let | |
143 | + | let Q = ac._1 | |
144 | + | let R = ac._2 | |
145 | + | let S = ac._3 | |
146 | + | let ak = assetBalance(this, I) | |
166 | 147 | if (if ((Q == L)) | |
167 | - | then ( | |
148 | + | then (ak >= p) | |
168 | 149 | else false) | |
169 | - | then [ScriptTransfer(H.caller, | |
150 | + | then [ScriptTransfer(H.caller, ak, I)] | |
170 | 151 | else throw("routing != routingSize or amountToRecieve < minAmountToReceive") | |
171 | 152 | } | |
172 | 153 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = 8 | |
5 | 5 | ||
6 | 6 | let b = 100000000 | |
7 | 7 | ||
8 | 8 | let c = 1000000000000 | |
9 | 9 | ||
10 | 10 | let d = 50 | |
11 | 11 | ||
12 | 12 | let e = 2 | |
13 | 13 | ||
14 | 14 | let f = 46000000 | |
15 | 15 | ||
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) | |
17 | 21 | ||
18 | 22 | ||
19 | - | func | |
20 | - | let | |
21 | - | (fraction(( | |
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))) | |
22 | 26 | } | |
23 | 27 | ||
24 | 28 | ||
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")) | |
33 | 35 | then { | |
34 | - | let A = fraction(w, | |
35 | - | fraction(A, ( | |
36 | + | let A = fraction(w, o, (o + v)) | |
37 | + | fraction(A, (h - g), h) | |
36 | 38 | } | |
37 | - | else if (( | |
39 | + | else if ((r[0] == "flat")) | |
38 | 40 | then { | |
39 | - | let B = | |
40 | - | let C = | |
41 | - | let D = | |
41 | + | let B = l(v, w) | |
42 | + | let C = u[0] | |
43 | + | let D = l((v + o), (w - C)) | |
42 | 44 | if ((D >= B)) | |
43 | 45 | then C | |
44 | 46 | else throw("Flat contract: invariantNew < invariant") | |
45 | 47 | } | |
46 | 48 | else throw("Incorrect exchange type") | |
47 | - | let E = if (( | |
49 | + | let E = if ((r[1] == "cpmm")) | |
48 | 50 | then { | |
49 | 51 | let F = fraction(y, z, (z + x)) | |
50 | - | fraction(F, ( | |
52 | + | fraction(F, (h - g), h) | |
51 | 53 | } | |
52 | - | else if (( | |
54 | + | else if ((r[1] == "flat")) | |
53 | 55 | then { | |
54 | - | let B = | |
55 | - | let G = | |
56 | - | let D = | |
56 | + | let B = l(x, y) | |
57 | + | let G = u[1] | |
58 | + | let D = l((x + z), (y - G)) | |
57 | 59 | if ((D >= B)) | |
58 | 60 | then G | |
59 | 61 | else throw("Flat contract: invariantNew < invariant") | |
60 | 62 | } | |
61 | 63 | else throw("Incorrect exchange type") | |
62 | - | if ((E >= | |
64 | + | if ((E >= p)) | |
63 | 65 | then true | |
64 | 66 | else false | |
65 | 67 | } | |
66 | 68 | ||
67 | 69 | ||
68 | 70 | @Callable(H) | |
69 | - | func routingTrade ( | |
71 | + | func routingTrade (q,r,t,u,s,I,p) = { | |
70 | 72 | let J = $Tuple2(H.payments[0].amount, H.payments[0].assetId) | |
71 | - | let | |
73 | + | let o = J._1 | |
72 | 74 | let K = J._2 | |
73 | - | if (!( | |
75 | + | if (!(n(o, p, q, r, s, t, u))) | |
74 | 76 | then throw("Check transaction possibilty: declined") | |
75 | 77 | else { | |
76 | - | let L = size( | |
78 | + | let L = size(q) | |
77 | 79 | func M (N,O) = { | |
78 | 80 | let P = N | |
79 | 81 | let Q = P._1 | |
80 | 82 | let R = P._2 | |
81 | 83 | 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)) | |
83 | 92 | then { | |
84 | - | let | |
85 | - | let | |
86 | - | then invoke( | |
87 | - | else if (( | |
88 | - | then invoke( | |
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)]) | |
89 | 98 | else throw("Incorrect exchange type") | |
90 | - | if (( | |
99 | + | if ((X == X)) | |
91 | 100 | then { | |
92 | - | let | |
93 | - | if ($isInstanceOf( | |
101 | + | let Y = X | |
102 | + | if ($isInstanceOf(Y, "(Int, ByteVector)")) | |
94 | 103 | then { | |
95 | - | let | |
96 | - | let | |
97 | - | let | |
98 | - | let | |
99 | - | $Tuple3((Q + 1), | |
104 | + | let X = Y | |
105 | + | let Z = X | |
106 | + | let aa = Z._1 | |
107 | + | let ab = Z._2 | |
108 | + | $Tuple3((Q + 1), aa, ab) | |
100 | 109 | } | |
101 | 110 | else throw("Incorrect invoke result: expected amountWithFee and assetsIdSend") | |
102 | 111 | } | |
103 | 112 | else throw("Strict value is not equal to itself.") | |
104 | 113 | } | |
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 | |
134 | 115 | } | |
135 | 116 | ||
136 | - | let | |
137 | - | let | |
138 | - | let | |
139 | - | let | |
140 | - | if (( | |
141 | - | then | |
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 | |
142 | 123 | else { | |
143 | - | let | |
144 | - | if (( | |
145 | - | then | |
124 | + | let ag = M(af, ad[0]) | |
125 | + | if ((ae == 1)) | |
126 | + | then ag | |
146 | 127 | else { | |
147 | - | let | |
148 | - | if (( | |
149 | - | then | |
128 | + | let ah = M(ag, ad[1]) | |
129 | + | if ((ae == 2)) | |
130 | + | then ah | |
150 | 131 | else { | |
151 | - | let | |
152 | - | if (( | |
153 | - | then | |
132 | + | let ai = M(ah, ad[2]) | |
133 | + | if ((ae == 3)) | |
134 | + | then ai | |
154 | 135 | else { | |
155 | - | let | |
136 | + | let aj = M(ai, ad[3]) | |
156 | 137 | throw("List size exceed 3") | |
157 | 138 | } | |
158 | 139 | } | |
159 | 140 | } | |
160 | 141 | } | |
161 | 142 | } | |
162 | - | let Q = | |
163 | - | let R = | |
164 | - | let S = | |
165 | - | let | |
143 | + | let Q = ac._1 | |
144 | + | let R = ac._2 | |
145 | + | let S = ac._3 | |
146 | + | let ak = assetBalance(this, I) | |
166 | 147 | if (if ((Q == L)) | |
167 | - | then ( | |
148 | + | then (ak >= p) | |
168 | 149 | else false) | |
169 | - | then [ScriptTransfer(H.caller, | |
150 | + | then [ScriptTransfer(H.caller, ak, I)] | |
170 | 151 | else throw("routing != routingSize or amountToRecieve < minAmountToReceive") | |
171 | 152 | } | |
172 | 153 | } | |
173 | 154 | ||
174 | 155 |
github/deemru/w8io/026f985 60.76 ms ◑