tx · 4CuLC9CLa76mqGzE5JGsAFmXKDGJf9Xr6ThwyGB3G6V5 3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh: -0.00900000 Waves 2022.12.01 22:21 [2341679] smart account 3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh > SELF 0.00000000 Waves
{ "type": 13, "id": "4CuLC9CLa76mqGzE5JGsAFmXKDGJf9Xr6ThwyGB3G6V5", "fee": 900000, "feeAssetId": null, "timestamp": 1669922581119, "version": 2, "chainId": 84, "sender": "3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh", "senderPublicKey": "HscGVyJG5M3NMHWKfQbucCBsFLGPi8VmTxTAmcBbaWTa", "proofs": [ "2yPrkrnBkyuKMBgLVRSDMLX1XAxW3M1dzqDPHeA49249Nfnsd1GRhAiMeirvx8XXr2WdokACTDJqLaDV7jgbFpw2" ], "script": "base64:BgITCAISAwoBCBIDCgEIEgASAwoBARMABlNjYWxlNgDAhD0ABlNjYWxlOACAwtcvAAdTY2FsZTE2CQBoAgUGU2NhbGU4BQZTY2FsZTgACnZhbGlkYXRvcnMJAMwIAgIjM05BbXFHanhSQlJQb1JIWlVVcXZoaU5TNmF4bkdwaW5MSEMFA25pbAAHYXNzZXRJZAIsSEhtYUZRcFVvYndLeHpqejRFQ2FCUHRvRjY5a3VqS3dVMmNvemFVelRzZ3YAC3B1enpsZVBvb2xzCQDMCAICIzNONlN0SmRnbVRmQVJzUk5uOVh0NXJEWUVzM3ByNEtHeTF2BQNuaWwBCmdldEJhbGFuY2UBB2Fzc2V0SWQEByRtYXRjaDAFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIEVW5pdAQBeAUHJG1hdGNoMAgJAO8HAQUEdGhpcwlhdmFpbGFibGUJAPAHAgUEdGhpcwkBBXZhbHVlAQUHYXNzZXRJZAEJdHJ5R2V0SW50AgdhZGRyZXNzA2tleQQHJG1hdGNoMAkAmggCBQdhZGRyZXNzBQNrZXkDCQABAgUHJG1hdGNo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VudFBvb2wCAAkAAgECFFBvb2wgbm90IGluaXRpYWxpemVkCQDOCAIJAQtzdGFrZVJlc3VsdAIFBHVzZXIFBmFtb3VudAkBDHN1cHBseVJlc3VsdAEFC2N1cnJlbnRQb29sAWkBB3Vuc3Rha2UBBmFtb3VudAQEdXNlcgkApQgBCAUBaQZjYWxsZXIEC2N1cnJlbnRQb29sCQEJdHJ5R2V0U3RyAgUEdGhpcwILY3VycmVudFBvb2wEAnR4CQEWd2l0aGRyYXdGcm9tUHV6emxlUG9vbAIFC2N1cnJlbnRQb29sBQZhbW91bnQDCQAAAgUCdHgFAnR4CQDOCAIJAQ11bnN0YWtlUmVzdWx0AgUEdXNlcgUGYW1vdW50CQDMCAIJAQ5TY3JpcHRUcmFuc2ZlcgMIBQFpBmNhbGxlcgUGYW1vdW50CQDZBAEFB2Fzc2V0SWQFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXlkpqDV", "height": 2341679, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ALUPCoxYdG6XSME6xfy1pfkNe8T9vpxsPtZUjpVU1rwz Next: ChtSv1AseKpKtu36yP5ZvmQnnUXbfv1EekzVwjGGh36e Diff:
Old | New | Differences | |
---|---|---|---|
100 | 100 | func D (E) = { | |
101 | 101 | let A = j(this, "global_staked") | |
102 | 102 | let C = y() | |
103 | - | [IntegerEntry("global_staked", (A + E)), IntegerEntry("global_lastCheckSRate", C) | |
103 | + | [IntegerEntry("global_staked", (A + E)), IntegerEntry("global_lastCheckSRate", C)] | |
104 | 104 | } | |
105 | 105 | ||
106 | 106 |
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 = "HHmaFQpUobwKxzjz4ECaBPtoF69kujKwU2cozaUzTsgv" | |
13 | 13 | ||
14 | 14 | let f = ["3N6StJdgmTfARsRNn9Xt5rDYEs3pr4KGy1v"] | |
15 | 15 | ||
16 | 16 | func g (e) = { | |
17 | 17 | let h = e | |
18 | 18 | if ($isInstanceOf(h, "Unit")) | |
19 | 19 | then { | |
20 | 20 | let i = h | |
21 | 21 | wavesBalance(this).available | |
22 | 22 | } | |
23 | 23 | else assetBalance(this, value(e)) | |
24 | 24 | } | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func j (k,l) = { | |
28 | 28 | let h = getInteger(k, l) | |
29 | 29 | if ($isInstanceOf(h, "Int")) | |
30 | 30 | then { | |
31 | 31 | let m = h | |
32 | 32 | m | |
33 | 33 | } | |
34 | 34 | else 0 | |
35 | 35 | } | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func n (k,l) = { | |
39 | 39 | let h = getString(k, l) | |
40 | 40 | if ($isInstanceOf(h, "String")) | |
41 | 41 | then { | |
42 | 42 | let m = h | |
43 | 43 | m | |
44 | 44 | } | |
45 | 45 | else "" | |
46 | 46 | } | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func o (e) = { | |
50 | 50 | let h = e | |
51 | 51 | if ($isInstanceOf(h, "ByteVector")) | |
52 | 52 | then { | |
53 | 53 | let m = h | |
54 | 54 | toBase58String(m) | |
55 | 55 | } | |
56 | 56 | else "WAVES" | |
57 | 57 | } | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func p (q) = { | |
61 | 61 | let r = assetBalance(Address(fromBase58String(q)), fromBase58String(e)) | |
62 | 62 | r | |
63 | 63 | } | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func s () = { | |
67 | 67 | let t = n(this, "currentPool") | |
68 | 68 | if ((t == "")) | |
69 | 69 | then throw(("Cannot find pool with id " + t)) | |
70 | 70 | else p(t) | |
71 | 71 | } | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func u (q,v) = { | |
75 | 75 | let w = Address(fromBase58String(q)) | |
76 | 76 | let x = if ((v > 0)) | |
77 | 77 | then invoke(w, "withdraw", [e, v], nil) | |
78 | 78 | else "" | |
79 | 79 | if ((x == x)) | |
80 | 80 | then x | |
81 | 81 | else throw("Strict value is not equal to itself.") | |
82 | 82 | } | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func y () = { | |
86 | 86 | let z = j(this, "global_lastCheckSRate") | |
87 | 87 | let A = j(this, "global_staked") | |
88 | 88 | let B = fraction(A, z, b) | |
89 | 89 | if ((B == 0)) | |
90 | 90 | then b | |
91 | 91 | else { | |
92 | 92 | let C = fraction(z, s(), B) | |
93 | 93 | if ((b > C)) | |
94 | 94 | then b | |
95 | 95 | else C | |
96 | 96 | } | |
97 | 97 | } | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func D (E) = { | |
101 | 101 | let A = j(this, "global_staked") | |
102 | 102 | let C = y() | |
103 | - | [IntegerEntry("global_staked", (A + E)), IntegerEntry("global_lastCheckSRate", C) | |
103 | + | [IntegerEntry("global_staked", (A + E)), IntegerEntry("global_lastCheckSRate", C)] | |
104 | 104 | } | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func F (q) = if ((indexOf(f, q) == unit)) | |
108 | 108 | then throw(("Unknown poolId " + q)) | |
109 | 109 | else { | |
110 | 110 | let G = fromBase58String(e) | |
111 | 111 | let r = g(G) | |
112 | 112 | let H = invoke(Address(fromBase58String(q)), "supply", nil, [AttachedPayment(G, r)]) | |
113 | 113 | if ((H == H)) | |
114 | 114 | then [StringEntry("currentPool", q)] | |
115 | 115 | else throw("Strict value is not equal to itself.") | |
116 | 116 | } | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func I () = { | |
120 | 120 | let t = n(this, "currentPool") | |
121 | 121 | if ((t == "")) | |
122 | 122 | then throw(("Cannot find pool with id " + t)) | |
123 | 123 | else { | |
124 | 124 | let v = p(t) | |
125 | 125 | let J = u(t, v) | |
126 | 126 | if ((J == J)) | |
127 | 127 | then J | |
128 | 128 | else throw("Strict value is not equal to itself.") | |
129 | 129 | } | |
130 | 130 | } | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | func K (L,v) = { | |
134 | 134 | let M = fraction(v, b, y()) | |
135 | 135 | (D(M) ++ [IntegerEntry((L + "_staked"), (j(this, (L + "_staked")) + M))]) | |
136 | 136 | } | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | func N (L,v) = { | |
140 | 140 | let M = fraction(v, b, y()) | |
141 | 141 | let O = j(this, (L + "_staked")) | |
142 | 142 | let P = if ((M > O)) | |
143 | 143 | then O | |
144 | 144 | else M | |
145 | 145 | (D(-(M)) ++ [IntegerEntry((L + "_staked"), (O - P))]) | |
146 | 146 | } | |
147 | 147 | ||
148 | 148 | ||
149 | 149 | @Callable(Q) | |
150 | 150 | func init (q) = { | |
151 | 151 | let t = n(this, "currentPool") | |
152 | 152 | if ((indexOf(d, toString(Q.caller)) == unit)) | |
153 | 153 | then throw("Access denied") | |
154 | 154 | else if ((t == "")) | |
155 | 155 | then [StringEntry("currentPool", q)] | |
156 | 156 | else nil | |
157 | 157 | } | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | ||
161 | 161 | @Callable(Q) | |
162 | 162 | func rebalance (q) = { | |
163 | 163 | let t = n(this, "currentPool") | |
164 | 164 | if ((indexOf(d, toString(Q.caller)) == unit)) | |
165 | 165 | then throw("Access denied") | |
166 | 166 | else if ((t == q)) | |
167 | 167 | then throw(("Already supplied to" + t)) | |
168 | 168 | else { | |
169 | 169 | let x = I() | |
170 | 170 | if ((x == x)) | |
171 | 171 | then (F(q) ++ D(0)) | |
172 | 172 | else throw("Strict value is not equal to itself.") | |
173 | 173 | } | |
174 | 174 | } | |
175 | 175 | ||
176 | 176 | ||
177 | 177 | ||
178 | 178 | @Callable(Q) | |
179 | 179 | func stake () = { | |
180 | 180 | let L = toString(Q.caller) | |
181 | 181 | let v = Q.payments[0].amount | |
182 | 182 | let t = n(this, "currentPool") | |
183 | 183 | if (if ((0 >= v)) | |
184 | 184 | then true | |
185 | 185 | else (Q.payments[0].assetId != fromBase58String(e))) | |
186 | 186 | then throw("invalid token attached") | |
187 | 187 | else if ((t == "")) | |
188 | 188 | then throw("Pool not initialized") | |
189 | 189 | else (K(L, v) ++ F(t)) | |
190 | 190 | } | |
191 | 191 | ||
192 | 192 | ||
193 | 193 | ||
194 | 194 | @Callable(Q) | |
195 | 195 | func unstake (v) = { | |
196 | 196 | let L = toString(Q.caller) | |
197 | 197 | let t = n(this, "currentPool") | |
198 | 198 | let J = u(t, v) | |
199 | 199 | if ((J == J)) | |
200 | 200 | then (N(L, v) ++ [ScriptTransfer(Q.caller, v, fromBase58String(e))]) | |
201 | 201 | else throw("Strict value is not equal to itself.") | |
202 | 202 | } | |
203 | 203 | ||
204 | 204 | ||
205 | 205 | @Verifier(J) | |
206 | 206 | func R () = sigVerify(J.bodyBytes, J.proofs[0], J.senderPublicKey) | |
207 | 207 |
github/deemru/w8io/026f985 40.35 ms ◑