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:BgIRCAISABIAEgASBQoDAQEBEgAOAAxjb250cmFjdEZpbGUCCXJlYmFsYW5jZQAPa2V5c1RhcmdldFJhdGlvAg8lc19fdGFyZ2V0UmF0aW8AFGtleUFkZGl0aW9uYWxCYWxhbmNlAholc19fYWRkaXRpb25hbFdhdmVzQmFsYW5jZQAaa2V5U1dhdmVzQWRkaXRpb25hbEJhbGFuY2UCESVzX19zV2F2ZXNCYWxhbmNlABBrZXlTV2F2ZXNBc3NldElkAhElc19fc1dhdmVzQXNzZXRJZAAPa2V5UHJveHlBZGRyZXNzAhAlc19fcHJveHlBZGRyZXNzARBnZXRJbnRlZ2VyT3JaZXJvAQppbnRlZ2VyS2V5BAckbWF0Y2gwCQCaCAIFBHRoaXMFCmludGVnZXJLZXkDCQABAgUHJG1hdGNoMAIDSW50BAN2YWwFByRtYXRjaDAFA3ZhbAAAARBnZXRTdHJpbmdPclRocm93AQlzdHJpbmdLZXkEByRtYXRjaDAJAJ0IAgUEdGhpcwUJc3RyaW5nS2V5AwkAAQIFByRtYXRjaDACBlN0cmluZwQBcwUHJG1hdGNoMAUBcwkA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pdGlvbmFsQmFsYW5jZQkAawMFC3RhcmdldFJhdGlvBQ13aG9sZUJsYWxhbmNlAGQEBmNoYW5nZQkAZQIFEWFkZGl0aW9uYWxCYWxhbmNlBRd0YXJnZXRBZGRpdGlvbmFsQmFsYW5jZQQGbmV3UmVnCQBkAgUOcmVndWxhckJhbGFuY2UFBmNoYW5nZQMJAAACBQZjaGFuZ2UAAAUDbmlsAwkAZgIAAAUGY2hhbmdlBA9zZW5kV2F2ZXNBbW91bnQJAGgCBQZjaGFuZ2UA////////////AQkBB2RlcG9zaXQBBQ9zZW5kV2F2ZXNBbW91bnQEDmdldFdhdmVzQW1vdW50BQZjaGFuZ2UJAQh3aXRoZHJhdwEFDmdldFdhdmVzQW1vdW50CQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAJuTpWE=", "height": 2509479, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ZYfmLsTeAxZk97CX7PPMQG7g1478dGJrXATh9cfAWYD Next: 44fuU8CAFGwn9pdreeYxTFyZjNNnccaCtuD5AzgdAjR2 Diff:
Old | New | Differences | |
---|---|---|---|
198 | 198 | let P = fraction(N, T, 100) | |
199 | 199 | let Q = (q - P) | |
200 | 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 | - | } | |
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 | + | } | |
210 | 212 | } | |
211 | 213 | else throw("Strict value is not equal to itself.") | |
212 | 214 | } |
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 | func g (h) = { | |
17 | 17 | let i = getInteger(this, h) | |
18 | 18 | if ($isInstanceOf(i, "Int")) | |
19 | 19 | then { | |
20 | 20 | let j = i | |
21 | 21 | j | |
22 | 22 | } | |
23 | 23 | else 0 | |
24 | 24 | } | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func k (l) = { | |
28 | 28 | let i = getString(this, l) | |
29 | 29 | if ($isInstanceOf(i, "String")) | |
30 | 30 | then { | |
31 | 31 | let m = i | |
32 | 32 | m | |
33 | 33 | } | |
34 | 34 | else throw((("[" + l) + "] is empty")) | |
35 | 35 | } | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func n () = { | |
39 | 39 | let i = getInteger(b) | |
40 | 40 | if ($isInstanceOf(i, "Int")) | |
41 | 41 | then { | |
42 | 42 | let m = i | |
43 | 43 | m | |
44 | 44 | } | |
45 | 45 | else 80 | |
46 | 46 | } | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func o () = (wavesBalance(this).regular + g(c)) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func p () = { | |
53 | 53 | let q = g(c) | |
54 | 54 | let r = g(d) | |
55 | 55 | if ((q == 0)) | |
56 | 56 | then 0 | |
57 | 57 | else fraction(100000000000, q, r) | |
58 | 58 | } | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func s () = { | |
62 | 62 | let t = addressFromStringValue(k(f)) | |
63 | 63 | let u = invoke(t, "getRate", nil, nil) | |
64 | 64 | if ((u == u)) | |
65 | 65 | then { | |
66 | 66 | let i = u | |
67 | 67 | if ($isInstanceOf(i, "String")) | |
68 | 68 | then { | |
69 | 69 | let m = i | |
70 | 70 | parseIntValue(m) | |
71 | 71 | } | |
72 | 72 | else throw("ZERO rate") | |
73 | 73 | } | |
74 | 74 | else throw("Strict value is not equal to itself.") | |
75 | 75 | } | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func v (w) = { | |
79 | 79 | let t = addressFromStringValue(k(f)) | |
80 | 80 | let x = g(c) | |
81 | 81 | if ((x == x)) | |
82 | 82 | then { | |
83 | 83 | let y = g(d) | |
84 | 84 | if ((y == y)) | |
85 | 85 | then { | |
86 | 86 | let z = invoke(t, "deposit", nil, [AttachedPayment(unit, w)]) | |
87 | 87 | if ((z == z)) | |
88 | 88 | then { | |
89 | 89 | let i = z | |
90 | 90 | if ($isInstanceOf(i, "Int")) | |
91 | 91 | then { | |
92 | 92 | let A = i | |
93 | 93 | let B = (x + w) | |
94 | 94 | let C = (y + A) | |
95 | 95 | [IntegerEntry(c, B), IntegerEntry(d, C)] | |
96 | 96 | } | |
97 | 97 | else nil | |
98 | 98 | } | |
99 | 99 | else throw("Strict value is not equal to itself.") | |
100 | 100 | } | |
101 | 101 | else throw("Strict value is not equal to itself.") | |
102 | 102 | } | |
103 | 103 | else throw("Strict value is not equal to itself.") | |
104 | 104 | } | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func D (w) = { | |
108 | 108 | let t = addressFromStringValue(k(f)) | |
109 | 109 | let E = fromBase58String(k(e)) | |
110 | 110 | if ((E == E)) | |
111 | 111 | then { | |
112 | 112 | let x = g(c) | |
113 | 113 | if ((x == x)) | |
114 | 114 | then { | |
115 | 115 | let y = g(d) | |
116 | 116 | if ((y == y)) | |
117 | 117 | then { | |
118 | 118 | let F = s() | |
119 | 119 | if ((F == F)) | |
120 | 120 | then { | |
121 | 121 | let G = fraction(1000000000000, w, F) | |
122 | 122 | let z = invoke(t, "withdraw", nil, [AttachedPayment(E, G)]) | |
123 | 123 | if ((z == z)) | |
124 | 124 | then { | |
125 | 125 | let i = z | |
126 | 126 | if ($isInstanceOf(i, "Int")) | |
127 | 127 | then { | |
128 | 128 | let H = i | |
129 | 129 | let B = (x - H) | |
130 | 130 | let C = (y - G) | |
131 | 131 | [IntegerEntry(c, B), IntegerEntry(d, C)] | |
132 | 132 | } | |
133 | 133 | else nil | |
134 | 134 | } | |
135 | 135 | else throw("Strict value is not equal to itself.") | |
136 | 136 | } | |
137 | 137 | else throw("Strict value is not equal to itself.") | |
138 | 138 | } | |
139 | 139 | else throw("Strict value is not equal to itself.") | |
140 | 140 | } | |
141 | 141 | else throw("Strict value is not equal to itself.") | |
142 | 142 | } | |
143 | 143 | else throw("Strict value is not equal to itself.") | |
144 | 144 | } | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | @Callable(I) | |
148 | 148 | func returnWavesBalance () = $Tuple2(nil, o()) | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | ||
152 | 152 | @Callable(I) | |
153 | 153 | func returnSWavesBalance () = $Tuple2(nil, g(d)) | |
154 | 154 | ||
155 | 155 | ||
156 | 156 | ||
157 | 157 | @Callable(I) | |
158 | 158 | func calcRatio () = { | |
159 | 159 | let J = wavesBalance(this).regular | |
160 | 160 | let K = g(c) | |
161 | 161 | let L = fraction(100, K, (K + J)) | |
162 | 162 | $Tuple2(nil, L) | |
163 | 163 | } | |
164 | 164 | ||
165 | 165 | ||
166 | 166 | ||
167 | 167 | @Callable(I) | |
168 | 168 | func calcRatioTest (M,K,N) = { | |
169 | 169 | let O = (M + K) | |
170 | 170 | let P = fraction(N, O, 100) | |
171 | 171 | let Q = (K - P) | |
172 | 172 | let R = (M + Q) | |
173 | 173 | if ((0 > Q)) | |
174 | 174 | then { | |
175 | 175 | let S = (Q * -1) | |
176 | 176 | $Tuple2(nil, [R, P, Q, ("deposit: " + toString(S))]) | |
177 | 177 | } | |
178 | 178 | else { | |
179 | 179 | let S = Q | |
180 | 180 | $Tuple2(nil, [R, P, Q, ("withdraw: " + toString(S))]) | |
181 | 181 | } | |
182 | 182 | } | |
183 | 183 | ||
184 | 184 | ||
185 | 185 | ||
186 | 186 | @Callable(I) | |
187 | 187 | func rebalance () = { | |
188 | 188 | let M = wavesBalance(this).regular | |
189 | 189 | if ((M == M)) | |
190 | 190 | then { | |
191 | 191 | let q = g(c) | |
192 | 192 | if ((q == q)) | |
193 | 193 | then { | |
194 | 194 | let N = n() | |
195 | 195 | if ((N == N)) | |
196 | 196 | then { | |
197 | 197 | let T = (M + q) | |
198 | 198 | let P = fraction(N, T, 100) | |
199 | 199 | let Q = (q - P) | |
200 | 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 | - | } | |
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 | + | } | |
210 | 212 | } | |
211 | 213 | else throw("Strict value is not equal to itself.") | |
212 | 214 | } | |
213 | 215 | else throw("Strict value is not equal to itself.") | |
214 | 216 | } | |
215 | 217 | else throw("Strict value is not equal to itself.") | |
216 | 218 | } | |
217 | 219 | ||
218 | 220 |
github/deemru/w8io/169f3d6 35.68 ms ◑