tx · AKW2SvCMFrc61Cfc2dUDqBrsNf3Jth3zn731ULCJrXSt

3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h:  -0.05000000 Waves

2023.03.28 10:05 [2509479] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves

{ "type": 13, "id": "AKW2SvCMFrc61Cfc2dUDqBrsNf3Jth3zn731ULCJrXSt", "fee": 5000000, "feeAssetId": null, "timestamp": 1679987135876, "version": 2, "chainId": 84, "sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h", "senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2", "proofs": [ "2AKGJwXT3MT8PsaB8g6YwoJ2reMbVkyK68rkiMvZTWLCzPn61dcLV4RwN1rqNRN4wSpY4XVSEYPX5PaioDUjopFJ" ], "script": "base64:BgIRCAISABIAEgASBQoDAQEBEgAOAAxjb250cmFjdEZpbGUCCXJlYmFsYW5jZQAPa2V5c1RhcmdldFJhdGlvAg8lc19fdGFyZ2V0UmF0aW8AFGtleUFkZGl0aW9uYWxCYWxhbmNlAholc19fYWRkaXRpb25hbFdhdmVzQmFsYW5jZQAaa2V5U1dhdmVzQWRkaXRpb25hbEJhbGFuY2UCESVzX19zV2F2ZXNCYWxhbmNlABBrZXlTV2F2ZXNBc3NldElkAhElc19fc1dhdmVzQXNzZXRJZAAPa2V5UHJveHlBZGRyZXNzAhAlc19fcHJveHlBZGRyZXNzARBnZXRJbnRlZ2VyT3JaZXJvAQppbnRlZ2VyS2V5BAckbWF0Y2gwCQCaCAIFBHRoaXMFCmludGVnZXJLZXkDCQABAgUHJG1hdGNoMAIDSW50BAN2YWwFByRtYXRjaDAFA3ZhbAAAARBnZXRTdHJpbmdPclRocm93AQlzdHJpbmdLZXkEByRtYXRjaDAJAJ0IAgUEdGhpcwUJc3RyaW5nS2V5AwkAAQIFByRtYXRjaDACBlN0cmluZwQBcwUHJG1hdGNoMAUBcwk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RpdGlvbmFsQmFsYW5jZQkAawMFC3RhcmdldFJhdGlvBQ13aG9sZUJsYWxhbmNlAGQEBmNoYW5nZQkAZQIFEWFkZGl0aW9uYWxCYWxhbmNlBRd0YXJnZXRBZGRpdGlvbmFsQmFsYW5jZQQGbmV3UmVnCQBkAgUOcmVndWxhckJhbGFuY2UFBmNoYW5nZQMJAAACBQZjaGFuZ2UAAAUDbmlsAwkAZgIAAAUGY2hhbmdlBA9zZW5kV2F2ZXNBbW91bnQJAGgCBQZjaGFuZ2UA////////////AQkBB2RlcG9zaXQBBQ9zZW5kV2F2ZXNBbW91bnQEDmdldFdhdmVzQW1vdW50BQZjaGFuZ2UJAQh3aXRoZHJhdwEFDmdldFdhdmVzQW1vdW50CQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAJuTpWE=", "height": 2509479, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ZYfmLsTeAxZk97CX7PPMQG7g1478dGJrXATh9cfAWYD Next: 44fuU8CAFGwn9pdreeYxTFyZjNNnccaCtuD5AzgdAjR2 Diff:
OldNewDifferences
198198 let P = fraction(N, T, 100)
199199 let Q = (q - P)
200200 let R = (M + Q)
201- if ((0 > Q))
202- then {
203- let U = (Q * -1)
204- v(U)
205- }
206- else {
207- let V = Q
208- D(V)
209- }
201+ if ((Q == 0))
202+ then nil
203+ else if ((0 > Q))
204+ then {
205+ let U = (Q * -1)
206+ v(U)
207+ }
208+ else {
209+ let V = Q
210+ D(V)
211+ }
210212 }
211213 else throw("Strict value is not equal to itself.")
212214 }
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 func g (h) = {
1717 let i = getInteger(this, h)
1818 if ($isInstanceOf(i, "Int"))
1919 then {
2020 let j = i
2121 j
2222 }
2323 else 0
2424 }
2525
2626
2727 func k (l) = {
2828 let i = getString(this, l)
2929 if ($isInstanceOf(i, "String"))
3030 then {
3131 let m = i
3232 m
3333 }
3434 else throw((("[" + l) + "] is empty"))
3535 }
3636
3737
3838 func n () = {
3939 let i = getInteger(b)
4040 if ($isInstanceOf(i, "Int"))
4141 then {
4242 let m = i
4343 m
4444 }
4545 else 80
4646 }
4747
4848
4949 func o () = (wavesBalance(this).regular + g(c))
5050
5151
5252 func p () = {
5353 let q = g(c)
5454 let r = g(d)
5555 if ((q == 0))
5656 then 0
5757 else fraction(100000000000, q, r)
5858 }
5959
6060
6161 func s () = {
6262 let t = addressFromStringValue(k(f))
6363 let u = invoke(t, "getRate", nil, nil)
6464 if ((u == u))
6565 then {
6666 let i = u
6767 if ($isInstanceOf(i, "String"))
6868 then {
6969 let m = i
7070 parseIntValue(m)
7171 }
7272 else throw("ZERO rate")
7373 }
7474 else throw("Strict value is not equal to itself.")
7575 }
7676
7777
7878 func v (w) = {
7979 let t = addressFromStringValue(k(f))
8080 let x = g(c)
8181 if ((x == x))
8282 then {
8383 let y = g(d)
8484 if ((y == y))
8585 then {
8686 let z = invoke(t, "deposit", nil, [AttachedPayment(unit, w)])
8787 if ((z == z))
8888 then {
8989 let i = z
9090 if ($isInstanceOf(i, "Int"))
9191 then {
9292 let A = i
9393 let B = (x + w)
9494 let C = (y + A)
9595 [IntegerEntry(c, B), IntegerEntry(d, C)]
9696 }
9797 else nil
9898 }
9999 else throw("Strict value is not equal to itself.")
100100 }
101101 else throw("Strict value is not equal to itself.")
102102 }
103103 else throw("Strict value is not equal to itself.")
104104 }
105105
106106
107107 func D (w) = {
108108 let t = addressFromStringValue(k(f))
109109 let E = fromBase58String(k(e))
110110 if ((E == E))
111111 then {
112112 let x = g(c)
113113 if ((x == x))
114114 then {
115115 let y = g(d)
116116 if ((y == y))
117117 then {
118118 let F = s()
119119 if ((F == F))
120120 then {
121121 let G = fraction(1000000000000, w, F)
122122 let z = invoke(t, "withdraw", nil, [AttachedPayment(E, G)])
123123 if ((z == z))
124124 then {
125125 let i = z
126126 if ($isInstanceOf(i, "Int"))
127127 then {
128128 let H = i
129129 let B = (x - H)
130130 let C = (y - G)
131131 [IntegerEntry(c, B), IntegerEntry(d, C)]
132132 }
133133 else nil
134134 }
135135 else throw("Strict value is not equal to itself.")
136136 }
137137 else throw("Strict value is not equal to itself.")
138138 }
139139 else throw("Strict value is not equal to itself.")
140140 }
141141 else throw("Strict value is not equal to itself.")
142142 }
143143 else throw("Strict value is not equal to itself.")
144144 }
145145
146146
147147 @Callable(I)
148148 func returnWavesBalance () = $Tuple2(nil, o())
149149
150150
151151
152152 @Callable(I)
153153 func returnSWavesBalance () = $Tuple2(nil, g(d))
154154
155155
156156
157157 @Callable(I)
158158 func calcRatio () = {
159159 let J = wavesBalance(this).regular
160160 let K = g(c)
161161 let L = fraction(100, K, (K + J))
162162 $Tuple2(nil, L)
163163 }
164164
165165
166166
167167 @Callable(I)
168168 func calcRatioTest (M,K,N) = {
169169 let O = (M + K)
170170 let P = fraction(N, O, 100)
171171 let Q = (K - P)
172172 let R = (M + Q)
173173 if ((0 > Q))
174174 then {
175175 let S = (Q * -1)
176176 $Tuple2(nil, [R, P, Q, ("deposit: " + toString(S))])
177177 }
178178 else {
179179 let S = Q
180180 $Tuple2(nil, [R, P, Q, ("withdraw: " + toString(S))])
181181 }
182182 }
183183
184184
185185
186186 @Callable(I)
187187 func rebalance () = {
188188 let M = wavesBalance(this).regular
189189 if ((M == M))
190190 then {
191191 let q = g(c)
192192 if ((q == q))
193193 then {
194194 let N = n()
195195 if ((N == N))
196196 then {
197197 let T = (M + q)
198198 let P = fraction(N, T, 100)
199199 let Q = (q - P)
200200 let R = (M + Q)
201- if ((0 > Q))
202- then {
203- let U = (Q * -1)
204- v(U)
205- }
206- else {
207- let V = Q
208- D(V)
209- }
201+ if ((Q == 0))
202+ then nil
203+ else if ((0 > Q))
204+ then {
205+ let U = (Q * -1)
206+ v(U)
207+ }
208+ else {
209+ let V = Q
210+ D(V)
211+ }
210212 }
211213 else throw("Strict value is not equal to itself.")
212214 }
213215 else throw("Strict value is not equal to itself.")
214216 }
215217 else throw("Strict value is not equal to itself.")
216218 }
217219
218220

github/deemru/w8io/169f3d6 
35.68 ms