tx · 4ivE1AGr4tkLf6aj5KdeM1VuUEnLG1yqANHszFQP6thM 3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r: -0.04000000 Waves 2022.01.15 22:59 [1880515] smart account 3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r > SELF 0.00000000 Waves
{ "type": 13, "id": "4ivE1AGr4tkLf6aj5KdeM1VuUEnLG1yqANHszFQP6thM", "fee": 4000000, "feeAssetId": null, "timestamp": 1642276831554, "version": 2, "chainId": 84, "sender": "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r", "senderPublicKey": "GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY", "proofs": [ "mCrWzJXiS1cTNnSfhJBMJc6HSMJZNgWu5DHEy2BCnFJz3zLmZJCyjrUgm99rzkPc56xro77EWQ2NerxDEQeGZSU" ], "script": "base64:AAIFAAAAAAAAATsIAhIFCgMICAgSAwoBCBoXCgFhEhJob2xkaW5nc0FkZHJlc3NTdHIaFgoBYhIRaG9sZGluZ3NQdWJsaWNLZXkaFAoBYxIPaG9sZGluZ3NBZGRyZXNzGhQKAWQSD3RyYW5zZmVyQ29zdFBjdBoGCgFlEgFpGgwKAWYSB293bmVySWQaDAoBZxIHYXNzZXRJZBoLCgFoEgZhbW91bnQaDAoBaRIHJG1hdGNoMBoGCgFqEgF4GhIKAWsSDXBheW1lbnRBbW91bnQaDQoBbBIIdHJhbnNmZXIaHQoBbRIYYW1vdW50VG9SZW1haW5JbkhvbGRpbmdzGhwKAW4SF2Ftb3VudFRvVHJhbnNmZXJUb093bmVyGhEKAW8SDG93bmVyQWRkcmVzcxoHCgFwEgJ0eBoLCgFxEgZ2ZXJpZnkAAAAEAAAAAAFhAgAAACMzTjlSN3U0NDlaMWI3NlFwSnA5dTNnelBqTVlRWW5wM1Y3cgAAAAABYgEAAAAg5d0hRbOj7Efpajd5Rdd2peneLysI9sOzTPgBiZfQ228AAAAAAWMJAQAAABRhZGRyZXNzRnJvbVB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ABAgAAABlPcmlnaW5hbCBvd25lciBub3QgZm91bmQgAwMJAAAAAAAAAgUAAAABaAAAAAAAAAAAAAYJAABmAAAAAgUAAAABaAUAAAABawkAAAIAAAABCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAADNQYXltZW50IGFuZCBhbW91bnQgZG8gbm90IG1hdGNoLiBUaGlzIGFzc2V0cyBjb3N0cyAJAAGkAAAAAQUAAAABaAIAAAANYnV0IHlvdSBzZW50IAkAAaQAAAABBQAAAAFrBAAAAAFsCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFlAAAABmNhbGxlcgAAAAAAAAAAAQkAAlkAAAABBQAAAAFnBQAAAANuaWwDCQEAAAACIT0AAAACBQAAAAFmBQAAAAFhBAAAAAFtCQAAaAAAAAIFAAAAAWsJAABpAAAAAgUAAAABZAAAAAAAAAAD6AQAAAABbgkAAGUAAAACBQAAAAFrBQAAAAFtBAAAAAFvCQEAAAAHQWRkcmVzcwAAAAEJAAJZAAAAAQUAAAABZgkABE4AAAACBQAAAAFsCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAAAW8FAAAAAW4FAAAABHVuaXQFAAAAA25pbAUAAAABbAAAAAEAAAABcAEAAAABcQAAAAAJAAH0AAAAAwgFAAAAAXAAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAFwAAAABnByb29mcwAAAAAAAAAAAAgFAAAAAXAAAAAPc2VuZGVyUHVibGljS2V5mbd76w==", "height": 1880515, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 61zba1DFGcCSqhAZPKUUZRjm8wwBogJmdm1Txj9svZL2 Next: Cxym8uoY2kWiwWkG1yBzP1Cg6xBF259RnCmfHc7piFto Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = | |
4 | + | let a = "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r" | |
5 | 5 | ||
6 | - | let b = | |
6 | + | let b = base58'GUHw1jkstNWTs9SX1KM3pMtq9HXjupvxiTd1urNhNoyY' | |
7 | 7 | ||
8 | - | let c = | |
8 | + | let c = addressFromPublicKey(b) | |
9 | 9 | ||
10 | - | let d = | |
10 | + | let d = 25 | |
11 | 11 | ||
12 | - | let e = "3N9R7u449Z1b76QpJp9u3gzPjMYQYnp3V7r" | |
13 | - | ||
14 | - | let f = Address(fromBase58String(e)) | |
15 | - | ||
16 | - | func g (h) = { | |
17 | - | let i = h | |
18 | - | let j = i._1 | |
19 | - | let k = i._2 | |
20 | - | let l = i._3 | |
21 | - | let m = pow(2, 0, (l - 1), 0, 0, HALFUP) | |
22 | - | let n = $Tuple2((j - m), (k - m)) | |
23 | - | let o = $Tuple2(j, (k - m)) | |
24 | - | let p = $Tuple2((j + m), (k + m)) | |
25 | - | let q = $Tuple2((j - m), k) | |
26 | - | let r = $Tuple2((j + m), k) | |
27 | - | let s = $Tuple2((j - m), (k + m)) | |
28 | - | let t = $Tuple2(j, (k + m)) | |
29 | - | let u = $Tuple2((j + m), (k + m)) | |
30 | - | [$Tuple3(n, o, q), $Tuple3(o, p, r), $Tuple3(q, s, t), $Tuple3(r, t, u)] | |
31 | - | } | |
12 | + | @Callable(e) | |
13 | + | func addOwnerAndAmount (f,g,h) = [StringEntry((("sale_" + g) + "_originalOwner"), f), StringEntry((("sale_" + g) + "_amount"), h)] | |
32 | 14 | ||
33 | 15 | ||
34 | - | func v (w,l,x) = { | |
35 | - | let y = w | |
36 | - | let z = y._1 | |
37 | - | let A = y._2 | |
38 | - | let B = y._3 | |
39 | - | let C = (((((toString(z._1) + ",") + toString(z._2)) + ",") + l) + "_owner") | |
40 | - | let D = (((((toString(A._1) + ",") + toString(A._2)) + ",") + l) + "_owner") | |
41 | - | let E = (((((toString(B._1) + ",") + toString(B._2)) + ",") + l) + "_owner") | |
42 | - | let F = { | |
43 | - | let G = getString(this, C) | |
44 | - | if ($isInstanceOf(G, "Unit")) | |
16 | + | ||
17 | + | @Callable(e) | |
18 | + | func buyFromHoldings (g) = { | |
19 | + | let f = { | |
20 | + | let i = getString(this, (("sale_" + g) + "_originalOwner")) | |
21 | + | if ($isInstanceOf(i, "Unit")) | |
45 | 22 | then "unset" | |
46 | - | else if ($isInstanceOf( | |
23 | + | else if ($isInstanceOf(i, "String")) | |
47 | 24 | then { | |
48 | - | let j = | |
25 | + | let j = i | |
49 | 26 | j | |
50 | 27 | } | |
51 | 28 | else throw("Match error") | |
52 | 29 | } | |
53 | - | let H = { | |
54 | - | let G = getString(this, D) | |
55 | - | if ($isInstanceOf(G, "Unit")) | |
56 | - | then "unset" | |
57 | - | else if ($isInstanceOf(G, "String")) | |
30 | + | let k = valueOrElse(e.payments[0].amount, 0) | |
31 | + | let h = { | |
32 | + | let i = getString(this, (("sale_" + g) + "_amount")) | |
33 | + | if ($isInstanceOf(i, "Unit")) | |
34 | + | then 0 | |
35 | + | else if ($isInstanceOf(i, "String")) | |
58 | 36 | then { | |
59 | - | let j = | |
60 | - | j | |
37 | + | let j = i | |
38 | + | (valueOrElse(parseInt(j), 0) * 100000000) | |
61 | 39 | } | |
62 | 40 | else throw("Match error") | |
63 | 41 | } | |
64 | - | let I = { | |
65 | - | let G = getString(this, E) | |
66 | - | if ($isInstanceOf(G, "Unit")) | |
67 | - | then "unset" | |
68 | - | else if ($isInstanceOf(G, "String")) | |
69 | - | then { | |
70 | - | let j = G | |
71 | - | j | |
72 | - | } | |
73 | - | else throw("Match error") | |
74 | - | } | |
75 | - | if (if ((F == x)) | |
76 | - | then (H == x) | |
77 | - | else false) | |
78 | - | then (I == x) | |
79 | - | else false | |
42 | + | if ((f == "unset")) | |
43 | + | then throw("Original owner not found ") | |
44 | + | else if (if ((h == 0)) | |
45 | + | then true | |
46 | + | else (h > k)) | |
47 | + | then throw(((("Payment and amount do not match. This assets costs " + toString(h)) + "but you sent ") + toString(k))) | |
48 | + | else { | |
49 | + | let l = [ScriptTransfer(e.caller, 1, fromBase58String(g))] | |
50 | + | if ((f != a)) | |
51 | + | then { | |
52 | + | let m = (k * (d / 1000)) | |
53 | + | let n = (k - m) | |
54 | + | let o = Address(fromBase58String(f)) | |
55 | + | (l ++ [ScriptTransfer(o, n, unit)]) | |
56 | + | } | |
57 | + | else l | |
58 | + | } | |
80 | 59 | } | |
81 | 60 | ||
82 | 61 | ||
83 | - | func J (K,l) = { | |
84 | - | let L = K | |
85 | - | let j = L._1 | |
86 | - | let k = L._2 | |
87 | - | $Tuple3(j, k, (l + 1)) | |
88 | - | } | |
89 | - | ||
90 | - | ||
91 | - | func M (N,x) = { | |
92 | - | let O = g(N) | |
93 | - | let P = N | |
94 | - | let j = P._1 | |
95 | - | let k = P._2 | |
96 | - | let l = P._3 | |
97 | - | let Q = toString(l) | |
98 | - | if (v(O[0], Q, x)) | |
99 | - | then J(O[0]._1, l) | |
100 | - | else if (v(O[1], Q, x)) | |
101 | - | then J(O[1]._1, l) | |
102 | - | else if (v(O[2], Q, x)) | |
103 | - | then J(O[2]._1, l) | |
104 | - | else if (v(O[3], Q, x)) | |
105 | - | then J(O[3]._1, l) | |
106 | - | else N | |
107 | - | } | |
108 | - | ||
109 | - | ||
110 | - | func R (N,x) = { | |
111 | - | let S = N | |
112 | - | let j = S._1 | |
113 | - | let k = S._2 | |
114 | - | let l = S._3 | |
115 | - | let T = M(N, x) | |
116 | - | if ((T._3 == l)) | |
117 | - | then T | |
118 | - | else { | |
119 | - | let U = M(T, x) | |
120 | - | if ((U._3 == T._3)) | |
121 | - | then U | |
122 | - | else { | |
123 | - | let V = M(U, x) | |
124 | - | if ((V._3 == U._3)) | |
125 | - | then V | |
126 | - | else { | |
127 | - | let W = M(V, x) | |
128 | - | if ((W._3 == V._3)) | |
129 | - | then W | |
130 | - | else { | |
131 | - | let X = M(W, x) | |
132 | - | if ((X._3 == W._3)) | |
133 | - | then X | |
134 | - | else { | |
135 | - | let Y = M(X, x) | |
136 | - | if ((Y._3 == X._3)) | |
137 | - | then Y | |
138 | - | else { | |
139 | - | let Z = M(Y, x) | |
140 | - | if ((Z._3 == Y._3)) | |
141 | - | then Z | |
142 | - | else { | |
143 | - | let aa = M(Z, x) | |
144 | - | if ((aa._3 == Z._3)) | |
145 | - | then aa | |
146 | - | else { | |
147 | - | let ab = M(aa, x) | |
148 | - | if ((ab._3 == aa._3)) | |
149 | - | then ab | |
150 | - | else M(M(ab, x), x) | |
151 | - | } | |
152 | - | } | |
153 | - | } | |
154 | - | } | |
155 | - | } | |
156 | - | } | |
157 | - | } | |
158 | - | } | |
159 | - | } | |
160 | - | ||
161 | - | ||
162 | - | func ac (j,k,x,ad) = { | |
163 | - | let ae = M($Tuple3(parseIntValue(j), parseIntValue(k), 1), x) | |
164 | - | let af = ae._1 | |
165 | - | let ag = ae._2 | |
166 | - | let ah = ae._3 | |
167 | - | let ai = toString(af) | |
168 | - | let aj = toString(ag) | |
169 | - | let ak = toString(ah) | |
170 | - | let al = ((ai + ",") + aj) | |
171 | - | let am = ((c + ad) + ".png") | |
172 | - | let an = Issue(((al + " Gen ") + ak), am, 1, 0, false) | |
173 | - | let ao = calculateAssetId(an) | |
174 | - | let l = ak | |
175 | - | let ap = ((al + ",") + l) | |
176 | - | $Tuple4(an, ao, am, ap) | |
177 | - | } | |
178 | - | ||
179 | - | ||
180 | - | @Callable(aq) | |
181 | - | func purchase (j,k) = { | |
182 | - | let x = toBase58String(aq.caller.bytes) | |
183 | - | let ad = toBase58String(aq.transactionId) | |
184 | - | let ar = ac(j, k, x, ad) | |
185 | - | let an = ar._1 | |
186 | - | let ao = ar._2 | |
187 | - | let am = ar._3 | |
188 | - | let ap = ar._4 | |
189 | - | [an, StringEntry((ap + "_assetId"), toBase58String(ao)), StringEntry((ap + "_asset"), am), StringEntry((ap + "_owner"), x), StringEntry(ad, ap), ScriptTransfer(aq.caller, 1, ao)] | |
190 | - | } | |
191 | - | ||
192 | - | ||
193 | - | ||
194 | - | @Callable(aq) | |
195 | - | func autoBuy (j,k) = { | |
196 | - | let x = toBase58String(f.bytes) | |
197 | - | let ad = toBase58String(aq.transactionId) | |
198 | - | let as = ac(j, k, x, ad) | |
199 | - | let an = as._1 | |
200 | - | let ao = as._2 | |
201 | - | let am = as._3 | |
202 | - | let ap = as._4 | |
203 | - | let at = toBase58String(ao) | |
204 | - | let au = invoke(f, "addOwnerAndAmount", [x, at, "2"], [AttachedPayment(unit, 0)]) | |
205 | - | if ((au == au)) | |
206 | - | then [an, StringEntry((ap + "_assetId"), at), StringEntry((ap + "_asset"), am), StringEntry((ap + "_owner"), x), StringEntry((("sale_" + at) + "_originalOwner"), x), IntegerEntry((("sale_" + at) + "_amount"), 2), StringEntry(ad, ap), ScriptTransfer(f, 1, ao)] | |
207 | - | else throw("Strict value is not equal to itself.") | |
208 | - | } | |
209 | - | ||
210 | - | ||
211 | - | ||
212 | - | @Callable(aq) | |
213 | - | func putForSale (ao,av) = { | |
214 | - | let x = toBase58String(aq.caller.bytes) | |
215 | - | let au = invoke(f, "addOwnerAndAmount", [x, ao, av], [AttachedPayment(unit, 0)]) | |
216 | - | if ((au == au)) | |
217 | - | then [StringEntry((("sale_" + ao) + "_originalOwner"), x), StringEntry((("sale_" + ao) + "_amount"), av), ScriptTransfer(f, 1, fromBase58String(ao))] | |
218 | - | else throw("Strict value is not equal to itself.") | |
219 | - | } | |
220 | - | ||
221 | - | ||
222 | - | ||
223 | - | @Callable(aq) | |
224 | - | func finalizeSale (ao,x) = { | |
225 | - | let aw = { | |
226 | - | let G = assetInfo(fromBase58String(ao)) | |
227 | - | if ($isInstanceOf(G, "Asset")) | |
228 | - | then { | |
229 | - | let ax = G | |
230 | - | ax | |
231 | - | } | |
232 | - | else throw("Asset not found") | |
233 | - | } | |
234 | - | let al = aw.name | |
235 | - | let ay = split(al, ",") | |
236 | - | let az = split(ay[1], " ") | |
237 | - | let j = { | |
238 | - | let G = ay[0] | |
239 | - | if ($isInstanceOf(G, "String")) | |
240 | - | then { | |
241 | - | let aA = G | |
242 | - | valueOrErrorMessage(parseInt(aA), "Could not parse 'x'") | |
243 | - | } | |
244 | - | else throw("'x' not found") | |
245 | - | } | |
246 | - | let k = { | |
247 | - | let G = az[0] | |
248 | - | if ($isInstanceOf(G, "String")) | |
249 | - | then { | |
250 | - | let aA = G | |
251 | - | valueOrErrorMessage(parseInt(aA), "Could not parse 'y'") | |
252 | - | } | |
253 | - | else throw("'y' not found") | |
254 | - | } | |
255 | - | let l = { | |
256 | - | let G = az[2] | |
257 | - | if ($isInstanceOf(G, "String")) | |
258 | - | then { | |
259 | - | let aA = G | |
260 | - | valueOrErrorMessage(parseInt(aA), "Could not parse 'gen'") | |
261 | - | } | |
262 | - | else throw("'gen' not found") | |
263 | - | } | |
264 | - | let aB = toString(j) | |
265 | - | let aC = toString(k) | |
266 | - | let Q = toString(l) | |
267 | - | let aD = M($Tuple3(j, k, l), x) | |
268 | - | let aE = aD._1 | |
269 | - | let aF = aD._2 | |
270 | - | let aG = aD._3 | |
271 | - | let aH = nil | |
272 | - | if ((aG == l)) | |
273 | - | then { | |
274 | - | let aI = ((((aB + ",") + aC) + ",") + Q) | |
275 | - | $Tuple2([StringEntry((aI + "_owner"), x), StringEntry((("sale_" + ao) + "_originalOwner"), ""), IntegerEntry((("sale_" + ao) + "_amount"), 0)], aI) | |
276 | - | } | |
277 | - | else { | |
278 | - | let ad = toBase58String(aq.transactionId) | |
279 | - | let aJ = ac(aB, aC, x, ad) | |
280 | - | let an = aJ._1 | |
281 | - | let aK = aJ._2 | |
282 | - | let am = aJ._3 | |
283 | - | let ap = aJ._4 | |
284 | - | let aI = ap | |
285 | - | $Tuple2([an, StringEntry((aI + "_assetId"), toBase58String(aK)), StringEntry((aI + "_asset"), am), StringEntry((aI + "_owner"), x), StringEntry(ad, aI), ScriptTransfer(Address(fromBase58String(x)), 1, fromBase58String(ao))], aI) | |
286 | - | } | |
287 | - | } | |
288 | - | ||
62 | + | @Verifier(p) | |
63 | + | func q () = sigVerify(p.bodyBytes, p.proofs[0], p.senderPublicKey) | |
289 | 64 |
github/deemru/w8io/169f3d6 59.07 ms ◑