tx · G3MuSEZ7UCSPQw5t9jCEnG9uKotau9x64PZjbQtw6Po

3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh:  -0.00800000 Waves

2022.11.30 20:56 [2340167] smart account 3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh > SELF 0.00000000 Waves

{ "type": 13, "id": "G3MuSEZ7UCSPQw5t9jCEnG9uKotau9x64PZjbQtw6Po", "fee": 800000, "feeAssetId": null, "timestamp": 1669831051588, "version": 2, "chainId": 84, "sender": "3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh", "senderPublicKey": "HscGVyJG5M3NMHWKfQbucCBsFLGPi8VmTxTAmcBbaWTa", "proofs": [ "2Ychjh8My6kjQrMNEPVauKEv1mnRhReZ2x2ZCACeqBVuqRtqkunnfTp2AWp4pNBb2qRPnSpwpvYqfg3DrQBsHT6d" ], "script": "base64:BgIJCAISAwoBCBIAEQAGU2NhbGU2AMCEPQAGU2NhbGU4AIDC1y8AB1NjYWxlMTYJAGgCBQZTY2FsZTgFBlNjYWxlOAAKdmFsaWRhdG9ycwkAzAgCAiMzTkFtcUdqeFJCUlBvUkhaVVVxdmhpTlM2YXhuR3BpbkxIQwUDbmlsAAdhc3NldElkAixISG1hRlFwVW9id0t4emp6NEVDYUJQdG9GNjlrdWpLd1UyY296YVV6VHNndgALcHV6emxlUG9vbHMJAMwIAgIjM042U3RKZGdtVGZBUnNSTm45WHQ1ckRZRXMzcHI0S0d5MXYFA25pbAEKZ2V0QmFsYW5jZQEHYXNzZXRJZAQHJG1hdGNoMAUHYXNzZXRJZAMJAAECBQckbWF0Y2gwAgRVbml0BAF4BQckbWF0Y2gwCAkA7wcBBQR0aGlzCWF2YWlsYWJsZQkA8AcCBQR0aGlzCQEFdmFsdWUBBQdhc3NldElkAQl0cnlHZXRJbnQCB2FkZHJlc3MDa2V5BAckbWF0Y2gwCQCaCAIFB2FkZHJlc3MFA2tleQMJAAECBQckbWF0Y2gwAgNJbnQEAWIFByRtY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BseVJlc3VsdAEFBnBvb2xJZAkBDHJlY2FsY1Jlc3VsdAEAAAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgFpAQVzdGFrZQAEBHVzZXIJAKUIAQgFAWkGY2FsbGVyBAZhbW91bnQICQCRAwIIBQFpCHBheW1lbnRzAAAGYW1vdW50BAtjdXJyZW50UG9vbAkBCXRyeUdldFN0cgIFBHRoaXMCC2N1cnJlbnRQb29sAwMJAGcCAAAFBmFtb3VudAYJAQIhPQIICQCRAwIIBQFpCHBheW1lbnRzAAAHYXNzZXRJZAkA2QQBBQdhc3NldElkCQACAQIWaW52YWxpZCB0b2tlbiBhdHRhY2hlZAMJAAACBQtjdXJyZW50UG9vbAIACQACAQIUUG9vbCBub3QgaW5pdGlhbGl6ZWQJAM4IAgkBC3N0YWtlUmVzdWx0AgUEdXNlcgUGYW1vdW50CQEMc3VwcGx5UmVzdWx0AQULY3VycmVudFBvb2wBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5hxjZsA==", "height": 2340167, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GJgHWHssEwXM3uEng789AxfCXnvBHtpa3oYkfh164TtW Next: ALtUDyXosYHwARe1G5sRnpKYLVNDfYnUXRkQW9Ky5wH6 Diff:
OldNewDifferences
5757 }
5858
5959
60-func p (q) = {
61- let r = assetBalance(Address(fromBase58String(q)), fromBase58String(e))
62- r
63- }
60+func p (q) = if ((q == ""))
61+ then 0
62+ else {
63+ let r = assetBalance(Address(fromBase58String(q)), fromBase58String(e))
64+ r
65+ }
6466
6567
6668 func s () = {
118120 }
119121
120122
121-func K () = {
122- let t = n(this, "currentPool")
123- if ((t == ""))
124- then throw(("Cannot find pool with id " + t))
125- else {
126- let v = p(t)
127- let L = u(t, v)
128- if ((L == L))
129- then L
130- else throw("Strict value is not equal to itself.")
131- }
123+func K (L,v) = {
124+ let M = fraction(v, b, y())
125+ (F(M) ++ [IntegerEntry((L + "_staked"), (j(this, (L + "_staked")) + M))])
132126 }
133127
134128
135-func M (N,v) = {
136- let O = fraction(v, b, y())
137- (F(O) ++ [IntegerEntry((N + "_staked"), (j(this, (N + "_staked")) + O))])
138- }
139-
140-
141-@Callable(P)
129+@Callable(N)
142130 func rebalance (q) = {
143131 let t = n(this, "currentPool")
144- if ((indexOf(d, toString(P.caller)) == unit))
132+ if ((indexOf(d, toString(N.caller)) == unit))
145133 then throw("Access denied")
146134 else if ((t == q))
147135 then throw(("Already supplied to" + t))
148136 else {
149- let x = K()
150- if ((x == x))
137+ let v = p(t)
138+ let O = if ((v > 0))
139+ then u(t, v)
140+ else ""
141+ if ((O == O))
151142 then (H(q) ++ F(0))
152143 else throw("Strict value is not equal to itself.")
153144 }
155146
156147
157148
158-@Callable(P)
149+@Callable(N)
159150 func stake () = {
160- let N = toString(P.caller)
161- let v = P.payments[0].amount
151+ let L = toString(N.caller)
152+ let v = N.payments[0].amount
162153 let t = n(this, "currentPool")
163154 if (if ((0 >= v))
164155 then true
165- else (P.payments[0].assetId != fromBase58String(e)))
156+ else (N.payments[0].assetId != fromBase58String(e)))
166157 then throw("invalid token attached")
167158 else if ((t == ""))
168159 then throw("Pool not initialized")
169- else (M(N, v) ++ H(t))
160+ else (K(L, v) ++ H(t))
170161 }
171162
172163
173-@Verifier(L)
174-func Q () = sigVerify(L.bodyBytes, L.proofs[0], L.senderPublicKey)
164+@Verifier(O)
165+func P () = sigVerify(O.bodyBytes, O.proofs[0], O.senderPublicKey)
175166
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 = "HHmaFQpUobwKxzjz4ECaBPtoF69kujKwU2cozaUzTsgv"
1313
1414 let f = ["3N6StJdgmTfARsRNn9Xt5rDYEs3pr4KGy1v"]
1515
1616 func g (e) = {
1717 let h = e
1818 if ($isInstanceOf(h, "Unit"))
1919 then {
2020 let i = h
2121 wavesBalance(this).available
2222 }
2323 else assetBalance(this, value(e))
2424 }
2525
2626
2727 func j (k,l) = {
2828 let h = getInteger(k, l)
2929 if ($isInstanceOf(h, "Int"))
3030 then {
3131 let m = h
3232 m
3333 }
3434 else 0
3535 }
3636
3737
3838 func n (k,l) = {
3939 let h = getString(k, l)
4040 if ($isInstanceOf(h, "String"))
4141 then {
4242 let m = h
4343 m
4444 }
4545 else ""
4646 }
4747
4848
4949 func o (e) = {
5050 let h = e
5151 if ($isInstanceOf(h, "ByteVector"))
5252 then {
5353 let m = h
5454 toBase58String(m)
5555 }
5656 else "WAVES"
5757 }
5858
5959
60-func p (q) = {
61- let r = assetBalance(Address(fromBase58String(q)), fromBase58String(e))
62- r
63- }
60+func p (q) = if ((q == ""))
61+ then 0
62+ else {
63+ let r = assetBalance(Address(fromBase58String(q)), fromBase58String(e))
64+ r
65+ }
6466
6567
6668 func s () = {
6769 let t = n(this, "currentPool")
6870 if ((t == ""))
6971 then throw(("Cannot find pool with id " + t))
7072 else p(t)
7173 }
7274
7375
7476 func u (q,v) = {
7577 let w = Address(fromBase58String(q))
7678 let x = if ((v > 0))
7779 then invoke(w, "withdraw", [e, v], nil)
7880 else ""
7981 if ((x == x))
8082 then x
8183 else throw("Strict value is not equal to itself.")
8284 }
8385
8486
8587 func y () = {
8688 let z = j(this, "global_lastCheckSRate")
8789 let A = j(this, "global_staked")
8890 let B = j(this, "global_lastCheckSRateHeight")
8991 let C = (height - B)
9092 let D = (s() - fraction(A, z, b))
9193 if ((A == 0))
9294 then b
9395 else {
9496 let E = (z + fraction((C * b), D, A))
9597 if ((b > E))
9698 then b
9799 else E
98100 }
99101 }
100102
101103
102104 func F (G) = {
103105 let A = j(this, "global_staked")
104106 let E = y()
105107 [IntegerEntry("global_staked", (A + G)), IntegerEntry("global_lastCheckSRate", E), IntegerEntry("global_lastCheckSRateHeight", height)]
106108 }
107109
108110
109111 func H (q) = if ((indexOf(f, q) == unit))
110112 then throw(("Unknown poolId " + q))
111113 else {
112114 let I = fromBase58String(e)
113115 let r = g(I)
114116 let J = invoke(Address(fromBase58String(q)), "supply", nil, [AttachedPayment(I, r)])
115117 if ((J == J))
116118 then [StringEntry("currentPool", q)]
117119 else throw("Strict value is not equal to itself.")
118120 }
119121
120122
121-func K () = {
122- let t = n(this, "currentPool")
123- if ((t == ""))
124- then throw(("Cannot find pool with id " + t))
125- else {
126- let v = p(t)
127- let L = u(t, v)
128- if ((L == L))
129- then L
130- else throw("Strict value is not equal to itself.")
131- }
123+func K (L,v) = {
124+ let M = fraction(v, b, y())
125+ (F(M) ++ [IntegerEntry((L + "_staked"), (j(this, (L + "_staked")) + M))])
132126 }
133127
134128
135-func M (N,v) = {
136- let O = fraction(v, b, y())
137- (F(O) ++ [IntegerEntry((N + "_staked"), (j(this, (N + "_staked")) + O))])
138- }
139-
140-
141-@Callable(P)
129+@Callable(N)
142130 func rebalance (q) = {
143131 let t = n(this, "currentPool")
144- if ((indexOf(d, toString(P.caller)) == unit))
132+ if ((indexOf(d, toString(N.caller)) == unit))
145133 then throw("Access denied")
146134 else if ((t == q))
147135 then throw(("Already supplied to" + t))
148136 else {
149- let x = K()
150- if ((x == x))
137+ let v = p(t)
138+ let O = if ((v > 0))
139+ then u(t, v)
140+ else ""
141+ if ((O == O))
151142 then (H(q) ++ F(0))
152143 else throw("Strict value is not equal to itself.")
153144 }
154145 }
155146
156147
157148
158-@Callable(P)
149+@Callable(N)
159150 func stake () = {
160- let N = toString(P.caller)
161- let v = P.payments[0].amount
151+ let L = toString(N.caller)
152+ let v = N.payments[0].amount
162153 let t = n(this, "currentPool")
163154 if (if ((0 >= v))
164155 then true
165- else (P.payments[0].assetId != fromBase58String(e)))
156+ else (N.payments[0].assetId != fromBase58String(e)))
166157 then throw("invalid token attached")
167158 else if ((t == ""))
168159 then throw("Pool not initialized")
169- else (M(N, v) ++ H(t))
160+ else (K(L, v) ++ H(t))
170161 }
171162
172163
173-@Verifier(L)
174-func Q () = sigVerify(L.bodyBytes, L.proofs[0], L.senderPublicKey)
164+@Verifier(O)
165+func P () = sigVerify(O.bodyBytes, O.proofs[0], O.senderPublicKey)
175166

github/deemru/w8io/169f3d6 
34.94 ms