tx · 6qjiGmkGnHy9XM3BQwo6xgVdGx6go2qGNUPJvCvpBFnS

3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h:  -0.05000000 Waves

2023.03.29 15:46 [2511258] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves

{ "type": 13, "id": "6qjiGmkGnHy9XM3BQwo6xgVdGx6go2qGNUPJvCvpBFnS", "fee": 5000000, "feeAssetId": null, "timestamp": 1680093977185, "version": 2, "chainId": 84, "sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h", "senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2", "proofs": [ "32yE3py5Myyinpv8RJMwsg7FrvgRX4n17xvqDAMQoTnv7zdFPMp2njzqiYggwbp6jrk3sKdMfgF1NxQ4NnndRpvF" ], "script": "base64:BgIECAISAAwAA1NFUAICX18ADGNvbnRyYWN0RmlsZQIJcmViYWxhbmNlABFrZXlGYWN0b3J5QWRkcmVzcwILJXNfX2ZhY3RvcnkBFGtleUFkZGl0aW9uYWxCYWxhbmNlAQdhc3NldElkCQC5CQIJAMwIAgIEJXMlcwkAzAgCAhFhZGRpdGlvbmFsQmFsYW5jZQkAzAgCBQdhc3NldElkBQNuaWwFA1NFUAEWa2V5U3Rha2luZ0Fzc2V0QmFsYW5jZQEHYXNzZXRJZAkAuQkCCQDMCAICBCVzJXMJAMwIAgITc3Rha2luZ0Fzc2V0QmFsYW5jZQkAzAgCBQdhc3NldElkBQNuaWwFA1NFUAEUZ2V0QWRkaXRpb25hbEJhbGFuY2UBB2Fzc2V0SWQJAQt2YWx1ZU9yRWxzZQIJAJoIAgUEdGhpcwkBFGtleUFkZGl0aW9uYWxCYWxhbmNlAQUHYXNzZXRJZAAAARZnZXRTdGFraW5nQXNzZXRCYWxhbmNlAQdhc3NldElkCQELdmFsdWVPckVsc2UCCQCaCAIFBHRoaXMJARZrZXlTdGFraW5nQXNzZXRCYWxh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c3MIBQskdDA0MjYwNDM2OQJfNwMFCmlzTGVhc2FibGUJARFyZWJhbGFuY2VJbnRlcm5hbAYFC2xlYXNlZFJhdGlvBQZhc3NldDEFDHByb3h5QXNzZXRJZAUKbWluQmFsYW5jZQkBEUBleHRyTmF0aXZlKDEwNjIpAQUMcHJveHlBZGRyZXNzBQxwcm94eVJhdGVNdWwFA25pbAkAAgECA0JSUgAZBfhq", "height": 2511258, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AMUwG36YQv66tpSkTNkVUyUeaCsDCK5rdczmaWj9tJvc Next: E2AYH9iR5teHM54BQBnsut7vra1dEtDS9zwSorEAccuK Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let a = "rebalance"
4+let a = "__"
55
6-let b = "%s__targetRatio"
6+let b = "rebalance"
77
8-let c = "%s__additionalWavesBalance"
8+let c = "%s__factory"
99
10-let d = "%s__sWavesBalance"
11-
12-let e = "%s__sWavesAssetId"
13-
14-let f = "%s__proxyAddress"
15-
16-let g = "%s__minWavesBalance"
17-
18-let h = "%s__factory"
19-
20-let i = 1000000000000
21-
22-func j (k) = {
23- let l = getInteger(this, k)
24- if ($isInstanceOf(l, "Int"))
25- then {
26- let m = l
27- m
28- }
29- else 0
30- }
10+func d (e) = makeString(["%s%s", "additionalBalance", e], a)
3111
3212
33-func n (o) = {
34- let l = getString(this, o)
35- if ($isInstanceOf(l, "String"))
36- then {
37- let p = l
38- p
39- }
40- else throw((("[" + o) + "] is empty"))
41- }
13+func f (e) = makeString(["%s%s", "stakingAssetBalance", e], a)
4214
4315
44-func q () = {
45- let l = getInteger(b)
46- if ($isInstanceOf(l, "Int"))
47- then {
48- let r = l
49- min([100, max([0, r])])
50- }
51- else 0
52- }
16+func g (e) = valueOrElse(getInteger(this, d(e)), 0)
5317
5418
55-func s () = {
56- let l = getInteger(g)
57- if ($isInstanceOf(l, "Int"))
58- then {
59- let t = l
60- max([0, t])
61- }
62- else 0
63- }
19+func h (e) = valueOrElse(getInteger(this, f(e)), 0)
6420
6521
66-func u () = {
67- let v = addressFromStringValue(n(f))
68- let w = invoke(v, "getRate", nil, nil)
69- if ((w == w))
22+func i (j) = {
23+ let k = invoke(j, "getRate", nil, nil)
24+ if ((k == k))
7025 then {
71- let l = w
26+ let l = k
7227 if ($isInstanceOf(l, "String"))
7328 then {
74- let p = l
75- parseIntValue(p)
29+ let m = l
30+ parseIntValue(m)
7631 }
7732 else throw("Rate is zero (0)")
7833 }
8035 }
8136
8237
83-func x () = addressFromStringValue(n(f))
84-
85-
86-func y () = fromBase58String(n(e))
87-
88-
89-func z () = {
90- let A = addressFromStringValue(valueOrElse(getString(h), ""))
91- let B = toString(this)
92- $Tuple2(invoke(A, "getPoolLeaseConfigREADONLY", [B, "WAVES"], nil), B)
38+func n (e) = {
39+ let o = addressFromStringValue(valueOrElse(getString(c), ""))
40+ let p = toString(this)
41+ invoke(o, "getPoolLeaseConfigREADONLY", [p, e], nil)
9342 }
9443
9544
96-func C (D) = {
97- let v = x()
98- let E = j(c)
99- if ((E == E))
45+func q (e,r,s,j) = {
46+ let t = g(e)
47+ if ((t == t))
10048 then {
101- let F = j(d)
102- if ((F == F))
103- then if ((D > 0))
104- then {
105- let G = invoke(v, "deposit", nil, [AttachedPayment(unit, D)])
106- if ((G == G))
107- then {
108- let l = G
109- if ($isInstanceOf(l, "Int"))
110- then {
111- let H = l
112- let I = (E + D)
113- let J = (F + H)
114-[IntegerEntry(c, I), IntegerEntry(d, J)]
115- }
116- else nil
117- }
118- else throw("Strict value is not equal to itself.")
119- }
120- else nil
49+ let u = h(s)
50+ if ((u == u))
51+ then {
52+ let v = if ((e == "WAVES"))
53+ then unit
54+ else fromBase58String(e)
55+ if ((r > 0))
56+ then {
57+ let w = invoke(j, "deposit", nil, [AttachedPayment(v, r)])
58+ if ((w == w))
59+ then {
60+ let l = w
61+ if ($isInstanceOf(l, "Int"))
62+ then {
63+ let x = l
64+ let y = (t + r)
65+ let z = (u + x)
66+[IntegerEntry(d(e), y), IntegerEntry(f(s), z)]
67+ }
68+ else nil
69+ }
70+ else throw("Strict value is not equal to itself.")
71+ }
72+ else nil
73+ }
12174 else throw("Strict value is not equal to itself.")
12275 }
12376 else throw("Strict value is not equal to itself.")
12477 }
12578
12679
127-func K (D) = {
128- let v = x()
129- let E = j(c)
130- if ((E == E))
80+func A (e,r,s,j,B) = {
81+ let t = g(e)
82+ if ((t == t))
13183 then {
132- let F = j(d)
133- if ((F == F))
84+ let u = h(s)
85+ if ((u == u))
13486 then {
135- let L = u()
136- if ((L == L))
87+ let C = i(j)
88+ if ((C == C))
13789 then {
138- let M = fraction(i, D, L)
139- if ((M > 0))
90+ let D = fraction(B, r, C)
91+ if ((D > 0))
14092 then {
141- let N = invoke(v, "withdraw", nil, [AttachedPayment(y(), M)])
142- if ((N == N))
93+ let E = invoke(j, "withdraw", nil, [AttachedPayment(fromBase58String(s), D)])
94+ if ((E == E))
14395 then {
144- let l = N
96+ let l = E
14597 if ($isInstanceOf(l, "Int"))
14698 then {
147- let O = l
148- let I = (E - O)
149- let J = (F - M)
150-[IntegerEntry(c, I), IntegerEntry(d, J)]
99+ let F = l
100+ let y = (t - F)
101+ let z = (u - D)
102+[IntegerEntry(d(e), y), IntegerEntry(f(s), z)]
151103 }
152104 else nil
153105 }
163115 }
164116
165117
166-func P (Q) = {
167- let R = wavesBalance(this).available
168- if ((R == R))
118+func G (H,e,s,I,j,B) = {
119+ let t = g(e)
120+ if ((t == t))
169121 then {
170- let S = j(c)
171- if ((S == S))
122+ let u = h(s)
123+ if ((u == u))
172124 then {
173- let T = max([0, ((R + S) - s())])
174- let U = fraction(Q, T, 100)
175- let V = (S - U)
176- if ((V == 0))
177- then nil
178- else if ((0 > V))
179- then {
180- let W = -(V)
181- C(W)
182- }
183- else {
184- let X = V
185- K(X)
186- }
125+ let J = if ((e == "WAVES"))
126+ then wavesBalance(this).available
127+ else assetBalance(this, fromBase58String(e))
128+ if ((J == J))
129+ then {
130+ let K = max([0, ((J + t) - I)])
131+ let L = fraction(H, K, 100)
132+ let M = (t - L)
133+ if ((M == 0))
134+ then nil
135+ else if ((0 > M))
136+ then {
137+ let N = -(M)
138+ q(e, N, s, j)
139+ }
140+ else {
141+ let O = M
142+ A(e, O, s, j, B)
143+ }
144+ }
145+ else throw("Strict value is not equal to itself.")
187146 }
188147 else throw("Strict value is not equal to itself.")
189148 }
191150 }
192151
193152
194-@Callable(t)
195-func rebalanceRatio (Q) = P(Q)
196-
197-
198-
199-@Callable(t)
200-func rebalance () = P(q())
153+@Callable(P)
154+func rebalance () = {
155+ let Q = "WAVES"
156+ let l = n(Q)
157+ if ($isInstanceOf(l, "(Boolean, Int, Int, String, String, Int, String)"))
158+ then {
159+ let R = l
160+ let S = R
161+ let T = S._1
162+ let U = S._2
163+ let I = S._3
164+ let V = S._4
165+ let W = S._5
166+ let B = S._6
167+ let X = S._7
168+ if (T)
169+ then G(U, Q, W, I, addressFromStringValue(V), B)
170+ else nil
171+ }
172+ else throw("BRR")
173+ }
201174
202175
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let a = "rebalance"
4+let a = "__"
55
6-let b = "%s__targetRatio"
6+let b = "rebalance"
77
8-let c = "%s__additionalWavesBalance"
8+let c = "%s__factory"
99
10-let d = "%s__sWavesBalance"
11-
12-let e = "%s__sWavesAssetId"
13-
14-let f = "%s__proxyAddress"
15-
16-let g = "%s__minWavesBalance"
17-
18-let h = "%s__factory"
19-
20-let i = 1000000000000
21-
22-func j (k) = {
23- let l = getInteger(this, k)
24- if ($isInstanceOf(l, "Int"))
25- then {
26- let m = l
27- m
28- }
29- else 0
30- }
10+func d (e) = makeString(["%s%s", "additionalBalance", e], a)
3111
3212
33-func n (o) = {
34- let l = getString(this, o)
35- if ($isInstanceOf(l, "String"))
36- then {
37- let p = l
38- p
39- }
40- else throw((("[" + o) + "] is empty"))
41- }
13+func f (e) = makeString(["%s%s", "stakingAssetBalance", e], a)
4214
4315
44-func q () = {
45- let l = getInteger(b)
46- if ($isInstanceOf(l, "Int"))
47- then {
48- let r = l
49- min([100, max([0, r])])
50- }
51- else 0
52- }
16+func g (e) = valueOrElse(getInteger(this, d(e)), 0)
5317
5418
55-func s () = {
56- let l = getInteger(g)
57- if ($isInstanceOf(l, "Int"))
58- then {
59- let t = l
60- max([0, t])
61- }
62- else 0
63- }
19+func h (e) = valueOrElse(getInteger(this, f(e)), 0)
6420
6521
66-func u () = {
67- let v = addressFromStringValue(n(f))
68- let w = invoke(v, "getRate", nil, nil)
69- if ((w == w))
22+func i (j) = {
23+ let k = invoke(j, "getRate", nil, nil)
24+ if ((k == k))
7025 then {
71- let l = w
26+ let l = k
7227 if ($isInstanceOf(l, "String"))
7328 then {
74- let p = l
75- parseIntValue(p)
29+ let m = l
30+ parseIntValue(m)
7631 }
7732 else throw("Rate is zero (0)")
7833 }
7934 else throw("Strict value is not equal to itself.")
8035 }
8136
8237
83-func x () = addressFromStringValue(n(f))
84-
85-
86-func y () = fromBase58String(n(e))
87-
88-
89-func z () = {
90- let A = addressFromStringValue(valueOrElse(getString(h), ""))
91- let B = toString(this)
92- $Tuple2(invoke(A, "getPoolLeaseConfigREADONLY", [B, "WAVES"], nil), B)
38+func n (e) = {
39+ let o = addressFromStringValue(valueOrElse(getString(c), ""))
40+ let p = toString(this)
41+ invoke(o, "getPoolLeaseConfigREADONLY", [p, e], nil)
9342 }
9443
9544
96-func C (D) = {
97- let v = x()
98- let E = j(c)
99- if ((E == E))
45+func q (e,r,s,j) = {
46+ let t = g(e)
47+ if ((t == t))
10048 then {
101- let F = j(d)
102- if ((F == F))
103- then if ((D > 0))
104- then {
105- let G = invoke(v, "deposit", nil, [AttachedPayment(unit, D)])
106- if ((G == G))
107- then {
108- let l = G
109- if ($isInstanceOf(l, "Int"))
110- then {
111- let H = l
112- let I = (E + D)
113- let J = (F + H)
114-[IntegerEntry(c, I), IntegerEntry(d, J)]
115- }
116- else nil
117- }
118- else throw("Strict value is not equal to itself.")
119- }
120- else nil
49+ let u = h(s)
50+ if ((u == u))
51+ then {
52+ let v = if ((e == "WAVES"))
53+ then unit
54+ else fromBase58String(e)
55+ if ((r > 0))
56+ then {
57+ let w = invoke(j, "deposit", nil, [AttachedPayment(v, r)])
58+ if ((w == w))
59+ then {
60+ let l = w
61+ if ($isInstanceOf(l, "Int"))
62+ then {
63+ let x = l
64+ let y = (t + r)
65+ let z = (u + x)
66+[IntegerEntry(d(e), y), IntegerEntry(f(s), z)]
67+ }
68+ else nil
69+ }
70+ else throw("Strict value is not equal to itself.")
71+ }
72+ else nil
73+ }
12174 else throw("Strict value is not equal to itself.")
12275 }
12376 else throw("Strict value is not equal to itself.")
12477 }
12578
12679
127-func K (D) = {
128- let v = x()
129- let E = j(c)
130- if ((E == E))
80+func A (e,r,s,j,B) = {
81+ let t = g(e)
82+ if ((t == t))
13183 then {
132- let F = j(d)
133- if ((F == F))
84+ let u = h(s)
85+ if ((u == u))
13486 then {
135- let L = u()
136- if ((L == L))
87+ let C = i(j)
88+ if ((C == C))
13789 then {
138- let M = fraction(i, D, L)
139- if ((M > 0))
90+ let D = fraction(B, r, C)
91+ if ((D > 0))
14092 then {
141- let N = invoke(v, "withdraw", nil, [AttachedPayment(y(), M)])
142- if ((N == N))
93+ let E = invoke(j, "withdraw", nil, [AttachedPayment(fromBase58String(s), D)])
94+ if ((E == E))
14395 then {
144- let l = N
96+ let l = E
14597 if ($isInstanceOf(l, "Int"))
14698 then {
147- let O = l
148- let I = (E - O)
149- let J = (F - M)
150-[IntegerEntry(c, I), IntegerEntry(d, J)]
99+ let F = l
100+ let y = (t - F)
101+ let z = (u - D)
102+[IntegerEntry(d(e), y), IntegerEntry(f(s), z)]
151103 }
152104 else nil
153105 }
154106 else throw("Strict value is not equal to itself.")
155107 }
156108 else nil
157109 }
158110 else throw("Strict value is not equal to itself.")
159111 }
160112 else throw("Strict value is not equal to itself.")
161113 }
162114 else throw("Strict value is not equal to itself.")
163115 }
164116
165117
166-func P (Q) = {
167- let R = wavesBalance(this).available
168- if ((R == R))
118+func G (H,e,s,I,j,B) = {
119+ let t = g(e)
120+ if ((t == t))
169121 then {
170- let S = j(c)
171- if ((S == S))
122+ let u = h(s)
123+ if ((u == u))
172124 then {
173- let T = max([0, ((R + S) - s())])
174- let U = fraction(Q, T, 100)
175- let V = (S - U)
176- if ((V == 0))
177- then nil
178- else if ((0 > V))
179- then {
180- let W = -(V)
181- C(W)
182- }
183- else {
184- let X = V
185- K(X)
186- }
125+ let J = if ((e == "WAVES"))
126+ then wavesBalance(this).available
127+ else assetBalance(this, fromBase58String(e))
128+ if ((J == J))
129+ then {
130+ let K = max([0, ((J + t) - I)])
131+ let L = fraction(H, K, 100)
132+ let M = (t - L)
133+ if ((M == 0))
134+ then nil
135+ else if ((0 > M))
136+ then {
137+ let N = -(M)
138+ q(e, N, s, j)
139+ }
140+ else {
141+ let O = M
142+ A(e, O, s, j, B)
143+ }
144+ }
145+ else throw("Strict value is not equal to itself.")
187146 }
188147 else throw("Strict value is not equal to itself.")
189148 }
190149 else throw("Strict value is not equal to itself.")
191150 }
192151
193152
194-@Callable(t)
195-func rebalanceRatio (Q) = P(Q)
196-
197-
198-
199-@Callable(t)
200-func rebalance () = P(q())
153+@Callable(P)
154+func rebalance () = {
155+ let Q = "WAVES"
156+ let l = n(Q)
157+ if ($isInstanceOf(l, "(Boolean, Int, Int, String, String, Int, String)"))
158+ then {
159+ let R = l
160+ let S = R
161+ let T = S._1
162+ let U = S._2
163+ let I = S._3
164+ let V = S._4
165+ let W = S._5
166+ let B = S._6
167+ let X = S._7
168+ if (T)
169+ then G(U, Q, W, I, addressFromStringValue(V), B)
170+ else nil
171+ }
172+ else throw("BRR")
173+ }
201174
202175

github/deemru/w8io/026f985 
50.52 ms