tx · HxEv2bmkMuQYShH8eE9nj6ueGG8M52TMRBtvePdbbPzQ

3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh:  -0.00900000 Waves

2022.12.06 23:58 [2348989] smart account 3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh > SELF 0.00000000 Waves

{ "type": 13, "id": "HxEv2bmkMuQYShH8eE9nj6ueGG8M52TMRBtvePdbbPzQ", "fee": 900000, "feeAssetId": null, "timestamp": 1670360352818, "version": 2, "chainId": 84, "sender": "3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh", "senderPublicKey": "HscGVyJG5M3NMHWKfQbucCBsFLGPi8VmTxTAmcBbaWTa", "proofs": [ "5ru4Df7TvhLb97GFqS5AWvAsrnBneyx6w6h9skHaVkCmcr949cRAmcMyuJXWb57yhei2RDnhNdDngo3TQ7hDPkpY" ], "script": "base64:BgITCAISAwoBCBIDCgEIEgASAwoBARUABlNjYWxlNgDAhD0ABlNjYWxlOACAwtcvAAdTY2FsZTE2CQBoAgUGU2NhbGU4BQZTY2FsZTgACnZhbGlkYXRvcnMJAMwIAgIjM05BbXFHanhSQlJQb1JIWlVVcXZoaU5TNmF4bkdwaW5MSEMFA25pbAAPbW9uZXlCb3hBZGRyZXNzCQEHQWRkcmVzcwEBGgFUZKnP467xWXotJQOt2k8QiNBvrQpHH8SpAAdhc3NldElkAixISG1hRlFwVW9id0t4emp6NEVDYUJQdG9GNjlrdWpLd1UyY296YVV6VHNndgALcHV6emxlUG9vbHMJAMwIAgIjM042U3RKZGdtVGZBUnNSTm45WHQ1ckRZRXMzcHI0S0d5MXYFA25pbAEKZ2V0QmFsYW5jZQEHYXNzZXRJZAQHJG1hdGNoMAUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgRVbml0BAF4BQckbWF0Y2gwCAkA7wcBBQR0aGlzCWF2YWlsYWJsZQkA8AcCBQR0aGlzCQEFdmFsdWUBBQdhc3NldElkAQl0cnlHZXRJbnQCB2FkZHJlc3MD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FBHVzZXIFBmFtb3VudAkBDHN1cHBseVJlc3VsdAIFC2N1cnJlbnRQb29sBQNmZWUBaQEHdW5zdGFrZQEGYW1vdW50BAR1c2VyCQClCAEIBQFpBmNhbGxlcgQLY3VycmVudFBvb2wJAQl0cnlHZXRTdHICBQR0aGlzAgtjdXJyZW50UG9vbAQDZmVlCQEHY2FsY0ZlZQAEBWFzc2V0CQDZBAEFB2Fzc2V0SWQEEnVuc3Rha2VSZXN1bHRTdGF0ZQkBDXVuc3Rha2VSZXN1bHQCBQR1c2VyBQZhbW91bnQEAnR4CQEWd2l0aGRyYXdGcm9tUHV6emxlUG9vbAIFC2N1cnJlbnRQb29sCQBkAgUGYW1vdW50BQNmZWUDCQAAAgUCdHgFAnR4CQDOCAIFEnVuc3Rha2VSZXN1bHRTdGF0ZQkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIFBmFtb3VudAUFYXNzZXQJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwUPbW9uZXlCb3hBZGRyZXNzBQNmZWUFBWFzc2V0BQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5iZkWJA==", "height": 2348989, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HsT7hAfvd3PqREvak2ng9VC37kFLpg5xwBwoW9eiPutv Next: AiyEJ2Mr4gsuUNeX1c2hjmfXT5o1qhQu5Xn26TVVsM49 Diff:
OldNewDifferences
117117 func K (L) = {
118118 let A = k(this, "global_staked")
119119 let J = G()
120-[IntegerEntry("global_staked", (A + L)), IntegerEntry("global_lastCheckSRate", J)]
120+ if ((J > 0))
121+ then throw(("sRate: " + toString(J)))
122+ else [IntegerEntry("global_staked", (A + L)), IntegerEntry("global_lastCheckSRate", J)]
121123 }
122124
123125
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = 1000000
55
66 let b = 100000000
77
88 let c = (b * b)
99
1010 let d = ["3NAmqGjxRBRPoRHZUUqvhiNS6axnGpinLHC"]
1111
1212 let e = Address(base58'3My6LmrRSRvJ73T14oT5k53SGPavGFoacWc')
1313
1414 let f = "HHmaFQpUobwKxzjz4ECaBPtoF69kujKwU2cozaUzTsgv"
1515
1616 let g = ["3N6StJdgmTfARsRNn9Xt5rDYEs3pr4KGy1v"]
1717
1818 func h (f) = {
1919 let i = f
2020 if ($isInstanceOf(i, "Unit"))
2121 then {
2222 let j = i
2323 wavesBalance(this).available
2424 }
2525 else assetBalance(this, value(f))
2626 }
2727
2828
2929 func k (l,m) = {
3030 let i = getInteger(l, m)
3131 if ($isInstanceOf(i, "Int"))
3232 then {
3333 let n = i
3434 n
3535 }
3636 else 0
3737 }
3838
3939
4040 func o (l,m) = {
4141 let i = getString(l, m)
4242 if ($isInstanceOf(i, "String"))
4343 then {
4444 let n = i
4545 n
4646 }
4747 else ""
4848 }
4949
5050
5151 func p (f) = {
5252 let i = f
5353 if ($isInstanceOf(i, "ByteVector"))
5454 then {
5555 let n = i
5656 toBase58String(n)
5757 }
5858 else "WAVES"
5959 }
6060
6161
6262 func q (r) = {
6363 let s = assetBalance(Address(fromBase58String(r)), fromBase58String(f))
6464 s
6565 }
6666
6767
6868 func t () = {
6969 let u = o(this, "currentPool")
7070 if ((u == ""))
7171 then throw(("Cannot find pool with id " + u))
7272 else q(u)
7373 }
7474
7575
7676 func v (r,w) = {
7777 let x = Address(fromBase58String(r))
7878 let y = if ((w > 0))
7979 then invoke(x, "withdraw", [f, w], nil)
8080 else ""
8181 if ((y == y))
8282 then y
8383 else throw("Strict value is not equal to itself.")
8484 }
8585
8686
8787 func z () = {
8888 let A = k(this, "global_staked")
8989 let B = k(this, "global_lastCheckSRate")
9090 let C = fraction(A, B, b)
9191 let D = t()
9292 let E = (D - C)
9393 let F = fraction(E, 5000000, b)
9494 if ((F > 0))
9595 then F
9696 else 0
9797 }
9898
9999
100100 func G () = {
101101 let H = k(this, "global_lastCheckSRate")
102102 let A = k(this, "global_staked")
103103 let I = fraction(A, H, b)
104104 if ((H == 0))
105105 then b
106106 else if ((I == 0))
107107 then H
108108 else {
109109 let J = fraction(H, (fraction((fraction(t(), a, I) - a), (b - 5000000), b) + a), a)
110110 if ((b > J))
111111 then H
112112 else J
113113 }
114114 }
115115
116116
117117 func K (L) = {
118118 let A = k(this, "global_staked")
119119 let J = G()
120-[IntegerEntry("global_staked", (A + L)), IntegerEntry("global_lastCheckSRate", J)]
120+ if ((J > 0))
121+ then throw(("sRate: " + toString(J)))
122+ else [IntegerEntry("global_staked", (A + L)), IntegerEntry("global_lastCheckSRate", J)]
121123 }
122124
123125
124126 func M (r,F) = if ((indexOf(g, r) == unit))
125127 then throw(("Unknown poolId " + r))
126128 else {
127129 let N = fromBase58String(f)
128130 let s = h(N)
129131 let O = invoke(Address(fromBase58String(r)), "supply", nil, [AttachedPayment(N, s)])
130132 if ((O == O))
131133 then {
132134 let P = v(r, F)
133135 if ((P == P))
134136 then [StringEntry("currentPool", r), ScriptTransfer(e, F, fromBase58String(f))]
135137 else throw("Strict value is not equal to itself.")
136138 }
137139 else throw("Strict value is not equal to itself.")
138140 }
139141
140142
141143 func Q () = {
142144 let u = o(this, "currentPool")
143145 if ((u == ""))
144146 then throw(("Cannot find pool with id " + u))
145147 else {
146148 let w = q(u)
147149 let R = v(u, w)
148150 if ((R == R))
149151 then R
150152 else throw("Strict value is not equal to itself.")
151153 }
152154 }
153155
154156
155157 func S (T,w) = {
156158 let C = fraction(w, b, G())
157159 (K(C) ++ [IntegerEntry((T + "_staked"), (k(this, (T + "_staked")) + C))])
158160 }
159161
160162
161163 func U (T,w) = {
162164 let C = fraction(w, b, G())
163165 let V = k(this, (T + "_staked"))
164166 let W = if ((C > V))
165167 then V
166168 else C
167169 (K(-(W)) ++ [IntegerEntry((T + "_staked"), (V - W))])
168170 }
169171
170172
171173 @Callable(X)
172174 func init (r) = {
173175 let u = o(this, "currentPool")
174176 if ((indexOf(d, toString(X.caller)) == unit))
175177 then throw("Access denied")
176178 else if ((u == ""))
177179 then [StringEntry("currentPool", r)]
178180 else nil
179181 }
180182
181183
182184
183185 @Callable(X)
184186 func rebalance (r) = {
185187 let u = o(this, "currentPool")
186188 if ((indexOf(d, toString(X.caller)) == unit))
187189 then throw("Access denied")
188190 else if ((u == r))
189191 then throw(("Already supplied to" + u))
190192 else {
191193 let y = Q()
192194 if ((y == y))
193195 then (M(r, 0) ++ K(0))
194196 else throw("Strict value is not equal to itself.")
195197 }
196198 }
197199
198200
199201
200202 @Callable(X)
201203 func stake () = {
202204 let T = toString(X.caller)
203205 let w = X.payments[0].amount
204206 let u = o(this, "currentPool")
205207 if (if ((0 >= w))
206208 then true
207209 else (X.payments[0].assetId != fromBase58String(f)))
208210 then throw("invalid token attached")
209211 else if ((u == ""))
210212 then throw("Pool not initialized")
211213 else {
212214 let F = z()
213215 (S(T, w) ++ M(u, F))
214216 }
215217 }
216218
217219
218220
219221 @Callable(X)
220222 func unstake (w) = {
221223 let T = toString(X.caller)
222224 let u = o(this, "currentPool")
223225 let F = z()
224226 let Y = fromBase58String(f)
225227 let Z = U(T, w)
226228 let R = v(u, (w + F))
227229 if ((R == R))
228230 then (Z ++ [ScriptTransfer(X.caller, w, Y), ScriptTransfer(e, F, Y)])
229231 else throw("Strict value is not equal to itself.")
230232 }
231233
232234
233235 @Verifier(R)
234236 func aa () = sigVerify(R.bodyBytes, R.proofs[0], R.senderPublicKey)
235237

github/deemru/w8io/026f985 
53.03 ms