tx · 5cp6kSLnPCDNRt4Xo9LTgKpdGmQqGZs318NkncRMq7vS 3MxN6Cszfki941gTcEwXc8ngmbWPTsHoJFq: -0.01400000 Waves 2019.06.22 22:39 [553682] smart account 3MxN6Cszfki941gTcEwXc8ngmbWPTsHoJFq > SELF 0.00000000 Waves
{ "type": 13, "id": "5cp6kSLnPCDNRt4Xo9LTgKpdGmQqGZs318NkncRMq7vS", "fee": 1400000, "feeAssetId": null, "timestamp": 1561232373871, "version": 1, "sender": "3MxN6Cszfki941gTcEwXc8ngmbWPTsHoJFq", "senderPublicKey": "4fygXNNAjU52sT9N6uq4o9Ck8G75e94ukktN3pd4VxVo", "proofs": [ "5mZmzHGvmxDxBLe5oW2w79ui3kuSVxG6HsToDuUEuSGbWemrEyu37miAxos7VjEexzUAvXcJ5XL2WGLVqhU4B6KV" ], "script": "base64:AAIDAAAAAAAAAAAAAAAdAAAAAAROT05FAgAAAARub25lAQAAAA9nZXRLZXlJdGVtUHJpY2UAAAABAAAABGl0ZW0JAAEsAAAAAgUAAAAEaXRlbQIAAAAGX3ByaWNlAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAAAAFWdldEtleVVzZXJJdGVtQ291bnRlcgAAAAIAAAAEdXNlcgAAAARpdGVtCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAARpdGVtAgAA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AAApr9WX", "chainId": 84, "height": 553682, "spentComplexity": 0 } View: original | compacted Prev: 57G39WGVQUXRLFwSWHYycuiG1APrePxwX6t5cB1en8UJ Next: 3HpUH3t3CQFNJLzNFrjKHBwJ7R6ektpvL8oUCsUCcxwq Diff:
Old | New | Differences | |
---|---|---|---|
179 | 179 | then throw("wrong status") | |
180 | 180 | else if (if ((vote != Featured)) | |
181 | 181 | then true | |
182 | - | else ( | |
182 | + | else (vote != Delisted)) | |
183 | 183 | then throw("wrong vote") | |
184 | 184 | else if (if ((status == Featured)) | |
185 | 185 | then true |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let NONE = "none" | |
5 | 5 | ||
6 | 6 | func getKeyItemPrice (item) = (item + "_price") | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func getNumberByKey (key) = { | |
10 | 10 | let num = match getInteger(this, key) { | |
11 | 11 | case a: Int => | |
12 | 12 | a | |
13 | 13 | case _ => | |
14 | 14 | 0 | |
15 | 15 | } | |
16 | 16 | num | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func getStrByKey (key) = { | |
21 | 21 | let str = match getString(this, key) { | |
22 | 22 | case a: String => | |
23 | 23 | a | |
24 | 24 | case _ => | |
25 | 25 | NONE | |
26 | 26 | } | |
27 | 27 | str | |
28 | 28 | } | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt") | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item)) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func getKeyItemData (item) = (item + "_data") | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getKeyItemSupplier (item) = (item + "_owner") | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func getKeyBalanceSupplier (account) = (account + "_balance") | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account)) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | let Voters = 3 | |
59 | 59 | ||
60 | 60 | let Quorum = 2 | |
61 | 61 | ||
62 | 62 | let Voting = "voting" | |
63 | 63 | ||
64 | 64 | let Reveal = "reveal" | |
65 | 65 | ||
66 | 66 | let Featured = "featured" | |
67 | 67 | ||
68 | 68 | let Delisted = "delisted" | |
69 | 69 | ||
70 | 70 | func getKeyCommit (item,user) = (((item + "_") + user) + "_commit") | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user)) | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func getKeyCommitsCount (item) = (item + "+comcnt") | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item)) | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal") | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user)) | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func getKeyItemStatus (item) = (item + "_status") | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item)) | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func getKeyVoteCount (item,vote) = ((item + "_res:") + vote) | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote)) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | @Callable(i) | |
101 | 101 | func additem (title,price,data) = { | |
102 | 102 | let suppad = toBase58String(i.caller.bytes) | |
103 | 103 | let item = getKeyItem(suppad, title) | |
104 | 104 | if ((0 >= price)) | |
105 | 105 | then throw("purchase amount cannot be less than 0 or 0") | |
106 | 106 | else if ((getValueItemSupplier(item) != NONE)) | |
107 | 107 | then throw("an item already exists") | |
108 | 108 | else WriteSet([DataEntry(getKeyItemSupplier(item), suppad), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
109 | 109 | } | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | ||
113 | 113 | @Callable(i) | |
114 | 114 | func purchase (item) = { | |
115 | 115 | let pmt = extract(i.payment) | |
116 | 116 | if (isDefined(pmt.assetId)) | |
117 | 117 | then throw("Can use Waves only at the moment") | |
118 | 118 | else { | |
119 | 119 | let customerAddress = toBase58String(i.caller.bytes) | |
120 | 120 | let price = getValueItemPrice(item) | |
121 | 121 | let supadd = getValueItemSupplier(item) | |
122 | 122 | if ((price > pmt.amount)) | |
123 | 123 | then throw("purchase amount cannot be less than item price ") | |
124 | 124 | else if ((pmt.amount > price)) | |
125 | 125 | then throw("purchase amount cannot be higher than item price") | |
126 | 126 | else WriteSet([DataEntry(getKeyUserItemCounter(customerAddress, item), (getValueUserItemCounter(customerAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supadd), (getValueBalanceSupplier(supadd) + pmt.amount))]) | |
127 | 127 | } | |
128 | 128 | } | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | ||
132 | 132 | @Callable(i) | |
133 | 133 | func withdraw () = { | |
134 | 134 | let suppadd = toBase58String(i.caller.bytes) | |
135 | 135 | let bal = getNumberByKey("3MqjzNpmZAF3K7W6RRcezbSdWorMAXXwdqo_balance") | |
136 | 136 | if ((0 >= bal)) | |
137 | 137 | then throw("Insufficient Balance xD") | |
138 | 138 | else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(suppadd), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(suppadd), bal, unit)])) | |
139 | 139 | } | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | ||
143 | 143 | @Callable(i) | |
144 | 144 | func voteCommit (item,hash) = { | |
145 | 145 | let user = toBase58String(i.caller.bytes) | |
146 | 146 | let commits = getValueCommitsCount(item) | |
147 | 147 | let status = getValueItemStatus(item) | |
148 | 148 | if ((commits >= Voters)) | |
149 | 149 | then throw("Max votes") | |
150 | 150 | else if ((getValueCommit(item, user) != NONE)) | |
151 | 151 | then throw("already done") | |
152 | 152 | else if ((getKeyItemSupplier(item) == NONE)) | |
153 | 153 | then throw("item doesnot exist") | |
154 | 154 | else if (if ((status != NONE)) | |
155 | 155 | then (status != Voting) | |
156 | 156 | else false) | |
157 | 157 | then throw("not possilble") | |
158 | 158 | else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == Voters)) | |
159 | 159 | then Reveal | |
160 | 160 | else Voting)]) | |
161 | 161 | } | |
162 | 162 | ||
163 | 163 | ||
164 | 164 | ||
165 | 165 | @Callable(i) | |
166 | 166 | func voteReveal (item,vote,salt) = { | |
167 | 167 | let user = toBase58String(i.caller.bytes) | |
168 | 168 | let status = getValueItemStatus(item) | |
169 | 169 | let newVoteCount = (getValueVoteCount(item, vote) + 1) | |
170 | 170 | if ((toBase58String(sha256(toBytes((vote + salt)))) != getValueCommit(item, user))) | |
171 | 171 | then throw("reveal is not valid") | |
172 | 172 | else if ((Voters > getValueCommitsCount(item))) | |
173 | 173 | then throw("not enough votes") | |
174 | 174 | else if ((getValueReveal(item, user) != NONE)) | |
175 | 175 | then throw("usr already participated") | |
176 | 176 | else if (if ((status != Voting)) | |
177 | 177 | then (status != Reveal) | |
178 | 178 | else false) | |
179 | 179 | then throw("wrong status") | |
180 | 180 | else if (if ((vote != Featured)) | |
181 | 181 | then true | |
182 | - | else ( | |
182 | + | else (vote != Delisted)) | |
183 | 183 | then throw("wrong vote") | |
184 | 184 | else if (if ((status == Featured)) | |
185 | 185 | then true | |
186 | 186 | else (status == Delisted)) | |
187 | 187 | then throw("voting finished already") | |
188 | 188 | else WriteSet([DataEntry(getKeyReveal(item, user), vote), DataEntry(getKeyVoteCount(item, vote), newVoteCount), DataEntry(getKeyItemStatus(item), if ((newVoteCount >= Quorum)) | |
189 | 189 | then vote | |
190 | 190 | else Reveal)]) | |
191 | 191 | } | |
192 | 192 | ||
193 | 193 |
github/deemru/w8io/026f985 32.62 ms ◑