tx · FQR71EwWYET2D37rV9cyPQy9c57AsVrLSPBFetrAPMsk

3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h:  -0.05000000 Waves

2023.03.28 09:53 [2509468] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves

{ "type": 13, "id": "FQR71EwWYET2D37rV9cyPQy9c57AsVrLSPBFetrAPMsk", "fee": 5000000, "feeAssetId": null, "timestamp": 1679986407647, "version": 2, "chainId": 84, "sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h", "senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2", "proofs": [ "4Hf2zM5FTDj64zR1dnYNtjKb11pjMh6yt1uDxvu673rLvPzK6wJiwKhM2493Nhjf9vnUkgYUoL1kQ9txttwgrnPY" ], "script": "base64:BgIRCAISABIAEgASBQoDAQEBEgAOAAxjb250cmFjdEZpbGUCCXJlYmFsYW5jZQAPa2V5c1RhcmdldFJhdGlvAg8lc19fdGFyZ2V0UmF0aW8AFGtleUFkZGl0aW9uYWxCYWxhbmNlAholc19fYWRkaXRpb25hbFdhdmVzQmFsYW5jZQAaa2V5U1dhdmVzQWRkaXRpb25hbEJhbGFuY2UCESVzX19zV2F2ZXNCYWxhbmNlABBrZXlTV2F2ZXNBc3NldElkAhElc19fc1dhdmVzQXNzZXRJZAAPa2V5UHJveHlBZGRyZXNzAhAlc19fcHJveHlBZGRyZXNzARBnZXRJbnRlZ2VyT3JaZXJvAQppbnRlZ2VyS2V5BAckbWF0Y2gwCQCaCAIFBHRoaXMFCmludGVnZXJLZXkDCQABAgUHJG1hdGNoMAIDSW50BAN2YWwFByRtYXRjaDAFA3ZhbAAAARBnZXRTdHJpbmdPclRocm93AQlzdHJpbmdLZXkEByRtYXRjaDAJAJ0IAgUEdGhpcwUJc3RyaW5nS2V5AwkAAQIFByRtYXRjaDACBlN0cmluZwQBcwUHJG1hdGNoMAUBcwkAAgEJAKw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FsQmFsYW5jZQkAawMFC3RhcmdldFJhdGlvBQ13aG9sZUJsYWxhbmNlAGQEBmNoYW5nZQkAZQIFEWFkZGl0aW9uYWxCYWxhbmNlBRd0YXJnZXRBZGRpdGlvbmFsQmFsYW5jZQQGbmV3UmVnCQBkAgUOcmVndWxhckJhbGFuY2UFBmNoYW5nZQMJAGYCAAAFBmNoYW5nZQQPc2VuZFdhdmVzQW1vdW50CQBoAgUGY2hhbmdlAP///////////wEJAQdkZXBvc2l0AQUPc2VuZFdhdmVzQW1vdW50BA5nZXRXYXZlc0Ftb3VudAUGY2hhbmdlCQEId2l0aGRyYXcBBQ5nZXRXYXZlc0Ftb3VudAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAxfZFj", "height": 2509468, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BN14Vfd9aoDBtQospVDznCoZboQsFZ5bmmSTPvtknHZD Next: ZYfmLsTeAxZk97CX7PPMQG7g1478dGJrXATh9cfAWYD Diff:
OldNewDifferences
3535 }
3636
3737
38-func n () = (wavesBalance(this).regular + g(c))
39-
40-
41-func o () = {
42- let p = g(c)
43- let q = g(d)
44- if ((p == 0))
45- then 0
46- else fraction(100000000000, p, q)
38+func n () = {
39+ let i = getInteger(b)
40+ if ($isInstanceOf(i, "Int"))
41+ then {
42+ let m = i
43+ m
44+ }
45+ else 80
4746 }
4847
4948
50-func r () = {
51- let s = addressFromStringValue(k(f))
52- let t = invoke(s, "getRate", nil, nil)
53- if ((t == t))
49+func o () = (wavesBalance(this).regular + g(c))
50+
51+
52+func p () = {
53+ let q = g(c)
54+ let r = g(d)
55+ if ((q == 0))
56+ then 0
57+ else fraction(100000000000, q, r)
58+ }
59+
60+
61+func s () = {
62+ let t = addressFromStringValue(k(f))
63+ let u = invoke(t, "getRate", nil, nil)
64+ if ((u == u))
5465 then {
55- let i = t
66+ let i = u
5667 if ($isInstanceOf(i, "String"))
5768 then {
5869 let m = i
5970 parseIntValue(m)
6071 }
61- else 0
72+ else throw("ZERO rate")
6273 }
6374 else throw("Strict value is not equal to itself.")
6475 }
6576
6677
67-@Callable(u)
68-func returnWavesBalance () = $Tuple2(nil, n())
78+func v (w) = {
79+ let t = addressFromStringValue(k(f))
80+ let x = g(c)
81+ if ((x == x))
82+ then {
83+ let y = g(d)
84+ if ((y == y))
85+ then {
86+ let z = invoke(t, "deposit", nil, [AttachedPayment(unit, w)])
87+ if ((z == z))
88+ then {
89+ let i = z
90+ if ($isInstanceOf(i, "Int"))
91+ then {
92+ let A = i
93+ let B = (x - w)
94+ let C = (y + A)
95+[IntegerEntry(c, B), IntegerEntry(d, C)]
96+ }
97+ else nil
98+ }
99+ else throw("Strict value is not equal to itself.")
100+ }
101+ else throw("Strict value is not equal to itself.")
102+ }
103+ else throw("Strict value is not equal to itself.")
104+ }
105+
106+
107+func D (w) = {
108+ let t = addressFromStringValue(k(f))
109+ let E = fromBase58String(k(e))
110+ if ((E == E))
111+ then {
112+ let x = g(c)
113+ if ((x == x))
114+ then {
115+ let y = g(d)
116+ if ((y == y))
117+ then {
118+ let F = s()
119+ if ((F == F))
120+ then {
121+ let G = fraction(1000000000000, w, F)
122+ let z = invoke(t, "withdraw", nil, [AttachedPayment(E, G)])
123+ if ((z == z))
124+ then {
125+ let i = z
126+ if ($isInstanceOf(i, "Int"))
127+ then {
128+ let H = i
129+ let B = (x + H)
130+ let C = (y - G)
131+[IntegerEntry(c, B), IntegerEntry(d, C)]
132+ }
133+ else nil
134+ }
135+ else throw("Strict value is not equal to itself.")
136+ }
137+ else throw("Strict value is not equal to itself.")
138+ }
139+ else throw("Strict value is not equal to itself.")
140+ }
141+ else throw("Strict value is not equal to itself.")
142+ }
143+ else throw("Strict value is not equal to itself.")
144+ }
145+
146+
147+@Callable(I)
148+func returnWavesBalance () = $Tuple2(nil, o())
69149
70150
71151
72-@Callable(u)
152+@Callable(I)
73153 func returnSWavesBalance () = $Tuple2(nil, g(d))
74154
75155
76156
77-@Callable(u)
157+@Callable(I)
78158 func calcRatio () = {
79- let v = wavesBalance(this).regular
80- let w = g(c)
81- let x = fraction(100, w, (w + v))
82- $Tuple2(nil, x)
159+ let J = wavesBalance(this).regular
160+ let K = g(c)
161+ let L = fraction(100, K, (K + J))
162+ $Tuple2(nil, L)
83163 }
84164
85165
86166
87-@Callable(u)
88-func calcRatioTest (y,w,z) = {
89- let A = (y + w)
90- let B = fraction(z, A, 100)
91- let C = (w - B)
92- let D = (y + C)
93- if ((0 > C))
167+@Callable(I)
168+func calcRatioTest (M,K,N) = {
169+ let O = (M + K)
170+ let P = fraction(N, O, 100)
171+ let Q = (K - P)
172+ let R = (M + Q)
173+ if ((0 > Q))
94174 then {
95- let E = (C * -1)
96- $Tuple2(nil, [D, B, C, ("deposit: " + toString(E))])
175+ let S = (Q * -1)
176+ $Tuple2(nil, [R, P, Q, ("deposit: " + toString(S))])
97177 }
98178 else {
99- let E = C
100- $Tuple2(nil, [D, B, C, ("withdraw: " + toString(E))])
179+ let S = Q
180+ $Tuple2(nil, [R, P, Q, ("withdraw: " + toString(S))])
101181 }
182+ }
183+
184+
185+
186+@Callable(I)
187+func rebalance () = {
188+ let M = wavesBalance(this).regular
189+ if ((M == M))
190+ then {
191+ let q = g(c)
192+ if ((q == q))
193+ then {
194+ let N = n()
195+ if ((N == N))
196+ then {
197+ let T = (M + q)
198+ let P = fraction(N, T, 100)
199+ let Q = (q - P)
200+ 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+ }
210+ }
211+ else throw("Strict value is not equal to itself.")
212+ }
213+ else throw("Strict value is not equal to itself.")
214+ }
215+ else throw("Strict value is not equal to itself.")
102216 }
103217
104218
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
38-func n () = (wavesBalance(this).regular + g(c))
39-
40-
41-func o () = {
42- let p = g(c)
43- let q = g(d)
44- if ((p == 0))
45- then 0
46- else fraction(100000000000, p, q)
38+func n () = {
39+ let i = getInteger(b)
40+ if ($isInstanceOf(i, "Int"))
41+ then {
42+ let m = i
43+ m
44+ }
45+ else 80
4746 }
4847
4948
50-func r () = {
51- let s = addressFromStringValue(k(f))
52- let t = invoke(s, "getRate", nil, nil)
53- if ((t == t))
49+func o () = (wavesBalance(this).regular + g(c))
50+
51+
52+func p () = {
53+ let q = g(c)
54+ let r = g(d)
55+ if ((q == 0))
56+ then 0
57+ else fraction(100000000000, q, r)
58+ }
59+
60+
61+func s () = {
62+ let t = addressFromStringValue(k(f))
63+ let u = invoke(t, "getRate", nil, nil)
64+ if ((u == u))
5465 then {
55- let i = t
66+ let i = u
5667 if ($isInstanceOf(i, "String"))
5768 then {
5869 let m = i
5970 parseIntValue(m)
6071 }
61- else 0
72+ else throw("ZERO rate")
6273 }
6374 else throw("Strict value is not equal to itself.")
6475 }
6576
6677
67-@Callable(u)
68-func returnWavesBalance () = $Tuple2(nil, n())
78+func v (w) = {
79+ let t = addressFromStringValue(k(f))
80+ let x = g(c)
81+ if ((x == x))
82+ then {
83+ let y = g(d)
84+ if ((y == y))
85+ then {
86+ let z = invoke(t, "deposit", nil, [AttachedPayment(unit, w)])
87+ if ((z == z))
88+ then {
89+ let i = z
90+ if ($isInstanceOf(i, "Int"))
91+ then {
92+ let A = i
93+ let B = (x - w)
94+ let C = (y + A)
95+[IntegerEntry(c, B), IntegerEntry(d, C)]
96+ }
97+ else nil
98+ }
99+ else throw("Strict value is not equal to itself.")
100+ }
101+ else throw("Strict value is not equal to itself.")
102+ }
103+ else throw("Strict value is not equal to itself.")
104+ }
105+
106+
107+func D (w) = {
108+ let t = addressFromStringValue(k(f))
109+ let E = fromBase58String(k(e))
110+ if ((E == E))
111+ then {
112+ let x = g(c)
113+ if ((x == x))
114+ then {
115+ let y = g(d)
116+ if ((y == y))
117+ then {
118+ let F = s()
119+ if ((F == F))
120+ then {
121+ let G = fraction(1000000000000, w, F)
122+ let z = invoke(t, "withdraw", nil, [AttachedPayment(E, G)])
123+ if ((z == z))
124+ then {
125+ let i = z
126+ if ($isInstanceOf(i, "Int"))
127+ then {
128+ let H = i
129+ let B = (x + H)
130+ let C = (y - G)
131+[IntegerEntry(c, B), IntegerEntry(d, C)]
132+ }
133+ else nil
134+ }
135+ else throw("Strict value is not equal to itself.")
136+ }
137+ else throw("Strict value is not equal to itself.")
138+ }
139+ else throw("Strict value is not equal to itself.")
140+ }
141+ else throw("Strict value is not equal to itself.")
142+ }
143+ else throw("Strict value is not equal to itself.")
144+ }
145+
146+
147+@Callable(I)
148+func returnWavesBalance () = $Tuple2(nil, o())
69149
70150
71151
72-@Callable(u)
152+@Callable(I)
73153 func returnSWavesBalance () = $Tuple2(nil, g(d))
74154
75155
76156
77-@Callable(u)
157+@Callable(I)
78158 func calcRatio () = {
79- let v = wavesBalance(this).regular
80- let w = g(c)
81- let x = fraction(100, w, (w + v))
82- $Tuple2(nil, x)
159+ let J = wavesBalance(this).regular
160+ let K = g(c)
161+ let L = fraction(100, K, (K + J))
162+ $Tuple2(nil, L)
83163 }
84164
85165
86166
87-@Callable(u)
88-func calcRatioTest (y,w,z) = {
89- let A = (y + w)
90- let B = fraction(z, A, 100)
91- let C = (w - B)
92- let D = (y + C)
93- if ((0 > C))
167+@Callable(I)
168+func calcRatioTest (M,K,N) = {
169+ let O = (M + K)
170+ let P = fraction(N, O, 100)
171+ let Q = (K - P)
172+ let R = (M + Q)
173+ if ((0 > Q))
94174 then {
95- let E = (C * -1)
96- $Tuple2(nil, [D, B, C, ("deposit: " + toString(E))])
175+ let S = (Q * -1)
176+ $Tuple2(nil, [R, P, Q, ("deposit: " + toString(S))])
97177 }
98178 else {
99- let E = C
100- $Tuple2(nil, [D, B, C, ("withdraw: " + toString(E))])
179+ let S = Q
180+ $Tuple2(nil, [R, P, Q, ("withdraw: " + toString(S))])
101181 }
182+ }
183+
184+
185+
186+@Callable(I)
187+func rebalance () = {
188+ let M = wavesBalance(this).regular
189+ if ((M == M))
190+ then {
191+ let q = g(c)
192+ if ((q == q))
193+ then {
194+ let N = n()
195+ if ((N == N))
196+ then {
197+ let T = (M + q)
198+ let P = fraction(N, T, 100)
199+ let Q = (q - P)
200+ 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+ }
210+ }
211+ else throw("Strict value is not equal to itself.")
212+ }
213+ else throw("Strict value is not equal to itself.")
214+ }
215+ else throw("Strict value is not equal to itself.")
102216 }
103217
104218

github/deemru/w8io/026f985 
34.18 ms