tx · 5bSwgFi9KbYrRSbZLEPYM3UiNpCTj3d9Wxd6KTXimagH

3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh:  -0.00900000 Waves

2022.12.06 23:06 [2348940] smart account 3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh > SELF 0.00000000 Waves

{ "type": 13, "id": "5bSwgFi9KbYrRSbZLEPYM3UiNpCTj3d9Wxd6KTXimagH", "fee": 900000, "feeAssetId": null, "timestamp": 1670357257776, "version": 2, "chainId": 84, "sender": "3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh", "senderPublicKey": "HscGVyJG5M3NMHWKfQbucCBsFLGPi8VmTxTAmcBbaWTa", "proofs": [ "4oEEBFQnivNHDowBvYzA9Jb3bxB24GHwU9oyWwDJv31fHq7qe48JFs6dnHUgTeN9rE4bJRVmY9Lict6tZjYzcRpN" ], "script": "base64:BgITCAISAwoBCBIDCgEIEgASAwoBARUABlNjYWxlNgDAhD0ABlNjYWxlOACAwtcvAAdTY2FsZTE2CQBoAgUGU2NhbGU4BQZTY2FsZTgACnZhbGlkYXRvcnMJAMwIAgIjM05BbXFHanhSQlJQb1JIWlVVcXZoaU5TNmF4bkdwaW5MSEMFA25pbAAPbW9uZXlCb3hBZGRyZXNzCQEHQWRkcmVzcwEBGgFUZKnP467xWXotJQOt2k8QiNBvrQpHH8SpAAdhc3NldElkAixISG1hRlFwVW9id0t4emp6NEVDYUJQdG9GNjlrdWpLd1UyY296YVV6VHNndgALcHV6emxlUG9vbHMJAMwIAgIjM042U3RKZGdtVGZBUnNSTm45WHQ1ckRZRXMzcHI0S0d5MXYFA25pbAEKZ2V0QmFsYW5jZQEHYXNzZXRJZAQHJG1hdGNoMAUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgRVbml0BAF4BQckbWF0Y2gwCAkA7wcBBQR0aGlzCWF2YWlsYWJsZQkA8AcCBQR0aGlzCQEFdmFsdWUBBQdhc3NldElkAQl0cnlHZXRJbnQCB2FkZHJ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Vuc3Rha2UBBmFtb3VudAQEdXNlcgkApQgBCAUBaQZjYWxsZXIEC2N1cnJlbnRQb29sCQEJdHJ5R2V0U3RyAgUEdGhpcwILY3VycmVudFBvb2wEA2ZlZQkBB2NhbGNGZWUABAVhc3NldAkA2QQBBQdhc3NldElkBAJ0eAkBFndpdGhkcmF3RnJvbVB1enpsZVBvb2wCBQtjdXJyZW50UG9vbAkAZAIFBmFtb3VudAUDZmVlAwkAAAIFAnR4BQJ0eAkAzggCCQENdW5zdGFrZVJlc3VsdAIFBHVzZXIFBmFtb3VudAkAzAgCCQEOU2NyaXB0VHJhbnNmZXIDCAUBaQZjYWxsZXIFBmFtb3VudAUFYXNzZXQJAMwIAgkBDlNjcmlwdFRyYW5zZmVyAwUPbW9uZXlCb3hBZGRyZXNzBQNmZWUFBWFzc2V0BQNuaWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5n35GXw==", "height": 2348940, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9zYqSJ4FhGeGLXbZTfA9Hgq6gw1NYpvmm7Jmcpxq5cuS Next: CBLvu4R4BUZniPFxXFcKmH9pimLQoJjnAP8wAyVXyHtC 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()
120120 [IntegerEntry("global_staked", (A + L)), IntegerEntry("global_lastCheckSRate", J)]
121121 }
122122
123123
124124 func M (r,F) = if ((indexOf(g, r) == unit))
125125 then throw(("Unknown poolId " + r))
126126 else {
127127 let N = fromBase58String(f)
128128 let s = h(N)
129129 let O = invoke(Address(fromBase58String(r)), "supply", nil, [AttachedPayment(N, s)])
130130 if ((O == O))
131131 then {
132132 let P = v(r, F)
133133 if ((P == P))
134134 then [StringEntry("currentPool", r), ScriptTransfer(e, F, fromBase58String(f))]
135135 else throw("Strict value is not equal to itself.")
136136 }
137137 else throw("Strict value is not equal to itself.")
138138 }
139139
140140
141141 func Q () = {
142142 let u = o(this, "currentPool")
143143 if ((u == ""))
144144 then throw(("Cannot find pool with id " + u))
145145 else {
146146 let w = q(u)
147147 let R = v(u, w)
148148 if ((R == R))
149149 then R
150150 else throw("Strict value is not equal to itself.")
151151 }
152152 }
153153
154154
155155 func S (T,w) = {
156156 let C = fraction(w, b, G())
157157 (K(C) ++ [IntegerEntry((T + "_staked"), (k(this, (T + "_staked")) + C))])
158158 }
159159
160160
161161 func U (T,w) = {
162162 let C = fraction(w, b, G())
163163 let V = k(this, (T + "_staked"))
164164 let W = if ((C > V))
165165 then V
166166 else C
167167 (K(-(W)) ++ [IntegerEntry((T + "_staked"), (V - W))])
168168 }
169169
170170
171171 @Callable(X)
172172 func init (r) = {
173173 let u = o(this, "currentPool")
174174 if ((indexOf(d, toString(X.caller)) == unit))
175175 then throw("Access denied")
176176 else if ((u == ""))
177177 then [StringEntry("currentPool", r)]
178178 else nil
179179 }
180180
181181
182182
183183 @Callable(X)
184184 func rebalance (r) = {
185185 let u = o(this, "currentPool")
186186 if ((indexOf(d, toString(X.caller)) == unit))
187187 then throw("Access denied")
188188 else if ((u == r))
189189 then throw(("Already supplied to" + u))
190190 else {
191191 let y = Q()
192192 if ((y == y))
193193 then (M(r, 0) ++ K(0))
194194 else throw("Strict value is not equal to itself.")
195195 }
196196 }
197197
198198
199199
200200 @Callable(X)
201201 func stake () = {
202202 let T = toString(X.caller)
203203 let w = X.payments[0].amount
204204 let u = o(this, "currentPool")
205205 if (if ((0 >= w))
206206 then true
207207 else (X.payments[0].assetId != fromBase58String(f)))
208208 then throw("invalid token attached")
209209 else if ((u == ""))
210210 then throw("Pool not initialized")
211211 else {
212212 let F = z()
213213 (S(T, w) ++ M(u, F))
214214 }
215215 }
216216
217217
218218
219219 @Callable(X)
220220 func unstake (w) = {
221221 let T = toString(X.caller)
222222 let u = o(this, "currentPool")
223223 let F = z()
224224 let Y = fromBase58String(f)
225225 let R = v(u, (w + F))
226226 if ((R == R))
227227 then (U(T, w) ++ [ScriptTransfer(X.caller, w, Y), ScriptTransfer(e, F, Y)])
228228 else throw("Strict value is not equal to itself.")
229229 }
230230
231231
232232 @Verifier(R)
233233 func Z () = sigVerify(R.bodyBytes, R.proofs[0], R.senderPublicKey)
234234

github/deemru/w8io/169f3d6 
48.59 ms