tx · EVPGbwWXxQU4D3xZoNFV4eGgJ2RcbmLD9aGaW6T9WiS9 3MqySDQxn5jzBUc144oks9fQzAXCBvJ2B8Y: -0.01000000 Waves 2021.09.08 10:01 [1693745] smart account 3MqySDQxn5jzBUc144oks9fQzAXCBvJ2B8Y > SELF 0.00000000 Waves
{ "type": 13, "id": "EVPGbwWXxQU4D3xZoNFV4eGgJ2RcbmLD9aGaW6T9WiS9", "fee": 1000000, "feeAssetId": null, "timestamp": 1631084499207, "version": 1, "sender": "3MqySDQxn5jzBUc144oks9fQzAXCBvJ2B8Y", "senderPublicKey": "3YcAqsm6P2UYnzeZng9DPfjNQbEcHithbYzPy3ZMzLMk", "proofs": [ "CWaMqfkheJhud4mdLUQCNHjqk4XU879fgbPYYZd2PC2WE4atn4g8p1A9b9ZHpHgMkGP74KbYNBTTS8MqTF5rsbf" ], "script": "base64:AAIFAAAAAAAAAA8IAhIDCgEIEgASBAoCCAEAAAAMAAAAAANTRVACAAAAAl9fAQAAAA9nZXRTdHJpbmdPckZhaWwAAAABAAAAA2tleQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEIgAAAAEFAAAAA2tleQkAASwAAAACCQABLAAAAAICAAAAD21hbmRhdG9yeSB0aGlzLgUAAAADa2V5AgAAAA8gaXMgbm90IGRlZmluZWQBAAAAGGdldFN0cmluZ0J5QWRkcmVzc09yRmFpbAAAAAIAAAAHYWRkcmVzcwAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAKbWFuZGF0b3J5IAkABCUAAAABBQAAAAdhZGRyZXNzAgAAAAEuBQAAAANrZXkCAAAADyBpcyBub3QgZGVmaW5lZAEAAAARa2V5RmFjdG9yeUFkZHJlc3MAAAAAAgAAABwlcyVzX19jb25maWdfX2ZhY3RvcnlBZGRyZXNzAQA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AAJHBhc3NlZCBhbW91bnQgaXMgbGVzcyB0aGVuIGF2YWlsYWJsZQkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAPc3Rha2VkQnlVc2VyS0VZCQAAZQAAAAIFAAAADHN0YWtlZEJ5VXNlcgUAAAAGYW1vdW50CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAA5zdGFrZWRUb3RhbEtFWQkAAGUAAAACBQAAAAtzdGFrZWRUb3RhbAUAAAAGYW1vdW50CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAGYW1vdW50BQAAAAdhc3NldElkCQAETAAAAAIJAQAAABVPcGVyYXRpb25IaXN0b3J5RW50cnkAAAAFAgAAAAVjbGFpbQUAAAAOdXNlckFkZHJlc3NTdHIFAAAACmFzc2V0SWRTdHIFAAAABmFtb3VudAgFAAAAAWkAAAANdHJhbnNhY3Rpb25JZAUAAAADbmlsAAAAACU8NSo=", "chainId": 84, "height": 1693745, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: J7teaWohvqdtLqRFwkWHtSZ62YgprYcBYiH7CLaHEgpF Next: CVi33qYQd7GCta6zgZ6dnKWMJoaVm6MG4qdexTJXw45z Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | func a (b) = valueOrErrorMessage(getString(b), (("mandatory this." + b) + " is not defined")) | |
4 | + | let a = "__" | |
5 | + | ||
6 | + | func b (c) = valueOrErrorMessage(getString(c), (("mandatory this." + c) + " is not defined")) | |
5 | 7 | ||
6 | 8 | ||
7 | - | let c = "__" | |
8 | - | ||
9 | - | let d = toBigInt(1000000000000000000) | |
10 | - | ||
11 | - | func e (f,g,h,i,j) = { | |
12 | - | let k = toBigInt(g) | |
13 | - | let l = fraction(toBigInt(f), d, k) | |
14 | - | let m = fraction(l, k, toBigInt(h)) | |
15 | - | toInt(fraction(m, toBigInt(j), d)) | |
16 | - | } | |
9 | + | func d (e,c) = valueOrErrorMessage(getString(e, c), (((("mandatory " + toString(e)) + ".") + c) + " is not defined")) | |
17 | 10 | ||
18 | 11 | ||
19 | - | let n = 1 | |
20 | - | ||
21 | - | let o = 2 | |
22 | - | ||
23 | - | let p = 3 | |
24 | - | ||
25 | - | let q = 4 | |
26 | - | ||
27 | - | let r = 5 | |
28 | - | ||
29 | - | let s = 6 | |
30 | - | ||
31 | - | let t = 7 | |
32 | - | ||
33 | - | let u = 8 | |
34 | - | ||
35 | - | let v = 9 | |
36 | - | ||
37 | - | let w = 10 | |
38 | - | ||
39 | - | let x = 11 | |
40 | - | ||
41 | - | func y (z,A,B,C,h,D,E,F,G,H,I) = makeString(["%d%d%d%d%d%d%s%d%s%d%d", z, A, B, C, h, D, E, F, G, H, I], c) | |
12 | + | func f () = "%s%s__config__factoryAddress" | |
42 | 13 | ||
43 | 14 | ||
44 | - | func | |
15 | + | func g (h) = makeString(["%s%s%s", h, "mappings__lpAsset2PoolContract"], a) | |
45 | 16 | ||
46 | 17 | ||
47 | - | let K = 1 | |
48 | - | ||
49 | - | let L = 2 | |
50 | - | ||
51 | - | let M = 3 | |
52 | - | ||
53 | - | let N = 4 | |
54 | - | ||
55 | - | let O = 5 | |
56 | - | ||
57 | - | func P (Q,R,S,T,U) = makeString(["%d%d%d%d%d", Q, R, S, T, U], c) | |
18 | + | func i () = addressFromStringValue(b(f())) | |
58 | 19 | ||
59 | 20 | ||
60 | - | func | |
21 | + | func j (k,l) = makeString(["%s%s%s__staked__", k, l], a) | |
61 | 22 | ||
62 | 23 | ||
63 | - | func | |
24 | + | func m (l) = ("%s%s%s__staked__total__" + l) | |
64 | 25 | ||
65 | 26 | ||
66 | - | func | |
27 | + | func n (c) = valueOrElse(getInteger(this, c), 0) | |
67 | 28 | ||
68 | 29 | ||
69 | - | func | |
30 | + | func o (p,q,r) = makeString(["%s%s%s%s__history", p, q, r], a) | |
70 | 31 | ||
71 | 32 | ||
72 | - | func | |
33 | + | func s (q,t,p,u) = makeString(["%s%s%s%d%d%d", q, t, p, toString(height), toString(lastBlock.timestamp), toString(u)], a) | |
73 | 34 | ||
74 | 35 | ||
75 | - | func | |
36 | + | func v (p,q,t,u,w) = StringEntry(o(p, q, toBase58String(w)), s(q, t, p, u)) | |
76 | 37 | ||
77 | 38 | ||
78 | - | func af () = split(a(Y()), c) | |
79 | - | ||
80 | - | ||
81 | - | func ag (ah) = split(valueOrElse(getString(ah), P("0", "0", "0", "0", "0")), c) | |
82 | - | ||
83 | - | ||
84 | - | func ai () = ag(ab()) | |
85 | - | ||
86 | - | ||
87 | - | func aj (aa) = ag(Z(aa)) | |
88 | - | ||
89 | - | ||
90 | - | func ak (aa) = split(a(Z(aa)), c) | |
91 | - | ||
92 | - | ||
93 | - | let al = 0 | |
94 | - | ||
95 | - | let am = 1 | |
96 | - | ||
97 | - | let an = 2 | |
98 | - | ||
99 | - | let ao = 3 | |
100 | - | ||
101 | - | func ap (b,aq,ar,as) = { | |
102 | - | let Q = parseIntValue(aq[K]) | |
103 | - | let R = parseIntValue(aq[L]) | |
104 | - | let S = parseIntValue(aq[M]) | |
105 | - | let T = parseIntValue(aq[N]) | |
106 | - | let U = parseIntValue(aq[O]) | |
107 | - | let at = (Q + ar[al]) | |
108 | - | let au = (R + ar[am]) | |
109 | - | let av = (S + ar[an]) | |
110 | - | let aw = (T + ar[ao]) | |
111 | - | if ((0 > au)) | |
112 | - | then throw("invalid math") | |
113 | - | else StringEntry(b, V(at, au, av, aw, as)) | |
114 | - | } | |
115 | - | ||
116 | - | ||
117 | - | func ax (aa,f,X,ay) = StringEntry(ac("invest", aa, toBase58String(ay)), W(f, X)) | |
118 | - | ||
119 | - | ||
120 | - | func az (aa,f,X,ay) = StringEntry(ac("claim", aa, toBase58String(ay)), W(f, X)) | |
121 | - | ||
122 | - | ||
123 | - | func aA (aB,aa,ay) = { | |
124 | - | let aC = af() | |
125 | - | let B = parseIntValue(aC[p]) | |
126 | - | let C = parseIntValue(aC[q]) | |
127 | - | let aD = (B + C) | |
128 | - | let h = parseIntValue(aC[r]) | |
129 | - | let D = parseIntValue(aC[s]) | |
130 | - | let E = aC[t] | |
131 | - | let aE = fromBase58String(E) | |
132 | - | let F = parseIntValue(aC[u]) | |
133 | - | let G = aC[v] | |
134 | - | let aF = fromBase58String(G) | |
135 | - | let H = parseIntValue(aC[w]) | |
136 | - | let aG = toString(aa) | |
137 | - | let aH = ak(aG) | |
138 | - | let aI = parseIntValue(aH[K]) | |
139 | - | let aJ = parseIntValue(aH[O]) | |
140 | - | let aK = if ((height > aD)) | |
141 | - | then aD | |
142 | - | else if ((B > height)) | |
143 | - | then B | |
144 | - | else height | |
145 | - | let aL = (aK - aJ) | |
146 | - | let aM = fraction(aI, aL, C) | |
147 | - | let aN = e(aM, H, h, D, F) | |
148 | - | if ((aB == G)) | |
149 | - | then $Tuple6([0, -(aM), aM, 0], aM, aF, aH, aK, [aM, aN]) | |
150 | - | else if ((aB == E)) | |
151 | - | then $Tuple6([0, -(aM), 0, aN], aN, aE, aH, aK, [aM, aN]) | |
152 | - | else throw(("unsupported assetId: " + aB)) | |
153 | - | } | |
154 | - | ||
155 | - | ||
156 | - | @Callable(aO) | |
157 | - | func constructor (z,A,B,C,h,G,I) = { | |
158 | - | let D = ((100 * 1000) * 1000) | |
159 | - | let aP = (z + A) | |
160 | - | if (isDefined(getString(Y()))) | |
161 | - | then throw("already initialized") | |
162 | - | else if (("3N4Aib5iubWiGMzdTh6wWiVDVbo32oeVUmH" != toString(aO.caller))) | |
163 | - | then throw("not authorized") | |
164 | - | else if ((size(aO.payments) != 1)) | |
165 | - | then throw("exactly 1 payment must be attached") | |
166 | - | else if ((aP >= B)) | |
167 | - | then throw("claimStart must be greater than idoEnd") | |
168 | - | else { | |
169 | - | let aQ = value(aO.payments[0]) | |
170 | - | let aE = value(aQ.assetId) | |
171 | - | let aR = valueOrErrorMessage(assetInfo(aE), "fail to load ido asset info") | |
172 | - | let E = toBase58String(aE) | |
173 | - | let F = pow(10, 0, aR.decimals, 0, 0, DOWN) | |
174 | - | let aF = fromBase58String(G) | |
175 | - | let aS = valueOrErrorMessage(assetInfo(aF), "fail to load price asset info") | |
176 | - | let H = pow(10, 0, aS.decimals, 0, 0, DOWN) | |
177 | - | [StringEntry(Y(), J(z, A, B, C, h, D, E, F, G, H, I))] | |
178 | - | } | |
179 | - | } | |
39 | + | @Callable(x) | |
40 | + | func constructor (y) = if ((x.caller != this)) | |
41 | + | then throw("not authorized") | |
42 | + | else [StringEntry(f(), y)] | |
180 | 43 | ||
181 | 44 | ||
182 | 45 | ||
183 | - | @Callable(aO) | |
184 | - | func invest () = { | |
185 | - | let aC = af() | |
186 | - | let z = parseIntValue(aC[n]) | |
187 | - | let A = parseIntValue(aC[o]) | |
188 | - | let aP = (z + A) | |
189 | - | let B = parseIntValue(aC[p]) | |
190 | - | let C = parseIntValue(aC[q]) | |
191 | - | let h = parseIntValue(aC[r]) | |
192 | - | let D = parseIntValue(aC[s]) | |
193 | - | let E = aC[t] | |
194 | - | let aE = fromBase58String(E) | |
195 | - | let F = parseIntValue(aC[u]) | |
196 | - | let G = aC[v] | |
197 | - | let aF = fromBase58String(G) | |
198 | - | let H = parseIntValue(aC[w]) | |
199 | - | let aT = parseIntValue(aC[x]) | |
200 | - | let aa = toString(aO.caller) | |
201 | - | if ((z > height)) | |
202 | - | then throw("ido has not been started yet") | |
203 | - | else if ((height > aP)) | |
204 | - | then throw("ido has been already ended") | |
205 | - | else if ((size(aO.payments) != 1)) | |
206 | - | then throw("exactly 1 payment is expected") | |
46 | + | @Callable(x) | |
47 | + | func stake () = { | |
48 | + | let z = i() | |
49 | + | if ((size(x.payments) != 1)) | |
50 | + | then throw("invalid payment - exact one payment must be attached") | |
51 | + | else { | |
52 | + | let A = x.payments[0] | |
53 | + | let t = value(A.assetId) | |
54 | + | let l = toBase58String(t) | |
55 | + | let k = toString(x.caller) | |
56 | + | let u = A.amount | |
57 | + | if (!(isDefined(getString(z, g(l))))) | |
58 | + | then throw(("unsupported lp asset " + l)) | |
207 | 59 | else { | |
208 | - | let aQ = value(aO.payments[0]) | |
209 | - | let aU = value(aQ.assetId) | |
210 | - | let aV = aQ.amount | |
211 | - | if ((aU != aF)) | |
212 | - | then throw((("invalid payment asset id: " + toBase58String(aU)) + " is expected")) | |
213 | - | else if ((aT > aV)) | |
214 | - | then throw(((("payment amount is less then min allowed: pmtAmount=" + toString(aV)) + " minIvestAmount=") + toString(aT))) | |
215 | - | else { | |
216 | - | let aW = aj(aa) | |
217 | - | let aX = ai() | |
218 | - | let aY = (parseIntValue(aX[K]) + aV) | |
219 | - | let aZ = e(aY, H, h, D, F) | |
220 | - | if ((aZ > assetBalance(this, aE))) | |
221 | - | then throw("IDO asset has been - sold consider to use smaller payment") | |
222 | - | else { | |
223 | - | let ba = [aV, aV, 0, 0] | |
224 | - | [ap(Z(aa), aW, ba, B), ap(ab(), aX, ba, B), ax(aa, aV, 0, aO.transactionId)] | |
225 | - | } | |
226 | - | } | |
60 | + | let B = j(k, l) | |
61 | + | let C = j(k, l) | |
62 | + | let D = n(B) | |
63 | + | let E = n(C) | |
64 | + | [IntegerEntry(B, u), IntegerEntry(C, u), v("stake", k, l, u, x.transactionId)] | |
227 | 65 | } | |
228 | - | } | |
229 | - | ||
230 | - | ||
231 | - | ||
232 | - | @Callable(aO) | |
233 | - | func claim (aB,aG) = { | |
234 | - | let bb = toString(aO.caller) | |
235 | - | if ((aG != bb)) | |
236 | - | then throw("not authorized") | |
237 | - | else { | |
238 | - | let bc = aA(aB, aO.caller, aO.transactionId) | |
239 | - | let ba = bc._1 | |
240 | - | let bd = bc._2 | |
241 | - | let be = bc._3 | |
242 | - | let aH = bc._4 | |
243 | - | let aK = bc._5 | |
244 | - | let bf = ba[an] | |
245 | - | let bg = ba[ao] | |
246 | - | $Tuple2([ScriptTransfer(aO.caller, bd, be), ap(Z(aG), aH, ba, aK), ap(ab(), ai(), ba, aK), az(aG, bf, bg, aO.transactionId)], unit) | |
247 | 66 | } | |
248 | 67 | } | |
249 | 68 | ||
250 | 69 | ||
251 | 70 | ||
252 | - | @Callable(aO) | |
253 | - | func claimREADONLY (aB,aG) = { | |
254 | - | let bc = aA(aB, addressFromStringValue(aG), fromBase58String("")) | |
255 | - | let ba = bc._1 | |
256 | - | let bd = bc._2 | |
257 | - | let be = bc._3 | |
258 | - | let aH = bc._4 | |
259 | - | let aK = bc._5 | |
260 | - | let bh = bc._6 | |
261 | - | let bi = bh[0] | |
262 | - | let bj = bh[1] | |
263 | - | $Tuple2(nil, makeString(["%s%d%d", aG, toString(bi), toString(bj)], c)) | |
71 | + | @Callable(x) | |
72 | + | func claim (F,u) = { | |
73 | + | let z = i() | |
74 | + | let k = toString(x.caller) | |
75 | + | let G = fromBase58String(F) | |
76 | + | if (!(isDefined(getString(z, g(F))))) | |
77 | + | then throw(("unsupported lp asset " + F)) | |
78 | + | else { | |
79 | + | let B = j(k, F) | |
80 | + | let C = j(k, F) | |
81 | + | let D = n(B) | |
82 | + | let E = n(C) | |
83 | + | if ((u > D)) | |
84 | + | then throw("passed amount is less then available") | |
85 | + | else [IntegerEntry(B, (D - u)), IntegerEntry(C, (E - u)), ScriptTransfer(x.caller, u, G), v("claim", k, F, u, x.transactionId)] | |
86 | + | } | |
264 | 87 | } | |
265 | 88 | ||
266 | 89 |
github/deemru/w8io/169f3d6 52.95 ms ◑