tx · GHW7a3uPTqoVsjsSsVqXxaUB1F5sMfeFbaFrqL61PVZA 3MpjwMAGCaNqNFRa34foE5sTfV6zb76bYja: -0.01000010 Waves 2021.07.08 14:11 [1604546] smart account 3MpjwMAGCaNqNFRa34foE5sTfV6zb76bYja > SELF 0.00000000 Waves
{ "type": 13, "id": "GHW7a3uPTqoVsjsSsVqXxaUB1F5sMfeFbaFrqL61PVZA", "fee": 1000010, "feeAssetId": null, "timestamp": 1625742718100, "version": 2, "chainId": 84, "sender": "3MpjwMAGCaNqNFRa34foE5sTfV6zb76bYja", "senderPublicKey": "7Cy4wXHvgCRHP6MMhu9tTdayLHr9P9Dc342DVcCoCPzm", "proofs": [ "39B6tVbS8VmAfgHZjWpy3ME57YS5c2RoJxG23t4MJ9xUn5NeA3kb6skRxgaLwfDRckYVKQ2K3QCCrprbtEvFyBGx" ], "script": "base64:AAIFAAAAAAAAAkQIAhIFCgMIAQgSAwoBCBIAGgoKAmExEgROT05FGhQKAmEyEg5nZXROdW1iZXJCeUtleRoJCgJhMxIDa2V5GgkKAmE0EgNudW0aDQoCYTUSByRtYXRjaDAaBwoCYTYSAWEaEQoCYTcSC2dldFN0ckJ5S2V5GgkKAmE4EgNzdHIaFQoCYTkSD2dldEtleUl0ZW1QcmljZRoKCgJiMRIEaXRlbRoXCgJiMhIRZ2V0VmFsdWVJdGVtUHJpY2UaGwoCYjMSFWdldEtleVVzZXJJdGVtQ291bnRlchoKCgJiNBIEdXNlchodCgJiNRIXZ2V0VmFsdWVVc2VySXRlbUNvdW50ZXIaEAoCYjYSCmdldEtleUl0ZW0aDgoCYjcSCHN1cHBsaWVyGgsKAmI4EgV0aXRsZRoUCgJiORIOZ2V0S2V5SXRlbURhdGEaGAoCYzESEmdldEtleUl0ZW1TdXBwbGllchoaCgJjMhIUZ2V0VmFsdWVJdGVtU3VwcGxpZXIaGwoCYzMSFWdldEtleUJhbGFuY2VTdXBwbGllchoNCgJjNBIHYWNjb3VudBodCgJjNRIXZ2V0V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": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8YVQTvj68zepSUv9UznKyuNaQGYJYwQPRxwvoDivMJA Next: 7Lfcqsp3pnmuFur37TzNQydAqcHybAbQi9hDGHxP4JKT 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 = "none" | |
5 | 5 | ||
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")) | |
6 | + | func b (c) = { | |
7 | + | let d = { | |
8 | + | let e = getInteger(this, c) | |
9 | + | if ($isInstanceOf(e, "Int")) | |
22 | 10 | then { | |
23 | - | let | |
24 | - | | |
11 | + | let f = e | |
12 | + | f | |
25 | 13 | } | |
26 | 14 | else 0 | |
27 | 15 | } | |
28 | - | | |
16 | + | d | |
29 | 17 | } | |
30 | 18 | ||
31 | 19 | ||
32 | - | func | |
33 | - | let | |
34 | - | let | |
35 | - | if ($isInstanceOf( | |
20 | + | func g (c) = { | |
21 | + | let h = { | |
22 | + | let e = getString(this, c) | |
23 | + | if ($isInstanceOf(e, "String")) | |
36 | 24 | then { | |
37 | - | let | |
38 | - | | |
25 | + | let f = e | |
26 | + | f | |
39 | 27 | } | |
40 | - | else | |
28 | + | else a | |
41 | 29 | } | |
42 | - | | |
30 | + | h | |
43 | 31 | } | |
44 | 32 | ||
45 | 33 | ||
46 | - | func | |
34 | + | func i (j) = (j + "_price") | |
47 | 35 | ||
48 | 36 | ||
49 | - | func | |
37 | + | func k (j) = b(i(j)) | |
50 | 38 | ||
51 | 39 | ||
52 | - | func | |
40 | + | func l (m,j) = (((j + "_") + m) + "_cnt") | |
53 | 41 | ||
54 | 42 | ||
55 | - | func | |
43 | + | func n (m,j) = b(l(m, j)) | |
56 | 44 | ||
57 | 45 | ||
58 | - | func | |
46 | + | func o (p,q) = ("item_" + toBase58String(sha256(toBytes((p + q))))) | |
59 | 47 | ||
60 | 48 | ||
61 | - | func | |
49 | + | func r (j) = (j + "_data") | |
62 | 50 | ||
63 | 51 | ||
64 | - | func | |
52 | + | func s (j) = (j + "_data") | |
65 | 53 | ||
66 | 54 | ||
67 | - | func | |
55 | + | func t (j) = g(s(j)) | |
68 | 56 | ||
69 | 57 | ||
70 | - | func | |
58 | + | func u (v) = (v + "_balance") | |
71 | 59 | ||
72 | 60 | ||
73 | - | func | |
61 | + | func w (v) = b(u(v)) | |
74 | 62 | ||
75 | 63 | ||
76 | - | func B (p,A) = h(z(p, A)) | |
77 | - | ||
78 | - | ||
79 | - | @Callable(C) | |
80 | - | func voteCommit (p,D) = { | |
81 | - | let r = toBase58String(C.caller.bytes) | |
82 | - | let E = u(p) | |
83 | - | let F = y(p) | |
84 | - | if ((E >= a)) | |
85 | - | then throw("osiągnięto maksymaną liczbę głosujących") | |
86 | - | else if ((s(p, r) != g)) | |
87 | - | then throw("użtykownik już głosuje") | |
88 | - | else if ((o(p) == g)) | |
89 | - | then throw("nie istnieje taki przedmiot") | |
90 | - | else if (if ((F != g)) | |
91 | - | then (F != c) | |
92 | - | else false) | |
93 | - | then throw("głosowanie nie jest możliwe") | |
94 | - | else [StringEntry(q(p, r), D), IntegerEntry(t(p), (E + 1)), StringEntry(x(p), if ((E == a)) | |
95 | - | then d | |
96 | - | else c)] | |
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)) | |
69 | + | then throw("purchase amount cannot be less than item price") | |
70 | + | else if ((t(j) != a)) | |
71 | + | then throw("an item is already exist") | |
72 | + | else [StringEntry(s(j), A), IntegerEntry(i(j), y), StringEntry(r(j), z)] | |
97 | 73 | } | |
98 | 74 | ||
99 | 75 | ||
100 | 76 | ||
101 | - | @Callable(C) | |
102 | - | func voteReveal (p,A,G) = { | |
103 | - | let r = toBase58String(C.caller.bytes) | |
104 | - | let F = y(p) | |
105 | - | let H = (B(p, A) + 1) | |
106 | - | if ((toBase58String(sha256(toBytes((A + G)))) != s(p, r))) | |
107 | - | then throw("reveal data is not valid") | |
108 | - | else if ((a > u(p))) | |
109 | - | then throw("max number of voters hasn't reached yet") | |
110 | - | else if ((w(p, r) != g)) | |
111 | - | then throw("user has already participated") | |
112 | - | else if (if ((F != c)) | |
113 | - | then (F != d) | |
114 | - | else false) | |
115 | - | then throw("wrong status") | |
116 | - | else if (if ((A != e)) | |
117 | - | then (A != f) | |
118 | - | else false) | |
119 | - | then throw("vote has finished") | |
120 | - | else [StringEntry(v(p, r), A), IntegerEntry(z(p, A), H), StringEntry(x(p), if ((H >= b)) | |
121 | - | then A | |
122 | - | else d)] | |
77 | + | @Callable(x) | |
78 | + | func purchase (j) = { | |
79 | + | let B = x.payments[0] | |
80 | + | if (isDefined(B.assetId)) | |
81 | + | then throw("WAVES token only at the moment") | |
82 | + | else { | |
83 | + | let C = toBase58String(x.caller.bytes) | |
84 | + | let y = k(j) | |
85 | + | let D = t(j) | |
86 | + | if ((y > B.amount)) | |
87 | + | then throw("purchase amunt cannot be less than item price") | |
88 | + | else if ((B.amount > y)) | |
89 | + | then throw("purchase amount cannot be higher than item price") | |
90 | + | else if ((D == a)) | |
91 | + | then throw("Supplier address doesn't exist") | |
92 | + | else [IntegerEntry(l(C, j), (n(C, j) + 1)), IntegerEntry(u(D), (w(D) + B.amount))] | |
93 | + | } | |
94 | + | } | |
95 | + | ||
96 | + | ||
97 | + | ||
98 | + | @Callable(x) | |
99 | + | func withdraw () = { | |
100 | + | let A = toBase58String(x.caller.bytes) | |
101 | + | let E = w(A) | |
102 | + | if ((0 >= E)) | |
103 | + | then throw("za mało środków") | |
104 | + | else [IntegerEntry(u(A), 0), ScriptTransfer(addressFromStringValue(A), E, unit)] | |
123 | 105 | } | |
124 | 106 | ||
125 | 107 |
github/deemru/w8io/169f3d6 52.73 ms ◑