tx · E2AYH9iR5teHM54BQBnsut7vra1dEtDS9zwSorEAccuK

3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h:  -0.05000000 Waves

2023.03.30 09:13 [2512311] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves

{ "type": 13, "id": "E2AYH9iR5teHM54BQBnsut7vra1dEtDS9zwSorEAccuK", "fee": 5000000, "feeAssetId": null, "timestamp": 1680156845873, "version": 2, "chainId": 84, "sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h", "senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2", "proofs": [ "5pKsew2hsLqjxE86VvJFKr6o2wCwgeTQnGUuBhSv3NPPhj9W6EMgL2mFaCoENWT49AEE4qrfN5CkvxEmLZFsiL5i" ], "script": "base64:BgIHCAISAwoBCA0AA1NFUAICX18ADGNvbnRyYWN0RmlsZQIOcmViYWxhbmNlLnJpZGUAEWtleUZhY3RvcnlBZGRyZXNzAgslc19fZmFjdG9yeQEUa2V5QWRkaXRpb25hbEJhbGFuY2UBB2Fzc2V0SWQJALkJAgkAzAgCAgQlcyVzCQDMCAICEWFkZGl0aW9uYWxCYWxhbmNlCQDMCAIFB2Fzc2V0SWQFA25pbAUDU0VQARZrZXlTdGFraW5nQXNzZXRCYWxhbmNlAQdhc3NldElkCQC5CQIJAMwIAgIEJXMlcwkAzAgCAhNzdGFraW5nQXNzZXRCYWxhbmNlCQDMCAIFB2Fzc2V0SWQFA25pbAUDU0VQARRnZXRBZGRpdGlvbmFsQmFsYW5jZQEHYXNzZXRJZAkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzCQEUa2V5QWRkaXRpb25hbEJhbGFuY2UBBQdhc3NldElkAAABFmdldFN0YWtpbmdBc3NldEJhbGFuY2UBB2Fzc2V0SWQJAQt2YWx1ZU9yRWxzZQIJAJoIAgUEdGhpcwkBFmtleVN0YWtpbmdBc3NldEJhbG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0SWQIBQskdDA0MzU2NDQ2NQJfNQQMcHJveHlSYXRlTXVsCAULJHQwNDM1NjQ0NjUCXzYEFHN0YWtpbmdQcm9maXRBZGRyZXNzCAULJHQwNDM1NjQ0NjUCXzcDBQppc0xlYXNhYmxlCQERcmViYWxhbmNlSW50ZXJuYWwGBQtsZWFzZWRSYXRpbwUHYXNzZXRJZAUMcHJveHlBc3NldElkBQptaW5CYWxhbmNlCQERQGV4dHJOYXRpdmUoMTA2MikBBQxwcm94eUFkZHJlc3MFDHByb3h5UmF0ZU11bAUDbmlsCQEKdGhyb3dFcnJvcgEJAKwCAgkArAICAgFbBQdhc3NldElkAhFdIFJlYmFsYW5jZSBlcnJvcgB7PO6B", "height": 2512311, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6qjiGmkGnHy9XM3BQwo6xgVdGx6go2qGNUPJvCvpBFnS Next: GctJ3TsQsEVdWkAXm937qNffDjiqwhJPuXKd1N9vyGes Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "__"
55
6-let b = "rebalance"
6+let b = "rebalance.ride"
77
88 let c = "%s__factory"
99
1919 func h (e) = valueOrElse(getInteger(this, f(e)), 0)
2020
2121
22-func i (j) = {
23- let k = invoke(j, "getRate", nil, nil)
24- if ((k == k))
22+func i (j) = throw(((b + ": ") + j))
23+
24+
25+func k (l) = {
26+ let m = invoke(l, "getRate", nil, nil)
27+ if ((m == m))
2528 then {
26- let l = k
27- if ($isInstanceOf(l, "String"))
29+ let n = m
30+ if ($isInstanceOf(n, "String"))
2831 then {
29- let m = l
30- parseIntValue(m)
32+ let o = n
33+ parseIntValue(o)
3134 }
32- else throw("Rate is zero (0)")
35+ else i("getRate() returned zero")
3336 }
3437 else throw("Strict value is not equal to itself.")
3538 }
3639
3740
38-func n (e) = {
39- let o = addressFromStringValue(valueOrElse(getString(c), ""))
40- let p = toString(this)
41- invoke(o, "getPoolLeaseConfigREADONLY", [p, e], nil)
41+func p (e) = {
42+ let q = addressFromStringValue(valueOrElse(getString(c), ""))
43+ let r = toString(this)
44+ invoke(q, "getPoolLeaseConfigREADONLY", [r, e], nil)
4245 }
4346
4447
45-func q (e,r,s,j) = {
46- let t = g(e)
47- if ((t == t))
48+func s (e,t,u,l) = {
49+ let v = g(e)
50+ if ((v == v))
4851 then {
49- let u = h(s)
50- if ((u == u))
52+ let w = h(u)
53+ if ((w == w))
5154 then {
52- let v = if ((e == "WAVES"))
55+ let x = if ((e == "WAVES"))
5356 then unit
5457 else fromBase58String(e)
55- if ((r > 0))
58+ if ((t > 0))
5659 then {
57- let w = invoke(j, "deposit", nil, [AttachedPayment(v, r)])
58- if ((w == w))
60+ let y = invoke(l, "deposit", nil, [AttachedPayment(x, t)])
61+ if ((y == y))
5962 then {
60- let l = w
61- if ($isInstanceOf(l, "Int"))
63+ let n = y
64+ if ($isInstanceOf(n, "Int"))
6265 then {
63- let x = l
64- let y = (t + r)
65- let z = (u + x)
66-[IntegerEntry(d(e), y), IntegerEntry(f(s), z)]
66+ let z = n
67+ let A = (v + t)
68+ let B = (w + z)
69+[IntegerEntry(d(e), A), IntegerEntry(f(u), B)]
6770 }
6871 else nil
6972 }
7780 }
7881
7982
80-func A (e,r,s,j,B) = {
81- let t = g(e)
82- if ((t == t))
83+func C (e,t,u,l,D) = {
84+ let v = g(e)
85+ if ((v == v))
8386 then {
84- let u = h(s)
85- if ((u == u))
87+ let w = h(u)
88+ if ((w == w))
8689 then {
87- let C = i(j)
88- if ((C == C))
90+ let E = k(l)
91+ if ((E == E))
8992 then {
90- let D = fraction(B, r, C)
91- if ((D > 0))
93+ let F = fraction(D, t, E)
94+ if ((F > 0))
9295 then {
93- let E = invoke(j, "withdraw", nil, [AttachedPayment(fromBase58String(s), D)])
94- if ((E == E))
96+ let G = invoke(l, "withdraw", nil, [AttachedPayment(fromBase58String(u), F)])
97+ if ((G == G))
9598 then {
96- let l = E
97- if ($isInstanceOf(l, "Int"))
99+ let n = G
100+ if ($isInstanceOf(n, "Int"))
98101 then {
99- let F = l
100- let y = (t - F)
101- let z = (u - D)
102-[IntegerEntry(d(e), y), IntegerEntry(f(s), z)]
102+ let H = n
103+ let A = (v - H)
104+ let B = (w - F)
105+[IntegerEntry(d(e), A), IntegerEntry(f(u), B)]
103106 }
104107 else nil
105108 }
115118 }
116119
117120
118-func G (H,e,s,I,j,B) = {
119- let t = g(e)
120- if ((t == t))
121+func I (J,e,u,K,l,D) = {
122+ let v = g(e)
123+ if ((v == v))
121124 then {
122- let u = h(s)
123- if ((u == u))
125+ let w = h(u)
126+ if ((w == w))
124127 then {
125- let J = if ((e == "WAVES"))
128+ let L = if ((e == "WAVES"))
126129 then wavesBalance(this).available
127130 else assetBalance(this, fromBase58String(e))
128- if ((J == J))
131+ if ((L == L))
129132 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))
133+ let M = max([0, ((L + v) - K)])
134+ let N = fraction(J, M, 100)
135+ let O = (v - N)
136+ if ((O == 0))
134137 then nil
135- else if ((0 > M))
138+ else if ((0 > O))
136139 then {
137- let N = -(M)
138- q(e, N, s, j)
140+ let P = -(O)
141+ s(e, P, u, l)
139142 }
140143 else {
141- let O = M
142- A(e, O, s, j, B)
144+ let Q = O
145+ C(e, Q, u, l, D)
143146 }
144147 }
145148 else throw("Strict value is not equal to itself.")
150153 }
151154
152155
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)"))
156+@Callable(R)
157+func rebalanceAsset (e) = {
158+ let n = p(e)
159+ if ($isInstanceOf(n, "(Boolean, Int, Int, String, String, Int, String)"))
158160 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)
161+ let S = n
162+ let T = S
163+ let U = T._1
164+ let V = T._2
165+ let K = T._3
166+ let W = T._4
167+ let X = T._5
168+ let D = T._6
169+ let Y = T._7
170+ if (U)
171+ then I(V, e, X, K, addressFromStringValue(W), D)
170172 else nil
171173 }
172- else throw("BRR")
174+ else i((("[" + e) + "] Rebalance error"))
173175 }
174176
175177
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "__"
55
6-let b = "rebalance"
6+let b = "rebalance.ride"
77
88 let c = "%s__factory"
99
1010 func d (e) = makeString(["%s%s", "additionalBalance", e], a)
1111
1212
1313 func f (e) = makeString(["%s%s", "stakingAssetBalance", e], a)
1414
1515
1616 func g (e) = valueOrElse(getInteger(this, d(e)), 0)
1717
1818
1919 func h (e) = valueOrElse(getInteger(this, f(e)), 0)
2020
2121
22-func i (j) = {
23- let k = invoke(j, "getRate", nil, nil)
24- if ((k == k))
22+func i (j) = throw(((b + ": ") + j))
23+
24+
25+func k (l) = {
26+ let m = invoke(l, "getRate", nil, nil)
27+ if ((m == m))
2528 then {
26- let l = k
27- if ($isInstanceOf(l, "String"))
29+ let n = m
30+ if ($isInstanceOf(n, "String"))
2831 then {
29- let m = l
30- parseIntValue(m)
32+ let o = n
33+ parseIntValue(o)
3134 }
32- else throw("Rate is zero (0)")
35+ else i("getRate() returned zero")
3336 }
3437 else throw("Strict value is not equal to itself.")
3538 }
3639
3740
38-func n (e) = {
39- let o = addressFromStringValue(valueOrElse(getString(c), ""))
40- let p = toString(this)
41- invoke(o, "getPoolLeaseConfigREADONLY", [p, e], nil)
41+func p (e) = {
42+ let q = addressFromStringValue(valueOrElse(getString(c), ""))
43+ let r = toString(this)
44+ invoke(q, "getPoolLeaseConfigREADONLY", [r, e], nil)
4245 }
4346
4447
45-func q (e,r,s,j) = {
46- let t = g(e)
47- if ((t == t))
48+func s (e,t,u,l) = {
49+ let v = g(e)
50+ if ((v == v))
4851 then {
49- let u = h(s)
50- if ((u == u))
52+ let w = h(u)
53+ if ((w == w))
5154 then {
52- let v = if ((e == "WAVES"))
55+ let x = if ((e == "WAVES"))
5356 then unit
5457 else fromBase58String(e)
55- if ((r > 0))
58+ if ((t > 0))
5659 then {
57- let w = invoke(j, "deposit", nil, [AttachedPayment(v, r)])
58- if ((w == w))
60+ let y = invoke(l, "deposit", nil, [AttachedPayment(x, t)])
61+ if ((y == y))
5962 then {
60- let l = w
61- if ($isInstanceOf(l, "Int"))
63+ let n = y
64+ if ($isInstanceOf(n, "Int"))
6265 then {
63- let x = l
64- let y = (t + r)
65- let z = (u + x)
66-[IntegerEntry(d(e), y), IntegerEntry(f(s), z)]
66+ let z = n
67+ let A = (v + t)
68+ let B = (w + z)
69+[IntegerEntry(d(e), A), IntegerEntry(f(u), B)]
6770 }
6871 else nil
6972 }
7073 else throw("Strict value is not equal to itself.")
7174 }
7275 else nil
7376 }
7477 else throw("Strict value is not equal to itself.")
7578 }
7679 else throw("Strict value is not equal to itself.")
7780 }
7881
7982
80-func A (e,r,s,j,B) = {
81- let t = g(e)
82- if ((t == t))
83+func C (e,t,u,l,D) = {
84+ let v = g(e)
85+ if ((v == v))
8386 then {
84- let u = h(s)
85- if ((u == u))
87+ let w = h(u)
88+ if ((w == w))
8689 then {
87- let C = i(j)
88- if ((C == C))
90+ let E = k(l)
91+ if ((E == E))
8992 then {
90- let D = fraction(B, r, C)
91- if ((D > 0))
93+ let F = fraction(D, t, E)
94+ if ((F > 0))
9295 then {
93- let E = invoke(j, "withdraw", nil, [AttachedPayment(fromBase58String(s), D)])
94- if ((E == E))
96+ let G = invoke(l, "withdraw", nil, [AttachedPayment(fromBase58String(u), F)])
97+ if ((G == G))
9598 then {
96- let l = E
97- if ($isInstanceOf(l, "Int"))
99+ let n = G
100+ if ($isInstanceOf(n, "Int"))
98101 then {
99- let F = l
100- let y = (t - F)
101- let z = (u - D)
102-[IntegerEntry(d(e), y), IntegerEntry(f(s), z)]
102+ let H = n
103+ let A = (v - H)
104+ let B = (w - F)
105+[IntegerEntry(d(e), A), IntegerEntry(f(u), B)]
103106 }
104107 else nil
105108 }
106109 else throw("Strict value is not equal to itself.")
107110 }
108111 else nil
109112 }
110113 else throw("Strict value is not equal to itself.")
111114 }
112115 else throw("Strict value is not equal to itself.")
113116 }
114117 else throw("Strict value is not equal to itself.")
115118 }
116119
117120
118-func G (H,e,s,I,j,B) = {
119- let t = g(e)
120- if ((t == t))
121+func I (J,e,u,K,l,D) = {
122+ let v = g(e)
123+ if ((v == v))
121124 then {
122- let u = h(s)
123- if ((u == u))
125+ let w = h(u)
126+ if ((w == w))
124127 then {
125- let J = if ((e == "WAVES"))
128+ let L = if ((e == "WAVES"))
126129 then wavesBalance(this).available
127130 else assetBalance(this, fromBase58String(e))
128- if ((J == J))
131+ if ((L == L))
129132 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))
133+ let M = max([0, ((L + v) - K)])
134+ let N = fraction(J, M, 100)
135+ let O = (v - N)
136+ if ((O == 0))
134137 then nil
135- else if ((0 > M))
138+ else if ((0 > O))
136139 then {
137- let N = -(M)
138- q(e, N, s, j)
140+ let P = -(O)
141+ s(e, P, u, l)
139142 }
140143 else {
141- let O = M
142- A(e, O, s, j, B)
144+ let Q = O
145+ C(e, Q, u, l, D)
143146 }
144147 }
145148 else throw("Strict value is not equal to itself.")
146149 }
147150 else throw("Strict value is not equal to itself.")
148151 }
149152 else throw("Strict value is not equal to itself.")
150153 }
151154
152155
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)"))
156+@Callable(R)
157+func rebalanceAsset (e) = {
158+ let n = p(e)
159+ if ($isInstanceOf(n, "(Boolean, Int, Int, String, String, Int, String)"))
158160 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)
161+ let S = n
162+ let T = S
163+ let U = T._1
164+ let V = T._2
165+ let K = T._3
166+ let W = T._4
167+ let X = T._5
168+ let D = T._6
169+ let Y = T._7
170+ if (U)
171+ then I(V, e, X, K, addressFromStringValue(W), D)
170172 else nil
171173 }
172- else throw("BRR")
174+ else i((("[" + e) + "] Rebalance error"))
173175 }
174176
175177

github/deemru/w8io/026f985 
68.80 ms