tx · C61ebeiM7iWGYJUJUebHmLWEMcbNizcbDkpqYELujFpe 3Mzz3QCpMamT89CaFaovqXpnCdiUaKtLZ4D: -0.01400000 Waves 2019.06.22 18:06 [553411] smart account 3Mzz3QCpMamT89CaFaovqXpnCdiUaKtLZ4D > SELF 0.00000000 Waves
{ "type": 13, "id": "C61ebeiM7iWGYJUJUebHmLWEMcbNizcbDkpqYELujFpe", "fee": 1400000, "feeAssetId": null, "timestamp": 1561216022722, "version": 1, "sender": "3Mzz3QCpMamT89CaFaovqXpnCdiUaKtLZ4D", "senderPublicKey": "BJRaSW2saRv7CcFs3mSYpaVFQSFpZq9rGKnCcRKuKgWv", "proofs": [ "43TwVeb3tiimzg6Xscu218XYF1GYRCaLsCWjjVx7xexvifma8KtTE4kxCRcqe1tPJwFW7ABL2EMmH3KDiVuC2GaX" ], "script": "base64:AAIDAAAAAAAAAAAAAAAdAAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAEAAAAKZ2V0S2V5SXRlbQAAAAIAAAAIc3VwcGxpZXIAAAAFdGl0bGUJAAEsAAAAAgIAAAAFaXRlbV8JAAJYAAAAAQkAAfcAAAABCQABmwAAAAEJAAEsAAAAAgUAAAAIc3VwcGxpZXIFAAAABXRpdGxlAQAAABJnZXRLZXlJdGVtU3VwcGxpZXIAAAABAAAABGl0ZW0JAAEsAAAAAgUAAAAEaXRlbQIAAAAGX293bmVyAQAAABVnZXRLZXlCYWxhbmNlU3VwcGxpZXIAAAABAAAABGl0ZW0JAAEsAAAAAgUAAAAEaXRlbQIAAAAIX2JhbGFuY2UBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACB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ZwAAAAIFAAAAB2NvbW1pdHMFAAAABlZPVEVSUwkAAAIAAAABAgAAAAltYXggdm90ZXMDCQEAAAACIT0AAAACCQEAAAAOZ2V0VmFsdWVDb21taXQAAAACBQAAAARpdGVtBQAAAAR1c2VyBQAAAAROT05FCQAAAgAAAAECAAAAFGFscmVhZHkgcGFydGljaXBhdGVkAwkAAAAAAAACCQEAAAASZ2V0S2V5SXRlbVN1cHBsaWVyAAAAAQUAAAAEaXRlbQUAAAAETk9ORQkAAAIAAAABAgAAAAlub3QgZXhpc3QDAwkBAAAAAiE9AAAAAgUAAAAGc3RhdHVzBQAAAAROT05FCQEAAAACIT0AAAACBQAAAAZzdGF0dXMFAAAABlZPVElORwcJAAACAAAAAQIAAAAMbm90IHBvc3NpYmxlCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAMZ2V0S2V5Q29tbWl0AAAAAgUAAAAEaXRlbQUAAAAEdXNlcgUAAAAEaGFzaAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEmdldEtleUNvbW1pdHNDb3VudAAAAAEFAAAABGl0ZW0JAABkAAAAAgUAAAAHY29tbWl0cwAAAAAAAAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEGdldEtleUl0ZW1TdGF0dXMAAAABBQAAAARpdGVtAwkAAAAAAAACBQAAAAdjb21taXRzBQAAAAZWT1RFUlMFAAAABlJFVkVBTAUAAAAGVk9USU5HBQAAAANuaWwAAAAAkzpzfg==", "chainId": 84, "height": 553411, "spentComplexity": 0 } View: original | compacted Prev: 5Aoq76tGWqzsEqxcGnjCgH7a69CvCm7jyV6jF6KXGYGa Next: 7FbgU7APpeQemGDYYZ9Kgh1xpN6Cahwh9JihgpgAGkBY Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "none" | |
5 | 5 | ||
6 | - | func b (c,d) = ("item_" + toBase58String(sha256(toBytes((c + d))))) | |
6 | + | let b = 3 | |
7 | + | ||
8 | + | let c = 2 | |
9 | + | ||
10 | + | let d = "voting" | |
11 | + | ||
12 | + | let e = "reveal" | |
13 | + | ||
14 | + | let f = "featured" | |
15 | + | ||
16 | + | let g = "delisted" | |
17 | + | ||
18 | + | func h (i,j) = ("item_" + toBase58String(sha256(toBytes((i + j))))) | |
7 | 19 | ||
8 | 20 | ||
9 | - | func | |
21 | + | func k (l) = (l + "_owner") | |
10 | 22 | ||
11 | 23 | ||
12 | - | func | |
24 | + | func m (l) = (l + "_balance") | |
13 | 25 | ||
14 | 26 | ||
15 | - | func | |
27 | + | func n (l) = (l + "_price") | |
16 | 28 | ||
17 | 29 | ||
18 | - | func | |
30 | + | func o (l) = (l + "_data") | |
19 | 31 | ||
20 | 32 | ||
21 | - | func | |
33 | + | func p (q,l) = (((l + "_") + q) + "_cnt") | |
22 | 34 | ||
23 | 35 | ||
24 | - | func | |
25 | - | let | |
26 | - | let | |
27 | - | if ($isInstanceOf( | |
36 | + | func r (s) = { | |
37 | + | let t = { | |
38 | + | let u = getString(this, s) | |
39 | + | if ($isInstanceOf(u, "String")) | |
28 | 40 | then { | |
29 | - | let | |
30 | - | | |
41 | + | let v = u | |
42 | + | v | |
31 | 43 | } | |
32 | 44 | else a | |
33 | 45 | } | |
34 | - | | |
46 | + | t | |
35 | 47 | } | |
36 | 48 | ||
37 | 49 | ||
38 | - | func | |
39 | - | let | |
40 | - | let | |
41 | - | if ($isInstanceOf( | |
50 | + | func w (s) = { | |
51 | + | let x = { | |
52 | + | let u = getInteger(this, s) | |
53 | + | if ($isInstanceOf(u, "Int")) | |
42 | 54 | then { | |
43 | - | let | |
44 | - | | |
55 | + | let v = u | |
56 | + | v | |
45 | 57 | } | |
46 | 58 | else 0 | |
47 | 59 | } | |
48 | - | | |
60 | + | x | |
49 | 61 | } | |
50 | 62 | ||
51 | 63 | ||
52 | - | func | |
64 | + | func y (l) = r(k(l)) | |
53 | 65 | ||
54 | 66 | ||
55 | - | func | |
67 | + | func z (l) = w(n(l)) | |
56 | 68 | ||
57 | 69 | ||
58 | - | func | |
70 | + | func A (q,l) = w(p(q, l)) | |
59 | 71 | ||
60 | 72 | ||
61 | - | func | |
73 | + | func B (C) = w(m(C)) | |
62 | 74 | ||
63 | 75 | ||
64 | - | @Callable(x) | |
65 | - | func purchaseOld (y) = { | |
66 | - | let z = extract(x.payment) | |
67 | - | if (isDefined(z.assetId)) | |
76 | + | func D (l,q) = (((l + "_") + q) + "_commit") | |
77 | + | ||
78 | + | ||
79 | + | func E (l,q) = r(D(l, q)) | |
80 | + | ||
81 | + | ||
82 | + | func F (l) = (l + "_comcnt") | |
83 | + | ||
84 | + | ||
85 | + | func G (l) = w(F(l)) | |
86 | + | ||
87 | + | ||
88 | + | func H (l,q) = (((l + "_") + q) + "_reveal") | |
89 | + | ||
90 | + | ||
91 | + | func I (l,q) = r(D(l, q)) | |
92 | + | ||
93 | + | ||
94 | + | func J (l) = (l + "_status") | |
95 | + | ||
96 | + | ||
97 | + | func K (l) = r(J(l)) | |
98 | + | ||
99 | + | ||
100 | + | func L (l,M) = ((l + "_res:") + M) | |
101 | + | ||
102 | + | ||
103 | + | func N (l,M) = r(L(l, M)) | |
104 | + | ||
105 | + | ||
106 | + | @Callable(O) | |
107 | + | func purchaseOld (P) = { | |
108 | + | let Q = extract(O.payment) | |
109 | + | if (isDefined(Q.assetId)) | |
68 | 110 | then throw("can use WAVES only at the moment") | |
69 | 111 | else { | |
70 | - | let | |
71 | - | let | |
72 | - | let | |
73 | - | if ($isInstanceOf( | |
112 | + | let R = toBase58String(O.caller.bytes) | |
113 | + | let S = { | |
114 | + | let u = getInteger(this, (("item_" + P) + "_coupon_price")) | |
115 | + | if ($isInstanceOf(u, "Int")) | |
74 | 116 | then { | |
75 | - | let | |
76 | - | | |
117 | + | let v = u | |
118 | + | v | |
77 | 119 | } | |
78 | 120 | else 0 | |
79 | 121 | } | |
80 | - | if (( | |
122 | + | if ((S > Q.amount)) | |
81 | 123 | then throw("purschase amount cannot be less than item price") | |
82 | - | else if (( | |
124 | + | else if ((Q.amount > S)) | |
83 | 125 | then throw("purchase amount cannot be higher than item price") | |
84 | - | else WriteSet([DataEntry(((("status:purchase_item_" + | |
126 | + | else WriteSet([DataEntry(((("status:purchase_item_" + P) + "_customer_") + R), "confirmed"), DataEntry(((("price:purchase_item_" + P) + "_customer_") + R), S)]) | |
85 | 127 | } | |
86 | 128 | } | |
87 | 129 | ||
88 | 130 | ||
89 | 131 | ||
90 | - | @Callable( | |
91 | - | func addItem ( | |
92 | - | let | |
93 | - | let | |
94 | - | if ((0 >= | |
132 | + | @Callable(O) | |
133 | + | func addItem (j,S,T) = { | |
134 | + | let U = toBase58String(O.caller.bytes) | |
135 | + | let l = h(U, j) | |
136 | + | if ((0 >= S)) | |
95 | 137 | then throw("purchase amount cannot be less than item price") | |
96 | - | else if (( | |
138 | + | else if ((y(l) != a)) | |
97 | 139 | then throw("an items is already exist") | |
98 | - | else WriteSet([DataEntry( | |
140 | + | else WriteSet([DataEntry(k(l), U), DataEntry(n(l), S), DataEntry(o(l), T)]) | |
99 | 141 | } | |
100 | 142 | ||
101 | 143 | ||
102 | 144 | ||
103 | - | @Callable( | |
104 | - | func purchase ( | |
105 | - | let | |
106 | - | if (isDefined( | |
145 | + | @Callable(O) | |
146 | + | func purchase (l) = { | |
147 | + | let Q = extract(O.payment) | |
148 | + | if (isDefined(Q.assetId)) | |
107 | 149 | then throw("WAVES tokens only at the moment") | |
108 | 150 | else { | |
109 | - | let | |
110 | - | let | |
111 | - | let | |
112 | - | if (( | |
151 | + | let V = toBase58String(O.caller.bytes) | |
152 | + | let S = z(l) | |
153 | + | let U = y(l) | |
154 | + | if ((S > Q.amount)) | |
113 | 155 | then throw("purchase amount cannot be less than item price") | |
114 | - | else if (( | |
156 | + | else if ((Q.amount > S)) | |
115 | 157 | then throw("purchase amount cannot be higher than item price") | |
116 | - | else if (( | |
158 | + | else if ((U == a)) | |
117 | 159 | then throw("supplier does not exist") | |
118 | - | else WriteSet([DataEntry( | |
160 | + | else WriteSet([DataEntry(p(V, l), (A(V, l) + 1)), DataEntry(m(U), (B(U) + Q.amount))]) | |
119 | 161 | } | |
120 | 162 | } | |
121 | 163 | ||
122 | 164 | ||
123 | 165 | ||
124 | - | @Callable( | |
166 | + | @Callable(O) | |
125 | 167 | func withdraw () = { | |
126 | - | let | |
127 | - | let | |
128 | - | if ((0 >= | |
168 | + | let U = toBase58String(O.caller.bytes) | |
169 | + | let W = B(U) | |
170 | + | if ((0 >= W)) | |
129 | 171 | then throw("insufficient balance") | |
130 | - | else ScriptResult(WriteSet([DataEntry(g(D), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(D), F, unit)])) | |
172 | + | else ScriptResult(WriteSet([DataEntry(m(U), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(U), W, unit)])) | |
173 | + | } | |
174 | + | ||
175 | + | ||
176 | + | ||
177 | + | @Callable(O) | |
178 | + | func voteCommit (l,X) = { | |
179 | + | let q = toBase58String(O.caller.bytes) | |
180 | + | let Y = G(l) | |
181 | + | let Z = K(l) | |
182 | + | if ((Y >= b)) | |
183 | + | then throw("max votes") | |
184 | + | else if ((E(l, q) != a)) | |
185 | + | then throw("already participated") | |
186 | + | else if ((k(l) == a)) | |
187 | + | then throw("not exist") | |
188 | + | else if (if ((Z != a)) | |
189 | + | then (Z != d) | |
190 | + | else false) | |
191 | + | then throw("not possible") | |
192 | + | else WriteSet([DataEntry(D(l, q), X), DataEntry(F(l), (Y + 1)), DataEntry(J(l), if ((Y == b)) | |
193 | + | then e | |
194 | + | else d)]) | |
131 | 195 | } | |
132 | 196 | ||
133 | 197 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "none" | |
5 | 5 | ||
6 | - | func b (c,d) = ("item_" + toBase58String(sha256(toBytes((c + d))))) | |
6 | + | let b = 3 | |
7 | + | ||
8 | + | let c = 2 | |
9 | + | ||
10 | + | let d = "voting" | |
11 | + | ||
12 | + | let e = "reveal" | |
13 | + | ||
14 | + | let f = "featured" | |
15 | + | ||
16 | + | let g = "delisted" | |
17 | + | ||
18 | + | func h (i,j) = ("item_" + toBase58String(sha256(toBytes((i + j))))) | |
7 | 19 | ||
8 | 20 | ||
9 | - | func | |
21 | + | func k (l) = (l + "_owner") | |
10 | 22 | ||
11 | 23 | ||
12 | - | func | |
24 | + | func m (l) = (l + "_balance") | |
13 | 25 | ||
14 | 26 | ||
15 | - | func | |
27 | + | func n (l) = (l + "_price") | |
16 | 28 | ||
17 | 29 | ||
18 | - | func | |
30 | + | func o (l) = (l + "_data") | |
19 | 31 | ||
20 | 32 | ||
21 | - | func | |
33 | + | func p (q,l) = (((l + "_") + q) + "_cnt") | |
22 | 34 | ||
23 | 35 | ||
24 | - | func | |
25 | - | let | |
26 | - | let | |
27 | - | if ($isInstanceOf( | |
36 | + | func r (s) = { | |
37 | + | let t = { | |
38 | + | let u = getString(this, s) | |
39 | + | if ($isInstanceOf(u, "String")) | |
28 | 40 | then { | |
29 | - | let | |
30 | - | | |
41 | + | let v = u | |
42 | + | v | |
31 | 43 | } | |
32 | 44 | else a | |
33 | 45 | } | |
34 | - | | |
46 | + | t | |
35 | 47 | } | |
36 | 48 | ||
37 | 49 | ||
38 | - | func | |
39 | - | let | |
40 | - | let | |
41 | - | if ($isInstanceOf( | |
50 | + | func w (s) = { | |
51 | + | let x = { | |
52 | + | let u = getInteger(this, s) | |
53 | + | if ($isInstanceOf(u, "Int")) | |
42 | 54 | then { | |
43 | - | let | |
44 | - | | |
55 | + | let v = u | |
56 | + | v | |
45 | 57 | } | |
46 | 58 | else 0 | |
47 | 59 | } | |
48 | - | | |
60 | + | x | |
49 | 61 | } | |
50 | 62 | ||
51 | 63 | ||
52 | - | func | |
64 | + | func y (l) = r(k(l)) | |
53 | 65 | ||
54 | 66 | ||
55 | - | func | |
67 | + | func z (l) = w(n(l)) | |
56 | 68 | ||
57 | 69 | ||
58 | - | func | |
70 | + | func A (q,l) = w(p(q, l)) | |
59 | 71 | ||
60 | 72 | ||
61 | - | func | |
73 | + | func B (C) = w(m(C)) | |
62 | 74 | ||
63 | 75 | ||
64 | - | @Callable(x) | |
65 | - | func purchaseOld (y) = { | |
66 | - | let z = extract(x.payment) | |
67 | - | if (isDefined(z.assetId)) | |
76 | + | func D (l,q) = (((l + "_") + q) + "_commit") | |
77 | + | ||
78 | + | ||
79 | + | func E (l,q) = r(D(l, q)) | |
80 | + | ||
81 | + | ||
82 | + | func F (l) = (l + "_comcnt") | |
83 | + | ||
84 | + | ||
85 | + | func G (l) = w(F(l)) | |
86 | + | ||
87 | + | ||
88 | + | func H (l,q) = (((l + "_") + q) + "_reveal") | |
89 | + | ||
90 | + | ||
91 | + | func I (l,q) = r(D(l, q)) | |
92 | + | ||
93 | + | ||
94 | + | func J (l) = (l + "_status") | |
95 | + | ||
96 | + | ||
97 | + | func K (l) = r(J(l)) | |
98 | + | ||
99 | + | ||
100 | + | func L (l,M) = ((l + "_res:") + M) | |
101 | + | ||
102 | + | ||
103 | + | func N (l,M) = r(L(l, M)) | |
104 | + | ||
105 | + | ||
106 | + | @Callable(O) | |
107 | + | func purchaseOld (P) = { | |
108 | + | let Q = extract(O.payment) | |
109 | + | if (isDefined(Q.assetId)) | |
68 | 110 | then throw("can use WAVES only at the moment") | |
69 | 111 | else { | |
70 | - | let | |
71 | - | let | |
72 | - | let | |
73 | - | if ($isInstanceOf( | |
112 | + | let R = toBase58String(O.caller.bytes) | |
113 | + | let S = { | |
114 | + | let u = getInteger(this, (("item_" + P) + "_coupon_price")) | |
115 | + | if ($isInstanceOf(u, "Int")) | |
74 | 116 | then { | |
75 | - | let | |
76 | - | | |
117 | + | let v = u | |
118 | + | v | |
77 | 119 | } | |
78 | 120 | else 0 | |
79 | 121 | } | |
80 | - | if (( | |
122 | + | if ((S > Q.amount)) | |
81 | 123 | then throw("purschase amount cannot be less than item price") | |
82 | - | else if (( | |
124 | + | else if ((Q.amount > S)) | |
83 | 125 | then throw("purchase amount cannot be higher than item price") | |
84 | - | else WriteSet([DataEntry(((("status:purchase_item_" + | |
126 | + | else WriteSet([DataEntry(((("status:purchase_item_" + P) + "_customer_") + R), "confirmed"), DataEntry(((("price:purchase_item_" + P) + "_customer_") + R), S)]) | |
85 | 127 | } | |
86 | 128 | } | |
87 | 129 | ||
88 | 130 | ||
89 | 131 | ||
90 | - | @Callable( | |
91 | - | func addItem ( | |
92 | - | let | |
93 | - | let | |
94 | - | if ((0 >= | |
132 | + | @Callable(O) | |
133 | + | func addItem (j,S,T) = { | |
134 | + | let U = toBase58String(O.caller.bytes) | |
135 | + | let l = h(U, j) | |
136 | + | if ((0 >= S)) | |
95 | 137 | then throw("purchase amount cannot be less than item price") | |
96 | - | else if (( | |
138 | + | else if ((y(l) != a)) | |
97 | 139 | then throw("an items is already exist") | |
98 | - | else WriteSet([DataEntry( | |
140 | + | else WriteSet([DataEntry(k(l), U), DataEntry(n(l), S), DataEntry(o(l), T)]) | |
99 | 141 | } | |
100 | 142 | ||
101 | 143 | ||
102 | 144 | ||
103 | - | @Callable( | |
104 | - | func purchase ( | |
105 | - | let | |
106 | - | if (isDefined( | |
145 | + | @Callable(O) | |
146 | + | func purchase (l) = { | |
147 | + | let Q = extract(O.payment) | |
148 | + | if (isDefined(Q.assetId)) | |
107 | 149 | then throw("WAVES tokens only at the moment") | |
108 | 150 | else { | |
109 | - | let | |
110 | - | let | |
111 | - | let | |
112 | - | if (( | |
151 | + | let V = toBase58String(O.caller.bytes) | |
152 | + | let S = z(l) | |
153 | + | let U = y(l) | |
154 | + | if ((S > Q.amount)) | |
113 | 155 | then throw("purchase amount cannot be less than item price") | |
114 | - | else if (( | |
156 | + | else if ((Q.amount > S)) | |
115 | 157 | then throw("purchase amount cannot be higher than item price") | |
116 | - | else if (( | |
158 | + | else if ((U == a)) | |
117 | 159 | then throw("supplier does not exist") | |
118 | - | else WriteSet([DataEntry( | |
160 | + | else WriteSet([DataEntry(p(V, l), (A(V, l) + 1)), DataEntry(m(U), (B(U) + Q.amount))]) | |
119 | 161 | } | |
120 | 162 | } | |
121 | 163 | ||
122 | 164 | ||
123 | 165 | ||
124 | - | @Callable( | |
166 | + | @Callable(O) | |
125 | 167 | func withdraw () = { | |
126 | - | let | |
127 | - | let | |
128 | - | if ((0 >= | |
168 | + | let U = toBase58String(O.caller.bytes) | |
169 | + | let W = B(U) | |
170 | + | if ((0 >= W)) | |
129 | 171 | then throw("insufficient balance") | |
130 | - | else ScriptResult(WriteSet([DataEntry(g(D), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(D), F, unit)])) | |
172 | + | else ScriptResult(WriteSet([DataEntry(m(U), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(U), W, unit)])) | |
173 | + | } | |
174 | + | ||
175 | + | ||
176 | + | ||
177 | + | @Callable(O) | |
178 | + | func voteCommit (l,X) = { | |
179 | + | let q = toBase58String(O.caller.bytes) | |
180 | + | let Y = G(l) | |
181 | + | let Z = K(l) | |
182 | + | if ((Y >= b)) | |
183 | + | then throw("max votes") | |
184 | + | else if ((E(l, q) != a)) | |
185 | + | then throw("already participated") | |
186 | + | else if ((k(l) == a)) | |
187 | + | then throw("not exist") | |
188 | + | else if (if ((Z != a)) | |
189 | + | then (Z != d) | |
190 | + | else false) | |
191 | + | then throw("not possible") | |
192 | + | else WriteSet([DataEntry(D(l, q), X), DataEntry(F(l), (Y + 1)), DataEntry(J(l), if ((Y == b)) | |
193 | + | then e | |
194 | + | else d)]) | |
131 | 195 | } | |
132 | 196 | ||
133 | 197 |
github/deemru/w8io/026f985 56.34 ms ◑