tx · 97kHeeMZRJKL9B56kwhMBxvdh87ycc4CazKJX4QJrVHK 3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh: -0.01000000 Waves 2022.12.07 03:36 [2349220] smart account 3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh > SELF 0.00000000 Waves
{ "type": 13, "id": "97kHeeMZRJKL9B56kwhMBxvdh87ycc4CazKJX4QJrVHK", "fee": 1000000, "feeAssetId": null, "timestamp": 1670373371000, "version": 2, "chainId": 84, "sender": "3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh", "senderPublicKey": "HscGVyJG5M3NMHWKfQbucCBsFLGPi8VmTxTAmcBbaWTa", "proofs": [ "2YJW2MixRkcqKnauKH52krn1SChdoRmR59AEhxtRHsYPcj9qHXQ8DbMdu5oy2exKSo1gioR7fS74veEyASaw8jKn" ], "script": "base64:BgITCAISAwoBCBIDCgEIEgASAwoBARcABlNjYWxlNgDAhD0ABlNjYWxlOACAwtcvAAdTY2FsZTE2CQBoAgUGU2NhbGU4BQZTY2FsZTgACnZhbGlkYXRvcnMJAMwIAgIjM05BbXFHanhSQlJQb1JIWlVVcXZoaU5TNmF4bkdwaW5MSEMFA25pbAAPbW9uZXlCb3hBZGRyZXNzCQEHQWRkcmVzcwEBGgFUZKnP467xWXotJQOt2k8QiNBvrQpHH8SpAAdhc3NldElkAixISG1hRlFwVW9id0t4emp6NEVDYUJQdG9GNjlrdWpLd1UyY296YVV6VHNndgALcHV6emxlUG9vbHMJAMwIAgIjM042U3RKZGdtVGZBUnNSTm45WHQ1ckRZRXMzcHI0S0d5MXYJAMwIAgIjM014RFREUXRuUjd6cEx1SHlneGdGenJxS1oyQlN3emNqeWEFA25pbAEKZ2V0QmFsYW5jZQEHYXNzZXRJZAQHJG1hdGNoMAUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgRVbml0BAF4BQckbWF0Y2gwCAkA7wcBBQR0aGlzCWF2YWlsYWJsZQkA8AcCBQR0aGlzCQEFdm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mEdqLmEQaJcHC6PD8NFyvaLVFECSTjr5sA6FNL2 Next: AEcMiCB7dKNKF8t3LCw7WUpJzP72t2Vdv26fT8Qq5zDT Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = 1000000 | |
5 | 5 | ||
6 | 6 | let b = 100000000 | |
7 | 7 | ||
8 | 8 | let c = (b * b) | |
9 | 9 | ||
10 | 10 | let d = ["3NAmqGjxRBRPoRHZUUqvhiNS6axnGpinLHC"] | |
11 | 11 | ||
12 | 12 | let e = Address(base58'3My6LmrRSRvJ73T14oT5k53SGPavGFoacWc') | |
13 | 13 | ||
14 | 14 | let f = "HHmaFQpUobwKxzjz4ECaBPtoF69kujKwU2cozaUzTsgv" | |
15 | 15 | ||
16 | 16 | let g = ["3N6StJdgmTfARsRNn9Xt5rDYEs3pr4KGy1v", "3MxDTDQtnR7zpLuHygxgFzrqKZ2BSwzcjya"] | |
17 | 17 | ||
18 | 18 | func h (f) = { | |
19 | 19 | let i = f | |
20 | 20 | if ($isInstanceOf(i, "Unit")) | |
21 | 21 | then { | |
22 | 22 | let j = i | |
23 | 23 | wavesBalance(this).available | |
24 | 24 | } | |
25 | 25 | else assetBalance(this, value(f)) | |
26 | 26 | } | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func k (l,m) = { | |
30 | 30 | let i = getInteger(l, m) | |
31 | 31 | if ($isInstanceOf(i, "Int")) | |
32 | 32 | then { | |
33 | 33 | let n = i | |
34 | 34 | n | |
35 | 35 | } | |
36 | 36 | else 0 | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func o (l,m) = { | |
41 | 41 | let i = getString(l, m) | |
42 | 42 | if ($isInstanceOf(i, "String")) | |
43 | 43 | then { | |
44 | 44 | let n = i | |
45 | 45 | n | |
46 | 46 | } | |
47 | 47 | else "" | |
48 | 48 | } | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func p (f) = { | |
52 | 52 | let i = f | |
53 | 53 | if ($isInstanceOf(i, "ByteVector")) | |
54 | 54 | then { | |
55 | 55 | let n = i | |
56 | 56 | toBase58String(n) | |
57 | 57 | } | |
58 | 58 | else "WAVES" | |
59 | 59 | } | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func q (r) = { | |
63 | 63 | let s = assetBalance(Address(fromBase58String(r)), fromBase58String(f)) | |
64 | 64 | s | |
65 | 65 | } | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | func t () = { | |
69 | 69 | let u = o(this, "currentPool") | |
70 | 70 | if ((u == "")) | |
71 | 71 | then throw(("Cannot find pool with id " + u)) | |
72 | 72 | else q(u) | |
73 | 73 | } | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func v (r,w) = { | |
77 | 77 | let x = Address(fromBase58String(r)) | |
78 | 78 | let y = if ((w > 0)) | |
79 | 79 | then invoke(x, "withdraw", [f, w], nil) | |
80 | 80 | else "" | |
81 | 81 | if ((y == y)) | |
82 | 82 | then y | |
83 | 83 | else throw("Strict value is not equal to itself.") | |
84 | 84 | } | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func z () = { | |
88 | 88 | let A = k(this, "global_staked") | |
89 | 89 | let B = k(this, "global_lastCheckSRate") | |
90 | 90 | let C = fraction(A, B, b) | |
91 | 91 | let D = t() | |
92 | 92 | let E = (D - C) | |
93 | 93 | let F = fraction(E, 5000000, b) | |
94 | 94 | if ((F > 0)) | |
95 | 95 | then F | |
96 | 96 | else 0 | |
97 | 97 | } | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func G () = { | |
101 | 101 | let H = k(this, "global_lastCheckSRate") | |
102 | 102 | let A = k(this, "global_staked") | |
103 | 103 | let I = fraction(A, H, b) | |
104 | 104 | if ((H == 0)) | |
105 | 105 | then b | |
106 | 106 | else if ((I == 0)) | |
107 | 107 | then H | |
108 | 108 | else { | |
109 | 109 | let J = fraction(H, (fraction((fraction(t(), a, I) - a), (b - 5000000), b) + a), a) | |
110 | 110 | if ((b > J)) | |
111 | 111 | then H | |
112 | 112 | else J | |
113 | 113 | } | |
114 | 114 | } | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func K (L) = { | |
118 | 118 | let A = k(this, "global_staked") | |
119 | 119 | let J = G() | |
120 | 120 | [IntegerEntry("global_staked", (A + L)), IntegerEntry("global_lastCheckSRate", J)] | |
121 | 121 | } | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func M (r) = if ((indexOf(g, r) == unit)) | |
125 | 125 | then throw(("Unknown poolId " + r)) | |
126 | 126 | else { | |
127 | 127 | let N = fromBase58String(f) | |
128 | 128 | let s = h(N) | |
129 | 129 | let O = invoke(Address(fromBase58String(r)), "supply", nil, [AttachedPayment(N, s)]) | |
130 | 130 | if ((O == O)) | |
131 | 131 | then [StringEntry("currentPool", r)] | |
132 | 132 | else throw("Strict value is not equal to itself.") | |
133 | 133 | } | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func P (r,F) = { | |
137 | 137 | let Q = v(r, F) | |
138 | 138 | if ((Q == Q)) | |
139 | 139 | then [ScriptTransfer(e, F, fromBase58String(f))] | |
140 | 140 | else throw("Strict value is not equal to itself.") | |
141 | 141 | } | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | func R () = { | |
145 | 145 | let u = o(this, "currentPool") | |
146 | 146 | if ((u == "")) | |
147 | 147 | then throw(("Cannot find pool with id " + u)) | |
148 | 148 | else { | |
149 | 149 | let w = q(u) | |
150 | 150 | let S = v(u, w) | |
151 | 151 | if ((S == S)) | |
152 | 152 | then S | |
153 | 153 | else throw("Strict value is not equal to itself.") | |
154 | 154 | } | |
155 | 155 | } | |
156 | 156 | ||
157 | 157 | ||
158 | 158 | func T (U,w) = { | |
159 | 159 | let C = fraction(w, b, G()) | |
160 | 160 | (K(C) ++ [IntegerEntry((U + "_staked"), (k(this, (U + "_staked")) + C))]) | |
161 | 161 | } | |
162 | 162 | ||
163 | 163 | ||
164 | 164 | func V (U,w) = { | |
165 | 165 | let C = fraction(w, b, G()) | |
166 | 166 | let W = k(this, (U + "_staked")) | |
167 | 167 | let X = if ((C > W)) | |
168 | 168 | then W | |
169 | 169 | else C | |
170 | 170 | (K(-(X)) ++ [IntegerEntry((U + "_staked"), (W - X))]) | |
171 | 171 | } | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | func Y (u,Z,w) = { | |
175 | 175 | let S = v(u, w) | |
176 | 176 | if ((S == S)) | |
177 | 177 | then [ScriptTransfer(Z, w, fromBase58String(f))] | |
178 | 178 | else throw("Strict value is not equal to itself.") | |
179 | 179 | } | |
180 | 180 | ||
181 | 181 | ||
182 | 182 | @Callable(aa) | |
183 | 183 | func init (r) = { | |
184 | 184 | let u = o(this, "currentPool") | |
185 | 185 | if ((indexOf(d, toString(aa.caller)) == unit)) | |
186 | 186 | then throw("Access denied") | |
187 | 187 | else if ((u == "")) | |
188 | 188 | then [StringEntry("currentPool", r)] | |
189 | 189 | else nil | |
190 | 190 | } | |
191 | 191 | ||
192 | 192 | ||
193 | 193 | ||
194 | 194 | @Callable(aa) | |
195 | 195 | func rebalance (r) = { | |
196 | 196 | let u = o(this, "currentPool") | |
197 | 197 | if ((indexOf(d, toString(aa.caller)) == unit)) | |
198 | 198 | then throw("Access denied") | |
199 | 199 | else if ((u == r)) | |
200 | 200 | then throw(("Already supplied to" + u)) | |
201 | 201 | else { | |
202 | 202 | let y = R() | |
203 | 203 | if ((y == y)) | |
204 | 204 | then M(r) | |
205 | 205 | else throw("Strict value is not equal to itself.") | |
206 | 206 | } | |
207 | 207 | } | |
208 | 208 | ||
209 | 209 | ||
210 | 210 | ||
211 | 211 | @Callable(aa) | |
212 | 212 | func stake () = { | |
213 | 213 | let U = toString(aa.caller) | |
214 | 214 | let w = aa.payments[0].amount | |
215 | 215 | let u = o(this, "currentPool") | |
216 | 216 | if (if ((0 >= w)) | |
217 | 217 | then true | |
218 | 218 | else (aa.payments[0].assetId != fromBase58String(f))) | |
219 | 219 | then throw("invalid token attached") | |
220 | 220 | else if ((u == "")) | |
221 | 221 | then throw("Pool not initialized") | |
222 | 222 | else { | |
223 | 223 | let F = z() | |
224 | 224 | if ((F == F)) | |
225 | 225 | then ((T(U, w) ++ M(u)) ++ P(u, F)) | |
226 | 226 | else throw("Strict value is not equal to itself.") | |
227 | 227 | } | |
228 | 228 | } | |
229 | 229 | ||
230 | 230 | ||
231 | 231 | ||
232 | 232 | @Callable(aa) | |
233 | 233 | func unstake (w) = { | |
234 | 234 | let U = toString(aa.caller) | |
235 | 235 | let u = o(this, "currentPool") | |
236 | 236 | let ab = fromBase58String(f) | |
237 | 237 | let F = z() | |
238 | 238 | if ((F == F)) | |
239 | 239 | then ((V(U, w) ++ Y(u, aa.caller, w)) ++ P(u, F)) | |
240 | 240 | else throw("Strict value is not equal to itself.") | |
241 | 241 | } | |
242 | 242 | ||
243 | 243 | ||
244 | 244 | @Verifier(S) | |
245 | 245 | func ac () = sigVerify(S.bodyBytes, S.proofs[0], S.senderPublicKey) | |
246 | 246 |
github/deemru/w8io/026f985 45.66 ms ◑