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