tx · 9DQntgwT3Hrh8LNV6uVE6X8pKLqedSgzsjwr3c2tSqN3 3MtELerncMfYVZvRuEeMvgvsj7jUnshXWuw: -0.01400000 Waves 2019.11.02 22:15 [747651] smart account 3MtELerncMfYVZvRuEeMvgvsj7jUnshXWuw > SELF 0.00000000 Waves
{ "type": 13, "id": "9DQntgwT3Hrh8LNV6uVE6X8pKLqedSgzsjwr3c2tSqN3", "fee": 1400000, "feeAssetId": null, "timestamp": 1572722087234, "version": 1, "sender": "3MtELerncMfYVZvRuEeMvgvsj7jUnshXWuw", "senderPublicKey": "FXsc9LG44fGFsWEUFctaZ8pr75ZoWQuPc75fhhG6CQb7", "proofs": [ "4oKGfmwABFb1SadK5HkvxvRuuGcbR8idvzzJ25h2JMPHD26QEF8Krc1WYwua3qS5YShcVse5tnsTYP5G9J1FaBBE" ], "script": "base64:AAIDAAAAAAAAABYIARIDCgEIEgUKAwgBCBIAEgQKAggIAAAAIAAAAAALYWxpY2VQdWJLZXkBAAAAINfsQvR9fqXlDzGc04eGbOwG0sh9xqqQFwH/8Axi/ldeAAAAAAlib2JQdWJLZXkBAAAAIOwSkxfPNRumLYV/QyOtvoP1Xrqg0wLIbWQvZrWRxCZVAAAAAAxjb29wZXJQdWJLZXkBAAAAIIBJjl+IC6h/Eyp/ki/D97TEbqOcKJDZv13sTNCgJKkiAAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAA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qhUuj5UZ1MjKU52 Diff:
Old | New | Differences | |
---|---|---|---|
8 | 8 | let cooperPubKey = base58'9dnEr8G5eVHGJ5LkzueoK512pE3XBYBpe2ReLVcsrawT' | |
9 | 9 | ||
10 | 10 | let NONE = "none" | |
11 | + | ||
12 | + | let VOTERS = 3 | |
13 | + | ||
14 | + | let QUORUM = 2 | |
15 | + | ||
16 | + | let VOTING = "voting" | |
17 | + | ||
18 | + | let REVEAL = "reveal" | |
19 | + | ||
20 | + | let FEATURED = "featured" | |
21 | + | ||
22 | + | let DELISTED = "delisted" | |
11 | 23 | ||
12 | 24 | func getNumberByKey (key) = { | |
13 | 25 | let num = match getInteger(this, key) { | |
29 | 41 | } | |
30 | 42 | str | |
31 | 43 | } | |
44 | + | ||
45 | + | ||
46 | + | func getKeyCommit (item,user) = (((item + "_") + user) + "_commit") | |
47 | + | ||
48 | + | ||
49 | + | func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user)) | |
50 | + | ||
51 | + | ||
52 | + | func getKeyCommitsCount (item) = (item + "_comcnt") | |
53 | + | ||
54 | + | ||
55 | + | func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item)) | |
56 | + | ||
57 | + | ||
58 | + | func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal") | |
59 | + | ||
60 | + | ||
61 | + | func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user)) | |
62 | + | ||
63 | + | ||
64 | + | func getKeyItemStatus (item) = (item + "_status") | |
65 | + | ||
66 | + | ||
67 | + | func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item)) | |
68 | + | ||
69 | + | ||
70 | + | func getKeyVoteCount (item,vote) = ((item + "_res:") + vote) | |
71 | + | ||
72 | + | ||
73 | + | func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote)) | |
32 | 74 | ||
33 | 75 | ||
34 | 76 | func getKeyItemPrice (item) = (item + "_price") | |
102 | 144 | if ((0 >= balance)) | |
103 | 145 | then throw("insufficient balance") | |
104 | 146 | else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)])) | |
147 | + | } | |
148 | + | ||
149 | + | ||
150 | + | ||
151 | + | @Callable(i) | |
152 | + | func voteCommit (item,hash) = { | |
153 | + | let user = toBase58String(i.caller.bytes) | |
154 | + | let commits = getValueCommitsCount(item) | |
155 | + | let status = getValueItemStatus(item) | |
156 | + | if ((commits >= VOTERS)) | |
157 | + | then throw("Reached max number of voters") | |
158 | + | else if ((getValueCommit(item, user) != NONE)) | |
159 | + | then throw("User has aready participated") | |
160 | + | else if ((getKeyItemSupplier(item) == NONE)) | |
161 | + | then throw("Item does not exist") | |
162 | + | else if (if ((status != NONE)) | |
163 | + | then (status != VOTING) | |
164 | + | else false) | |
165 | + | then throw("Voting is not possible") | |
166 | + | else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS)) | |
167 | + | then REVEAL | |
168 | + | else VOTING)]) | |
105 | 169 | } | |
106 | 170 | ||
107 | 171 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let alicePubKey = base58'FXsc9LG44fGFsWEUFctaZ8pr75ZoWQuPc75fhhG6CQb7' | |
5 | 5 | ||
6 | 6 | let bobPubKey = base58'GtXeMqkP3JUjRf7EDptgqdEu5wkrkG4d2sbfUi5hYQVi' | |
7 | 7 | ||
8 | 8 | let cooperPubKey = base58'9dnEr8G5eVHGJ5LkzueoK512pE3XBYBpe2ReLVcsrawT' | |
9 | 9 | ||
10 | 10 | let NONE = "none" | |
11 | + | ||
12 | + | let VOTERS = 3 | |
13 | + | ||
14 | + | let QUORUM = 2 | |
15 | + | ||
16 | + | let VOTING = "voting" | |
17 | + | ||
18 | + | let REVEAL = "reveal" | |
19 | + | ||
20 | + | let FEATURED = "featured" | |
21 | + | ||
22 | + | let DELISTED = "delisted" | |
11 | 23 | ||
12 | 24 | func getNumberByKey (key) = { | |
13 | 25 | let num = match getInteger(this, key) { | |
14 | 26 | case a: Int => | |
15 | 27 | a | |
16 | 28 | case _ => | |
17 | 29 | 0 | |
18 | 30 | } | |
19 | 31 | num | |
20 | 32 | } | |
21 | 33 | ||
22 | 34 | ||
23 | 35 | func getStrByKey (key) = { | |
24 | 36 | let str = match getString(this, key) { | |
25 | 37 | case a: String => | |
26 | 38 | a | |
27 | 39 | case _ => | |
28 | 40 | NONE | |
29 | 41 | } | |
30 | 42 | str | |
31 | 43 | } | |
44 | + | ||
45 | + | ||
46 | + | func getKeyCommit (item,user) = (((item + "_") + user) + "_commit") | |
47 | + | ||
48 | + | ||
49 | + | func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user)) | |
50 | + | ||
51 | + | ||
52 | + | func getKeyCommitsCount (item) = (item + "_comcnt") | |
53 | + | ||
54 | + | ||
55 | + | func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item)) | |
56 | + | ||
57 | + | ||
58 | + | func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal") | |
59 | + | ||
60 | + | ||
61 | + | func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user)) | |
62 | + | ||
63 | + | ||
64 | + | func getKeyItemStatus (item) = (item + "_status") | |
65 | + | ||
66 | + | ||
67 | + | func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item)) | |
68 | + | ||
69 | + | ||
70 | + | func getKeyVoteCount (item,vote) = ((item + "_res:") + vote) | |
71 | + | ||
72 | + | ||
73 | + | func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote)) | |
32 | 74 | ||
33 | 75 | ||
34 | 76 | func getKeyItemPrice (item) = (item + "_price") | |
35 | 77 | ||
36 | 78 | ||
37 | 79 | func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item)) | |
38 | 80 | ||
39 | 81 | ||
40 | 82 | func getKeyUserItemCounter (user,item) = (((item + "user") + user) + "_cnt") | |
41 | 83 | ||
42 | 84 | ||
43 | 85 | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
44 | 86 | ||
45 | 87 | ||
46 | 88 | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
47 | 89 | ||
48 | 90 | ||
49 | 91 | func getKeyItemData (item) = (item + "_data") | |
50 | 92 | ||
51 | 93 | ||
52 | 94 | func getKeyItemSupplier (item) = (item + "_owner") | |
53 | 95 | ||
54 | 96 | ||
55 | 97 | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
56 | 98 | ||
57 | 99 | ||
58 | 100 | func getKeyBalanceSupplier (account) = (account + "_balance") | |
59 | 101 | ||
60 | 102 | ||
61 | 103 | func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account)) | |
62 | 104 | ||
63 | 105 | ||
64 | 106 | @Callable(i) | |
65 | 107 | func purchase (item) = { | |
66 | 108 | let pmt = extract(i.payment) | |
67 | 109 | if (isDefined(pmt.assetId)) | |
68 | 110 | then throw("Can use WAVES only at the moment") | |
69 | 111 | else { | |
70 | 112 | let customerAddress = toBase58String(i.caller.bytes) | |
71 | 113 | let price = getValueItemPrice(item) | |
72 | 114 | let supplierAddress = getValueItemSupplier(item) | |
73 | 115 | if ((price > pmt.amount)) | |
74 | 116 | then throw("Purchase amount can not be less than item price") | |
75 | 117 | else if ((pmt.amount > price)) | |
76 | 118 | then throw("Purchase amount can not be more than item price") | |
77 | 119 | else if ((supplierAddress == NONE)) | |
78 | 120 | then throw("Supplier does not exist") | |
79 | 121 | else WriteSet([DataEntry(getKeyUserItemCounter(customerAddress, item), (getValueUserItemCounter(customerAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))]) | |
80 | 122 | } | |
81 | 123 | } | |
82 | 124 | ||
83 | 125 | ||
84 | 126 | ||
85 | 127 | @Callable(i) | |
86 | 128 | func addItem (title,price,data) = { | |
87 | 129 | let supplierAddress = toBase58String(i.caller.bytes) | |
88 | 130 | let item = getKeyItem(supplierAddress, title) | |
89 | 131 | if ((0 >= price)) | |
90 | 132 | then throw("purchase amount can not be less than item price") | |
91 | 133 | else if ((getValueItemSupplier(item) != NONE)) | |
92 | 134 | then throw("An item is already") | |
93 | 135 | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
94 | 136 | } | |
95 | 137 | ||
96 | 138 | ||
97 | 139 | ||
98 | 140 | @Callable(i) | |
99 | 141 | func withdraw () = { | |
100 | 142 | let supplierAddress = toBase58String(i.caller.bytes) | |
101 | 143 | let balance = getValueBalanceSupplier(supplierAddress) | |
102 | 144 | if ((0 >= balance)) | |
103 | 145 | then throw("insufficient balance") | |
104 | 146 | else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)])) | |
147 | + | } | |
148 | + | ||
149 | + | ||
150 | + | ||
151 | + | @Callable(i) | |
152 | + | func voteCommit (item,hash) = { | |
153 | + | let user = toBase58String(i.caller.bytes) | |
154 | + | let commits = getValueCommitsCount(item) | |
155 | + | let status = getValueItemStatus(item) | |
156 | + | if ((commits >= VOTERS)) | |
157 | + | then throw("Reached max number of voters") | |
158 | + | else if ((getValueCommit(item, user) != NONE)) | |
159 | + | then throw("User has aready participated") | |
160 | + | else if ((getKeyItemSupplier(item) == NONE)) | |
161 | + | then throw("Item does not exist") | |
162 | + | else if (if ((status != NONE)) | |
163 | + | then (status != VOTING) | |
164 | + | else false) | |
165 | + | then throw("Voting is not possible") | |
166 | + | else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS)) | |
167 | + | then REVEAL | |
168 | + | else VOTING)]) | |
105 | 169 | } | |
106 | 170 | ||
107 | 171 | ||
108 | 172 | @Verifier(tx) | |
109 | 173 | func verify () = { | |
110 | 174 | let Alice1 = sigVerify(tx.bodyBytes, tx.proofs[0], alicePubKey) | |
111 | 175 | let Alice2 = sigVerify(tx.bodyBytes, tx.proofs[1], alicePubKey) | |
112 | 176 | let Alice3 = sigVerify(tx.bodyBytes, tx.proofs[2], alicePubKey) | |
113 | 177 | let Bob1 = sigVerify(tx.bodyBytes, tx.proofs[0], bobPubKey) | |
114 | 178 | let Bob2 = sigVerify(tx.bodyBytes, tx.proofs[1], bobPubKey) | |
115 | 179 | let Bob3 = sigVerify(tx.bodyBytes, tx.proofs[2], bobPubKey) | |
116 | 180 | let Cooper1 = sigVerify(tx.bodyBytes, tx.proofs[0], cooperPubKey) | |
117 | 181 | let Cooper2 = sigVerify(tx.bodyBytes, tx.proofs[1], cooperPubKey) | |
118 | 182 | let Cooper3 = sigVerify(tx.bodyBytes, tx.proofs[2], cooperPubKey) | |
119 | 183 | let AliceAndBob = if (if (if (if (if (if (Alice1) | |
120 | 184 | then Bob2 | |
121 | 185 | else false) | |
122 | 186 | then true | |
123 | 187 | else if (Alice1) | |
124 | 188 | then Bob3 | |
125 | 189 | else false) | |
126 | 190 | then true | |
127 | 191 | else if (Alice2) | |
128 | 192 | then Bob1 | |
129 | 193 | else false) | |
130 | 194 | then true | |
131 | 195 | else if (Alice2) | |
132 | 196 | then Bob3 | |
133 | 197 | else false) | |
134 | 198 | then true | |
135 | 199 | else if (Alice3) | |
136 | 200 | then Bob1 | |
137 | 201 | else false) | |
138 | 202 | then true | |
139 | 203 | else if (Alice3) | |
140 | 204 | then Bob2 | |
141 | 205 | else false | |
142 | 206 | let AliceAndCooper = if (if (if (if (if (if (Cooper1) | |
143 | 207 | then Alice2 | |
144 | 208 | else false) | |
145 | 209 | then true | |
146 | 210 | else if (Cooper1) | |
147 | 211 | then Alice3 | |
148 | 212 | else false) | |
149 | 213 | then true | |
150 | 214 | else if (Cooper2) | |
151 | 215 | then Alice1 | |
152 | 216 | else false) | |
153 | 217 | then true | |
154 | 218 | else if (Cooper2) | |
155 | 219 | then Alice3 | |
156 | 220 | else false) | |
157 | 221 | then true | |
158 | 222 | else if (Cooper3) | |
159 | 223 | then Alice1 | |
160 | 224 | else false) | |
161 | 225 | then true | |
162 | 226 | else if (Cooper3) | |
163 | 227 | then Alice2 | |
164 | 228 | else false | |
165 | 229 | let BobAndCooper = if (if (if (if (if (if (Bob1) | |
166 | 230 | then Cooper2 | |
167 | 231 | else false) | |
168 | 232 | then true | |
169 | 233 | else if (Bob1) | |
170 | 234 | then Cooper3 | |
171 | 235 | else false) | |
172 | 236 | then true | |
173 | 237 | else if (Bob2) | |
174 | 238 | then Cooper1 | |
175 | 239 | else false) | |
176 | 240 | then true | |
177 | 241 | else if (Bob2) | |
178 | 242 | then Cooper3 | |
179 | 243 | else false) | |
180 | 244 | then true | |
181 | 245 | else if (Bob3) | |
182 | 246 | then Cooper1 | |
183 | 247 | else false) | |
184 | 248 | then true | |
185 | 249 | else if (Bob3) | |
186 | 250 | then Cooper2 | |
187 | 251 | else false | |
188 | 252 | match tx { | |
189 | 253 | case d: SetScriptTransaction => | |
190 | 254 | true | |
191 | 255 | case _ => | |
192 | 256 | if (if (AliceAndBob) | |
193 | 257 | then true | |
194 | 258 | else AliceAndCooper) | |
195 | 259 | then true | |
196 | 260 | else BobAndCooper | |
197 | 261 | } | |
198 | 262 | } | |
199 | 263 |
github/deemru/w8io/169f3d6 58.13 ms ◑