tx · GY1d3fNpDDQpDPH6wfFoGwHj9uvXXbbXKQUxkzZi5sGX 3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs: -0.01400000 Waves 2019.08.28 00:13 [650129] smart account 3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs > SELF 0.00000000 Waves
{ "type": 13, "id": "GY1d3fNpDDQpDPH6wfFoGwHj9uvXXbbXKQUxkzZi5sGX", "fee": 1400000, "feeAssetId": null, "timestamp": 1566940472872, "version": 1, "sender": "3N2Z6EjzrzaCpD8ypDYLWDKe2PPVU8y9dJs", "senderPublicKey": "HSTmdhPrJF81ozDBaqVn8QVtV76oD7gzDfcHPQRdxdwW", "proofs": [ "2etvVF72EdnaWN1BSDabcjMAg3yXg9n1r7SGUQGAPoWLbmAMaMr1ZoYnhaC9pMsp1azcqV2cgDYSwJzjTXMJCt1P" ], "script": "base64:AAIDAAAAAAAAAAAAAAAQAAAAAAdXQVZFTEVUCQAAaAAAAAIJAABoAAAAAgAAAAAAAAAAZAAAAAAAAAAD6AAAAAAAAAAD6AAAAAAKQ09NTUlTU0lPTgkAAGkAAAACCQAAaAAAAAIAAAAAAAAAAAUFAAAAB1dBVkVMRVQAAAAAAAAAA+gAAAAAClRva2VuUHJpY2UAAAAAAAAAAAoAAAAAEERPTkFURUNPVU5URVJLRVkCAAAACyRET05BVEVfTlVNAAAAAAdCVVlJVEVNAgAAAAkkQlVZX0lURU0AAAAABEJhZzEJAABoAAAAAgAAAAAAAAAAAQUAAAAHV0FWRUxFVAAAAAAEQmFnNQkAAGgAAAACAAAAAAAAAAAFBQAAAAdXQVZFTEVUAAAAAAVCYWcxMAkAAGgAAAACAAAAAAAAAAAKBQAAAAdXQVZFTEVUAAAAAAVCYWcyMAkAAGgAAAACAAAAAAAAAAAUBQAAAAdXQVZFTEVUAAAAAAVCYWc1MAkAAGgAAAACAAAAAAAAAAAyBQAAAAdXQVZFTEVUAAAAAAZCYWcxMDAJAABoAAAAAgAAAAAAAAA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ZXQAAAABBQAAAApkb25hdGVEYXRhCQAAAgAAAAECAAAAGVlvdSBwYWlkIHRoZSB3cm9uZyBhbW91bnQAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAAAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABNUcmFuc2ZlclRyYW5zYWN0aW9uBAAAAAN0dHgFAAAAByRtYXRjaDAGAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAADc3R4BQAAAAckbWF0Y2gwBgcHkSncpw==", "chainId": 84, "height": 650129, "spentComplexity": 0 } View: original | compacted Prev: 32kGkj89KUW4ci8NGuHUXTBrGhMScP865vLDZBkySyhT Next: GN8tJPmxbWbXtCRvcWaE56yjth8Czs26jZPd9K6X5FHb Diff:
Old | New | Differences | |
---|---|---|---|
23 | 23 | ||
24 | 24 | let k = (100 * a) | |
25 | 25 | ||
26 | - | func l () = { | |
27 | - | let m = { | |
28 | - | let n = getInteger(this, d) | |
29 | - | if ($isInstanceOf(n, "Int")) | |
26 | + | let l = 20 | |
27 | + | ||
28 | + | let m = [1, 3, 5, 6, 2, 2, 4, 9, 10, 12, 5, 1, 9, 12, 5, 4, 1, 11, 12, 9] | |
29 | + | ||
30 | + | func n () = { | |
31 | + | let o = { | |
32 | + | let p = getInteger(this, d) | |
33 | + | if ($isInstanceOf(p, "Int")) | |
30 | 34 | then { | |
31 | - | let | |
32 | - | | |
35 | + | let q = p | |
36 | + | q | |
33 | 37 | } | |
34 | 38 | else 0 | |
35 | 39 | } | |
36 | - | ( | |
40 | + | (o + 1) | |
37 | 41 | } | |
38 | 42 | ||
39 | 43 | ||
40 | - | func | |
41 | - | let | |
42 | - | let | |
43 | - | if ($isInstanceOf( | |
44 | + | func r (s) = { | |
45 | + | let t = { | |
46 | + | let p = getInteger(this, s) | |
47 | + | if ($isInstanceOf(p, "Int")) | |
44 | 48 | then { | |
45 | - | let | |
46 | - | | |
49 | + | let t = p | |
50 | + | t | |
47 | 51 | } | |
48 | 52 | else 0 | |
49 | - | } | |
50 | - | r | |
51 | - | } | |
52 | - | ||
53 | - | ||
54 | - | func s (q) = { | |
55 | - | let t = { | |
56 | - | let n = getString(this, q) | |
57 | - | if ($isInstanceOf(n, "String")) | |
58 | - | then { | |
59 | - | let u = n | |
60 | - | u | |
61 | - | } | |
62 | - | else "" | |
63 | 53 | } | |
64 | 54 | t | |
65 | 55 | } | |
66 | 56 | ||
67 | 57 | ||
68 | - | func v (w) = if ((w == "1")) | |
69 | - | then 1 | |
70 | - | else if ((w == "2")) | |
71 | - | then 4 | |
72 | - | else if ((w == "3")) | |
73 | - | then 6 | |
74 | - | else throw("Неверный ID item") | |
75 | - | ||
76 | - | ||
77 | - | func x (y,w) = { | |
78 | - | let t = { | |
79 | - | let n = indexOf(y, (w + ":")) | |
80 | - | if ($isInstanceOf(n, "Int")) | |
58 | + | func u (v,w) = { | |
59 | + | let x = { | |
60 | + | let p = indexOf(v, (w + ":")) | |
61 | + | if ($isInstanceOf(p, "Int")) | |
81 | 62 | then { | |
82 | - | let | |
83 | - | toString( | |
63 | + | let y = p | |
64 | + | toString(y) | |
84 | 65 | } | |
85 | 66 | else "undefined" | |
86 | 67 | } | |
87 | - | | |
68 | + | x | |
88 | 69 | } | |
89 | 70 | ||
90 | 71 | ||
91 | - | @Callable(A) | |
92 | - | func buy (w) = { | |
93 | - | let B = toBase58String(A.transactionId) | |
94 | - | let C = toString(A.caller) | |
95 | - | let D = (C + "_items") | |
96 | - | let E = v(w) | |
97 | - | let F = (p((C + "_balance")) - E) | |
98 | - | let G = DataEntry((C + "_balance"), F) | |
99 | - | let y = s(D) | |
100 | - | let H = x(y, w) | |
101 | - | if ((H == "undefined")) | |
102 | - | then throw("This item not exist") | |
103 | - | else throw((("Новый список айтемов: " + w) + ":2")) | |
72 | + | @Callable(z) | |
73 | + | func buyItem (w) = { | |
74 | + | let A = toBase58String(z.transactionId) | |
75 | + | let B = toString(z.caller) | |
76 | + | if (if ((w > 0)) | |
77 | + | then (l >= w) | |
78 | + | else false) | |
79 | + | then { | |
80 | + | let C = m[w] | |
81 | + | let D = (r((B + "_balance")) - C) | |
82 | + | let E = DataEntry((B + "_balance"), D) | |
83 | + | let F = ((B + "_itemID_") + toString(w)) | |
84 | + | WriteSet([DataEntry(F, 1), DataEntry(((e + "_") + A), w), E]) | |
85 | + | } | |
86 | + | else throw("Item has not found") | |
104 | 87 | } | |
105 | 88 | ||
106 | 89 | ||
107 | 90 | ||
108 | - | @Callable( | |
91 | + | @Callable(z) | |
109 | 92 | func reset () = { | |
110 | - | let | |
111 | - | let | |
112 | - | WriteSet( | |
93 | + | let B = toString(z.caller) | |
94 | + | let G = [DataEntry(d, 0), DataEntry((B + "_balance"), 0)] | |
95 | + | WriteSet(G) | |
113 | 96 | } | |
114 | 97 | ||
115 | 98 | ||
116 | 99 | ||
117 | - | @Callable( | |
100 | + | @Callable(z) | |
118 | 101 | func donate () = { | |
119 | - | let | |
120 | - | let | |
121 | - | let | |
122 | - | let | |
123 | - | let | |
124 | - | let | |
125 | - | let | |
126 | - | if ( | |
102 | + | let H = n() | |
103 | + | let I = toBase58String(z.transactionId) | |
104 | + | let J = extract(z.payment) | |
105 | + | let B = toString(z.caller) | |
106 | + | let K = isDefined(J.assetId) | |
107 | + | let L = isDefined(J.assetId) | |
108 | + | let M = J.amount | |
109 | + | if (K) | |
127 | 110 | then throw("Bet amount must be in Waves") | |
128 | - | else if ( | |
111 | + | else if (L) | |
129 | 112 | then throw("Transaction's fee must be in Waves") | |
130 | 113 | else { | |
131 | - | let | |
114 | + | let N = if (if (if (if (if (if ((M == (f + b))) | |
132 | 115 | then true | |
133 | - | else ( | |
116 | + | else (M == (g + b))) | |
134 | 117 | then true | |
135 | - | else ( | |
118 | + | else (M == (h + b))) | |
136 | 119 | then true | |
137 | - | else ( | |
120 | + | else (M == (i + b))) | |
138 | 121 | then true | |
139 | - | else ( | |
122 | + | else (M == (j + b))) | |
140 | 123 | then true | |
141 | - | else ( | |
124 | + | else (M == (k + b))) | |
142 | 125 | then true | |
143 | 126 | else false | |
144 | - | if ( | |
127 | + | if (N) | |
145 | 128 | then { | |
146 | - | let | |
147 | - | let | |
148 | - | let | |
149 | - | let | |
150 | - | WriteSet( | |
129 | + | let O = ((M - b) / a) | |
130 | + | let P = (B + "_balance") | |
131 | + | let Q = (r(P) + (O * c)) | |
132 | + | let G = [DataEntry(d, H), DataEntry(P, Q), DataEntry(I, O)] | |
133 | + | WriteSet(G) | |
151 | 134 | } | |
152 | 135 | else throw("You paid the wrong amount") | |
153 | 136 | } | |
154 | 137 | } | |
155 | 138 | ||
156 | 139 | ||
157 | - | @Verifier( | |
158 | - | func | |
140 | + | @Verifier(R) | |
141 | + | func S () = if (sigVerify(R.bodyBytes, R.proofs[0], R.senderPublicKey)) | |
159 | 142 | then { | |
160 | - | let | |
161 | - | if ($isInstanceOf( | |
143 | + | let p = R | |
144 | + | if ($isInstanceOf(p, "TransferTransaction")) | |
162 | 145 | then { | |
163 | - | let | |
146 | + | let T = p | |
164 | 147 | true | |
165 | 148 | } | |
166 | - | else if ($isInstanceOf( | |
149 | + | else if ($isInstanceOf(p, "SetScriptTransaction")) | |
167 | 150 | then { | |
168 | - | let | |
151 | + | let U = p | |
169 | 152 | true | |
170 | 153 | } | |
171 | 154 | else false |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = ((100 * 1000) * 1000) | |
5 | 5 | ||
6 | 6 | let b = ((5 * a) / 1000) | |
7 | 7 | ||
8 | 8 | let c = 10 | |
9 | 9 | ||
10 | 10 | let d = "$DONATE_NUM" | |
11 | 11 | ||
12 | 12 | let e = "$BUY_ITEM" | |
13 | 13 | ||
14 | 14 | let f = (1 * a) | |
15 | 15 | ||
16 | 16 | let g = (5 * a) | |
17 | 17 | ||
18 | 18 | let h = (10 * a) | |
19 | 19 | ||
20 | 20 | let i = (20 * a) | |
21 | 21 | ||
22 | 22 | let j = (50 * a) | |
23 | 23 | ||
24 | 24 | let k = (100 * a) | |
25 | 25 | ||
26 | - | func l () = { | |
27 | - | let m = { | |
28 | - | let n = getInteger(this, d) | |
29 | - | if ($isInstanceOf(n, "Int")) | |
26 | + | let l = 20 | |
27 | + | ||
28 | + | let m = [1, 3, 5, 6, 2, 2, 4, 9, 10, 12, 5, 1, 9, 12, 5, 4, 1, 11, 12, 9] | |
29 | + | ||
30 | + | func n () = { | |
31 | + | let o = { | |
32 | + | let p = getInteger(this, d) | |
33 | + | if ($isInstanceOf(p, "Int")) | |
30 | 34 | then { | |
31 | - | let | |
32 | - | | |
35 | + | let q = p | |
36 | + | q | |
33 | 37 | } | |
34 | 38 | else 0 | |
35 | 39 | } | |
36 | - | ( | |
40 | + | (o + 1) | |
37 | 41 | } | |
38 | 42 | ||
39 | 43 | ||
40 | - | func | |
41 | - | let | |
42 | - | let | |
43 | - | if ($isInstanceOf( | |
44 | + | func r (s) = { | |
45 | + | let t = { | |
46 | + | let p = getInteger(this, s) | |
47 | + | if ($isInstanceOf(p, "Int")) | |
44 | 48 | then { | |
45 | - | let | |
46 | - | | |
49 | + | let t = p | |
50 | + | t | |
47 | 51 | } | |
48 | 52 | else 0 | |
49 | - | } | |
50 | - | r | |
51 | - | } | |
52 | - | ||
53 | - | ||
54 | - | func s (q) = { | |
55 | - | let t = { | |
56 | - | let n = getString(this, q) | |
57 | - | if ($isInstanceOf(n, "String")) | |
58 | - | then { | |
59 | - | let u = n | |
60 | - | u | |
61 | - | } | |
62 | - | else "" | |
63 | 53 | } | |
64 | 54 | t | |
65 | 55 | } | |
66 | 56 | ||
67 | 57 | ||
68 | - | func v (w) = if ((w == "1")) | |
69 | - | then 1 | |
70 | - | else if ((w == "2")) | |
71 | - | then 4 | |
72 | - | else if ((w == "3")) | |
73 | - | then 6 | |
74 | - | else throw("Неверный ID item") | |
75 | - | ||
76 | - | ||
77 | - | func x (y,w) = { | |
78 | - | let t = { | |
79 | - | let n = indexOf(y, (w + ":")) | |
80 | - | if ($isInstanceOf(n, "Int")) | |
58 | + | func u (v,w) = { | |
59 | + | let x = { | |
60 | + | let p = indexOf(v, (w + ":")) | |
61 | + | if ($isInstanceOf(p, "Int")) | |
81 | 62 | then { | |
82 | - | let | |
83 | - | toString( | |
63 | + | let y = p | |
64 | + | toString(y) | |
84 | 65 | } | |
85 | 66 | else "undefined" | |
86 | 67 | } | |
87 | - | | |
68 | + | x | |
88 | 69 | } | |
89 | 70 | ||
90 | 71 | ||
91 | - | @Callable(A) | |
92 | - | func buy (w) = { | |
93 | - | let B = toBase58String(A.transactionId) | |
94 | - | let C = toString(A.caller) | |
95 | - | let D = (C + "_items") | |
96 | - | let E = v(w) | |
97 | - | let F = (p((C + "_balance")) - E) | |
98 | - | let G = DataEntry((C + "_balance"), F) | |
99 | - | let y = s(D) | |
100 | - | let H = x(y, w) | |
101 | - | if ((H == "undefined")) | |
102 | - | then throw("This item not exist") | |
103 | - | else throw((("Новый список айтемов: " + w) + ":2")) | |
72 | + | @Callable(z) | |
73 | + | func buyItem (w) = { | |
74 | + | let A = toBase58String(z.transactionId) | |
75 | + | let B = toString(z.caller) | |
76 | + | if (if ((w > 0)) | |
77 | + | then (l >= w) | |
78 | + | else false) | |
79 | + | then { | |
80 | + | let C = m[w] | |
81 | + | let D = (r((B + "_balance")) - C) | |
82 | + | let E = DataEntry((B + "_balance"), D) | |
83 | + | let F = ((B + "_itemID_") + toString(w)) | |
84 | + | WriteSet([DataEntry(F, 1), DataEntry(((e + "_") + A), w), E]) | |
85 | + | } | |
86 | + | else throw("Item has not found") | |
104 | 87 | } | |
105 | 88 | ||
106 | 89 | ||
107 | 90 | ||
108 | - | @Callable( | |
91 | + | @Callable(z) | |
109 | 92 | func reset () = { | |
110 | - | let | |
111 | - | let | |
112 | - | WriteSet( | |
93 | + | let B = toString(z.caller) | |
94 | + | let G = [DataEntry(d, 0), DataEntry((B + "_balance"), 0)] | |
95 | + | WriteSet(G) | |
113 | 96 | } | |
114 | 97 | ||
115 | 98 | ||
116 | 99 | ||
117 | - | @Callable( | |
100 | + | @Callable(z) | |
118 | 101 | func donate () = { | |
119 | - | let | |
120 | - | let | |
121 | - | let | |
122 | - | let | |
123 | - | let | |
124 | - | let | |
125 | - | let | |
126 | - | if ( | |
102 | + | let H = n() | |
103 | + | let I = toBase58String(z.transactionId) | |
104 | + | let J = extract(z.payment) | |
105 | + | let B = toString(z.caller) | |
106 | + | let K = isDefined(J.assetId) | |
107 | + | let L = isDefined(J.assetId) | |
108 | + | let M = J.amount | |
109 | + | if (K) | |
127 | 110 | then throw("Bet amount must be in Waves") | |
128 | - | else if ( | |
111 | + | else if (L) | |
129 | 112 | then throw("Transaction's fee must be in Waves") | |
130 | 113 | else { | |
131 | - | let | |
114 | + | let N = if (if (if (if (if (if ((M == (f + b))) | |
132 | 115 | then true | |
133 | - | else ( | |
116 | + | else (M == (g + b))) | |
134 | 117 | then true | |
135 | - | else ( | |
118 | + | else (M == (h + b))) | |
136 | 119 | then true | |
137 | - | else ( | |
120 | + | else (M == (i + b))) | |
138 | 121 | then true | |
139 | - | else ( | |
122 | + | else (M == (j + b))) | |
140 | 123 | then true | |
141 | - | else ( | |
124 | + | else (M == (k + b))) | |
142 | 125 | then true | |
143 | 126 | else false | |
144 | - | if ( | |
127 | + | if (N) | |
145 | 128 | then { | |
146 | - | let | |
147 | - | let | |
148 | - | let | |
149 | - | let | |
150 | - | WriteSet( | |
129 | + | let O = ((M - b) / a) | |
130 | + | let P = (B + "_balance") | |
131 | + | let Q = (r(P) + (O * c)) | |
132 | + | let G = [DataEntry(d, H), DataEntry(P, Q), DataEntry(I, O)] | |
133 | + | WriteSet(G) | |
151 | 134 | } | |
152 | 135 | else throw("You paid the wrong amount") | |
153 | 136 | } | |
154 | 137 | } | |
155 | 138 | ||
156 | 139 | ||
157 | - | @Verifier( | |
158 | - | func | |
140 | + | @Verifier(R) | |
141 | + | func S () = if (sigVerify(R.bodyBytes, R.proofs[0], R.senderPublicKey)) | |
159 | 142 | then { | |
160 | - | let | |
161 | - | if ($isInstanceOf( | |
143 | + | let p = R | |
144 | + | if ($isInstanceOf(p, "TransferTransaction")) | |
162 | 145 | then { | |
163 | - | let | |
146 | + | let T = p | |
164 | 147 | true | |
165 | 148 | } | |
166 | - | else if ($isInstanceOf( | |
149 | + | else if ($isInstanceOf(p, "SetScriptTransaction")) | |
167 | 150 | then { | |
168 | - | let | |
151 | + | let U = p | |
169 | 152 | true | |
170 | 153 | } | |
171 | 154 | else false | |
172 | 155 | } | |
173 | 156 | else false | |
174 | 157 |
github/deemru/w8io/026f985 48.76 ms ◑