tx · 24x7gEHVJS9TYsfDzeny3xko4KrExNnwzFwq2gBV63Js 3MqiiiD5GiCgJENfvC6HA8MyUeZfX1fB4yD: -0.01400000 Waves 2019.06.25 23:33 [558128] smart account 3MqiiiD5GiCgJENfvC6HA8MyUeZfX1fB4yD > SELF 0.00000000 Waves
{ "type": 13, "id": "24x7gEHVJS9TYsfDzeny3xko4KrExNnwzFwq2gBV63Js", "fee": 1400000, "feeAssetId": null, "timestamp": 1561494846305, "version": 1, "sender": "3MqiiiD5GiCgJENfvC6HA8MyUeZfX1fB4yD", "senderPublicKey": "2XEK2wpQ5tXMZdzxJPyGzitzHyVyQxp3WT9Ekxe8br7N", "proofs": [ "49f3ckehFGrj4qivZE8sdLDrf1BcxH7dW5gatyXpMiNVHc8NS1fuFfQ355sZ3hqVEjWMJWL8cdxZyT3abCC5Zctr" ], "script": "base64:AAIDAAAAAAAAAAAAAAAdAAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAAETk9ORQUAAAADc3R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yeQAAAAIJAQAAAA9nZXRLZXlWb3RlQ291bnQAAAACBQAAAARpdGVtBQAAAAR2b3RlBQAAAAxuZXdWb3RlQ291bnQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABBnZXRLZXlJdGVtU3RhdHVzAAAAAQUAAAAEaXRlbQMJAABnAAAAAgUAAAAMbmV3Vm90ZUNvdW50BQAAAAZRVU9SVU0FAAAABHZvdGUFAAAABlJFVkVBTAUAAAADbmlsAAAAAI6HQOo=", "chainId": 84, "height": 558128, "spentComplexity": 0 } View: original | compacted Prev: Fs6icRBs9uCmurrkHrb1UREQkT7vYWmbgp4mT72h3Vfb Next: none Diff:
Old | New | Differences | |
---|---|---|---|
180 | 180 | else false) | |
181 | 181 | then throw("wrong status") | |
182 | 182 | else if (if ((vote != FEATURED)) | |
183 | - | then | |
184 | - | else | |
183 | + | then (vote != DELISTED) | |
184 | + | else false) | |
185 | 185 | then throw("wrong vote") | |
186 | 186 | else if (if ((status == FEATURED)) | |
187 | 187 | 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 | let VOTERS = 3 | |
7 | 7 | ||
8 | 8 | let QUORUM = 2 | |
9 | 9 | ||
10 | 10 | let VOTING = "voting" | |
11 | 11 | ||
12 | 12 | let REVEAL = "reveal" | |
13 | 13 | ||
14 | 14 | let FEATURED = "featured" | |
15 | 15 | ||
16 | 16 | let DELISTED = "delisted" | |
17 | 17 | ||
18 | 18 | func getNumberByKey (key) = { | |
19 | 19 | let num = match getInteger(this, key) { | |
20 | 20 | case a: Int => | |
21 | 21 | a | |
22 | 22 | case _ => | |
23 | 23 | 0 | |
24 | 24 | } | |
25 | 25 | num | |
26 | 26 | } | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func getStrByKey (key) = { | |
30 | 30 | let str = match getString(this, key) { | |
31 | 31 | case a: String => | |
32 | 32 | a | |
33 | 33 | case _ => | |
34 | 34 | NONE | |
35 | 35 | } | |
36 | 36 | str | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func getKeyItemPrice (item) = (item + "_price") | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item)) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt") | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func getKeyItem (supplier,item) = ("item_" + toBase58String(sha256(toBytes((supplier + item))))) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func getKeyItemData (item) = (item + "_data") | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func getKeyItemSupplier (item) = (item + "_owner") | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func getKeyBalanceSupplier (account) = (account + "_balance") | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func getValueBalanceSupplier (item) = getNumberByKey(getKeyBalanceSupplier(item)) | |
68 | 68 | ||
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 purchase (item) = { | |
102 | 102 | let pmt = extract(i.payment) | |
103 | 103 | if (isDefined(pmt.assetId)) | |
104 | 104 | then throw("can use WAVES only at the moment") | |
105 | 105 | else { | |
106 | 106 | let userAddress = toBase58String(i.caller.bytes) | |
107 | 107 | let price = getValueItemPrice(item) | |
108 | 108 | let supplierAddress = getValueItemSupplier(item) | |
109 | 109 | if ((price > pmt.amount)) | |
110 | 110 | then throw("purchase amount cannot be less than item price") | |
111 | 111 | else if ((pmt.amount > price)) | |
112 | 112 | then throw("purchase amount cannot be higher than item price") | |
113 | 113 | else if ((supplierAddress == NONE)) | |
114 | 114 | then throw("supplier does not exist") | |
115 | 115 | else WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))]) | |
116 | 116 | } | |
117 | 117 | } | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | ||
121 | 121 | @Callable(i) | |
122 | 122 | func addItem (title,price,data) = { | |
123 | 123 | let supplierAddress = toBase58String(i.caller.bytes) | |
124 | 124 | let item = getKeyItem(supplierAddress, title) | |
125 | 125 | if ((0 >= price)) | |
126 | 126 | then throw("purchase amount cannot be less than item price") | |
127 | 127 | else if ((getValueItemSupplier(item) != NONE)) | |
128 | 128 | then throw("Item already exists") | |
129 | 129 | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
130 | 130 | } | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | ||
134 | 134 | @Callable(i) | |
135 | 135 | func withdraw () = { | |
136 | 136 | let supplierAddress = toBase58String(i.caller.bytes) | |
137 | 137 | let balance = getValueBalanceSupplier(supplierAddress) | |
138 | 138 | if ((0 >= balance)) | |
139 | 139 | then throw("insufficient balance") | |
140 | 140 | else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)])) | |
141 | 141 | } | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | ||
145 | 145 | @Callable(i) | |
146 | 146 | func voteCommit (item,hash) = { | |
147 | 147 | let user = toBase58String(i.caller.bytes) | |
148 | 148 | let commits = getValueCommitsCount(item) | |
149 | 149 | let status = getValueItemStatus(item) | |
150 | 150 | if ((commits >= VOTERS)) | |
151 | 151 | then throw("reached max num of voters") | |
152 | 152 | else if ((getValueCommit(item, user) != NONE)) | |
153 | 153 | then throw("user has already participated") | |
154 | 154 | else if ((getKeyItemSupplier(item) == NONE)) | |
155 | 155 | then throw("item does not exist") | |
156 | 156 | else if (if ((status != NONE)) | |
157 | 157 | then (status != VOTING) | |
158 | 158 | else false) | |
159 | 159 | then throw("voting is not possible") | |
160 | 160 | else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS)) | |
161 | 161 | then REVEAL | |
162 | 162 | else VOTING)]) | |
163 | 163 | } | |
164 | 164 | ||
165 | 165 | ||
166 | 166 | ||
167 | 167 | @Callable(i) | |
168 | 168 | func voteReveal (item,vote,salt) = { | |
169 | 169 | let user = toBase58String(i.caller.bytes) | |
170 | 170 | let status = getValueItemStatus(item) | |
171 | 171 | let newVoteCount = (getValueVoteCount(item, vote) + 1) | |
172 | 172 | if ((toBase58String(sha256(toBytes((vote + salt)))) != getValueCommit(item, user))) | |
173 | 173 | then throw("Reveal data is not valid") | |
174 | 174 | else if ((VOTERS > getValueCommitsCount(item))) | |
175 | 175 | then throw("max number of voters hasn't reached yet") | |
176 | 176 | else if ((getValueReveal(item, user) != NONE)) | |
177 | 177 | then throw("user has already participated") | |
178 | 178 | else if (if ((status != VOTING)) | |
179 | 179 | then (status != REVEAL) | |
180 | 180 | else false) | |
181 | 181 | then throw("wrong status") | |
182 | 182 | else if (if ((vote != FEATURED)) | |
183 | - | then | |
184 | - | else | |
183 | + | then (vote != DELISTED) | |
184 | + | else false) | |
185 | 185 | then throw("wrong vote") | |
186 | 186 | else if (if ((status == FEATURED)) | |
187 | 187 | then true | |
188 | 188 | else (status == DELISTED)) | |
189 | 189 | then throw("vote has finished") | |
190 | 190 | else WriteSet([DataEntry(getKeyReveal(item, user), vote), DataEntry(getKeyVoteCount(item, vote), newVoteCount), DataEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM)) | |
191 | 191 | then vote | |
192 | 192 | else REVEAL)]) | |
193 | 193 | } | |
194 | 194 | ||
195 | 195 |
github/deemru/w8io/026f985 48.25 ms ◑