tx · 6UbA2vXAJ7Yx86rq3mLMaa36ArB2Uw9a5dLycxV1FiWg

3NBbSp7yXAeyAmM8uuoenTt3XFfCGQZsHon:  -0.01300000 Waves

2023.05.04 13:13 [2562879] smart account 3NBbSp7yXAeyAmM8uuoenTt3XFfCGQZsHon > SELF 0.00000000 Waves

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

github/deemru/w8io/026f985 
70.24 ms