tx · Dwnd5VT42aUjjFR4iRzo8WW5HP4KdF18s8Tb2NbeWpH8 3NBbSp7yXAeyAmM8uuoenTt3XFfCGQZsHon: -0.01300000 Waves 2023.07.19 14:44 [2672693] smart account 3NBbSp7yXAeyAmM8uuoenTt3XFfCGQZsHon > SELF 0.00000000 Waves
{ "type": 13, "id": "Dwnd5VT42aUjjFR4iRzo8WW5HP4KdF18s8Tb2NbeWpH8", "fee": 1300000, "feeAssetId": null, "timestamp": 1689767072039, "version": 2, "chainId": 84, "sender": "3NBbSp7yXAeyAmM8uuoenTt3XFfCGQZsHon", "senderPublicKey": "EdMvX1KG6dSSSsAqgamTtbKQho4ZLojCVgcBU4CDSeix", "proofs": [ "454oUC2bMw7mk7UYXhDs3FoHmmd7y18uZm6MFa12XLYLC6y7LsA5v7kK6thiPBb46LPacTMqrMHxXoiUpjFEuSry" ], "script": "base64:BgIQCAISBQoDAQgIEgUKAwEICBcAA1NFUAICX18ACGZlZVNjYWxlCQC2AgEAgMLXLwEPZ2V0U3RyaW5nT3JGYWlsAQNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQR0aGlzBQNrZXkJAKwCAgIVTm8gZGF0YSBmb3IgdGhpcy5rZXk9BQNrZXkADHBvb2xEaXNhYmxlZAkAAgECDVBvb2wgZGlzYWJsZWQADHBvb2xOb3RFeGlzdAkAAgECEVBvb2wgaXMgbm90IGV4aXN0AA5zbGlwcGFnZVRvb0JpZwkAAgECE1NsaXBwYWdlIGlzIHRvbyBiaWcBE2tleU1hbmFnZXJQdWJsaWNLZXkAAhQlc19fbWFuYWdlclB1YmxpY0tleQEWa2V5TWFuYWdlclZhdWx0QWRkcmVzcwACFyVzX19tYW5hZ2VyVmF1bHRBZGRyZXNzAQJmYwACEyVzX19mYWN0b3J5Q29udHJhY3QAD2ZhY3RvcnlDb250cmFjdAkBEUBleHRyTmF0aXZlKDEwNjIpAQkBD2dldFN0cmluZ09yRmFpbAEJAQJmYwABC3Byb3RvY29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mdldFB1YmxpY0tleQQHJG1hdGNoMAkBFm1hbmFnZXJQdWJsaWNLZXlPclVuaXQAAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAnBrBQckbWF0Y2gwBQJwawMJAAECBQckbWF0Y2gwAgRVbml0CAUCdHgPc2VuZGVyUHVibGljS2V5CQACAQILTWF0Y2ggZXJyb3IJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFD3RhcmdldFB1YmxpY0tleQoA0Bo=", "height": 2672693, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 69unUFWTY6stpkjA9rUkqNCJHKKiKxx5ozz1ZAs4jLYv Next: none Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "__" | |
5 | 5 | ||
6 | - | let b = | |
6 | + | let b = toBigInt(100000000) | |
7 | 7 | ||
8 | - | let c = "WAVES" | |
9 | - | ||
10 | - | let d = 1000000000000000000 | |
11 | - | ||
12 | - | let e = toBigInt(d) | |
13 | - | ||
14 | - | func f (g) = makeString(["lp_staking_pools.ride:", g], " ") | |
8 | + | func c (d) = valueOrErrorMessage(getString(this, d), ("No data for this.key=" + d)) | |
15 | 9 | ||
16 | 10 | ||
17 | - | func h (g) = throw(f(g)) | |
11 | + | let e = throw("Pool disabled") | |
12 | + | ||
13 | + | let f = throw("Pool is not exist") | |
14 | + | ||
15 | + | let g = throw("Slippage is too big") | |
16 | + | ||
17 | + | func h () = "%s__managerPublicKey" | |
18 | 18 | ||
19 | 19 | ||
20 | - | func i ( | |
20 | + | func i () = "%s__managerVaultAddress" | |
21 | 21 | ||
22 | 22 | ||
23 | - | func | |
23 | + | func j () = "%s__factoryContract" | |
24 | 24 | ||
25 | 25 | ||
26 | - | func m (j,k) = valueOrErrorMessage(getInteger(j, k), i(j, k)) | |
26 | + | let k = addressFromStringValue(c(j())) | |
27 | + | ||
28 | + | func l () = makeString(["%s", "protocolFee"], a) | |
27 | 29 | ||
28 | 30 | ||
29 | - | func n (o) = if ((o == c)) | |
30 | - | then unit | |
31 | - | else fromBase58String(o) | |
31 | + | func m () = makeString(["%s", "poolFee"], a) | |
32 | 32 | ||
33 | 33 | ||
34 | - | func p (o) = if ((o == unit)) | |
35 | - | then c | |
36 | - | else toBase58String(value(o)) | |
34 | + | func n (o,d) = valueOrErrorMessage(getString(o, d), makeString(["mandatory ", toString(o), ".", d, " is not defined"], "")) | |
37 | 35 | ||
38 | 36 | ||
39 | - | func q (r) = if ((r >= 0)) | |
40 | - | then r | |
41 | - | else h("value should be positive") | |
37 | + | let p = "%s__feeCollectorAddress" | |
42 | 38 | ||
39 | + | let q = addressFromStringValue(n(k, p)) | |
43 | 40 | ||
44 | - | func s () = makeString(["%s", "factoryContract"], a) | |
45 | - | ||
46 | - | ||
47 | - | func t () = makeString(["%s", "lpStakingContract"], a) | |
48 | - | ||
49 | - | ||
50 | - | func u () = makeString(["%s", "stakingContract"], a) | |
51 | - | ||
52 | - | ||
53 | - | func v () = makeString(["%s", "boostingContract"], a) | |
54 | - | ||
55 | - | ||
56 | - | func w () = makeString(["%s", "swapContract"], a) | |
57 | - | ||
58 | - | ||
59 | - | func x () = makeString(["%s", "assetsStoreContract"], a) | |
60 | - | ||
61 | - | ||
62 | - | func y () = makeString(["%s", "usdtAssetId"], a) | |
63 | - | ||
64 | - | ||
65 | - | func z () = makeString(["%s", "wxAssetId"], a) | |
66 | - | ||
67 | - | ||
68 | - | func A () = makeString(["%s", "shutdown"], a) | |
69 | - | ||
70 | - | ||
71 | - | func B () = makeString(["%s", "minDelay"], a) | |
72 | - | ||
73 | - | ||
74 | - | func C () = makeString(["%s", "lockFraction"], a) | |
75 | - | ||
76 | - | ||
77 | - | func D (E) = makeString(["%s%s", p(E), "shareAssetId"], a) | |
78 | - | ||
79 | - | ||
80 | - | func F (G) = makeString(["%s%s", p(G), "baseAssetId"], a) | |
81 | - | ||
82 | - | ||
83 | - | func H (E) = makeString(["%s%s", p(E), "period"], a) | |
84 | - | ||
85 | - | ||
86 | - | func I (E,J) = makeString(["%s%s%d", p(E), "periodStartHeight", toString(J)], a) | |
87 | - | ||
88 | - | ||
89 | - | func K (E) = makeString(["%s%s", p(E), "baseAssetAmountToConvert"], a) | |
90 | - | ||
91 | - | ||
92 | - | func L (E) = makeString(["%s%s", p(E), "shareAssetAmountToConvert"], a) | |
93 | - | ||
94 | - | ||
95 | - | func M (E,N) = makeString(["%s%s%s", p(E), toString(N), "baseAssetAmountToConvert"], a) | |
96 | - | ||
97 | - | ||
98 | - | func O (E,N) = makeString(["%s%s%s%s", p(E), toString(N), "baseAssetAmountToConvert", "period"], a) | |
99 | - | ||
100 | - | ||
101 | - | func P (E,N) = makeString(["%s%s%s", p(E), toString(N), "shareAssetAmountToConvert"], a) | |
102 | - | ||
103 | - | ||
104 | - | func Q (E,N) = makeString(["%s%s%s%s", p(E), toString(N), "shareAssetAmountToConvert", "period"], a) | |
105 | - | ||
106 | - | ||
107 | - | func R (E,J) = makeString(["%s%s%d", p(E), "price", toString(J)], a) | |
108 | - | ||
109 | - | ||
110 | - | func S (E) = makeString(["%s%s%s%d%d", p(E), "price", "history", toString(lastBlock.height), toString(lastBlock.timestamp)], a) | |
111 | - | ||
112 | - | ||
113 | - | func T (E,J) = makeString(["%s%s%d%s", p(E), "price", toString(J), "put"], a) | |
114 | - | ||
115 | - | ||
116 | - | func U (E) = makeString(["%s%s%s%s%d%d", p(E), "price", "history", "put", toString(lastBlock.height), toString(lastBlock.timestamp)], a) | |
117 | - | ||
118 | - | ||
119 | - | func V (E,J) = makeString(["%s%s%d%s", p(E), "price", toString(J), "get"], a) | |
120 | - | ||
121 | - | ||
122 | - | func W (E) = makeString(["%s%s%s%s%d%d", p(E), "price", "history", "get", toString(lastBlock.height), toString(lastBlock.timestamp)], a) | |
123 | - | ||
124 | - | ||
125 | - | func X (E,Y,J,N,Z) = makeString(["%s%s%s%s", "history", toBase58String(value(E)), Y, toString(N), toBase58String(Z), toString(height)], a) | |
126 | - | ||
127 | - | ||
128 | - | func aa () = "%s__managerPublicKey" | |
129 | - | ||
130 | - | ||
131 | - | func ab () = "%s__managerVaultAddress" | |
132 | - | ||
133 | - | ||
134 | - | func ac () = { | |
135 | - | let ad = getString(ab()) | |
136 | - | if ($isInstanceOf(ad, "String")) | |
41 | + | func r () = { | |
42 | + | let s = getString(i()) | |
43 | + | if ($isInstanceOf(s, "String")) | |
137 | 44 | then { | |
138 | - | let | |
139 | - | addressFromStringValue( | |
45 | + | let t = s | |
46 | + | addressFromStringValue(t) | |
140 | 47 | } | |
141 | 48 | else this | |
142 | 49 | } | |
143 | 50 | ||
144 | 51 | ||
145 | - | func af () = { | |
146 | - | let ag = ac() | |
147 | - | let ad = getString(ag, aa()) | |
148 | - | if ($isInstanceOf(ad, "String")) | |
52 | + | func u (v) = { | |
53 | + | let s = v | |
54 | + | if ($isInstanceOf(s, "Int")) | |
149 | 55 | then { | |
150 | - | let | |
151 | - | | |
56 | + | let w = s | |
57 | + | w | |
152 | 58 | } | |
153 | - | else if ($isInstanceOf(ad, "Unit")) | |
59 | + | else throw("fail to cast into Int") | |
60 | + | } | |
61 | + | ||
62 | + | ||
63 | + | func x (y,z) = makeString(["%d%d", toString(y), toString(z)], a) | |
64 | + | ||
65 | + | ||
66 | + | func A () = { | |
67 | + | let B = r() | |
68 | + | let s = getString(B, h()) | |
69 | + | if ($isInstanceOf(s, "String")) | |
70 | + | then { | |
71 | + | let t = s | |
72 | + | fromBase58String(t) | |
73 | + | } | |
74 | + | else if ($isInstanceOf(s, "Unit")) | |
154 | 75 | then unit | |
155 | 76 | else throw("Match error") | |
156 | 77 | } | |
157 | 78 | ||
158 | 79 | ||
159 | - | let ah = throw("Permission denied") | |
160 | - | ||
161 | - | func ai (aj) = if ((aj.caller == this)) | |
162 | - | then true | |
163 | - | else ah | |
164 | - | ||
165 | - | ||
166 | - | func ak (aj) = { | |
167 | - | let ad = af() | |
168 | - | if ($isInstanceOf(ad, "ByteVector")) | |
80 | + | func C (D) = { | |
81 | + | let s = A() | |
82 | + | if ($isInstanceOf(s, "ByteVector")) | |
169 | 83 | then { | |
170 | - | let al = ad | |
171 | - | if ((aj.callerPublicKey == al)) | |
172 | - | then true | |
173 | - | else ah | |
84 | + | let E = s | |
85 | + | (D.callerPublicKey == E) | |
174 | 86 | } | |
175 | - | else if ($isInstanceOf( | |
176 | - | then | |
87 | + | else if ($isInstanceOf(s, "Unit")) | |
88 | + | then (D.caller == this) | |
177 | 89 | else throw("Match error") | |
178 | 90 | } | |
179 | 91 | ||
180 | 92 | ||
181 | - | let am = valueOrElse(getBoolean(A()), false) | |
182 | - | ||
183 | - | func an (aj) = if (if (!(am)) | |
93 | + | func F (D) = if (C(D)) | |
184 | 94 | then true | |
185 | - | else ak(aj)) | |
186 | - | then true | |
187 | - | else throw("operation is disabled") | |
95 | + | else throw("permission denied") | |
188 | 96 | ||
189 | 97 | ||
190 | - | let ao = addressFromStringValue(l(this, s())) | |
98 | + | func G (H) = if ((H == "WAVES")) | |
99 | + | then wavesBalance(this).available | |
100 | + | else assetBalance(this, fromBase58String(H)) | |
191 | 101 | ||
192 | - | let ap = addressFromStringValue(l(this, t())) | |
193 | 102 | ||
194 | - | let aq = addressFromStringValue(l(this, u())) | |
195 | - | ||
196 | - | let ar = addressFromStringValue(l(this, v())) | |
197 | - | ||
198 | - | let as = addressFromStringValue(l(this, w())) | |
199 | - | ||
200 | - | let at = addressFromStringValue(l(this, x())) | |
201 | - | ||
202 | - | let au = n(l(this, y())) | |
203 | - | ||
204 | - | let av = n(l(this, z())) | |
205 | - | ||
206 | - | let aw = 1440 | |
207 | - | ||
208 | - | let ax = valueOrElse(getInteger(this, B()), aw) | |
209 | - | ||
210 | - | let ay = 100000000 | |
211 | - | ||
212 | - | let az = fraction(1, ay, 2) | |
213 | - | ||
214 | - | let aA = valueOrElse(getInteger(this, C()), az) | |
215 | - | ||
216 | - | func aB (aC) = { | |
217 | - | let aD = p(aC) | |
218 | - | let aE = p(au) | |
219 | - | let aF = { | |
220 | - | let aG = invoke(ao, "poolInfoREADONLY", [aD, aE], nil) | |
221 | - | if ($isInstanceOf(aG, "(Address, ByteVector)")) | |
222 | - | then aG | |
103 | + | func I (J,K) = { | |
104 | + | let L = { | |
105 | + | let M = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [J, K], nil) | |
106 | + | if ($isInstanceOf(M, "String")) | |
107 | + | then M | |
223 | 108 | else unit | |
224 | 109 | } | |
225 | - | aF | |
226 | - | } | |
227 | - | ||
228 | - | ||
229 | - | func aH (aI,G) = { | |
230 | - | let aJ = valueOrErrorMessage(assetInfo(G), "failed to get share asset info") | |
231 | - | let aK = aJ.quantity | |
232 | - | let aL = q(valueOrErrorMessage({ | |
233 | - | let aG = invoke(aq, "stakedByUserREADONLY", [p(aI), toString(this)], nil) | |
234 | - | if ($isInstanceOf(aG, "Int")) | |
235 | - | then aG | |
110 | + | let N = { | |
111 | + | let M = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [K, J], nil) | |
112 | + | if ($isInstanceOf(M, "String")) | |
113 | + | then M | |
236 | 114 | else unit | |
237 | - | }, f("invalid stakedByUserREADONLY result"))) | |
238 | - | let aM = if ((aK == 0)) | |
239 | - | then e | |
240 | - | else fraction(toBigInt(aL), e, toBigInt(aK), FLOOR) | |
241 | - | aM | |
242 | - | } | |
243 | - | ||
244 | - | ||
245 | - | @Callable(aj) | |
246 | - | func emit (aN,aO) = { | |
247 | - | let aP = ai(aj) | |
248 | - | if ((aP == aP)) | |
115 | + | } | |
116 | + | let O = if ((L != unit)) | |
249 | 117 | then { | |
250 | - | let aQ = true | |
251 | - | $Tuple2([Reissue(aN, aO, aQ)], aO) | |
118 | + | let P = { | |
119 | + | let M = invoke(k, "getPoolAddressFromLpAssetREADONLY", [value(L)], nil) | |
120 | + | if ($isInstanceOf(M, "String")) | |
121 | + | then M | |
122 | + | else throw(($getType(M) + " couldn't be cast to String")) | |
123 | + | } | |
124 | + | $Tuple2(false, P) | |
125 | + | } | |
126 | + | else if ((N != unit)) | |
127 | + | then { | |
128 | + | let P = { | |
129 | + | let M = invoke(k, "getPoolAddressFromLpAssetREADONLY", [value(N)], nil) | |
130 | + | if ($isInstanceOf(M, "String")) | |
131 | + | then M | |
132 | + | else throw(($getType(M) + " couldn't be cast to String")) | |
133 | + | } | |
134 | + | $Tuple2(true, P) | |
135 | + | } | |
136 | + | else f | |
137 | + | let Q = O._1 | |
138 | + | let P = O._2 | |
139 | + | let R = { | |
140 | + | let M = invoke(k, "getPoolStatusREADONLY", [P], nil) | |
141 | + | if ($isInstanceOf(M, "Int")) | |
142 | + | then M | |
143 | + | else throw(($getType(M) + " couldn't be cast to Int")) | |
144 | + | } | |
145 | + | let S = if ((R == 1)) | |
146 | + | then true | |
147 | + | else e | |
148 | + | if ((S == S)) | |
149 | + | then { | |
150 | + | let T = addressFromStringValue(valueOrElse(P, "")) | |
151 | + | $Tuple2(T, Q) | |
252 | 152 | } | |
253 | 153 | else throw("Strict value is not equal to itself.") | |
254 | 154 | } | |
255 | 155 | ||
256 | 156 | ||
257 | - | ||
258 | - | @Callable(aj) | |
259 | - | func burn (aN,aO) = { | |
260 | - | let aP = ai(aj) | |
261 | - | if ((aP == aP)) | |
262 | - | then $Tuple2([Burn(aN, aO)], aO) | |
263 | - | else throw("Strict value is not equal to itself.") | |
157 | + | @Callable(D) | |
158 | + | func swapCalculateREADONLY (U,J,K) = { | |
159 | + | let V = value(getInteger(l())) | |
160 | + | let W = fraction(toBigInt(U), toBigInt(V), b) | |
161 | + | let X = value(getInteger(m())) | |
162 | + | let Y = fraction(toBigInt(U), toBigInt(X), b) | |
163 | + | let Z = if ((toInt(W) == 0)) | |
164 | + | then toBigInt(1) | |
165 | + | else W | |
166 | + | let aa = if ((toInt(Y) == 0)) | |
167 | + | then toBigInt(1) | |
168 | + | else Y | |
169 | + | let ab = ((toBigInt(U) - Z) - aa) | |
170 | + | let ac = I(J, K) | |
171 | + | let T = ac._1 | |
172 | + | let Q = ac._2 | |
173 | + | let ad = { | |
174 | + | let M = invoke(T, "calculateAmountOutForSwapREADONLY", [toInt(ab), Q, toInt(aa)], nil) | |
175 | + | if ($isInstanceOf(M, "Int")) | |
176 | + | then M | |
177 | + | else throw(($getType(M) + " couldn't be cast to Int")) | |
178 | + | } | |
179 | + | $Tuple2(nil, ad) | |
264 | 180 | } | |
265 | 181 | ||
266 | 182 | ||
267 | 183 | ||
268 | - | @Callable(aj) | |
269 | - | func create (aR,aS,aT,aU,aV) = { | |
270 | - | let aW = "STAKING_LP" | |
271 | - | let E = n(aR) | |
272 | - | let aX = [ak(aj), if (isDefined(aB(E))) | |
184 | + | @Callable(D) | |
185 | + | func swap (ae,af,ag) = { | |
186 | + | let K = if ((af == "")) | |
187 | + | then "WAVES" | |
188 | + | else af | |
189 | + | let ah = value(D.payments[0]) | |
190 | + | let J = if ((ah.assetId == unit)) | |
191 | + | then "WAVES" | |
192 | + | else toBase58String(value(ah.assetId)) | |
193 | + | let U = value(ah.amount) | |
194 | + | let V = value(getInteger(l())) | |
195 | + | let W = fraction(toBigInt(U), toBigInt(V), b) | |
196 | + | let X = value(getInteger(m())) | |
197 | + | let Y = fraction(toBigInt(U), toBigInt(X), b) | |
198 | + | let Z = if ((toInt(W) == 0)) | |
199 | + | then toBigInt(1) | |
200 | + | else W | |
201 | + | let aa = if ((toInt(Y) == 0)) | |
202 | + | then toBigInt(1) | |
203 | + | else Y | |
204 | + | let ab = ((toBigInt(U) - Z) - aa) | |
205 | + | let ai = [if ((size(D.payments) == 1)) | |
273 | 206 | then true | |
274 | - | else | |
275 | - | if (( | |
207 | + | else throw("exactly 1 payment are expected")] | |
208 | + | if ((ai == ai)) | |
276 | 209 | then { | |
277 | - | let aY = [IntegerEntry(H(E), 0)] | |
278 | - | if ((aS == "")) | |
279 | - | then { | |
280 | - | let aZ = 1 | |
281 | - | let ba = Issue(aT, aU, aZ, b, true) | |
282 | - | let bb = calculateAssetId(ba) | |
283 | - | let bc = Burn(bb, aZ) | |
284 | - | let bd = toBase58String(bb) | |
285 | - | let be = invoke(at, "createOrUpdate", [bd, aV, false], nil) | |
286 | - | if ((be == be)) | |
287 | - | then { | |
288 | - | let bf = invoke(at, "addLabel", [bd, aW], nil) | |
289 | - | if ((bf == bf)) | |
290 | - | then $Tuple2((aY ++ [ba, bc, StringEntry(D(E), bd), StringEntry(F(bb), aR)]), bd) | |
291 | - | else throw("Strict value is not equal to itself.") | |
292 | - | } | |
293 | - | else throw("Strict value is not equal to itself.") | |
294 | - | } | |
295 | - | else { | |
296 | - | let G = fromBase58String(aS) | |
297 | - | let aJ = valueOrErrorMessage(assetInfo(G), f("invalid share asset id")) | |
298 | - | let bg = if ((aJ.issuer == ap)) | |
299 | - | then true | |
300 | - | else h("invalid share asset id issuer") | |
301 | - | if ((bg == bg)) | |
302 | - | then $Tuple2((aY ++ [StringEntry(D(E), aS), StringEntry(F(G), aR)]), aS) | |
303 | - | else throw("Strict value is not equal to itself.") | |
304 | - | } | |
210 | + | let aj = I(J, K) | |
211 | + | let T = aj._1 | |
212 | + | let Q = aj._2 | |
213 | + | let ak = if ((J == "WAVES")) | |
214 | + | then unit | |
215 | + | else fromBase58String(J) | |
216 | + | let al = { | |
217 | + | let M = invoke(T, "calculateAmountOutForSwapAndSendTokens", [toInt(ab), Q, ae, ag, toInt(aa)], [AttachedPayment(ak, toInt(ab))]) | |
218 | + | if ($isInstanceOf(M, "Int")) | |
219 | + | then M | |
220 | + | else throw(($getType(M) + " couldn't be cast to Int")) | |
221 | + | } | |
222 | + | $Tuple2([ScriptTransfer(q, toInt(Z), ak), ScriptTransfer(T, toInt(aa), ak)], al) | |
305 | 223 | } | |
306 | 224 | else throw("Strict value is not equal to itself.") | |
307 | 225 | } | |
308 | 226 | ||
309 | 227 | ||
310 | - | ||
311 | - | @Callable(aj) | |
312 | - | func put () = { | |
313 | - | let bh = if ((size(aj.payments) == 1)) | |
314 | - | then aj.payments[0] | |
315 | - | else h("exactly 1 payment is expected") | |
316 | - | let E = bh.assetId | |
317 | - | let N = aj.caller | |
318 | - | let aX = [an(aj), if (isDefined(getString(D(E)))) | |
319 | - | then true | |
320 | - | else h("invalid asset")] | |
321 | - | if ((aX == aX)) | |
322 | - | then { | |
323 | - | let bi = valueOrErrorMessage(aB(E), f("invalid asset")) | |
324 | - | let bj = bi._1 | |
325 | - | let aI = bi._2 | |
326 | - | let J = value(getInteger(H(E))) | |
327 | - | let bk = getInteger(O(E, N)) | |
328 | - | let bl = if ((bk == unit)) | |
329 | - | then unit | |
330 | - | else { | |
331 | - | let bm = value(bk) | |
332 | - | if ((bm == J)) | |
333 | - | then unit | |
334 | - | else invoke(this, "claimShareAsset", [p(E), toString(N)], nil) | |
335 | - | } | |
336 | - | if ((bl == bl)) | |
337 | - | then { | |
338 | - | let bn = valueOrElse(getInteger(K(E)), 0) | |
339 | - | let bo = value(parseInt(split(valueOrElse(getString(M(E, N)), "%d%d%d__0__0"), a)[1])) | |
340 | - | $Tuple2([IntegerEntry(K(E), (bn + bh.amount)), StringEntry(M(E, N), makeString(["%d%d%d", toString((bo + bh.amount)), toString(lastBlock.timestamp), toString(J)], a)), IntegerEntry(O(E, N), J), StringEntry(X(E, "put", J, N, aj.transactionId), makeString(["%d%d%d", toString(bh.amount), toString(lastBlock.timestamp), toString(bo)], a))], unit) | |
341 | - | } | |
342 | - | else throw("Strict value is not equal to itself.") | |
343 | - | } | |
344 | - | else throw("Strict value is not equal to itself.") | |
345 | - | } | |
346 | - | ||
347 | - | ||
348 | - | ||
349 | - | @Callable(aj) | |
350 | - | func claimShareAsset (aR,bp) = { | |
351 | - | let aX = [an(aj)] | |
352 | - | if ((aX == aX)) | |
353 | - | then { | |
354 | - | let N = if ((bp == "")) | |
355 | - | then aj.caller | |
356 | - | else { | |
357 | - | let aP = ai(aj) | |
358 | - | if ((aP == aP)) | |
359 | - | then valueOrErrorMessage(addressFromString(bp), f("invalid user address")) | |
360 | - | else throw("Strict value is not equal to itself.") | |
361 | - | } | |
362 | - | if ((N == N)) | |
363 | - | then { | |
364 | - | let E = n(aR) | |
365 | - | let G = value(n(valueOrErrorMessage(getString(D(E)), f("invalid base asset id")))) | |
366 | - | if ((G == G)) | |
367 | - | then { | |
368 | - | let J = valueOrErrorMessage(getInteger(H(E)), f("invalid period")) | |
369 | - | if ((J == J)) | |
370 | - | then { | |
371 | - | let bo = value(parseInt(split(valueOrElse(getString(M(E, N)), "%d%d%d__0__0"), a)[1])) | |
372 | - | let bq = if ((bo > 0)) | |
373 | - | then true | |
374 | - | else h("nothing to claim") | |
375 | - | if ((bq == bq)) | |
376 | - | then { | |
377 | - | let bm = valueOrErrorMessage(getInteger(O(E, N)), f("failed to get period")) | |
378 | - | let br = if ((J > bm)) | |
379 | - | then true | |
380 | - | else h("invalid period") | |
381 | - | if ((br == br)) | |
382 | - | then { | |
383 | - | let aM = toBigInt(valueOrErrorMessage(getBinary(T(E, bm)), f("failed to get price"))) | |
384 | - | let bs = toInt(fraction(toBigInt(bo), e, aM)) | |
385 | - | $Tuple2([StringEntry(M(E, N), makeString(["%d%d%d", toString(0), toString(lastBlock.timestamp), toString(J)], a)), DeleteEntry(O(E, N)), ScriptTransfer(N, bs, G), StringEntry(X(E, "claimShareAsset", J, N, aj.transactionId), makeString(["%d%d%d%d", toString(bs), toString(lastBlock.timestamp), toString(aM), toString(bo)], a))], unit) | |
386 | - | } | |
387 | - | else throw("Strict value is not equal to itself.") | |
388 | - | } | |
389 | - | else throw("Strict value is not equal to itself.") | |
390 | - | } | |
391 | - | else throw("Strict value is not equal to itself.") | |
392 | - | } | |
393 | - | else throw("Strict value is not equal to itself.") | |
394 | - | } | |
395 | - | else throw("Strict value is not equal to itself.") | |
396 | - | } | |
397 | - | else throw("Strict value is not equal to itself.") | |
398 | - | } | |
399 | - | ||
400 | - | ||
401 | - | ||
402 | - | @Callable(aj) | |
403 | - | func get () = { | |
404 | - | let aX = [an(aj)] | |
405 | - | if ((aX == aX)) | |
406 | - | then { | |
407 | - | let bh = if ((size(aj.payments) == 1)) | |
408 | - | then aj.payments[0] | |
409 | - | else h("exactly 1 payment is expected") | |
410 | - | let G = bh.assetId | |
411 | - | let E = value(n(valueOrErrorMessage(getString(F(G)), f("invalid share asset id")))) | |
412 | - | if ((E == E)) | |
413 | - | then { | |
414 | - | let N = aj.caller | |
415 | - | let bt = valueOrErrorMessage(aB(E), f("invalid asset")) | |
416 | - | let bj = bt._1 | |
417 | - | let aI = bt._2 | |
418 | - | let J = value(getInteger(H(E))) | |
419 | - | let bu = getInteger(Q(E, N)) | |
420 | - | let bv = if ((bu == unit)) | |
421 | - | then unit | |
422 | - | else { | |
423 | - | let bw = value(bu) | |
424 | - | if ((bw == J)) | |
425 | - | then unit | |
426 | - | else invoke(this, "claimBaseAsset", [p(E), toString(N)], nil) | |
427 | - | } | |
428 | - | if ((bv == bv)) | |
429 | - | then { | |
430 | - | let bx = valueOrElse(getInteger(L(E)), 0) | |
431 | - | let by = value(parseInt(split(valueOrElse(getString(P(E, N)), "%d%d%d__0__0"), a)[1])) | |
432 | - | $Tuple2([IntegerEntry(L(E), (bx + bh.amount)), StringEntry(P(E, N), makeString(["%d%d%d", toString((by + bh.amount)), toString(lastBlock.timestamp), toString(J)], a)), IntegerEntry(Q(E, N), J), StringEntry(X(E, "get", J, N, aj.transactionId), makeString(["%d%d%d", toString(bh.amount), toString(lastBlock.timestamp), toString(by)], a))], unit) | |
433 | - | } | |
434 | - | else throw("Strict value is not equal to itself.") | |
435 | - | } | |
436 | - | else throw("Strict value is not equal to itself.") | |
437 | - | } | |
438 | - | else throw("Strict value is not equal to itself.") | |
439 | - | } | |
440 | - | ||
441 | - | ||
442 | - | ||
443 | - | @Callable(aj) | |
444 | - | func claimBaseAsset (aR,bp) = { | |
445 | - | let aX = [an(aj)] | |
446 | - | if ((aX == aX)) | |
447 | - | then { | |
448 | - | let N = if ((bp == "")) | |
449 | - | then aj.caller | |
450 | - | else { | |
451 | - | let aP = ai(aj) | |
452 | - | if ((aP == aP)) | |
453 | - | then valueOrErrorMessage(addressFromString(bp), f("invalid user address")) | |
454 | - | else throw("Strict value is not equal to itself.") | |
455 | - | } | |
456 | - | if ((N == N)) | |
457 | - | then { | |
458 | - | let E = n(aR) | |
459 | - | let G = value(n(valueOrErrorMessage(getString(D(E)), f("invalid base asset id")))) | |
460 | - | if ((G == G)) | |
461 | - | then { | |
462 | - | let J = valueOrErrorMessage(getInteger(H(E)), f("invalid period")) | |
463 | - | if ((J == J)) | |
464 | - | then { | |
465 | - | let by = value(parseInt(split(valueOrElse(getString(P(E, N)), "%d%d%d__0__0"), a)[1])) | |
466 | - | let bw = valueOrErrorMessage(getInteger(Q(E, N)), f("failed to get period")) | |
467 | - | let br = if ((J > bw)) | |
468 | - | then true | |
469 | - | else h("invalid period") | |
470 | - | if ((br == br)) | |
471 | - | then { | |
472 | - | let aM = toBigInt(valueOrErrorMessage(getBinary(V(E, bw)), f("failed to get price"))) | |
473 | - | let bz = toInt(fraction(toBigInt(by), aM, e)) | |
474 | - | $Tuple2([StringEntry(P(E, N), makeString(["%d%d%d", toString(0), toString(lastBlock.timestamp), toString(J)], a)), DeleteEntry(Q(E, N)), ScriptTransfer(N, bz, E), StringEntry(X(E, "claimBaseAsset", J, N, aj.transactionId), makeString(["%d%d%d%d", toString(bz), toString(lastBlock.timestamp), toString(aM), toString(bw)], a))], unit) | |
475 | - | } | |
476 | - | else throw("Strict value is not equal to itself.") | |
477 | - | } | |
478 | - | else throw("Strict value is not equal to itself.") | |
479 | - | } | |
480 | - | else throw("Strict value is not equal to itself.") | |
481 | - | } | |
482 | - | else throw("Strict value is not equal to itself.") | |
483 | - | } | |
484 | - | else throw("Strict value is not equal to itself.") | |
485 | - | } | |
486 | - | ||
487 | - | ||
488 | - | ||
489 | - | @Callable(aj) | |
490 | - | func finalize (aR) = { | |
491 | - | let aX = [an(aj)] | |
492 | - | if ((aX == aX)) | |
493 | - | then { | |
494 | - | let E = n(aR) | |
495 | - | let G = value(n(valueOrErrorMessage(getString(D(E)), f("invalid base asset id")))) | |
496 | - | if ((G == G)) | |
497 | - | then { | |
498 | - | let aJ = valueOrErrorMessage(assetInfo(G), f("invalid share asset id")) | |
499 | - | let J = valueOrErrorMessage(getInteger(H(E)), f("invalid period")) | |
500 | - | if ((J == J)) | |
501 | - | then { | |
502 | - | let bA = getInteger(I(E, J)) | |
503 | - | let bB = if ((bA == unit)) | |
504 | - | then unit | |
505 | - | else { | |
506 | - | let bC = (height - value(bA)) | |
507 | - | let bD = max([0, (ax - bC)]) | |
508 | - | if ((bD == 0)) | |
509 | - | then unit | |
510 | - | else h(makeString(["finalization will be possible in ", toString(bD), " blocks"], "")) | |
511 | - | } | |
512 | - | if ((bB == bB)) | |
513 | - | then { | |
514 | - | let bE = valueOrErrorMessage(aB(E), f("invalid asset")) | |
515 | - | let bj = bE._1 | |
516 | - | let aI = bE._2 | |
517 | - | let bF = valueOrErrorMessage({ | |
518 | - | let aG = invoke(aq, "claimWxDoNotThrow", [p(aI)], nil) | |
519 | - | if ($isInstanceOf(aG, "Int")) | |
520 | - | then aG | |
521 | - | else unit | |
522 | - | }, f("invalid claimWx result")) | |
523 | - | if ((bF == bF)) | |
524 | - | then { | |
525 | - | let bn = valueOrElse(getInteger(K(E)), 0) | |
526 | - | let bx = valueOrElse(getInteger(L(E)), 0) | |
527 | - | let bG = { | |
528 | - | let bH = if (if ((bF > 0)) | |
529 | - | then true | |
530 | - | else (bn > 0)) | |
531 | - | then true | |
532 | - | else (bx > 0) | |
533 | - | if (bH) | |
534 | - | then true | |
535 | - | else h("nothing to finalize") | |
536 | - | } | |
537 | - | if ((bG == bG)) | |
538 | - | then { | |
539 | - | let bI = if ((bF > 0)) | |
540 | - | then { | |
541 | - | let bJ = fraction(bF, aA, ay) | |
542 | - | let bK = (bF - bJ) | |
543 | - | let bL = invoke(ar, "userMaxDurationREADONLY", [toString(this)], nil) | |
544 | - | let bM = if ((bJ > 0)) | |
545 | - | then { | |
546 | - | let ad = bL | |
547 | - | if (if (if ($isInstanceOf(ad._1, "String")) | |
548 | - | then $isInstanceOf(ad._2, "Int") | |
549 | - | else false) | |
550 | - | then $isInstanceOf(ad, "(String, Int)") | |
551 | - | else false) | |
552 | - | then { | |
553 | - | let bN = ad._1 | |
554 | - | let bO = ad._2 | |
555 | - | if ((bJ > 0)) | |
556 | - | then invoke(ar, bN, [bO], [AttachedPayment(av, bJ)]) | |
557 | - | else unit | |
558 | - | } | |
559 | - | else h("invalid lock params") | |
560 | - | } | |
561 | - | else unit | |
562 | - | if ((bM == bM)) | |
563 | - | then { | |
564 | - | let bP = if ((bK > 0)) | |
565 | - | then { | |
566 | - | let bQ = av | |
567 | - | let bR = 0 | |
568 | - | let bS = p(au) | |
569 | - | let bT = toString(this) | |
570 | - | valueOrErrorMessage({ | |
571 | - | let aG = invoke(as, "swap", [bR, bS, bT], [AttachedPayment(bQ, bK)]) | |
572 | - | if ($isInstanceOf(aG, "Int")) | |
573 | - | then aG | |
574 | - | else unit | |
575 | - | }, f("invalid swap result")) | |
576 | - | } | |
577 | - | else 0 | |
578 | - | if ((bP == bP)) | |
579 | - | then { | |
580 | - | let bU = if ((bP > 0)) | |
581 | - | then { | |
582 | - | let bV = 0 | |
583 | - | let bW = true | |
584 | - | valueOrErrorMessage({ | |
585 | - | let aG = invoke(bj, "putOneTknV2", [bV, bW], [AttachedPayment(au, bP)]) | |
586 | - | if ($isInstanceOf(aG, "Int")) | |
587 | - | then aG | |
588 | - | else unit | |
589 | - | }, f("invalid putOneTknV2 result")) | |
590 | - | } | |
591 | - | else 0 | |
592 | - | if ((bU == bU)) | |
593 | - | then bU | |
594 | - | else throw("Strict value is not equal to itself.") | |
595 | - | } | |
596 | - | else throw("Strict value is not equal to itself.") | |
597 | - | } | |
598 | - | else throw("Strict value is not equal to itself.") | |
599 | - | } | |
600 | - | else unit | |
601 | - | if ((bI == bI)) | |
602 | - | then { | |
603 | - | let bX = if ((bx > 0)) | |
604 | - | then { | |
605 | - | let aM = aH(aI, G) | |
606 | - | if ((aM == aM)) | |
607 | - | then { | |
608 | - | let bY = toInt(fraction(toBigInt(bx), aM, e, FLOOR)) | |
609 | - | let bz = { | |
610 | - | let bZ = E | |
611 | - | let bV = 0 | |
612 | - | valueOrErrorMessage({ | |
613 | - | let aG = invoke(bj, "unstakeAndGetOneTknV2", [bY, p(bZ), bV], nil) | |
614 | - | if ($isInstanceOf(aG, "Int")) | |
615 | - | then aG | |
616 | - | else unit | |
617 | - | }, f("invalid unstakeAndGetOneTknV2 result")) | |
618 | - | } | |
619 | - | if ((bz == bz)) | |
620 | - | then { | |
621 | - | let ca = if ((aJ.issuer == this)) | |
622 | - | then invoke(this, "burn", [G, bx], nil) | |
623 | - | else h("invalid share asset issuer") | |
624 | - | if ((ca == ca)) | |
625 | - | then { | |
626 | - | let cb = fraction(toBigInt(bz), e, toBigInt(bx), FLOOR) | |
627 | - | let cc = [BinaryEntry(V(E, J), toBytes(cb)), StringEntry(W(E), toString(cb))] | |
628 | - | cc | |
629 | - | } | |
630 | - | else throw("Strict value is not equal to itself.") | |
631 | - | } | |
632 | - | else throw("Strict value is not equal to itself.") | |
633 | - | } | |
634 | - | else throw("Strict value is not equal to itself.") | |
635 | - | } | |
636 | - | else nil | |
637 | - | if ((bX == bX)) | |
638 | - | then { | |
639 | - | let cd = if ((bn > 0)) | |
640 | - | then { | |
641 | - | let bU = { | |
642 | - | let bV = 0 | |
643 | - | let bW = true | |
644 | - | valueOrErrorMessage({ | |
645 | - | let aG = invoke(bj, "putOneTknV2", [bV, bW], [AttachedPayment(E, bn)]) | |
646 | - | if ($isInstanceOf(aG, "Int")) | |
647 | - | then aG | |
648 | - | else unit | |
649 | - | }, f("invalid putOneTknV2 result")) | |
650 | - | } | |
651 | - | if ((bU == bU)) | |
652 | - | then { | |
653 | - | let aM = aH(aI, G) | |
654 | - | if ((aM == aM)) | |
655 | - | then { | |
656 | - | let ce = if ((value(toInt(aM)) != 0)) | |
657 | - | then true | |
658 | - | else throw("price is ZERO") | |
659 | - | if ((ce == ce)) | |
660 | - | then { | |
661 | - | let bs = toInt(fraction(toBigInt(bU), e, aM, FLOOR)) | |
662 | - | let cf = if ((value(toInt(aM)) != 0)) | |
663 | - | then true | |
664 | - | else throw("shareAssetAmount is ZERO") | |
665 | - | if ((cf == cf)) | |
666 | - | then { | |
667 | - | let cg = if ((aJ.issuer == this)) | |
668 | - | then invoke(this, "emit", [G, bs], nil) | |
669 | - | else h("invalid share asset issuer") | |
670 | - | if ((cg == cg)) | |
671 | - | then { | |
672 | - | let ch = fraction(toBigInt(bn), e, toBigInt(bs)) | |
673 | - | let ci = [BinaryEntry(T(E, J), toBytes(ch)), StringEntry(U(E), toString(ch))] | |
674 | - | ci | |
675 | - | } | |
676 | - | else throw("Strict value is not equal to itself.") | |
677 | - | } | |
678 | - | else throw("Strict value is not equal to itself.") | |
679 | - | } | |
680 | - | else throw("Strict value is not equal to itself.") | |
681 | - | } | |
682 | - | else throw("Strict value is not equal to itself.") | |
683 | - | } | |
684 | - | else throw("Strict value is not equal to itself.") | |
685 | - | } | |
686 | - | else nil | |
687 | - | if ((cd == cd)) | |
688 | - | then { | |
689 | - | let cj = (J + 1) | |
690 | - | let ck = aH(aI, G) | |
691 | - | let cl = (([IntegerEntry(H(E), cj), IntegerEntry(I(E, cj), height), IntegerEntry(L(E), 0), IntegerEntry(K(E), 0), BinaryEntry(R(E, J), toBytes(ck)), StringEntry(S(E), toString(ck))] ++ cd) ++ bX) | |
692 | - | $Tuple2(cl, toBytes(ck)) | |
693 | - | } | |
694 | - | else throw("Strict value is not equal to itself.") | |
695 | - | } | |
696 | - | else throw("Strict value is not equal to itself.") | |
697 | - | } | |
698 | - | else throw("Strict value is not equal to itself.") | |
699 | - | } | |
700 | - | else throw("Strict value is not equal to itself.") | |
701 | - | } | |
702 | - | else throw("Strict value is not equal to itself.") | |
703 | - | } | |
704 | - | else throw("Strict value is not equal to itself.") | |
705 | - | } | |
706 | - | else throw("Strict value is not equal to itself.") | |
707 | - | } | |
708 | - | else throw("Strict value is not equal to itself.") | |
709 | - | } | |
710 | - | else throw("Strict value is not equal to itself.") | |
711 | - | } | |
712 | - | ||
713 | - | ||
714 | - | @Verifier(cm) | |
715 | - | func cn () = { | |
716 | - | let co = { | |
717 | - | let ad = af() | |
718 | - | if ($isInstanceOf(ad, "ByteVector")) | |
228 | + | @Verifier(am) | |
229 | + | func an () = { | |
230 | + | let ao = { | |
231 | + | let s = A() | |
232 | + | if ($isInstanceOf(s, "ByteVector")) | |
719 | 233 | then { | |
720 | - | let | |
721 | - | | |
234 | + | let E = s | |
235 | + | E | |
722 | 236 | } | |
723 | - | else if ($isInstanceOf( | |
724 | - | then | |
237 | + | else if ($isInstanceOf(s, "Unit")) | |
238 | + | then am.senderPublicKey | |
725 | 239 | else throw("Match error") | |
726 | 240 | } | |
727 | - | sigVerify( | |
241 | + | sigVerify(am.bodyBytes, am.proofs[0], ao) | |
728 | 242 | } | |
729 | 243 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "__" | |
5 | 5 | ||
6 | - | let b = | |
6 | + | let b = toBigInt(100000000) | |
7 | 7 | ||
8 | - | let c = "WAVES" | |
9 | - | ||
10 | - | let d = 1000000000000000000 | |
11 | - | ||
12 | - | let e = toBigInt(d) | |
13 | - | ||
14 | - | func f (g) = makeString(["lp_staking_pools.ride:", g], " ") | |
8 | + | func c (d) = valueOrErrorMessage(getString(this, d), ("No data for this.key=" + d)) | |
15 | 9 | ||
16 | 10 | ||
17 | - | func h (g) = throw(f(g)) | |
11 | + | let e = throw("Pool disabled") | |
12 | + | ||
13 | + | let f = throw("Pool is not exist") | |
14 | + | ||
15 | + | let g = throw("Slippage is too big") | |
16 | + | ||
17 | + | func h () = "%s__managerPublicKey" | |
18 | 18 | ||
19 | 19 | ||
20 | - | func i ( | |
20 | + | func i () = "%s__managerVaultAddress" | |
21 | 21 | ||
22 | 22 | ||
23 | - | func | |
23 | + | func j () = "%s__factoryContract" | |
24 | 24 | ||
25 | 25 | ||
26 | - | func m (j,k) = valueOrErrorMessage(getInteger(j, k), i(j, k)) | |
26 | + | let k = addressFromStringValue(c(j())) | |
27 | + | ||
28 | + | func l () = makeString(["%s", "protocolFee"], a) | |
27 | 29 | ||
28 | 30 | ||
29 | - | func n (o) = if ((o == c)) | |
30 | - | then unit | |
31 | - | else fromBase58String(o) | |
31 | + | func m () = makeString(["%s", "poolFee"], a) | |
32 | 32 | ||
33 | 33 | ||
34 | - | func p (o) = if ((o == unit)) | |
35 | - | then c | |
36 | - | else toBase58String(value(o)) | |
34 | + | func n (o,d) = valueOrErrorMessage(getString(o, d), makeString(["mandatory ", toString(o), ".", d, " is not defined"], "")) | |
37 | 35 | ||
38 | 36 | ||
39 | - | func q (r) = if ((r >= 0)) | |
40 | - | then r | |
41 | - | else h("value should be positive") | |
37 | + | let p = "%s__feeCollectorAddress" | |
42 | 38 | ||
39 | + | let q = addressFromStringValue(n(k, p)) | |
43 | 40 | ||
44 | - | func s () = makeString(["%s", "factoryContract"], a) | |
45 | - | ||
46 | - | ||
47 | - | func t () = makeString(["%s", "lpStakingContract"], a) | |
48 | - | ||
49 | - | ||
50 | - | func u () = makeString(["%s", "stakingContract"], a) | |
51 | - | ||
52 | - | ||
53 | - | func v () = makeString(["%s", "boostingContract"], a) | |
54 | - | ||
55 | - | ||
56 | - | func w () = makeString(["%s", "swapContract"], a) | |
57 | - | ||
58 | - | ||
59 | - | func x () = makeString(["%s", "assetsStoreContract"], a) | |
60 | - | ||
61 | - | ||
62 | - | func y () = makeString(["%s", "usdtAssetId"], a) | |
63 | - | ||
64 | - | ||
65 | - | func z () = makeString(["%s", "wxAssetId"], a) | |
66 | - | ||
67 | - | ||
68 | - | func A () = makeString(["%s", "shutdown"], a) | |
69 | - | ||
70 | - | ||
71 | - | func B () = makeString(["%s", "minDelay"], a) | |
72 | - | ||
73 | - | ||
74 | - | func C () = makeString(["%s", "lockFraction"], a) | |
75 | - | ||
76 | - | ||
77 | - | func D (E) = makeString(["%s%s", p(E), "shareAssetId"], a) | |
78 | - | ||
79 | - | ||
80 | - | func F (G) = makeString(["%s%s", p(G), "baseAssetId"], a) | |
81 | - | ||
82 | - | ||
83 | - | func H (E) = makeString(["%s%s", p(E), "period"], a) | |
84 | - | ||
85 | - | ||
86 | - | func I (E,J) = makeString(["%s%s%d", p(E), "periodStartHeight", toString(J)], a) | |
87 | - | ||
88 | - | ||
89 | - | func K (E) = makeString(["%s%s", p(E), "baseAssetAmountToConvert"], a) | |
90 | - | ||
91 | - | ||
92 | - | func L (E) = makeString(["%s%s", p(E), "shareAssetAmountToConvert"], a) | |
93 | - | ||
94 | - | ||
95 | - | func M (E,N) = makeString(["%s%s%s", p(E), toString(N), "baseAssetAmountToConvert"], a) | |
96 | - | ||
97 | - | ||
98 | - | func O (E,N) = makeString(["%s%s%s%s", p(E), toString(N), "baseAssetAmountToConvert", "period"], a) | |
99 | - | ||
100 | - | ||
101 | - | func P (E,N) = makeString(["%s%s%s", p(E), toString(N), "shareAssetAmountToConvert"], a) | |
102 | - | ||
103 | - | ||
104 | - | func Q (E,N) = makeString(["%s%s%s%s", p(E), toString(N), "shareAssetAmountToConvert", "period"], a) | |
105 | - | ||
106 | - | ||
107 | - | func R (E,J) = makeString(["%s%s%d", p(E), "price", toString(J)], a) | |
108 | - | ||
109 | - | ||
110 | - | func S (E) = makeString(["%s%s%s%d%d", p(E), "price", "history", toString(lastBlock.height), toString(lastBlock.timestamp)], a) | |
111 | - | ||
112 | - | ||
113 | - | func T (E,J) = makeString(["%s%s%d%s", p(E), "price", toString(J), "put"], a) | |
114 | - | ||
115 | - | ||
116 | - | func U (E) = makeString(["%s%s%s%s%d%d", p(E), "price", "history", "put", toString(lastBlock.height), toString(lastBlock.timestamp)], a) | |
117 | - | ||
118 | - | ||
119 | - | func V (E,J) = makeString(["%s%s%d%s", p(E), "price", toString(J), "get"], a) | |
120 | - | ||
121 | - | ||
122 | - | func W (E) = makeString(["%s%s%s%s%d%d", p(E), "price", "history", "get", toString(lastBlock.height), toString(lastBlock.timestamp)], a) | |
123 | - | ||
124 | - | ||
125 | - | func X (E,Y,J,N,Z) = makeString(["%s%s%s%s", "history", toBase58String(value(E)), Y, toString(N), toBase58String(Z), toString(height)], a) | |
126 | - | ||
127 | - | ||
128 | - | func aa () = "%s__managerPublicKey" | |
129 | - | ||
130 | - | ||
131 | - | func ab () = "%s__managerVaultAddress" | |
132 | - | ||
133 | - | ||
134 | - | func ac () = { | |
135 | - | let ad = getString(ab()) | |
136 | - | if ($isInstanceOf(ad, "String")) | |
41 | + | func r () = { | |
42 | + | let s = getString(i()) | |
43 | + | if ($isInstanceOf(s, "String")) | |
137 | 44 | then { | |
138 | - | let | |
139 | - | addressFromStringValue( | |
45 | + | let t = s | |
46 | + | addressFromStringValue(t) | |
140 | 47 | } | |
141 | 48 | else this | |
142 | 49 | } | |
143 | 50 | ||
144 | 51 | ||
145 | - | func af () = { | |
146 | - | let ag = ac() | |
147 | - | let ad = getString(ag, aa()) | |
148 | - | if ($isInstanceOf(ad, "String")) | |
52 | + | func u (v) = { | |
53 | + | let s = v | |
54 | + | if ($isInstanceOf(s, "Int")) | |
149 | 55 | then { | |
150 | - | let | |
151 | - | | |
56 | + | let w = s | |
57 | + | w | |
152 | 58 | } | |
153 | - | else if ($isInstanceOf(ad, "Unit")) | |
59 | + | else throw("fail to cast into Int") | |
60 | + | } | |
61 | + | ||
62 | + | ||
63 | + | func x (y,z) = makeString(["%d%d", toString(y), toString(z)], a) | |
64 | + | ||
65 | + | ||
66 | + | func A () = { | |
67 | + | let B = r() | |
68 | + | let s = getString(B, h()) | |
69 | + | if ($isInstanceOf(s, "String")) | |
70 | + | then { | |
71 | + | let t = s | |
72 | + | fromBase58String(t) | |
73 | + | } | |
74 | + | else if ($isInstanceOf(s, "Unit")) | |
154 | 75 | then unit | |
155 | 76 | else throw("Match error") | |
156 | 77 | } | |
157 | 78 | ||
158 | 79 | ||
159 | - | let ah = throw("Permission denied") | |
160 | - | ||
161 | - | func ai (aj) = if ((aj.caller == this)) | |
162 | - | then true | |
163 | - | else ah | |
164 | - | ||
165 | - | ||
166 | - | func ak (aj) = { | |
167 | - | let ad = af() | |
168 | - | if ($isInstanceOf(ad, "ByteVector")) | |
80 | + | func C (D) = { | |
81 | + | let s = A() | |
82 | + | if ($isInstanceOf(s, "ByteVector")) | |
169 | 83 | then { | |
170 | - | let al = ad | |
171 | - | if ((aj.callerPublicKey == al)) | |
172 | - | then true | |
173 | - | else ah | |
84 | + | let E = s | |
85 | + | (D.callerPublicKey == E) | |
174 | 86 | } | |
175 | - | else if ($isInstanceOf( | |
176 | - | then | |
87 | + | else if ($isInstanceOf(s, "Unit")) | |
88 | + | then (D.caller == this) | |
177 | 89 | else throw("Match error") | |
178 | 90 | } | |
179 | 91 | ||
180 | 92 | ||
181 | - | let am = valueOrElse(getBoolean(A()), false) | |
182 | - | ||
183 | - | func an (aj) = if (if (!(am)) | |
93 | + | func F (D) = if (C(D)) | |
184 | 94 | then true | |
185 | - | else ak(aj)) | |
186 | - | then true | |
187 | - | else throw("operation is disabled") | |
95 | + | else throw("permission denied") | |
188 | 96 | ||
189 | 97 | ||
190 | - | let ao = addressFromStringValue(l(this, s())) | |
98 | + | func G (H) = if ((H == "WAVES")) | |
99 | + | then wavesBalance(this).available | |
100 | + | else assetBalance(this, fromBase58String(H)) | |
191 | 101 | ||
192 | - | let ap = addressFromStringValue(l(this, t())) | |
193 | 102 | ||
194 | - | let aq = addressFromStringValue(l(this, u())) | |
195 | - | ||
196 | - | let ar = addressFromStringValue(l(this, v())) | |
197 | - | ||
198 | - | let as = addressFromStringValue(l(this, w())) | |
199 | - | ||
200 | - | let at = addressFromStringValue(l(this, x())) | |
201 | - | ||
202 | - | let au = n(l(this, y())) | |
203 | - | ||
204 | - | let av = n(l(this, z())) | |
205 | - | ||
206 | - | let aw = 1440 | |
207 | - | ||
208 | - | let ax = valueOrElse(getInteger(this, B()), aw) | |
209 | - | ||
210 | - | let ay = 100000000 | |
211 | - | ||
212 | - | let az = fraction(1, ay, 2) | |
213 | - | ||
214 | - | let aA = valueOrElse(getInteger(this, C()), az) | |
215 | - | ||
216 | - | func aB (aC) = { | |
217 | - | let aD = p(aC) | |
218 | - | let aE = p(au) | |
219 | - | let aF = { | |
220 | - | let aG = invoke(ao, "poolInfoREADONLY", [aD, aE], nil) | |
221 | - | if ($isInstanceOf(aG, "(Address, ByteVector)")) | |
222 | - | then aG | |
103 | + | func I (J,K) = { | |
104 | + | let L = { | |
105 | + | let M = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [J, K], nil) | |
106 | + | if ($isInstanceOf(M, "String")) | |
107 | + | then M | |
223 | 108 | else unit | |
224 | 109 | } | |
225 | - | aF | |
226 | - | } | |
227 | - | ||
228 | - | ||
229 | - | func aH (aI,G) = { | |
230 | - | let aJ = valueOrErrorMessage(assetInfo(G), "failed to get share asset info") | |
231 | - | let aK = aJ.quantity | |
232 | - | let aL = q(valueOrErrorMessage({ | |
233 | - | let aG = invoke(aq, "stakedByUserREADONLY", [p(aI), toString(this)], nil) | |
234 | - | if ($isInstanceOf(aG, "Int")) | |
235 | - | then aG | |
110 | + | let N = { | |
111 | + | let M = invoke(k, "getLpAssetFromPoolAssetsREADONLY", [K, J], nil) | |
112 | + | if ($isInstanceOf(M, "String")) | |
113 | + | then M | |
236 | 114 | else unit | |
237 | - | }, f("invalid stakedByUserREADONLY result"))) | |
238 | - | let aM = if ((aK == 0)) | |
239 | - | then e | |
240 | - | else fraction(toBigInt(aL), e, toBigInt(aK), FLOOR) | |
241 | - | aM | |
242 | - | } | |
243 | - | ||
244 | - | ||
245 | - | @Callable(aj) | |
246 | - | func emit (aN,aO) = { | |
247 | - | let aP = ai(aj) | |
248 | - | if ((aP == aP)) | |
115 | + | } | |
116 | + | let O = if ((L != unit)) | |
249 | 117 | then { | |
250 | - | let aQ = true | |
251 | - | $Tuple2([Reissue(aN, aO, aQ)], aO) | |
118 | + | let P = { | |
119 | + | let M = invoke(k, "getPoolAddressFromLpAssetREADONLY", [value(L)], nil) | |
120 | + | if ($isInstanceOf(M, "String")) | |
121 | + | then M | |
122 | + | else throw(($getType(M) + " couldn't be cast to String")) | |
123 | + | } | |
124 | + | $Tuple2(false, P) | |
125 | + | } | |
126 | + | else if ((N != unit)) | |
127 | + | then { | |
128 | + | let P = { | |
129 | + | let M = invoke(k, "getPoolAddressFromLpAssetREADONLY", [value(N)], nil) | |
130 | + | if ($isInstanceOf(M, "String")) | |
131 | + | then M | |
132 | + | else throw(($getType(M) + " couldn't be cast to String")) | |
133 | + | } | |
134 | + | $Tuple2(true, P) | |
135 | + | } | |
136 | + | else f | |
137 | + | let Q = O._1 | |
138 | + | let P = O._2 | |
139 | + | let R = { | |
140 | + | let M = invoke(k, "getPoolStatusREADONLY", [P], nil) | |
141 | + | if ($isInstanceOf(M, "Int")) | |
142 | + | then M | |
143 | + | else throw(($getType(M) + " couldn't be cast to Int")) | |
144 | + | } | |
145 | + | let S = if ((R == 1)) | |
146 | + | then true | |
147 | + | else e | |
148 | + | if ((S == S)) | |
149 | + | then { | |
150 | + | let T = addressFromStringValue(valueOrElse(P, "")) | |
151 | + | $Tuple2(T, Q) | |
252 | 152 | } | |
253 | 153 | else throw("Strict value is not equal to itself.") | |
254 | 154 | } | |
255 | 155 | ||
256 | 156 | ||
257 | - | ||
258 | - | @Callable(aj) | |
259 | - | func burn (aN,aO) = { | |
260 | - | let aP = ai(aj) | |
261 | - | if ((aP == aP)) | |
262 | - | then $Tuple2([Burn(aN, aO)], aO) | |
263 | - | else throw("Strict value is not equal to itself.") | |
157 | + | @Callable(D) | |
158 | + | func swapCalculateREADONLY (U,J,K) = { | |
159 | + | let V = value(getInteger(l())) | |
160 | + | let W = fraction(toBigInt(U), toBigInt(V), b) | |
161 | + | let X = value(getInteger(m())) | |
162 | + | let Y = fraction(toBigInt(U), toBigInt(X), b) | |
163 | + | let Z = if ((toInt(W) == 0)) | |
164 | + | then toBigInt(1) | |
165 | + | else W | |
166 | + | let aa = if ((toInt(Y) == 0)) | |
167 | + | then toBigInt(1) | |
168 | + | else Y | |
169 | + | let ab = ((toBigInt(U) - Z) - aa) | |
170 | + | let ac = I(J, K) | |
171 | + | let T = ac._1 | |
172 | + | let Q = ac._2 | |
173 | + | let ad = { | |
174 | + | let M = invoke(T, "calculateAmountOutForSwapREADONLY", [toInt(ab), Q, toInt(aa)], nil) | |
175 | + | if ($isInstanceOf(M, "Int")) | |
176 | + | then M | |
177 | + | else throw(($getType(M) + " couldn't be cast to Int")) | |
178 | + | } | |
179 | + | $Tuple2(nil, ad) | |
264 | 180 | } | |
265 | 181 | ||
266 | 182 | ||
267 | 183 | ||
268 | - | @Callable(aj) | |
269 | - | func create (aR,aS,aT,aU,aV) = { | |
270 | - | let aW = "STAKING_LP" | |
271 | - | let E = n(aR) | |
272 | - | let aX = [ak(aj), if (isDefined(aB(E))) | |
184 | + | @Callable(D) | |
185 | + | func swap (ae,af,ag) = { | |
186 | + | let K = if ((af == "")) | |
187 | + | then "WAVES" | |
188 | + | else af | |
189 | + | let ah = value(D.payments[0]) | |
190 | + | let J = if ((ah.assetId == unit)) | |
191 | + | then "WAVES" | |
192 | + | else toBase58String(value(ah.assetId)) | |
193 | + | let U = value(ah.amount) | |
194 | + | let V = value(getInteger(l())) | |
195 | + | let W = fraction(toBigInt(U), toBigInt(V), b) | |
196 | + | let X = value(getInteger(m())) | |
197 | + | let Y = fraction(toBigInt(U), toBigInt(X), b) | |
198 | + | let Z = if ((toInt(W) == 0)) | |
199 | + | then toBigInt(1) | |
200 | + | else W | |
201 | + | let aa = if ((toInt(Y) == 0)) | |
202 | + | then toBigInt(1) | |
203 | + | else Y | |
204 | + | let ab = ((toBigInt(U) - Z) - aa) | |
205 | + | let ai = [if ((size(D.payments) == 1)) | |
273 | 206 | then true | |
274 | - | else | |
275 | - | if (( | |
207 | + | else throw("exactly 1 payment are expected")] | |
208 | + | if ((ai == ai)) | |
276 | 209 | then { | |
277 | - | let aY = [IntegerEntry(H(E), 0)] | |
278 | - | if ((aS == "")) | |
279 | - | then { | |
280 | - | let aZ = 1 | |
281 | - | let ba = Issue(aT, aU, aZ, b, true) | |
282 | - | let bb = calculateAssetId(ba) | |
283 | - | let bc = Burn(bb, aZ) | |
284 | - | let bd = toBase58String(bb) | |
285 | - | let be = invoke(at, "createOrUpdate", [bd, aV, false], nil) | |
286 | - | if ((be == be)) | |
287 | - | then { | |
288 | - | let bf = invoke(at, "addLabel", [bd, aW], nil) | |
289 | - | if ((bf == bf)) | |
290 | - | then $Tuple2((aY ++ [ba, bc, StringEntry(D(E), bd), StringEntry(F(bb), aR)]), bd) | |
291 | - | else throw("Strict value is not equal to itself.") | |
292 | - | } | |
293 | - | else throw("Strict value is not equal to itself.") | |
294 | - | } | |
295 | - | else { | |
296 | - | let G = fromBase58String(aS) | |
297 | - | let aJ = valueOrErrorMessage(assetInfo(G), f("invalid share asset id")) | |
298 | - | let bg = if ((aJ.issuer == ap)) | |
299 | - | then true | |
300 | - | else h("invalid share asset id issuer") | |
301 | - | if ((bg == bg)) | |
302 | - | then $Tuple2((aY ++ [StringEntry(D(E), aS), StringEntry(F(G), aR)]), aS) | |
303 | - | else throw("Strict value is not equal to itself.") | |
304 | - | } | |
210 | + | let aj = I(J, K) | |
211 | + | let T = aj._1 | |
212 | + | let Q = aj._2 | |
213 | + | let ak = if ((J == "WAVES")) | |
214 | + | then unit | |
215 | + | else fromBase58String(J) | |
216 | + | let al = { | |
217 | + | let M = invoke(T, "calculateAmountOutForSwapAndSendTokens", [toInt(ab), Q, ae, ag, toInt(aa)], [AttachedPayment(ak, toInt(ab))]) | |
218 | + | if ($isInstanceOf(M, "Int")) | |
219 | + | then M | |
220 | + | else throw(($getType(M) + " couldn't be cast to Int")) | |
221 | + | } | |
222 | + | $Tuple2([ScriptTransfer(q, toInt(Z), ak), ScriptTransfer(T, toInt(aa), ak)], al) | |
305 | 223 | } | |
306 | 224 | else throw("Strict value is not equal to itself.") | |
307 | 225 | } | |
308 | 226 | ||
309 | 227 | ||
310 | - | ||
311 | - | @Callable(aj) | |
312 | - | func put () = { | |
313 | - | let bh = if ((size(aj.payments) == 1)) | |
314 | - | then aj.payments[0] | |
315 | - | else h("exactly 1 payment is expected") | |
316 | - | let E = bh.assetId | |
317 | - | let N = aj.caller | |
318 | - | let aX = [an(aj), if (isDefined(getString(D(E)))) | |
319 | - | then true | |
320 | - | else h("invalid asset")] | |
321 | - | if ((aX == aX)) | |
322 | - | then { | |
323 | - | let bi = valueOrErrorMessage(aB(E), f("invalid asset")) | |
324 | - | let bj = bi._1 | |
325 | - | let aI = bi._2 | |
326 | - | let J = value(getInteger(H(E))) | |
327 | - | let bk = getInteger(O(E, N)) | |
328 | - | let bl = if ((bk == unit)) | |
329 | - | then unit | |
330 | - | else { | |
331 | - | let bm = value(bk) | |
332 | - | if ((bm == J)) | |
333 | - | then unit | |
334 | - | else invoke(this, "claimShareAsset", [p(E), toString(N)], nil) | |
335 | - | } | |
336 | - | if ((bl == bl)) | |
337 | - | then { | |
338 | - | let bn = valueOrElse(getInteger(K(E)), 0) | |
339 | - | let bo = value(parseInt(split(valueOrElse(getString(M(E, N)), "%d%d%d__0__0"), a)[1])) | |
340 | - | $Tuple2([IntegerEntry(K(E), (bn + bh.amount)), StringEntry(M(E, N), makeString(["%d%d%d", toString((bo + bh.amount)), toString(lastBlock.timestamp), toString(J)], a)), IntegerEntry(O(E, N), J), StringEntry(X(E, "put", J, N, aj.transactionId), makeString(["%d%d%d", toString(bh.amount), toString(lastBlock.timestamp), toString(bo)], a))], unit) | |
341 | - | } | |
342 | - | else throw("Strict value is not equal to itself.") | |
343 | - | } | |
344 | - | else throw("Strict value is not equal to itself.") | |
345 | - | } | |
346 | - | ||
347 | - | ||
348 | - | ||
349 | - | @Callable(aj) | |
350 | - | func claimShareAsset (aR,bp) = { | |
351 | - | let aX = [an(aj)] | |
352 | - | if ((aX == aX)) | |
353 | - | then { | |
354 | - | let N = if ((bp == "")) | |
355 | - | then aj.caller | |
356 | - | else { | |
357 | - | let aP = ai(aj) | |
358 | - | if ((aP == aP)) | |
359 | - | then valueOrErrorMessage(addressFromString(bp), f("invalid user address")) | |
360 | - | else throw("Strict value is not equal to itself.") | |
361 | - | } | |
362 | - | if ((N == N)) | |
363 | - | then { | |
364 | - | let E = n(aR) | |
365 | - | let G = value(n(valueOrErrorMessage(getString(D(E)), f("invalid base asset id")))) | |
366 | - | if ((G == G)) | |
367 | - | then { | |
368 | - | let J = valueOrErrorMessage(getInteger(H(E)), f("invalid period")) | |
369 | - | if ((J == J)) | |
370 | - | then { | |
371 | - | let bo = value(parseInt(split(valueOrElse(getString(M(E, N)), "%d%d%d__0__0"), a)[1])) | |
372 | - | let bq = if ((bo > 0)) | |
373 | - | then true | |
374 | - | else h("nothing to claim") | |
375 | - | if ((bq == bq)) | |
376 | - | then { | |
377 | - | let bm = valueOrErrorMessage(getInteger(O(E, N)), f("failed to get period")) | |
378 | - | let br = if ((J > bm)) | |
379 | - | then true | |
380 | - | else h("invalid period") | |
381 | - | if ((br == br)) | |
382 | - | then { | |
383 | - | let aM = toBigInt(valueOrErrorMessage(getBinary(T(E, bm)), f("failed to get price"))) | |
384 | - | let bs = toInt(fraction(toBigInt(bo), e, aM)) | |
385 | - | $Tuple2([StringEntry(M(E, N), makeString(["%d%d%d", toString(0), toString(lastBlock.timestamp), toString(J)], a)), DeleteEntry(O(E, N)), ScriptTransfer(N, bs, G), StringEntry(X(E, "claimShareAsset", J, N, aj.transactionId), makeString(["%d%d%d%d", toString(bs), toString(lastBlock.timestamp), toString(aM), toString(bo)], a))], unit) | |
386 | - | } | |
387 | - | else throw("Strict value is not equal to itself.") | |
388 | - | } | |
389 | - | else throw("Strict value is not equal to itself.") | |
390 | - | } | |
391 | - | else throw("Strict value is not equal to itself.") | |
392 | - | } | |
393 | - | else throw("Strict value is not equal to itself.") | |
394 | - | } | |
395 | - | else throw("Strict value is not equal to itself.") | |
396 | - | } | |
397 | - | else throw("Strict value is not equal to itself.") | |
398 | - | } | |
399 | - | ||
400 | - | ||
401 | - | ||
402 | - | @Callable(aj) | |
403 | - | func get () = { | |
404 | - | let aX = [an(aj)] | |
405 | - | if ((aX == aX)) | |
406 | - | then { | |
407 | - | let bh = if ((size(aj.payments) == 1)) | |
408 | - | then aj.payments[0] | |
409 | - | else h("exactly 1 payment is expected") | |
410 | - | let G = bh.assetId | |
411 | - | let E = value(n(valueOrErrorMessage(getString(F(G)), f("invalid share asset id")))) | |
412 | - | if ((E == E)) | |
413 | - | then { | |
414 | - | let N = aj.caller | |
415 | - | let bt = valueOrErrorMessage(aB(E), f("invalid asset")) | |
416 | - | let bj = bt._1 | |
417 | - | let aI = bt._2 | |
418 | - | let J = value(getInteger(H(E))) | |
419 | - | let bu = getInteger(Q(E, N)) | |
420 | - | let bv = if ((bu == unit)) | |
421 | - | then unit | |
422 | - | else { | |
423 | - | let bw = value(bu) | |
424 | - | if ((bw == J)) | |
425 | - | then unit | |
426 | - | else invoke(this, "claimBaseAsset", [p(E), toString(N)], nil) | |
427 | - | } | |
428 | - | if ((bv == bv)) | |
429 | - | then { | |
430 | - | let bx = valueOrElse(getInteger(L(E)), 0) | |
431 | - | let by = value(parseInt(split(valueOrElse(getString(P(E, N)), "%d%d%d__0__0"), a)[1])) | |
432 | - | $Tuple2([IntegerEntry(L(E), (bx + bh.amount)), StringEntry(P(E, N), makeString(["%d%d%d", toString((by + bh.amount)), toString(lastBlock.timestamp), toString(J)], a)), IntegerEntry(Q(E, N), J), StringEntry(X(E, "get", J, N, aj.transactionId), makeString(["%d%d%d", toString(bh.amount), toString(lastBlock.timestamp), toString(by)], a))], unit) | |
433 | - | } | |
434 | - | else throw("Strict value is not equal to itself.") | |
435 | - | } | |
436 | - | else throw("Strict value is not equal to itself.") | |
437 | - | } | |
438 | - | else throw("Strict value is not equal to itself.") | |
439 | - | } | |
440 | - | ||
441 | - | ||
442 | - | ||
443 | - | @Callable(aj) | |
444 | - | func claimBaseAsset (aR,bp) = { | |
445 | - | let aX = [an(aj)] | |
446 | - | if ((aX == aX)) | |
447 | - | then { | |
448 | - | let N = if ((bp == "")) | |
449 | - | then aj.caller | |
450 | - | else { | |
451 | - | let aP = ai(aj) | |
452 | - | if ((aP == aP)) | |
453 | - | then valueOrErrorMessage(addressFromString(bp), f("invalid user address")) | |
454 | - | else throw("Strict value is not equal to itself.") | |
455 | - | } | |
456 | - | if ((N == N)) | |
457 | - | then { | |
458 | - | let E = n(aR) | |
459 | - | let G = value(n(valueOrErrorMessage(getString(D(E)), f("invalid base asset id")))) | |
460 | - | if ((G == G)) | |
461 | - | then { | |
462 | - | let J = valueOrErrorMessage(getInteger(H(E)), f("invalid period")) | |
463 | - | if ((J == J)) | |
464 | - | then { | |
465 | - | let by = value(parseInt(split(valueOrElse(getString(P(E, N)), "%d%d%d__0__0"), a)[1])) | |
466 | - | let bw = valueOrErrorMessage(getInteger(Q(E, N)), f("failed to get period")) | |
467 | - | let br = if ((J > bw)) | |
468 | - | then true | |
469 | - | else h("invalid period") | |
470 | - | if ((br == br)) | |
471 | - | then { | |
472 | - | let aM = toBigInt(valueOrErrorMessage(getBinary(V(E, bw)), f("failed to get price"))) | |
473 | - | let bz = toInt(fraction(toBigInt(by), aM, e)) | |
474 | - | $Tuple2([StringEntry(P(E, N), makeString(["%d%d%d", toString(0), toString(lastBlock.timestamp), toString(J)], a)), DeleteEntry(Q(E, N)), ScriptTransfer(N, bz, E), StringEntry(X(E, "claimBaseAsset", J, N, aj.transactionId), makeString(["%d%d%d%d", toString(bz), toString(lastBlock.timestamp), toString(aM), toString(bw)], a))], unit) | |
475 | - | } | |
476 | - | else throw("Strict value is not equal to itself.") | |
477 | - | } | |
478 | - | else throw("Strict value is not equal to itself.") | |
479 | - | } | |
480 | - | else throw("Strict value is not equal to itself.") | |
481 | - | } | |
482 | - | else throw("Strict value is not equal to itself.") | |
483 | - | } | |
484 | - | else throw("Strict value is not equal to itself.") | |
485 | - | } | |
486 | - | ||
487 | - | ||
488 | - | ||
489 | - | @Callable(aj) | |
490 | - | func finalize (aR) = { | |
491 | - | let aX = [an(aj)] | |
492 | - | if ((aX == aX)) | |
493 | - | then { | |
494 | - | let E = n(aR) | |
495 | - | let G = value(n(valueOrErrorMessage(getString(D(E)), f("invalid base asset id")))) | |
496 | - | if ((G == G)) | |
497 | - | then { | |
498 | - | let aJ = valueOrErrorMessage(assetInfo(G), f("invalid share asset id")) | |
499 | - | let J = valueOrErrorMessage(getInteger(H(E)), f("invalid period")) | |
500 | - | if ((J == J)) | |
501 | - | then { | |
502 | - | let bA = getInteger(I(E, J)) | |
503 | - | let bB = if ((bA == unit)) | |
504 | - | then unit | |
505 | - | else { | |
506 | - | let bC = (height - value(bA)) | |
507 | - | let bD = max([0, (ax - bC)]) | |
508 | - | if ((bD == 0)) | |
509 | - | then unit | |
510 | - | else h(makeString(["finalization will be possible in ", toString(bD), " blocks"], "")) | |
511 | - | } | |
512 | - | if ((bB == bB)) | |
513 | - | then { | |
514 | - | let bE = valueOrErrorMessage(aB(E), f("invalid asset")) | |
515 | - | let bj = bE._1 | |
516 | - | let aI = bE._2 | |
517 | - | let bF = valueOrErrorMessage({ | |
518 | - | let aG = invoke(aq, "claimWxDoNotThrow", [p(aI)], nil) | |
519 | - | if ($isInstanceOf(aG, "Int")) | |
520 | - | then aG | |
521 | - | else unit | |
522 | - | }, f("invalid claimWx result")) | |
523 | - | if ((bF == bF)) | |
524 | - | then { | |
525 | - | let bn = valueOrElse(getInteger(K(E)), 0) | |
526 | - | let bx = valueOrElse(getInteger(L(E)), 0) | |
527 | - | let bG = { | |
528 | - | let bH = if (if ((bF > 0)) | |
529 | - | then true | |
530 | - | else (bn > 0)) | |
531 | - | then true | |
532 | - | else (bx > 0) | |
533 | - | if (bH) | |
534 | - | then true | |
535 | - | else h("nothing to finalize") | |
536 | - | } | |
537 | - | if ((bG == bG)) | |
538 | - | then { | |
539 | - | let bI = if ((bF > 0)) | |
540 | - | then { | |
541 | - | let bJ = fraction(bF, aA, ay) | |
542 | - | let bK = (bF - bJ) | |
543 | - | let bL = invoke(ar, "userMaxDurationREADONLY", [toString(this)], nil) | |
544 | - | let bM = if ((bJ > 0)) | |
545 | - | then { | |
546 | - | let ad = bL | |
547 | - | if (if (if ($isInstanceOf(ad._1, "String")) | |
548 | - | then $isInstanceOf(ad._2, "Int") | |
549 | - | else false) | |
550 | - | then $isInstanceOf(ad, "(String, Int)") | |
551 | - | else false) | |
552 | - | then { | |
553 | - | let bN = ad._1 | |
554 | - | let bO = ad._2 | |
555 | - | if ((bJ > 0)) | |
556 | - | then invoke(ar, bN, [bO], [AttachedPayment(av, bJ)]) | |
557 | - | else unit | |
558 | - | } | |
559 | - | else h("invalid lock params") | |
560 | - | } | |
561 | - | else unit | |
562 | - | if ((bM == bM)) | |
563 | - | then { | |
564 | - | let bP = if ((bK > 0)) | |
565 | - | then { | |
566 | - | let bQ = av | |
567 | - | let bR = 0 | |
568 | - | let bS = p(au) | |
569 | - | let bT = toString(this) | |
570 | - | valueOrErrorMessage({ | |
571 | - | let aG = invoke(as, "swap", [bR, bS, bT], [AttachedPayment(bQ, bK)]) | |
572 | - | if ($isInstanceOf(aG, "Int")) | |
573 | - | then aG | |
574 | - | else unit | |
575 | - | }, f("invalid swap result")) | |
576 | - | } | |
577 | - | else 0 | |
578 | - | if ((bP == bP)) | |
579 | - | then { | |
580 | - | let bU = if ((bP > 0)) | |
581 | - | then { | |
582 | - | let bV = 0 | |
583 | - | let bW = true | |
584 | - | valueOrErrorMessage({ | |
585 | - | let aG = invoke(bj, "putOneTknV2", [bV, bW], [AttachedPayment(au, bP)]) | |
586 | - | if ($isInstanceOf(aG, "Int")) | |
587 | - | then aG | |
588 | - | else unit | |
589 | - | }, f("invalid putOneTknV2 result")) | |
590 | - | } | |
591 | - | else 0 | |
592 | - | if ((bU == bU)) | |
593 | - | then bU | |
594 | - | else throw("Strict value is not equal to itself.") | |
595 | - | } | |
596 | - | else throw("Strict value is not equal to itself.") | |
597 | - | } | |
598 | - | else throw("Strict value is not equal to itself.") | |
599 | - | } | |
600 | - | else unit | |
601 | - | if ((bI == bI)) | |
602 | - | then { | |
603 | - | let bX = if ((bx > 0)) | |
604 | - | then { | |
605 | - | let aM = aH(aI, G) | |
606 | - | if ((aM == aM)) | |
607 | - | then { | |
608 | - | let bY = toInt(fraction(toBigInt(bx), aM, e, FLOOR)) | |
609 | - | let bz = { | |
610 | - | let bZ = E | |
611 | - | let bV = 0 | |
612 | - | valueOrErrorMessage({ | |
613 | - | let aG = invoke(bj, "unstakeAndGetOneTknV2", [bY, p(bZ), bV], nil) | |
614 | - | if ($isInstanceOf(aG, "Int")) | |
615 | - | then aG | |
616 | - | else unit | |
617 | - | }, f("invalid unstakeAndGetOneTknV2 result")) | |
618 | - | } | |
619 | - | if ((bz == bz)) | |
620 | - | then { | |
621 | - | let ca = if ((aJ.issuer == this)) | |
622 | - | then invoke(this, "burn", [G, bx], nil) | |
623 | - | else h("invalid share asset issuer") | |
624 | - | if ((ca == ca)) | |
625 | - | then { | |
626 | - | let cb = fraction(toBigInt(bz), e, toBigInt(bx), FLOOR) | |
627 | - | let cc = [BinaryEntry(V(E, J), toBytes(cb)), StringEntry(W(E), toString(cb))] | |
628 | - | cc | |
629 | - | } | |
630 | - | else throw("Strict value is not equal to itself.") | |
631 | - | } | |
632 | - | else throw("Strict value is not equal to itself.") | |
633 | - | } | |
634 | - | else throw("Strict value is not equal to itself.") | |
635 | - | } | |
636 | - | else nil | |
637 | - | if ((bX == bX)) | |
638 | - | then { | |
639 | - | let cd = if ((bn > 0)) | |
640 | - | then { | |
641 | - | let bU = { | |
642 | - | let bV = 0 | |
643 | - | let bW = true | |
644 | - | valueOrErrorMessage({ | |
645 | - | let aG = invoke(bj, "putOneTknV2", [bV, bW], [AttachedPayment(E, bn)]) | |
646 | - | if ($isInstanceOf(aG, "Int")) | |
647 | - | then aG | |
648 | - | else unit | |
649 | - | }, f("invalid putOneTknV2 result")) | |
650 | - | } | |
651 | - | if ((bU == bU)) | |
652 | - | then { | |
653 | - | let aM = aH(aI, G) | |
654 | - | if ((aM == aM)) | |
655 | - | then { | |
656 | - | let ce = if ((value(toInt(aM)) != 0)) | |
657 | - | then true | |
658 | - | else throw("price is ZERO") | |
659 | - | if ((ce == ce)) | |
660 | - | then { | |
661 | - | let bs = toInt(fraction(toBigInt(bU), e, aM, FLOOR)) | |
662 | - | let cf = if ((value(toInt(aM)) != 0)) | |
663 | - | then true | |
664 | - | else throw("shareAssetAmount is ZERO") | |
665 | - | if ((cf == cf)) | |
666 | - | then { | |
667 | - | let cg = if ((aJ.issuer == this)) | |
668 | - | then invoke(this, "emit", [G, bs], nil) | |
669 | - | else h("invalid share asset issuer") | |
670 | - | if ((cg == cg)) | |
671 | - | then { | |
672 | - | let ch = fraction(toBigInt(bn), e, toBigInt(bs)) | |
673 | - | let ci = [BinaryEntry(T(E, J), toBytes(ch)), StringEntry(U(E), toString(ch))] | |
674 | - | ci | |
675 | - | } | |
676 | - | else throw("Strict value is not equal to itself.") | |
677 | - | } | |
678 | - | else throw("Strict value is not equal to itself.") | |
679 | - | } | |
680 | - | else throw("Strict value is not equal to itself.") | |
681 | - | } | |
682 | - | else throw("Strict value is not equal to itself.") | |
683 | - | } | |
684 | - | else throw("Strict value is not equal to itself.") | |
685 | - | } | |
686 | - | else nil | |
687 | - | if ((cd == cd)) | |
688 | - | then { | |
689 | - | let cj = (J + 1) | |
690 | - | let ck = aH(aI, G) | |
691 | - | let cl = (([IntegerEntry(H(E), cj), IntegerEntry(I(E, cj), height), IntegerEntry(L(E), 0), IntegerEntry(K(E), 0), BinaryEntry(R(E, J), toBytes(ck)), StringEntry(S(E), toString(ck))] ++ cd) ++ bX) | |
692 | - | $Tuple2(cl, toBytes(ck)) | |
693 | - | } | |
694 | - | else throw("Strict value is not equal to itself.") | |
695 | - | } | |
696 | - | else throw("Strict value is not equal to itself.") | |
697 | - | } | |
698 | - | else throw("Strict value is not equal to itself.") | |
699 | - | } | |
700 | - | else throw("Strict value is not equal to itself.") | |
701 | - | } | |
702 | - | else throw("Strict value is not equal to itself.") | |
703 | - | } | |
704 | - | else throw("Strict value is not equal to itself.") | |
705 | - | } | |
706 | - | else throw("Strict value is not equal to itself.") | |
707 | - | } | |
708 | - | else throw("Strict value is not equal to itself.") | |
709 | - | } | |
710 | - | else throw("Strict value is not equal to itself.") | |
711 | - | } | |
712 | - | ||
713 | - | ||
714 | - | @Verifier(cm) | |
715 | - | func cn () = { | |
716 | - | let co = { | |
717 | - | let ad = af() | |
718 | - | if ($isInstanceOf(ad, "ByteVector")) | |
228 | + | @Verifier(am) | |
229 | + | func an () = { | |
230 | + | let ao = { | |
231 | + | let s = A() | |
232 | + | if ($isInstanceOf(s, "ByteVector")) | |
719 | 233 | then { | |
720 | - | let | |
721 | - | | |
234 | + | let E = s | |
235 | + | E | |
722 | 236 | } | |
723 | - | else if ($isInstanceOf( | |
724 | - | then | |
237 | + | else if ($isInstanceOf(s, "Unit")) | |
238 | + | then am.senderPublicKey | |
725 | 239 | else throw("Match error") | |
726 | 240 | } | |
727 | - | sigVerify( | |
241 | + | sigVerify(am.bodyBytes, am.proofs[0], ao) | |
728 | 242 | } | |
729 | 243 |
github/deemru/w8io/169f3d6 81.83 ms ◑