tx · 4LDgK1DQT1SAcPwQ1cis7UAysoZz2dFoN5vPHTU98Nek 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq: -0.01300000 Waves 2023.01.30 12:38 [2427529] smart account 3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq > SELF 0.00000000 Waves
{ "type": 13, "id": "4LDgK1DQT1SAcPwQ1cis7UAysoZz2dFoN5vPHTU98Nek", "fee": 1300000, "feeAssetId": null, "timestamp": 1675071572465, "version": 1, "sender": "3N6LHjfGb6Fgcy7YsVcNxGyPTj49XbQAijq", "senderPublicKey": "2u2wYYcVBQv43Cc71zkhHPPitkqgg6dqTZ3nUMvYJ1uq", "proofs": [ "5NT25v2oqHgdbCMpJconRNSnowZoaHs1UYH5DxsqD3tZHqTm5HxUFifBsD8uksNT1rr4geZzhRMvagom2Zh7Cx8V" ], "script": "base64:BgIXCAISBQoDAQgIEgUKAwEICBIDCgEIEgAUAANTRVACAl9fAAhmZWVTY2FsZQkAtgIBAKCNBgEPZ2V0U3RyaW5nT3JGYWlsAQNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQR0aGlzBQNrZXkJAKwCAgIVTm8gZGF0YSBmb3IgdGhpcy5rZXk9BQNrZXkADHBvb2xEaXNhYmxlZAkAAgECDVBvb2wgZGlzYWJsZWQADHBvb2xOb3RFeGlzdAkAAgECEVBvb2wgaXMgbm90IGV4aXN0AA5zbGlwcGFnZVRvb0JpZwkAAgECE1NsaXBwYWdlIGlzIHRvbyBiaWcBE2tleU1hbmFnZXJQdWJsaWNLZXkAAhQlc19fbWFuYWdlclB1YmxpY0tleQEaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAhslc19fcGVuZGluZ01hbmFnZXJQdWJsaWNLZXkBAmZjAAITJXNfX2ZhY3RvcnlDb250cmFjdAAPZmFjdG9yeUNvbnRyYWN0CQERQGV4dHJOYXRpdmUoMTA2MikBCQEPZ2V0U3RyaW5nT3JGYWlsAQk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3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgFpAQ5jb25maXJtTWFuYWdlcgAEAnBtCQEdcGVuZGluZ01hbmFnZXJQdWJsaWNLZXlPclVuaXQABAVoYXNQTQMJAQlpc0RlZmluZWQBBQJwbQYJAAIBAhJubyBwZW5kaW5nIG1hbmFnZXIDCQAAAgUFaGFzUE0FBWhhc1BNBAdjaGVja1BNAwkAAAIIBQFpD2NhbGxlclB1YmxpY0tleQkBBXZhbHVlAQUCcG0GCQACAQIbeW91IGFyZSBub3QgcGVuZGluZyBtYW5hZ2VyAwkAAAIFB2NoZWNrUE0FB2NoZWNrUE0JAMwIAgkBC1N0cmluZ0VudHJ5AgkBE2tleU1hbmFnZXJQdWJsaWNLZXkACQDYBAEJAQV2YWx1ZQEFAnBtCQDMCAIJAQtEZWxldGVFbnRyeQEJARprZXlQZW5kaW5nTWFuYWdlclB1YmxpY0tleQAFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAED3RhcmdldFB1YmxpY0tleQQHJG1hdGNoMAkBFm1hbmFnZXJQdWJsaWNLZXlPclVuaXQAAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAnBrBQckbWF0Y2gwBQJwawMJAAECBQckbWF0Y2gwAgRVbml0CAUCdHgPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFD3RhcmdldFB1YmxpY0tleRcydRs=", "chainId": 84, "height": 2427529, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3XNuPqrLxCykM5YCU9L5mZmYiGrmPeEwC9g3UQwpDNG9 Next: A7H6RqSs3FWyF4erSDHv8qyoE2kLqHs7ZLpxhZFrapMQ Diff:
Old | New | Differences | |
---|---|---|---|
98 | 98 | ||
99 | 99 | ||
100 | 100 | @Callable(z) | |
101 | - | func | |
101 | + | func swapCalculateREADONLY (E,F,G) = { | |
102 | 102 | let H = value(getInteger(n())) | |
103 | 103 | let I = fraction(toBigInt(E), toBigInt(H), b) | |
104 | 104 | let J = fraction(toBigInt(E), toBigInt(H), b) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "__" | |
5 | 5 | ||
6 | 6 | let b = toBigInt(100000) | |
7 | 7 | ||
8 | 8 | func c (d) = valueOrErrorMessage(getString(this, d), ("No data for this.key=" + d)) | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | let e = throw("Pool disabled") | |
12 | 12 | ||
13 | 13 | let f = throw("Pool is not exist") | |
14 | 14 | ||
15 | 15 | let g = throw("Slippage is too big") | |
16 | 16 | ||
17 | 17 | func h () = "%s__managerPublicKey" | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func i () = "%s__pendingManagerPublicKey" | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func j () = "%s__factoryContract" | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | let k = addressFromStringValue(c(j())) | |
27 | 27 | ||
28 | 28 | func l () = makeString(["%s", "feeLiquidityContractAddress"], a) | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func m () = makeString(["%s", "feeLiquidity"], a) | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func n () = makeString(["%s", "protocolFee"], a) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func o (p) = { | |
38 | 38 | let q = p | |
39 | 39 | if ($isInstanceOf(q, "Int")) | |
40 | 40 | then { | |
41 | 41 | let r = q | |
42 | 42 | r | |
43 | 43 | } | |
44 | 44 | else throw("fail to cast into Int") | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func s (t,u) = makeString(["%d%d", toString(t), toString(u)], a) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func v () = { | |
52 | 52 | let q = getString(h()) | |
53 | 53 | if ($isInstanceOf(q, "String")) | |
54 | 54 | then { | |
55 | 55 | let w = q | |
56 | 56 | fromBase58String(w) | |
57 | 57 | } | |
58 | 58 | else if ($isInstanceOf(q, "Unit")) | |
59 | 59 | then unit | |
60 | 60 | else throw("Match error") | |
61 | 61 | } | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func x () = { | |
65 | 65 | let q = getString(i()) | |
66 | 66 | if ($isInstanceOf(q, "String")) | |
67 | 67 | then { | |
68 | 68 | let w = q | |
69 | 69 | fromBase58String(w) | |
70 | 70 | } | |
71 | 71 | else if ($isInstanceOf(q, "Unit")) | |
72 | 72 | then unit | |
73 | 73 | else throw("Match error") | |
74 | 74 | } | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func y (z) = { | |
78 | 78 | let q = v() | |
79 | 79 | if ($isInstanceOf(q, "ByteVector")) | |
80 | 80 | then { | |
81 | 81 | let A = q | |
82 | 82 | (z.callerPublicKey == A) | |
83 | 83 | } | |
84 | 84 | else if ($isInstanceOf(q, "Unit")) | |
85 | 85 | then (z.caller == this) | |
86 | 86 | else throw("Match error") | |
87 | 87 | } | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | func B (z) = if (y(z)) | |
91 | 91 | then true | |
92 | 92 | else throw("permission denied") | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func C (D) = if ((D == "WAVES")) | |
96 | 96 | then wavesBalance(this).available | |
97 | 97 | else assetBalance(this, fromBase58String(D)) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | @Callable(z) | |
101 | - | func | |
101 | + | func swapCalculateREADONLY (E,F,G) = { | |
102 | 102 | let H = value(getInteger(n())) | |
103 | 103 | let I = fraction(toBigInt(E), toBigInt(H), b) | |
104 | 104 | let J = fraction(toBigInt(E), toBigInt(H), b) | |
105 | 105 | let K = (toBigInt(E) - I) | |
106 | 106 | let L = (K - J) | |
107 | 107 | let M = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [F, G], nil) | |
108 | 108 | let N = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [G, F], nil) | |
109 | 109 | let O = if ((M != unit)) | |
110 | 110 | then { | |
111 | 111 | let P = false | |
112 | 112 | let Q = { | |
113 | 113 | let R = invoke(k, "getPoolAddressFromLpAssetREADONLY", [M], nil) | |
114 | 114 | if ($isInstanceOf(R, "Address")) | |
115 | 115 | then R | |
116 | 116 | else throw(($getType(R) + " couldn't be cast to Address")) | |
117 | 117 | } | |
118 | 118 | $Tuple2(P, Q) | |
119 | 119 | } | |
120 | 120 | else if ((N != unit)) | |
121 | 121 | then { | |
122 | 122 | let P = true | |
123 | 123 | let Q = invoke(k, "getPoolAddressFromLpAssetREADONLY", [N], nil) | |
124 | 124 | $Tuple2(P, Q) | |
125 | 125 | } | |
126 | 126 | else f | |
127 | 127 | let P = O._1 | |
128 | 128 | let Q = O._2 | |
129 | 129 | let S = { | |
130 | 130 | let R = invoke(k, "isPoolOneTokenOperationsDisabledREADONLY", [Q], nil) | |
131 | 131 | if ($isInstanceOf(R, "Boolean")) | |
132 | 132 | then R | |
133 | 133 | else throw(($getType(R) + " couldn't be cast to Boolean")) | |
134 | 134 | } | |
135 | 135 | let T = if (S) | |
136 | 136 | then true | |
137 | 137 | else e | |
138 | 138 | if ((T == T)) | |
139 | 139 | then { | |
140 | 140 | let U = addressFromStringValue(valueOrElse(Q, "")) | |
141 | 141 | let V = { | |
142 | 142 | let R = invoke(U, "calculateAmountOutForSwapREADONLY", [L, P], nil) | |
143 | 143 | if ($isInstanceOf(R, "Int")) | |
144 | 144 | then R | |
145 | 145 | else throw(($getType(R) + " couldn't be cast to Int")) | |
146 | 146 | } | |
147 | 147 | $Tuple2(nil, V) | |
148 | 148 | } | |
149 | 149 | else throw("Strict value is not equal to itself.") | |
150 | 150 | } | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | ||
154 | 154 | @Callable(z) | |
155 | 155 | func swap (W,G,X) = { | |
156 | 156 | let Y = value(z.payments[0]) | |
157 | 157 | let F = if ((Y.assetId == unit)) | |
158 | 158 | then toBytes("WAVES") | |
159 | 159 | else value(Y.assetId) | |
160 | 160 | let E = value(Y.amount) | |
161 | 161 | let H = value(getInteger(n())) | |
162 | 162 | let I = fraction(toBigInt(E), toBigInt(H), b) | |
163 | 163 | let J = fraction(toBigInt(E), toBigInt(H), b) | |
164 | 164 | let K = (toBigInt(E) - I) | |
165 | 165 | let L = (K - J) | |
166 | 166 | let Z = [if ((size(z.payments) == 1)) | |
167 | 167 | then true | |
168 | 168 | else throw("exactly 1 payment are expected")] | |
169 | 169 | if ((Z == Z)) | |
170 | 170 | then { | |
171 | 171 | let M = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [F, G], nil) | |
172 | 172 | let N = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [G, F], nil) | |
173 | 173 | let aa = if ((M != unit)) | |
174 | 174 | then { | |
175 | 175 | let P = false | |
176 | 176 | let Q = { | |
177 | 177 | let R = invoke(k, "getPoolAddressFromLpAssetREADONLY", [M], nil) | |
178 | 178 | if ($isInstanceOf(R, "Address")) | |
179 | 179 | then R | |
180 | 180 | else throw(($getType(R) + " couldn't be cast to Address")) | |
181 | 181 | } | |
182 | 182 | $Tuple2(P, Q) | |
183 | 183 | } | |
184 | 184 | else if ((N != unit)) | |
185 | 185 | then { | |
186 | 186 | let P = true | |
187 | 187 | let Q = invoke(k, "getPoolAddressFromLpAssetREADONLY", [N], nil) | |
188 | 188 | $Tuple2(P, Q) | |
189 | 189 | } | |
190 | 190 | else f | |
191 | 191 | let P = aa._1 | |
192 | 192 | let Q = aa._2 | |
193 | 193 | let S = { | |
194 | 194 | let R = invoke(k, "isPoolOneTokenOperationsDisabledREADONLY", [Q], nil) | |
195 | 195 | if ($isInstanceOf(R, "Boolean")) | |
196 | 196 | then R | |
197 | 197 | else throw(($getType(R) + " couldn't be cast to Boolean")) | |
198 | 198 | } | |
199 | 199 | let T = if (S) | |
200 | 200 | then true | |
201 | 201 | else e | |
202 | 202 | if ((T == T)) | |
203 | 203 | then { | |
204 | 204 | let U = addressFromStringValue(valueOrElse(Q, "")) | |
205 | 205 | let V = { | |
206 | 206 | let R = invoke(U, "calculateAmountOutForSwapAndSendTokens", [L, P, W, X], [AttachedPayment(F, toInt(K))]) | |
207 | 207 | if ($isInstanceOf(R, "Boolean")) | |
208 | 208 | then R | |
209 | 209 | else throw(($getType(R) + " couldn't be cast to Boolean")) | |
210 | 210 | } | |
211 | 211 | $Tuple2(nil, V) | |
212 | 212 | } | |
213 | 213 | else throw("Strict value is not equal to itself.") | |
214 | 214 | } | |
215 | 215 | else throw("Strict value is not equal to itself.") | |
216 | 216 | } | |
217 | 217 | ||
218 | 218 | ||
219 | 219 | ||
220 | 220 | @Callable(z) | |
221 | 221 | func setManager (ab) = { | |
222 | 222 | let ac = B(z) | |
223 | 223 | if ((ac == ac)) | |
224 | 224 | then { | |
225 | 225 | let ad = fromBase58String(ab) | |
226 | 226 | if ((ad == ad)) | |
227 | 227 | then [StringEntry(i(), ab)] | |
228 | 228 | else throw("Strict value is not equal to itself.") | |
229 | 229 | } | |
230 | 230 | else throw("Strict value is not equal to itself.") | |
231 | 231 | } | |
232 | 232 | ||
233 | 233 | ||
234 | 234 | ||
235 | 235 | @Callable(z) | |
236 | 236 | func confirmManager () = { | |
237 | 237 | let ae = x() | |
238 | 238 | let af = if (isDefined(ae)) | |
239 | 239 | then true | |
240 | 240 | else throw("no pending manager") | |
241 | 241 | if ((af == af)) | |
242 | 242 | then { | |
243 | 243 | let ag = if ((z.callerPublicKey == value(ae))) | |
244 | 244 | then true | |
245 | 245 | else throw("you are not pending manager") | |
246 | 246 | if ((ag == ag)) | |
247 | 247 | then [StringEntry(h(), toBase58String(value(ae))), DeleteEntry(i())] | |
248 | 248 | else throw("Strict value is not equal to itself.") | |
249 | 249 | } | |
250 | 250 | else throw("Strict value is not equal to itself.") | |
251 | 251 | } | |
252 | 252 | ||
253 | 253 | ||
254 | 254 | @Verifier(ah) | |
255 | 255 | func ai () = { | |
256 | 256 | let aj = { | |
257 | 257 | let q = v() | |
258 | 258 | if ($isInstanceOf(q, "ByteVector")) | |
259 | 259 | then { | |
260 | 260 | let A = q | |
261 | 261 | A | |
262 | 262 | } | |
263 | 263 | else if ($isInstanceOf(q, "Unit")) | |
264 | 264 | then ah.senderPublicKey | |
265 | 265 | else throw("Match error") | |
266 | 266 | } | |
267 | 267 | sigVerify(ah.bodyBytes, ah.proofs[0], aj) | |
268 | 268 | } | |
269 | 269 |
github/deemru/w8io/169f3d6 31.95 ms ◑