tx · 9B5o6xrQxZesRAhzUguYrZiAsQDiEBE8rwd8j9ahfLaN

3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h:  -0.05000000 Waves

2023.03.29 13:43 [2511119] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves

{ "type": 13, "id": "9B5o6xrQxZesRAhzUguYrZiAsQDiEBE8rwd8j9ahfLaN", "fee": 5000000, "feeAssetId": null, "timestamp": 1680086699856, "version": 2, "chainId": 84, "sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h", "senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2", "proofs": [ "pR666GCz44wuAbysBvzcw89QhYQTtHDEVa6osSfxdMFrec45oDwNqCxTjCsTVmeMMNKCeqWmawCKoGdbHs3DAXr" ], "script": "base64:BgIJCAISAwoBARIAEgAMY29udHJhY3RGaWxlAglyZWJhbGFuY2UAD2tleXNUYXJnZXRSYXRpbwIPJXNfX3RhcmdldFJhdGlvABRrZXlBZGRpdGlvbmFsQmFsYW5jZQIaJXNfX2FkZGl0aW9uYWxXYXZlc0JhbGFuY2UAGmtleVNXYXZlc0FkZGl0aW9uYWxCYWxhbmNlAhElc19fc1dhdmVzQmFsYW5jZQAQa2V5U1dhdmVzQXNzZXRJZAIRJXNfX3NXYXZlc0Fzc2V0SWQAD2tleVByb3h5QWRkcmVzcwIQJXNfX3Byb3h5QWRkcmVzcwANa2V5TWluQmFsYW5jZQITJXNfX21pbldhdmVzQmFsYW5jZQAGTVVMVDEyAICglKWNHQEQZ2V0SW50ZWdlck9yWmVybwEKaW50ZWdlcktleQQHJG1hdGNoMAkAmggCBQR0aGlzBQppbnRlZ2VyS2V5AwkAAQIFByRtYXRjaDACA0ludAQDdmFsBQckbWF0Y2gwBQN2YWwAAAEQZ2V0U3RyaW5nT3JUaHJvdwEJc3RyaW5nS2V5BAckbWF0Y2gwCQCdCAIFBHRoaXMFCXN0cmlu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ZmYED3NlbmRXYXZlc0Ftb3VudAkBAS0BBQRkaWZmCQEHZGVwb3NpdAEFD3NlbmRXYXZlc0Ftb3VudAQOZ2V0V2F2ZXNBbW91bnQFBGRpZmYJAQh3aXRoZHJhdwEFDmdldFdhdmVzQW1vdW50CQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAgFpAQ5yZWJhbGFuY2VSYXRpbwELdGFyZ2V0UmF0aW8JARFyZWJhbGFuY2VJbnRlcm5hbAEFC3RhcmdldFJhdGlvAWkBCXJlYmFsYW5jZQAJARFyZWJhbGFuY2VJbnRlcm5hbAEJAQ5nZXRUYXJnZXRSYXRpbwAAu2iIKw==", "height": 2511119, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 95Qmh2UMcxgtRYrLNxj1Hhv9eJE4krhpttBxDFRi5SiR Next: GuWtKs3nYMdz2tUqzSF3Xmi9nZzLLUmXVtpq8jcdRpEn Diff:
OldNewDifferences
155155
156156
157157 func L (M) = {
158- let N = max([0, (wavesBalance(this).regular - r())])
158+ let N = wavesBalance(this).regular
159159 if ((N == N))
160160 then {
161161 let O = i(c)
162162 if ((O == O))
163163 then {
164- let P = (N + O)
164+ let P = max([0, ((N + O) - r())])
165165 let Q = fraction(M, P, 100)
166166 let R = (O - Q)
167167 if ((R == 0))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "rebalance"
55
66 let b = "%s__targetRatio"
77
88 let c = "%s__additionalWavesBalance"
99
1010 let d = "%s__sWavesBalance"
1111
1212 let e = "%s__sWavesAssetId"
1313
1414 let f = "%s__proxyAddress"
1515
1616 let g = "%s__minWavesBalance"
1717
1818 let h = 1000000000000
1919
2020 func i (j) = {
2121 let k = getInteger(this, j)
2222 if ($isInstanceOf(k, "Int"))
2323 then {
2424 let l = k
2525 l
2626 }
2727 else 0
2828 }
2929
3030
3131 func m (n) = {
3232 let k = getString(this, n)
3333 if ($isInstanceOf(k, "String"))
3434 then {
3535 let o = k
3636 o
3737 }
3838 else throw((("[" + n) + "] is empty"))
3939 }
4040
4141
4242 func p () = {
4343 let k = getInteger(b)
4444 if ($isInstanceOf(k, "Int"))
4545 then {
4646 let q = k
4747 min([100, max([0, q])])
4848 }
4949 else 0
5050 }
5151
5252
5353 func r () = {
5454 let k = getInteger(g)
5555 if ($isInstanceOf(k, "Int"))
5656 then {
5757 let s = k
5858 max([0, s])
5959 }
6060 else 0
6161 }
6262
6363
6464 func t () = {
6565 let u = addressFromStringValue(m(f))
6666 let v = invoke(u, "getRate", nil, nil)
6767 if ((v == v))
6868 then {
6969 let k = v
7070 if ($isInstanceOf(k, "String"))
7171 then {
7272 let o = k
7373 parseIntValue(o)
7474 }
7575 else throw("Rate is zero (0)")
7676 }
7777 else throw("Strict value is not equal to itself.")
7878 }
7979
8080
8181 func w () = addressFromStringValue(m(f))
8282
8383
8484 func x () = fromBase58String(m(e))
8585
8686
8787 func y (z) = {
8888 let u = w()
8989 let A = i(c)
9090 if ((A == A))
9191 then {
9292 let B = i(d)
9393 if ((B == B))
9494 then if ((z > 0))
9595 then {
9696 let C = invoke(u, "deposit", nil, [AttachedPayment(unit, z)])
9797 if ((C == C))
9898 then {
9999 let k = C
100100 if ($isInstanceOf(k, "Int"))
101101 then {
102102 let D = k
103103 let E = (A + z)
104104 let F = (B + D)
105105 [IntegerEntry(c, E), IntegerEntry(d, F)]
106106 }
107107 else nil
108108 }
109109 else throw("Strict value is not equal to itself.")
110110 }
111111 else nil
112112 else throw("Strict value is not equal to itself.")
113113 }
114114 else throw("Strict value is not equal to itself.")
115115 }
116116
117117
118118 func G (z) = {
119119 let u = w()
120120 let A = i(c)
121121 if ((A == A))
122122 then {
123123 let B = i(d)
124124 if ((B == B))
125125 then {
126126 let H = t()
127127 if ((H == H))
128128 then {
129129 let I = fraction(h, z, H)
130130 if ((I > 0))
131131 then {
132132 let J = invoke(u, "withdraw", nil, [AttachedPayment(x(), I)])
133133 if ((J == J))
134134 then {
135135 let k = J
136136 if ($isInstanceOf(k, "Int"))
137137 then {
138138 let K = k
139139 let E = (A - K)
140140 let F = (B - I)
141141 [IntegerEntry(c, E), IntegerEntry(d, F)]
142142 }
143143 else nil
144144 }
145145 else throw("Strict value is not equal to itself.")
146146 }
147147 else nil
148148 }
149149 else throw("Strict value is not equal to itself.")
150150 }
151151 else throw("Strict value is not equal to itself.")
152152 }
153153 else throw("Strict value is not equal to itself.")
154154 }
155155
156156
157157 func L (M) = {
158- let N = max([0, (wavesBalance(this).regular - r())])
158+ let N = wavesBalance(this).regular
159159 if ((N == N))
160160 then {
161161 let O = i(c)
162162 if ((O == O))
163163 then {
164- let P = (N + O)
164+ let P = max([0, ((N + O) - r())])
165165 let Q = fraction(M, P, 100)
166166 let R = (O - Q)
167167 if ((R == 0))
168168 then nil
169169 else if ((0 > R))
170170 then {
171171 let S = -(R)
172172 y(S)
173173 }
174174 else {
175175 let T = R
176176 G(T)
177177 }
178178 }
179179 else throw("Strict value is not equal to itself.")
180180 }
181181 else throw("Strict value is not equal to itself.")
182182 }
183183
184184
185185 @Callable(s)
186186 func rebalanceRatio (M) = L(M)
187187
188188
189189
190190 @Callable(s)
191191 func rebalance () = L(p())
192192
193193

github/deemru/w8io/169f3d6 
29.53 ms