tx · GPCRaLfmCssrDvqhoPNDt8ZoDeLkwsc1cHsezzwTr7on 3N1WbxZTdjLm3L8faJGiCTRk3kfaAofzd16: -1.20000000 Waves 2022.11.15 17:42 [2318372] smart account 3N1WbxZTdjLm3L8faJGiCTRk3kfaAofzd16 > SELF 0.00000000 Waves
{ "type": 13, "id": "GPCRaLfmCssrDvqhoPNDt8ZoDeLkwsc1cHsezzwTr7on", "fee": 120000000, "feeAssetId": null, "timestamp": 1668523398822, "version": 2, "chainId": 84, "sender": "3N1WbxZTdjLm3L8faJGiCTRk3kfaAofzd16", "senderPublicKey": "BrpLGAiTnNa5QohVytFPYdF7oZR7Gk1UZfA7c9Uxs9Fw", "proofs": [ "2oWpuxuDRHi3HvxVpSvCYNb4AkDqTJJo2G2gpkFX2ndZ7pLZ4bFiNLTzHYd28oAWBQswckAZqPGd5wUd6iHfqV9k" ], "script": "base64:AAIFAAAAAAAAAAkIAhIDCgEIEgAAAAAEAQAAABNrZXlNYW5hZ2VyUHVibGljS2V5AAAAAAkABCIAAAABAgAAABBtYW5hZ2VyUHVibGljS2V5AQAAABZtYW5hZ2VyUHVibGljS2V5T3JVbml0AAAAAAQAAAAHJG1hdGNoMAkBAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAAAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAXMFAAAAByRtYXRjaDAJAAJZAAAAAQUAAAABcwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAUAAAAEdW5pdAkAAAIAAAABAgAAAAtNYXRjaCBlcnJvcgEAAAALbXVzdE1hbmFnZXIAAAABAAAAAWkEAAAAAnBkCQAAAgAAAAECAAAAEXBlcm1pc3Npb24gZGVuaWVkBAAAAAckbWF0Y2gwCQEAAAAWbWFuYWdlclB1YmxpY0tleU9yVW5pdAAAAAADCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5dGVWZWN0b3IEAAAAAnBrBQAAAAckbWF0Y2gwAw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AAAAR0aGlzAAAAB3JlZ3VsYXIDCQEAAAACIT0AAAACCAUAAAABaQAAAAZjYWxsZXIFAAAAC21haW5BZGRyZXNzCQAAAgAAAAECAAAAKU9ubHkgbWFpbiBjb250cmFjdCBjYW4gaW52b2tlIHRoaXMgbWV0aG9kCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAC21haW5BZGRyZXNzBQAAAA5yZWd1bGFyQmFsYW5jZQUAAAAEdW5pdAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXlZx2US", "height": 2318372, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ChFNu4pTY1Sa3K8cLSjnwRy8FYHgvHYxXjciEh1gSypr Next: DJ9cpmfJMhr7wuqx68UUgZJSW81YzvqeMDNJemQWu4Ya Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = 1000000000000000000 | |
5 | - | ||
6 | - | let b = ((60 * 60) * 24) | |
7 | - | ||
8 | - | let c = 100000000 | |
9 | - | ||
10 | - | let d = "k_lastCompoundTime" | |
11 | - | ||
12 | - | let e = "k_periodFinish" | |
13 | - | ||
14 | - | let f = "k_lastRate" | |
15 | - | ||
16 | - | let g = "k_growthRate" | |
17 | - | ||
18 | - | let h = "k_balance" | |
19 | - | ||
20 | - | let i = "k_leaseId" | |
21 | - | ||
22 | - | let j = "k_initialized" | |
23 | - | ||
24 | - | let k = "k_adminPublicKey" | |
25 | - | ||
26 | - | let l = "k_adminAddress" | |
27 | - | ||
28 | - | let m = "k_minerAddress" | |
29 | - | ||
30 | - | let n = "k_sWavesAssetId" | |
31 | - | ||
32 | - | func o (p,q) = fraction(p, c, q, HALFEVEN) | |
4 | + | func a () = getString("managerPublicKey") | |
33 | 5 | ||
34 | 6 | ||
35 | - | func r (p,q) = fraction(p, q, c, HALFEVEN) | |
36 | - | ||
37 | - | ||
38 | - | func s (p,q) = fraction(p, a, q, HALFEVEN) | |
39 | - | ||
40 | - | ||
41 | - | func t (p,q) = fraction(p, q, a, HALFEVEN) | |
42 | - | ||
43 | - | ||
44 | - | func u (p) = if ((p > 0)) | |
45 | - | then p | |
46 | - | else -(p) | |
47 | - | ||
48 | - | ||
49 | - | func v (p,q) = if ((p > q)) | |
50 | - | then q | |
51 | - | else p | |
52 | - | ||
53 | - | ||
54 | - | func w (x,y) = ((x + "_") + y) | |
55 | - | ||
56 | - | ||
57 | - | func z () = addressFromString(getStringValue(this, l)) | |
58 | - | ||
59 | - | ||
60 | - | func A () = fromBase58String(getStringValue(this, k)) | |
61 | - | ||
62 | - | ||
63 | - | func B () = valueOrErrorMessage(addressFromString(getStringValue(this, m)), "Invalid miner address is not set") | |
64 | - | ||
65 | - | ||
66 | - | func C () = fromBase58String(getStringValue(this, n)) | |
67 | - | ||
68 | - | ||
69 | - | func D () = valueOrElse(getBoolean(this, j), false) | |
70 | - | ||
71 | - | ||
72 | - | func E (F) = valueOrErrorMessage(getInteger(this, F), ("No value for " + F)) | |
73 | - | ||
74 | - | ||
75 | - | func G (F) = valueOrElse(getInteger(this, F), 0) | |
76 | - | ||
77 | - | ||
78 | - | func H () = G(d) | |
79 | - | ||
80 | - | ||
81 | - | func I () = G(g) | |
82 | - | ||
83 | - | ||
84 | - | func J () = G(h) | |
85 | - | ||
86 | - | ||
87 | - | func K () = E(f) | |
88 | - | ||
89 | - | ||
90 | - | func L () = G(e) | |
91 | - | ||
92 | - | ||
93 | - | func M () = { | |
94 | - | let N = getString(this, k) | |
95 | - | if ($isInstanceOf(N, "String")) | |
7 | + | func b () = { | |
8 | + | let c = a() | |
9 | + | if ($isInstanceOf(c, "String")) | |
96 | 10 | then { | |
97 | - | let | |
98 | - | fromBase58String( | |
11 | + | let d = c | |
12 | + | fromBase58String(d) | |
99 | 13 | } | |
100 | - | else if ($isInstanceOf( | |
14 | + | else if ($isInstanceOf(c, "Unit")) | |
101 | 15 | then unit | |
102 | 16 | else throw("Match error") | |
103 | 17 | } | |
104 | 18 | ||
105 | 19 | ||
106 | - | func | |
107 | - | let | |
108 | - | let | |
109 | - | if ($isInstanceOf( | |
20 | + | func e (f) = { | |
21 | + | let g = throw("permission denied") | |
22 | + | let c = b() | |
23 | + | if ($isInstanceOf(c, "ByteVector")) | |
110 | 24 | then { | |
111 | - | let | |
112 | - | if (( | |
25 | + | let h = c | |
26 | + | if ((f.callerPublicKey == h)) | |
113 | 27 | then true | |
114 | - | else | |
28 | + | else g | |
115 | 29 | } | |
116 | - | else if ($isInstanceOf( | |
117 | - | then if (( | |
30 | + | else if ($isInstanceOf(c, "Unit")) | |
31 | + | then if ((f.caller == this)) | |
118 | 32 | then true | |
119 | - | else | |
33 | + | else g | |
120 | 34 | else throw("Match error") | |
121 | 35 | } | |
122 | 36 | ||
123 | 37 | ||
124 | - | func T () = (lastBlock.timestamp / 1000) | |
125 | - | ||
126 | - | ||
127 | - | func U () = v(T(), L()) | |
128 | - | ||
129 | - | ||
130 | - | func V () = { | |
131 | - | let N = getBinary(i) | |
132 | - | if ($isInstanceOf(N, "ByteVector")) | |
38 | + | func i () = { | |
39 | + | let c = getBoolean("inited") | |
40 | + | if ($isInstanceOf(c, "Boolean")) | |
133 | 41 | then { | |
134 | - | let W = N | |
135 | - | [LeaseCancel(W), DeleteEntry(i)] | |
42 | + | let j = c | |
43 | + | if ((j == false)) | |
44 | + | then true | |
45 | + | else throw("Already inited") | |
136 | 46 | } | |
137 | - | else if ($isInstanceOf( | |
138 | - | then | |
47 | + | else if ($isInstanceOf(c, "Unit")) | |
48 | + | then false | |
139 | 49 | else throw("Match error") | |
140 | 50 | } | |
141 | 51 | ||
142 | 52 | ||
143 | - | func X (Y) = [IntegerEntry(h, Y)] | |
144 | - | ||
145 | - | ||
146 | - | func Z (aa,ab) = [IntegerEntry(d, aa), IntegerEntry(e, ab)] | |
147 | - | ||
148 | - | ||
149 | - | func ac (ad,ae) = [IntegerEntry(f, ad), IntegerEntry(g, ae)] | |
150 | - | ||
151 | - | ||
152 | - | func af (Y) = if ((Y > 0)) | |
153 | - | then { | |
154 | - | let ag = Lease(B(), Y) | |
155 | - | let ah = calculateLeaseId(ag) | |
156 | - | [ag, BinaryEntry(i, ah)] | |
157 | - | } | |
158 | - | else nil | |
159 | - | ||
160 | - | ||
161 | - | func ai (Y) = if ((Y == 0)) | |
162 | - | then nil | |
163 | - | else { | |
164 | - | let aj = (J() + Y) | |
165 | - | ((V() ++ af(aj)) ++ X(aj)) | |
166 | - | } | |
167 | - | ||
168 | - | ||
169 | - | func ak (Y) = [Reissue(C(), Y, true)] | |
170 | - | ||
171 | - | ||
172 | - | func al (Y) = [Burn(C(), Y)] | |
173 | - | ||
174 | - | ||
175 | - | func am (an,Y) = [ScriptTransfer(an, Y, C())] | |
176 | - | ||
177 | - | ||
178 | - | func ao (an,Y) = [ScriptTransfer(an, Y, unit)] | |
179 | - | ||
180 | - | ||
181 | - | func ap () = { | |
182 | - | let N = assetInfo(C()) | |
183 | - | if ($isInstanceOf(N, "Asset")) | |
184 | - | then { | |
185 | - | let aq = N | |
186 | - | aq.quantity | |
187 | - | } | |
188 | - | else throw("Can't find asset") | |
189 | - | } | |
190 | - | ||
191 | - | ||
192 | - | func ar () = wavesBalance(B()).regular | |
193 | - | ||
194 | - | ||
195 | - | func as () = { | |
196 | - | let at = invoke(B(), "withdraw", nil, nil) | |
197 | - | if ((at == at)) | |
198 | - | then at | |
199 | - | else throw("Strict value is not equal to itself.") | |
200 | - | } | |
201 | - | ||
202 | - | ||
203 | - | func au () = (K() + (I() * U())) | |
204 | - | ||
205 | - | ||
206 | - | @Callable(Q) | |
207 | - | func init (av) = { | |
208 | - | let aw = P(Q) | |
209 | - | if ((aw == aw)) | |
210 | - | then if (D()) | |
211 | - | then throw("Already initialized") | |
212 | - | else { | |
213 | - | let ax = Issue("sWaves", "", 0, 8, true, unit, 0) | |
214 | - | let ay = calculateAssetId(ax) | |
215 | - | [BooleanEntry(j, true), StringEntry(n, toBase58String(ay)), StringEntry(m, av), IntegerEntry(f, a), ax] | |
216 | - | } | |
53 | + | @Callable(f) | |
54 | + | func init (k) = { | |
55 | + | let l = [e(f), i()] | |
56 | + | if ((l == l)) | |
57 | + | then [BooleanEntry("inited", true), StringEntry("mainAddress", k)] | |
217 | 58 | else throw("Strict value is not equal to itself.") | |
218 | 59 | } | |
219 | 60 | ||
220 | 61 | ||
221 | 62 | ||
222 | - | @Callable(Q) | |
223 | - | func compound () = if ((size(Q.payments) != 0)) | |
224 | - | then throw("No payments allowed") | |
225 | - | else { | |
226 | - | let az = ar() | |
227 | - | if ((az == az)) | |
228 | - | then if (((1 * c) > az)) | |
229 | - | then nil | |
230 | - | else { | |
231 | - | let aA = as() | |
232 | - | if ((aA == aA)) | |
233 | - | then { | |
234 | - | let aB = au() | |
235 | - | let aC = T() | |
236 | - | let aD = if ((aC > L())) | |
237 | - | then (s(az, c) / b) | |
238 | - | else { | |
239 | - | let aE = (L() - aC) | |
240 | - | let aF = (I() * aE) | |
241 | - | (s((az + aF), c) / b) | |
242 | - | } | |
243 | - | ((ai(az) ++ ac(aB, aD)) ++ Z(aC, (aC + b))) | |
244 | - | } | |
245 | - | else throw("Strict value is not equal to itself.") | |
246 | - | } | |
247 | - | else throw("Strict value is not equal to itself.") | |
248 | - | } | |
249 | - | ||
250 | - | ||
251 | - | ||
252 | - | @Callable(Q) | |
253 | - | func stake () = { | |
254 | - | let aG = invoke(this, "compound", nil, nil) | |
255 | - | if ((aG == aG)) | |
256 | - | then { | |
257 | - | let aH = Q.payments[0] | |
258 | - | if ((aH.assetId != unit)) | |
259 | - | then throw("Only WAVES supported") | |
260 | - | else if ((size(Q.payments) != 1)) | |
261 | - | then throw("Wrong payments amount") | |
262 | - | else { | |
263 | - | let aI = au() | |
264 | - | let aJ = s(aH.amount, aI) | |
265 | - | ((ai(aH.amount) ++ ak(aJ)) ++ am(Q.caller, aJ)) | |
266 | - | } | |
267 | - | } | |
268 | - | else throw("Strict value is not equal to itself.") | |
63 | + | @Callable(f) | |
64 | + | func withdraw () = { | |
65 | + | let k = Address(fromBase58String(getStringValue("mainAddress"))) | |
66 | + | let m = wavesBalance(this).regular | |
67 | + | if ((f.caller != k)) | |
68 | + | then throw("Only main contract can invoke this method") | |
69 | + | else [ScriptTransfer(k, m, unit)] | |
269 | 70 | } | |
270 | 71 | ||
271 | 72 | ||
272 | - | ||
273 | - | @Callable(Q) | |
274 | - | func unstake () = { | |
275 | - | let aG = invoke(this, "compound", nil, nil) | |
276 | - | if ((aG == aG)) | |
277 | - | then { | |
278 | - | let aH = Q.payments[0] | |
279 | - | if ((aH.assetId != C())) | |
280 | - | then throw("Only sWAVES supported") | |
281 | - | else if ((size(Q.payments) != 1)) | |
282 | - | then throw("Wrong payments amount") | |
283 | - | else { | |
284 | - | let aI = au() | |
285 | - | let aK = t(aH.amount, aI) | |
286 | - | ((ai(-(aK)) ++ al(aH.amount)) ++ ao(Q.caller, aK)) | |
287 | - | } | |
288 | - | } | |
289 | - | else throw("Strict value is not equal to itself.") | |
290 | - | } | |
291 | - | ||
292 | - | ||
293 | - | @Verifier(aL) | |
294 | - | func aM () = sigVerify(aL.bodyBytes, aL.proofs[0], aL.senderPublicKey) | |
73 | + | @Verifier(n) | |
74 | + | func o () = sigVerify(n.bodyBytes, n.proofs[0], n.senderPublicKey) | |
295 | 75 |
github/deemru/w8io/026f985 37.80 ms ◑