tx · GuWtKs3nYMdz2tUqzSF3Xmi9nZzLLUmXVtpq8jcdRpEn
3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h: -0.05000000 Waves
2023.03.29 14:45 [2511188] smart account 3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h > SELF 0.00000000 Waves
{
"type": 13,
"id": "GuWtKs3nYMdz2tUqzSF3Xmi9nZzLLUmXVtpq8jcdRpEn",
"fee": 5000000,
"feeAssetId": null,
"timestamp": 1680090396813,
"version": 2,
"chainId": 84,
"sender": "3NCWFHDzdPHZC6636ZkMLNDup9mjpbTLs7h",
"senderPublicKey": "3z8Q6Zu3KppVmn6fJJvrLc1Wo3krVHSvfaNcerm82md2",
"proofs": [
"5Jxs8ZaNV1bQLe1AT1emJc6UKoacfQrVYqLRr58W5TGXF2e6oL84kMdaGjNFjofvnhJ5fK6u9VBH9kTdYwa3Cqs3"
],
"script": "base64:BgIJCAISAwoBARIAFAAMY29udHJhY3RGaWxlAglyZWJhbGFuY2UAD2tleXNUYXJnZXRSYXRpbwIPJXNfX3RhcmdldFJhdGlvABRrZXlBZGRpdGlvbmFsQmFsYW5jZQIaJXNfX2FkZGl0aW9uYWxXYXZlc0JhbGFuY2UAGmtleVNXYXZlc0FkZGl0aW9uYWxCYWxhbmNlAhElc19fc1dhdmVzQmFsYW5jZQAQa2V5U1dhdmVzQXNzZXRJZAIRJXNfX3NXYXZlc0Fzc2V0SWQAD2tleVByb3h5QWRkcmVzcwIQJXNfX3Byb3h5QWRkcmVzcwANa2V5TWluQmFsYW5jZQITJXNfX21pbldhdmVzQmFsYW5jZQARa2V5RmFjdG9yeUFkZHJlc3MCCyVzX19mYWN0b3J5AAZNVUxUMTIAgKCUpY0dARBnZXRJbnRlZ2VyT3JaZXJvAQppbnRlZ2VyS2V5BAckbWF0Y2gwCQCaCAIFBHRoaXMFCmludGVnZXJLZXkDCQABAgUHJG1hdGNoMAIDSW50BAN2YWwFByRtYXRjaDAFA3ZhbAAAARBnZXR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3aG9sZUJhbGFuY2UJAJYDAQkAzAgCAAAJAMwIAgkAZQIJAGQCBRBhdmFpbGFibGVCYWxhbmNlBRFhZGRpdGlvbmFsQmFsYW5jZQkBDWdldE1pbkJhbGFuY2UABQNuaWwEF3RhcmdldEFkZGl0aW9uYWxCYWxhbmNlCQBrAwULdGFyZ2V0UmF0aW8FDHdob2xlQmFsYW5jZQBkBARkaWZmCQBlAgURYWRkaXRpb25hbEJhbGFuY2UFF3RhcmdldEFkZGl0aW9uYWxCYWxhbmNlAwkAAAIFBGRpZmYAAAUDbmlsAwkAZgIAAAUEZGlmZgQPc2VuZFdhdmVzQW1vdW50CQEBLQEFBGRpZmYJAQdkZXBvc2l0AQUPc2VuZFdhdmVzQW1vdW50BA5nZXRXYXZlc0Ftb3VudAUEZGlmZgkBCHdpdGhkcmF3AQUOZ2V0V2F2ZXNBbW91bnQJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4CAWkBDnJlYmFsYW5jZVJhdGlvAQt0YXJnZXRSYXRpbwkBEXJlYmFsYW5jZUludGVybmFsAQULdGFyZ2V0UmF0aW8BaQEJcmViYWxhbmNlAAkBEXJlYmFsYW5jZUludGVybmFsAQkBDmdldFRhcmdldFJhdGlvAABOjxUe",
"height": 2511188,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 9B5o6xrQxZesRAhzUguYrZiAsQDiEBE8rwd8j9ahfLaN
Next: AMUwG36YQv66tpSkTNkVUyUeaCsDCK5rdczmaWj9tJvc
Diff:
Old | New | | Differences |
---|
15 | 15 | | |
---|
16 | 16 | | let g = "%s__minWavesBalance" |
---|
17 | 17 | | |
---|
18 | | - | let h = 1000000000000 |
---|
| 18 | + | let h = "%s__factory" |
---|
19 | 19 | | |
---|
20 | | - | func i (j) = { |
---|
21 | | - | let k = getInteger(this, j) |
---|
22 | | - | if ($isInstanceOf(k, "Int")) |
---|
| 20 | + | let i = 1000000000000 |
---|
| 21 | + | |
---|
| 22 | + | func j (k) = { |
---|
| 23 | + | let l = getInteger(this, k) |
---|
| 24 | + | if ($isInstanceOf(l, "Int")) |
---|
23 | 25 | | then { |
---|
24 | | - | let l = k |
---|
25 | | - | l |
---|
| 26 | + | let m = l |
---|
| 27 | + | m |
---|
26 | 28 | | } |
---|
27 | 29 | | else 0 |
---|
28 | 30 | | } |
---|
29 | 31 | | |
---|
30 | 32 | | |
---|
31 | | - | func m (n) = { |
---|
32 | | - | let k = getString(this, n) |
---|
33 | | - | if ($isInstanceOf(k, "String")) |
---|
| 33 | + | func n (o) = { |
---|
| 34 | + | let l = getString(this, o) |
---|
| 35 | + | if ($isInstanceOf(l, "String")) |
---|
34 | 36 | | then { |
---|
35 | | - | let o = k |
---|
36 | | - | o |
---|
| 37 | + | let p = l |
---|
| 38 | + | p |
---|
37 | 39 | | } |
---|
38 | | - | else throw((("[" + n) + "] is empty")) |
---|
| 40 | + | else throw((("[" + o) + "] is empty")) |
---|
39 | 41 | | } |
---|
40 | 42 | | |
---|
41 | 43 | | |
---|
42 | | - | func p () = { |
---|
43 | | - | let k = getInteger(b) |
---|
44 | | - | if ($isInstanceOf(k, "Int")) |
---|
| 44 | + | func q () = { |
---|
| 45 | + | let l = getInteger(b) |
---|
| 46 | + | if ($isInstanceOf(l, "Int")) |
---|
45 | 47 | | then { |
---|
46 | | - | let q = k |
---|
47 | | - | min([100, max([0, q])]) |
---|
| 48 | + | let r = l |
---|
| 49 | + | min([100, max([0, r])]) |
---|
48 | 50 | | } |
---|
49 | 51 | | else 0 |
---|
50 | 52 | | } |
---|
51 | 53 | | |
---|
52 | 54 | | |
---|
53 | | - | func r () = { |
---|
54 | | - | let k = getInteger(g) |
---|
55 | | - | if ($isInstanceOf(k, "Int")) |
---|
| 55 | + | func s () = { |
---|
| 56 | + | let l = getInteger(g) |
---|
| 57 | + | if ($isInstanceOf(l, "Int")) |
---|
56 | 58 | | then { |
---|
57 | | - | let s = k |
---|
58 | | - | max([0, s]) |
---|
| 59 | + | let t = l |
---|
| 60 | + | max([0, t]) |
---|
59 | 61 | | } |
---|
60 | 62 | | else 0 |
---|
61 | 63 | | } |
---|
62 | 64 | | |
---|
63 | 65 | | |
---|
64 | | - | func t () = { |
---|
65 | | - | let u = addressFromStringValue(m(f)) |
---|
66 | | - | let v = invoke(u, "getRate", nil, nil) |
---|
67 | | - | if ((v == v)) |
---|
| 66 | + | func u () = { |
---|
| 67 | + | let v = addressFromStringValue(n(f)) |
---|
| 68 | + | let w = invoke(v, "getRate", nil, nil) |
---|
| 69 | + | if ((w == w)) |
---|
68 | 70 | | then { |
---|
69 | | - | let k = v |
---|
70 | | - | if ($isInstanceOf(k, "String")) |
---|
| 71 | + | let l = w |
---|
| 72 | + | if ($isInstanceOf(l, "String")) |
---|
71 | 73 | | then { |
---|
72 | | - | let o = k |
---|
73 | | - | parseIntValue(o) |
---|
| 74 | + | let p = l |
---|
| 75 | + | parseIntValue(p) |
---|
74 | 76 | | } |
---|
75 | 77 | | else throw("Rate is zero (0)") |
---|
76 | 78 | | } |
---|
|
78 | 80 | | } |
---|
79 | 81 | | |
---|
80 | 82 | | |
---|
81 | | - | func w () = addressFromStringValue(m(f)) |
---|
| 83 | + | func x () = addressFromStringValue(n(f)) |
---|
82 | 84 | | |
---|
83 | 85 | | |
---|
84 | | - | func x () = fromBase58String(m(e)) |
---|
| 86 | + | func y () = fromBase58String(n(e)) |
---|
85 | 87 | | |
---|
86 | 88 | | |
---|
87 | | - | func y (z) = { |
---|
88 | | - | let u = w() |
---|
89 | | - | let A = i(c) |
---|
90 | | - | if ((A == A)) |
---|
| 89 | + | func z () = { |
---|
| 90 | + | let A = addressFromStringValue(valueOrElse(getString(h), "")) |
---|
| 91 | + | let B = toString(this) |
---|
| 92 | + | $Tuple2(invoke(A, "", [B, "WAVES"], nil), B) |
---|
| 93 | + | } |
---|
| 94 | + | |
---|
| 95 | + | |
---|
| 96 | + | func C (D) = { |
---|
| 97 | + | let v = x() |
---|
| 98 | + | let E = j(c) |
---|
| 99 | + | if ((E == E)) |
---|
91 | 100 | | then { |
---|
92 | | - | let B = i(d) |
---|
93 | | - | if ((B == B)) |
---|
94 | | - | then if ((z > 0)) |
---|
| 101 | + | let F = j(d) |
---|
| 102 | + | if ((F == F)) |
---|
| 103 | + | then if ((D > 0)) |
---|
95 | 104 | | then { |
---|
96 | | - | let C = invoke(u, "deposit", nil, [AttachedPayment(unit, z)]) |
---|
97 | | - | if ((C == C)) |
---|
| 105 | + | let G = invoke(v, "deposit", nil, [AttachedPayment(unit, D)]) |
---|
| 106 | + | if ((G == G)) |
---|
98 | 107 | | then { |
---|
99 | | - | let k = C |
---|
100 | | - | if ($isInstanceOf(k, "Int")) |
---|
| 108 | + | let l = G |
---|
| 109 | + | if ($isInstanceOf(l, "Int")) |
---|
101 | 110 | | then { |
---|
102 | | - | let D = k |
---|
103 | | - | let E = (A + z) |
---|
104 | | - | let F = (B + D) |
---|
105 | | - | [IntegerEntry(c, E), IntegerEntry(d, F)] |
---|
| 111 | + | let H = l |
---|
| 112 | + | let I = (E + D) |
---|
| 113 | + | let J = (F + H) |
---|
| 114 | + | [IntegerEntry(c, I), IntegerEntry(d, J)] |
---|
106 | 115 | | } |
---|
107 | 116 | | else nil |
---|
108 | 117 | | } |
---|
|
115 | 124 | | } |
---|
116 | 125 | | |
---|
117 | 126 | | |
---|
118 | | - | func G (z) = { |
---|
119 | | - | let u = w() |
---|
120 | | - | let A = i(c) |
---|
121 | | - | if ((A == A)) |
---|
| 127 | + | func K (D) = { |
---|
| 128 | + | let v = x() |
---|
| 129 | + | let E = j(c) |
---|
| 130 | + | if ((E == E)) |
---|
122 | 131 | | then { |
---|
123 | | - | let B = i(d) |
---|
124 | | - | if ((B == B)) |
---|
| 132 | + | let F = j(d) |
---|
| 133 | + | if ((F == F)) |
---|
125 | 134 | | then { |
---|
126 | | - | let H = t() |
---|
127 | | - | if ((H == H)) |
---|
| 135 | + | let L = u() |
---|
| 136 | + | if ((L == L)) |
---|
128 | 137 | | then { |
---|
129 | | - | let I = fraction(h, z, H) |
---|
130 | | - | if ((I > 0)) |
---|
| 138 | + | let M = fraction(i, D, L) |
---|
| 139 | + | if ((M > 0)) |
---|
131 | 140 | | then { |
---|
132 | | - | let J = invoke(u, "withdraw", nil, [AttachedPayment(x(), I)]) |
---|
133 | | - | if ((J == J)) |
---|
| 141 | + | let N = invoke(v, "withdraw", nil, [AttachedPayment(y(), M)]) |
---|
| 142 | + | if ((N == N)) |
---|
134 | 143 | | then { |
---|
135 | | - | let k = J |
---|
136 | | - | if ($isInstanceOf(k, "Int")) |
---|
| 144 | + | let l = N |
---|
| 145 | + | if ($isInstanceOf(l, "Int")) |
---|
137 | 146 | | then { |
---|
138 | | - | let K = k |
---|
139 | | - | let E = (A - K) |
---|
140 | | - | let F = (B - I) |
---|
141 | | - | [IntegerEntry(c, E), IntegerEntry(d, F)] |
---|
| 147 | + | let O = l |
---|
| 148 | + | let I = (E - O) |
---|
| 149 | + | let J = (F - M) |
---|
| 150 | + | [IntegerEntry(c, I), IntegerEntry(d, J)] |
---|
142 | 151 | | } |
---|
143 | 152 | | else nil |
---|
144 | 153 | | } |
---|
|
154 | 163 | | } |
---|
155 | 164 | | |
---|
156 | 165 | | |
---|
157 | | - | func L (M) = { |
---|
158 | | - | let N = wavesBalance(this).regular |
---|
159 | | - | if ((N == N)) |
---|
| 166 | + | func P (Q) = { |
---|
| 167 | + | let R = wavesBalance(this).available |
---|
| 168 | + | if ((R == R)) |
---|
160 | 169 | | then { |
---|
161 | | - | let O = i(c) |
---|
162 | | - | if ((O == O)) |
---|
| 170 | + | let S = j(c) |
---|
| 171 | + | if ((S == S)) |
---|
163 | 172 | | then { |
---|
164 | | - | let P = max([0, ((N + O) - r())]) |
---|
165 | | - | let Q = fraction(M, P, 100) |
---|
166 | | - | let R = (O - Q) |
---|
167 | | - | if ((R == 0)) |
---|
| 173 | + | let T = max([0, ((R + S) - s())]) |
---|
| 174 | + | let U = fraction(Q, T, 100) |
---|
| 175 | + | let V = (S - U) |
---|
| 176 | + | if ((V == 0)) |
---|
168 | 177 | | then nil |
---|
169 | | - | else if ((0 > R)) |
---|
| 178 | + | else if ((0 > V)) |
---|
170 | 179 | | then { |
---|
171 | | - | let S = -(R) |
---|
172 | | - | y(S) |
---|
| 180 | + | let W = -(V) |
---|
| 181 | + | C(W) |
---|
173 | 182 | | } |
---|
174 | 183 | | else { |
---|
175 | | - | let T = R |
---|
176 | | - | G(T) |
---|
| 184 | + | let X = V |
---|
| 185 | + | K(X) |
---|
177 | 186 | | } |
---|
178 | 187 | | } |
---|
179 | 188 | | else throw("Strict value is not equal to itself.") |
---|
|
182 | 191 | | } |
---|
183 | 192 | | |
---|
184 | 193 | | |
---|
185 | | - | @Callable(s) |
---|
186 | | - | func rebalanceRatio (M) = L(M) |
---|
| 194 | + | @Callable(t) |
---|
| 195 | + | func rebalanceRatio (Q) = P(Q) |
---|
187 | 196 | | |
---|
188 | 197 | | |
---|
189 | 198 | | |
---|
190 | | - | @Callable(s) |
---|
191 | | - | func rebalance () = L(p()) |
---|
| 199 | + | @Callable(t) |
---|
| 200 | + | func rebalance () = P(q()) |
---|
192 | 201 | | |
---|
193 | 202 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 6 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let a = "rebalance" |
---|
5 | 5 | | |
---|
6 | 6 | | let b = "%s__targetRatio" |
---|
7 | 7 | | |
---|
8 | 8 | | let c = "%s__additionalWavesBalance" |
---|
9 | 9 | | |
---|
10 | 10 | | let d = "%s__sWavesBalance" |
---|
11 | 11 | | |
---|
12 | 12 | | let e = "%s__sWavesAssetId" |
---|
13 | 13 | | |
---|
14 | 14 | | let f = "%s__proxyAddress" |
---|
15 | 15 | | |
---|
16 | 16 | | let g = "%s__minWavesBalance" |
---|
17 | 17 | | |
---|
18 | | - | let h = 1000000000000 |
---|
| 18 | + | let h = "%s__factory" |
---|
19 | 19 | | |
---|
20 | | - | func i (j) = { |
---|
21 | | - | let k = getInteger(this, j) |
---|
22 | | - | if ($isInstanceOf(k, "Int")) |
---|
| 20 | + | let i = 1000000000000 |
---|
| 21 | + | |
---|
| 22 | + | func j (k) = { |
---|
| 23 | + | let l = getInteger(this, k) |
---|
| 24 | + | if ($isInstanceOf(l, "Int")) |
---|
23 | 25 | | then { |
---|
24 | | - | let l = k |
---|
25 | | - | l |
---|
| 26 | + | let m = l |
---|
| 27 | + | m |
---|
26 | 28 | | } |
---|
27 | 29 | | else 0 |
---|
28 | 30 | | } |
---|
29 | 31 | | |
---|
30 | 32 | | |
---|
31 | | - | func m (n) = { |
---|
32 | | - | let k = getString(this, n) |
---|
33 | | - | if ($isInstanceOf(k, "String")) |
---|
| 33 | + | func n (o) = { |
---|
| 34 | + | let l = getString(this, o) |
---|
| 35 | + | if ($isInstanceOf(l, "String")) |
---|
34 | 36 | | then { |
---|
35 | | - | let o = k |
---|
36 | | - | o |
---|
| 37 | + | let p = l |
---|
| 38 | + | p |
---|
37 | 39 | | } |
---|
38 | | - | else throw((("[" + n) + "] is empty")) |
---|
| 40 | + | else throw((("[" + o) + "] is empty")) |
---|
39 | 41 | | } |
---|
40 | 42 | | |
---|
41 | 43 | | |
---|
42 | | - | func p () = { |
---|
43 | | - | let k = getInteger(b) |
---|
44 | | - | if ($isInstanceOf(k, "Int")) |
---|
| 44 | + | func q () = { |
---|
| 45 | + | let l = getInteger(b) |
---|
| 46 | + | if ($isInstanceOf(l, "Int")) |
---|
45 | 47 | | then { |
---|
46 | | - | let q = k |
---|
47 | | - | min([100, max([0, q])]) |
---|
| 48 | + | let r = l |
---|
| 49 | + | min([100, max([0, r])]) |
---|
48 | 50 | | } |
---|
49 | 51 | | else 0 |
---|
50 | 52 | | } |
---|
51 | 53 | | |
---|
52 | 54 | | |
---|
53 | | - | func r () = { |
---|
54 | | - | let k = getInteger(g) |
---|
55 | | - | if ($isInstanceOf(k, "Int")) |
---|
| 55 | + | func s () = { |
---|
| 56 | + | let l = getInteger(g) |
---|
| 57 | + | if ($isInstanceOf(l, "Int")) |
---|
56 | 58 | | then { |
---|
57 | | - | let s = k |
---|
58 | | - | max([0, s]) |
---|
| 59 | + | let t = l |
---|
| 60 | + | max([0, t]) |
---|
59 | 61 | | } |
---|
60 | 62 | | else 0 |
---|
61 | 63 | | } |
---|
62 | 64 | | |
---|
63 | 65 | | |
---|
64 | | - | func t () = { |
---|
65 | | - | let u = addressFromStringValue(m(f)) |
---|
66 | | - | let v = invoke(u, "getRate", nil, nil) |
---|
67 | | - | if ((v == v)) |
---|
| 66 | + | func u () = { |
---|
| 67 | + | let v = addressFromStringValue(n(f)) |
---|
| 68 | + | let w = invoke(v, "getRate", nil, nil) |
---|
| 69 | + | if ((w == w)) |
---|
68 | 70 | | then { |
---|
69 | | - | let k = v |
---|
70 | | - | if ($isInstanceOf(k, "String")) |
---|
| 71 | + | let l = w |
---|
| 72 | + | if ($isInstanceOf(l, "String")) |
---|
71 | 73 | | then { |
---|
72 | | - | let o = k |
---|
73 | | - | parseIntValue(o) |
---|
| 74 | + | let p = l |
---|
| 75 | + | parseIntValue(p) |
---|
74 | 76 | | } |
---|
75 | 77 | | else throw("Rate is zero (0)") |
---|
76 | 78 | | } |
---|
77 | 79 | | else throw("Strict value is not equal to itself.") |
---|
78 | 80 | | } |
---|
79 | 81 | | |
---|
80 | 82 | | |
---|
81 | | - | func w () = addressFromStringValue(m(f)) |
---|
| 83 | + | func x () = addressFromStringValue(n(f)) |
---|
82 | 84 | | |
---|
83 | 85 | | |
---|
84 | | - | func x () = fromBase58String(m(e)) |
---|
| 86 | + | func y () = fromBase58String(n(e)) |
---|
85 | 87 | | |
---|
86 | 88 | | |
---|
87 | | - | func y (z) = { |
---|
88 | | - | let u = w() |
---|
89 | | - | let A = i(c) |
---|
90 | | - | if ((A == A)) |
---|
| 89 | + | func z () = { |
---|
| 90 | + | let A = addressFromStringValue(valueOrElse(getString(h), "")) |
---|
| 91 | + | let B = toString(this) |
---|
| 92 | + | $Tuple2(invoke(A, "", [B, "WAVES"], nil), B) |
---|
| 93 | + | } |
---|
| 94 | + | |
---|
| 95 | + | |
---|
| 96 | + | func C (D) = { |
---|
| 97 | + | let v = x() |
---|
| 98 | + | let E = j(c) |
---|
| 99 | + | if ((E == E)) |
---|
91 | 100 | | then { |
---|
92 | | - | let B = i(d) |
---|
93 | | - | if ((B == B)) |
---|
94 | | - | then if ((z > 0)) |
---|
| 101 | + | let F = j(d) |
---|
| 102 | + | if ((F == F)) |
---|
| 103 | + | then if ((D > 0)) |
---|
95 | 104 | | then { |
---|
96 | | - | let C = invoke(u, "deposit", nil, [AttachedPayment(unit, z)]) |
---|
97 | | - | if ((C == C)) |
---|
| 105 | + | let G = invoke(v, "deposit", nil, [AttachedPayment(unit, D)]) |
---|
| 106 | + | if ((G == G)) |
---|
98 | 107 | | then { |
---|
99 | | - | let k = C |
---|
100 | | - | if ($isInstanceOf(k, "Int")) |
---|
| 108 | + | let l = G |
---|
| 109 | + | if ($isInstanceOf(l, "Int")) |
---|
101 | 110 | | then { |
---|
102 | | - | let D = k |
---|
103 | | - | let E = (A + z) |
---|
104 | | - | let F = (B + D) |
---|
105 | | - | [IntegerEntry(c, E), IntegerEntry(d, F)] |
---|
| 111 | + | let H = l |
---|
| 112 | + | let I = (E + D) |
---|
| 113 | + | let J = (F + H) |
---|
| 114 | + | [IntegerEntry(c, I), IntegerEntry(d, J)] |
---|
106 | 115 | | } |
---|
107 | 116 | | else nil |
---|
108 | 117 | | } |
---|
109 | 118 | | else throw("Strict value is not equal to itself.") |
---|
110 | 119 | | } |
---|
111 | 120 | | else nil |
---|
112 | 121 | | else throw("Strict value is not equal to itself.") |
---|
113 | 122 | | } |
---|
114 | 123 | | else throw("Strict value is not equal to itself.") |
---|
115 | 124 | | } |
---|
116 | 125 | | |
---|
117 | 126 | | |
---|
118 | | - | func G (z) = { |
---|
119 | | - | let u = w() |
---|
120 | | - | let A = i(c) |
---|
121 | | - | if ((A == A)) |
---|
| 127 | + | func K (D) = { |
---|
| 128 | + | let v = x() |
---|
| 129 | + | let E = j(c) |
---|
| 130 | + | if ((E == E)) |
---|
122 | 131 | | then { |
---|
123 | | - | let B = i(d) |
---|
124 | | - | if ((B == B)) |
---|
| 132 | + | let F = j(d) |
---|
| 133 | + | if ((F == F)) |
---|
125 | 134 | | then { |
---|
126 | | - | let H = t() |
---|
127 | | - | if ((H == H)) |
---|
| 135 | + | let L = u() |
---|
| 136 | + | if ((L == L)) |
---|
128 | 137 | | then { |
---|
129 | | - | let I = fraction(h, z, H) |
---|
130 | | - | if ((I > 0)) |
---|
| 138 | + | let M = fraction(i, D, L) |
---|
| 139 | + | if ((M > 0)) |
---|
131 | 140 | | then { |
---|
132 | | - | let J = invoke(u, "withdraw", nil, [AttachedPayment(x(), I)]) |
---|
133 | | - | if ((J == J)) |
---|
| 141 | + | let N = invoke(v, "withdraw", nil, [AttachedPayment(y(), M)]) |
---|
| 142 | + | if ((N == N)) |
---|
134 | 143 | | then { |
---|
135 | | - | let k = J |
---|
136 | | - | if ($isInstanceOf(k, "Int")) |
---|
| 144 | + | let l = N |
---|
| 145 | + | if ($isInstanceOf(l, "Int")) |
---|
137 | 146 | | then { |
---|
138 | | - | let K = k |
---|
139 | | - | let E = (A - K) |
---|
140 | | - | let F = (B - I) |
---|
141 | | - | [IntegerEntry(c, E), IntegerEntry(d, F)] |
---|
| 147 | + | let O = l |
---|
| 148 | + | let I = (E - O) |
---|
| 149 | + | let J = (F - M) |
---|
| 150 | + | [IntegerEntry(c, I), IntegerEntry(d, J)] |
---|
142 | 151 | | } |
---|
143 | 152 | | else nil |
---|
144 | 153 | | } |
---|
145 | 154 | | else throw("Strict value is not equal to itself.") |
---|
146 | 155 | | } |
---|
147 | 156 | | else nil |
---|
148 | 157 | | } |
---|
149 | 158 | | else throw("Strict value is not equal to itself.") |
---|
150 | 159 | | } |
---|
151 | 160 | | else throw("Strict value is not equal to itself.") |
---|
152 | 161 | | } |
---|
153 | 162 | | else throw("Strict value is not equal to itself.") |
---|
154 | 163 | | } |
---|
155 | 164 | | |
---|
156 | 165 | | |
---|
157 | | - | func L (M) = { |
---|
158 | | - | let N = wavesBalance(this).regular |
---|
159 | | - | if ((N == N)) |
---|
| 166 | + | func P (Q) = { |
---|
| 167 | + | let R = wavesBalance(this).available |
---|
| 168 | + | if ((R == R)) |
---|
160 | 169 | | then { |
---|
161 | | - | let O = i(c) |
---|
162 | | - | if ((O == O)) |
---|
| 170 | + | let S = j(c) |
---|
| 171 | + | if ((S == S)) |
---|
163 | 172 | | then { |
---|
164 | | - | let P = max([0, ((N + O) - r())]) |
---|
165 | | - | let Q = fraction(M, P, 100) |
---|
166 | | - | let R = (O - Q) |
---|
167 | | - | if ((R == 0)) |
---|
| 173 | + | let T = max([0, ((R + S) - s())]) |
---|
| 174 | + | let U = fraction(Q, T, 100) |
---|
| 175 | + | let V = (S - U) |
---|
| 176 | + | if ((V == 0)) |
---|
168 | 177 | | then nil |
---|
169 | | - | else if ((0 > R)) |
---|
| 178 | + | else if ((0 > V)) |
---|
170 | 179 | | then { |
---|
171 | | - | let S = -(R) |
---|
172 | | - | y(S) |
---|
| 180 | + | let W = -(V) |
---|
| 181 | + | C(W) |
---|
173 | 182 | | } |
---|
174 | 183 | | else { |
---|
175 | | - | let T = R |
---|
176 | | - | G(T) |
---|
| 184 | + | let X = V |
---|
| 185 | + | K(X) |
---|
177 | 186 | | } |
---|
178 | 187 | | } |
---|
179 | 188 | | else throw("Strict value is not equal to itself.") |
---|
180 | 189 | | } |
---|
181 | 190 | | else throw("Strict value is not equal to itself.") |
---|
182 | 191 | | } |
---|
183 | 192 | | |
---|
184 | 193 | | |
---|
185 | | - | @Callable(s) |
---|
186 | | - | func rebalanceRatio (M) = L(M) |
---|
| 194 | + | @Callable(t) |
---|
| 195 | + | func rebalanceRatio (Q) = P(Q) |
---|
187 | 196 | | |
---|
188 | 197 | | |
---|
189 | 198 | | |
---|
190 | | - | @Callable(s) |
---|
191 | | - | func rebalance () = L(p()) |
---|
| 199 | + | @Callable(t) |
---|
| 200 | + | func rebalance () = P(q()) |
---|
192 | 201 | | |
---|
193 | 202 | | |
---|