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