tx · C3pWFFfWowQv1Dy6EkZtmf4c7TYs3e45SAhFRRHV26Bi 3MpVAH8ceFwtVkkznPe4MEitHvCVjpDsc93: -0.01000000 Waves 2019.06.26 19:16 [559332] smart account 3MpVAH8ceFwtVkkznPe4MEitHvCVjpDsc93 > SELF 0.00000000 Waves
{ "type": 13, "id": "C3pWFFfWowQv1Dy6EkZtmf4c7TYs3e45SAhFRRHV26Bi", "fee": 1000000, "feeAssetId": null, "timestamp": 1561562214217, "version": 1, "sender": "3MpVAH8ceFwtVkkznPe4MEitHvCVjpDsc93", "senderPublicKey": "C4jo949SSpPptY37q1BbXopaDjmvrQ8d4id63hWziJNb", "proofs": [ "6f5bKZDkHyrYYMQLHDHVPHXeevMnYHf1KTkZ5PPnUwgv9gtArshqqgn4Png9eVpan26eUWqDqftoMZQLCoqqZP7" ], "script": "base64:AAIDAAAAAAAAAAAAAAAdAAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAAETk9ORQUAAAADc3RyAQAAAA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nRyeQAAAAIJAQAAAA9nZXRLZXlWb3RlQ291bnQAAAACBQAAAARpdGVtBQAAAAR2b3RlBQAAAAxuZXdWb3RlQ291bnQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABBnZXRLZXlJdGVtU3RhdHVzAAAAAQUAAAAEaXRlbQMJAABnAAAAAgUAAAAMbmV3Vm90ZUNvdW50BQAAAAZRVU9SVU0FAAAABHZvdGUFAAAABlJFVkVBTAUAAAADbmlsAAAAAFdb9to=", "chainId": 84, "height": 559332, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = "none" | |
5 | + | ||
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) = { | |
19 | + | let j = { | |
20 | + | let k = getInteger(this, i) | |
21 | + | if ($isInstanceOf(k, "Int")) | |
22 | + | then { | |
23 | + | let l = k | |
24 | + | l | |
25 | + | } | |
26 | + | else 0 | |
27 | + | } | |
28 | + | j | |
29 | + | } | |
30 | + | ||
31 | + | ||
32 | + | func m (i) = { | |
33 | + | let n = { | |
34 | + | let k = getString(this, i) | |
35 | + | if ($isInstanceOf(k, "String")) | |
36 | + | then { | |
37 | + | let l = k | |
38 | + | l | |
39 | + | } | |
40 | + | else a | |
41 | + | } | |
42 | + | n | |
43 | + | } | |
44 | + | ||
45 | + | ||
46 | + | func o (p) = (p + "_price") | |
47 | + | ||
48 | + | ||
49 | + | func q (p) = h(o(p)) | |
50 | + | ||
51 | + | ||
52 | + | func r (s,p) = (((p + "_") + s) + "_cnt") | |
53 | + | ||
54 | + | ||
55 | + | func t (s,p) = h(r(s, p)) | |
56 | + | ||
57 | + | ||
58 | + | func u (v,w) = ("item_" + toBase58String(sha256(toBytes((v + w))))) | |
59 | + | ||
60 | + | ||
61 | + | func x (p) = (p + "_data") | |
62 | + | ||
63 | + | ||
64 | + | func y (p) = (p + "_owner") | |
65 | + | ||
66 | + | ||
67 | + | func z (p) = m(y(p)) | |
68 | + | ||
69 | + | ||
70 | + | func A (B) = (B + "_balance") | |
71 | + | ||
72 | + | ||
73 | + | func C (B) = h(A(B)) | |
74 | + | ||
75 | + | ||
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 + "_comcnt") | |
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)) | |
111 | + | then throw("purchase amount cannot be less than item price") | |
112 | + | else if ((z(p) != a)) | |
113 | + | then throw("an item is already exist") | |
114 | + | else WriteSet([DataEntry(y(p), R), DataEntry(o(p), P), DataEntry(x(p), Q)]) | |
115 | + | } | |
116 | + | ||
117 | + | ||
118 | + | ||
119 | + | @Callable(O) | |
120 | + | func purchase (p) = { | |
121 | + | let S = extract(O.payment) | |
122 | + | if (isDefined(S.assetId)) | |
123 | + | then throw("Waves tokens only at the moment") | |
124 | + | else { | |
125 | + | let T = toBase58String(O.caller.bytes) | |
126 | + | let P = q(p) | |
127 | + | let R = z(p) | |
128 | + | if ((P > S.amount)) | |
129 | + | then throw("purchase amount cannon be less than item price") | |
130 | + | else if ((P > S.amount)) | |
131 | + | then throw("purchase amount cannon be highter than item price") | |
132 | + | else if ((R == a)) | |
133 | + | then throw("supplier does not exist") | |
134 | + | else WriteSet([DataEntry(r(T, p), (t(T, p) + 1)), DataEntry(A(R), (C(R) + S.amount))]) | |
135 | + | } | |
136 | + | } | |
137 | + | ||
138 | + | ||
139 | + | ||
140 | + | @Callable(O) | |
141 | + | func withdraw () = { | |
142 | + | let R = toBase58String(O.caller.bytes) | |
143 | + | let U = C(R) | |
144 | + | if ((0 >= U)) | |
145 | + | then throw("insuffient balance") | |
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 >= b)) | |
157 | + | then throw("reached max num of voters") | |
158 | + | else if ((E(p, s) != a)) | |
159 | + | then throw("user has already participated") | |
160 | + | else if ((y(p) == a)) | |
161 | + | then throw("item doen`t exist") | |
162 | + | else if (if ((X != a)) | |
163 | + | then (X != d) | |
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 == b)) | |
167 | + | then e | |
168 | + | else d)]) | |
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 ((b > G(p))) | |
181 | + | then throw("max num of voters hasnt reached yet") | |
182 | + | else if ((I(p, s) != a)) | |
183 | + | then throw("user has already participated") | |
184 | + | else if (if ((X != d)) | |
185 | + | then (X != e) | |
186 | + | else false) | |
187 | + | then throw("wrong status") | |
188 | + | else if (if ((M != f)) | |
189 | + | then (M != g) | |
190 | + | else false) | |
191 | + | then throw("wrong vote") | |
192 | + | else if (if ((X == f)) | |
193 | + | then true | |
194 | + | else (X == g)) | |
195 | + | then throw("vote has finished") | |
196 | + | else WriteSet([DataEntry(H(p, s), M), DataEntry(L(p, M), Z), DataEntry(J(p), if ((Z >= c)) | |
197 | + | then M | |
198 | + | else e)]) | |
199 | + | } | |
200 | + | ||
201 | + |
github/deemru/w8io/026f985 20.12 ms ◑