tx · 2Gc1ChoJABFaa7RwRLbV8Bhmimxor89mL2NM5UcxyheH 3N4LwDMgdFYmuTPSSMDG9XUBxh58SuFrkg5: -0.01400000 Waves 2019.07.03 07:42 [568769] smart account 3N4LwDMgdFYmuTPSSMDG9XUBxh58SuFrkg5 > SELF 0.00000000 Waves
{ "type": 13, "id": "2Gc1ChoJABFaa7RwRLbV8Bhmimxor89mL2NM5UcxyheH", "fee": 1400000, "feeAssetId": null, "timestamp": 1562128894460, "version": 1, "sender": "3N4LwDMgdFYmuTPSSMDG9XUBxh58SuFrkg5", "senderPublicKey": "Gxyog9TfcQ5vAbvv8M5gFtxfN6YDuSzQPnn2QPLZHQ8W", "proofs": [ "4ikYuGQx48ArvJAJd91edoBKZWfZTvdbStAvKeQv6ssSYHCU7CJvjQGrcakba4FNHJH65PCuFfpLffRETnZZmVeH" ], "script": "base64:AAIDAAAAAAAAAAAAAAAhAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfcHJpY2UBAAAAEWdldFZhbHVlSXRlbVByaWNlAAAAAQAAAARpdGVtCQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABCQEAAAAPZ2V0S2V5SXRlbV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V3Vm90ZUNvdW50BQAAAAZRVU9SVU0FAAAABHZvdGUFAAAABlJFVkVBTAUAAAADbmlsAAAAAHhFkrk=", "chainId": 84, "height": 568769, "spentComplexity": 0 } View: original | compacted Prev: 9eBwpAHo8Af81WbbsHZk4tSipb5ZoE72TvpAro9FR5Dh Next: none Diff:
Old | New | Differences | |
---|---|---|---|
108 | 108 | func getExtValueItemStatus (oracle,account) = { | |
109 | 109 | let str = match getString(oracle, getExtKeyItemStatus(account)) { | |
110 | 110 | case a: String => | |
111 | - | | |
111 | + | a | |
112 | 112 | case _ => | |
113 | 113 | NONE | |
114 | 114 | } |
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 getNumberByKey (key) = { | |
7 | 7 | let num = match getInteger(this, key) { | |
8 | 8 | case a: Int => | |
9 | 9 | a | |
10 | 10 | case _ => | |
11 | 11 | 0 | |
12 | 12 | } | |
13 | 13 | num | |
14 | 14 | } | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func getStrByKey (key) = { | |
18 | 18 | let str = match getString(this, key) { | |
19 | 19 | case a: String => | |
20 | 20 | a | |
21 | 21 | case _ => | |
22 | 22 | NONE | |
23 | 23 | } | |
24 | 24 | str | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func getKeyItemPrice (item) = (item + "_price") | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item)) | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt") | |
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 | func getExtAddressOracle () = extract(addressFromString("3N4ynv5cxsVeGSMoHBhiKKYcMmgZcDz8rzh")) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | let BLACKLISTED = "blacklisted" | |
104 | 104 | ||
105 | 105 | func getExtKeyItemStatus (supplierAddress) = (supplierAddress + "_verified_status") | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func getExtValueItemStatus (oracle,account) = { | |
109 | 109 | let str = match getString(oracle, getExtKeyItemStatus(account)) { | |
110 | 110 | case a: String => | |
111 | - | | |
111 | + | a | |
112 | 112 | case _ => | |
113 | 113 | NONE | |
114 | 114 | } | |
115 | 115 | str | |
116 | 116 | } | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | @Callable(i) | |
120 | 120 | func addItem (title,price,data) = { | |
121 | 121 | let supplierAddress = toBase58String(i.caller.bytes) | |
122 | 122 | let item = getKeyItem(supplierAddress, title) | |
123 | 123 | let supplierWhiteList = getExtValueItemStatus(getExtAddressOracle(), supplierAddress) | |
124 | 124 | if ((0 >= price)) | |
125 | 125 | then throw("purchase amount cannot be less than price") | |
126 | 126 | else if ((getValueItemSupplier(item) != NONE)) | |
127 | 127 | then throw("an item is already exist") | |
128 | 128 | else if ((supplierWhiteList == BLACKLISTED)) | |
129 | 129 | then throw("your account is blacklisted") | |
130 | 130 | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemStatus(supplierAddress), supplierWhiteList)]) | |
131 | 131 | } | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | ||
135 | 135 | @Callable(tx) | |
136 | 136 | func purchase (item) = { | |
137 | 137 | let pmt = extract(tx.payment) | |
138 | 138 | if (isDefined(pmt.assetId)) | |
139 | 139 | then throw("You can use only Waves to purchase an item") | |
140 | 140 | else { | |
141 | 141 | let customerAddress = toBase58String(tx.caller.bytes) | |
142 | 142 | let price = getValueItemPrice(item) | |
143 | 143 | let supplierAddress = getValueItemSupplier(item) | |
144 | 144 | if ((price > pmt.amount)) | |
145 | 145 | then throw("purchase amount less than item price") | |
146 | 146 | else if ((pmt.amount > price)) | |
147 | 147 | then throw("purchase amount higher than item price") | |
148 | 148 | else WriteSet([DataEntry(getKeyUserItemCounter(customerAddress, item), (getValueUserItemCounter(customerAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))]) | |
149 | 149 | } | |
150 | 150 | } | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | ||
154 | 154 | @Callable(txi) | |
155 | 155 | func withdraw () = { | |
156 | 156 | let supplierAddress = toBase58String(txi.caller.bytes) | |
157 | 157 | let balance = getValueBalanceSupplier(supplierAddress) | |
158 | 158 | if ((0 >= balance)) | |
159 | 159 | then throw("insufficient funds") | |
160 | 160 | else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)])) | |
161 | 161 | } | |
162 | 162 | ||
163 | 163 | ||
164 | 164 | ||
165 | 165 | @Callable(iv) | |
166 | 166 | func voteCommit (item,hash) = { | |
167 | 167 | let user = toBase58String(iv.caller.bytes) | |
168 | 168 | let commits = getValueCommitsCount(item) | |
169 | 169 | let status = getValueItemStatus(item) | |
170 | 170 | if ((commits >= VOTERS)) | |
171 | 171 | then throw("reached max num of voters") | |
172 | 172 | else if ((getValueCommit(item, user) != NONE)) | |
173 | 173 | then throw("user has already participated") | |
174 | 174 | else if ((getKeyItemSupplier(item) == NONE)) | |
175 | 175 | then throw("item does not exist") | |
176 | 176 | else if (if ((status != NONE)) | |
177 | 177 | then (status != VOTING) | |
178 | 178 | else false) | |
179 | 179 | then throw("voting is not possible") | |
180 | 180 | else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS)) | |
181 | 181 | then REVEAL | |
182 | 182 | else VOTING)]) | |
183 | 183 | } | |
184 | 184 | ||
185 | 185 | ||
186 | 186 | ||
187 | 187 | @Callable(ivr) | |
188 | 188 | func voteReveal (item,vote,salt) = { | |
189 | 189 | let user = toBase58String(ivr.caller.bytes) | |
190 | 190 | let status = getValueItemStatus(item) | |
191 | 191 | let newVoteCount = getValueVoteCount(item, vote) | |
192 | 192 | if ((toBase58String(sha256(toBytes((vote + salt)))) != getValueCommit(item, user))) | |
193 | 193 | then throw("reveal data is not valid") | |
194 | 194 | else if ((VOTERS > getValueCommitsCount(item))) | |
195 | 195 | then throw("max num of voters has not reached yet") | |
196 | 196 | else if ((getValueReveal(item, user) != NONE)) | |
197 | 197 | then throw("user has already participated") | |
198 | 198 | else if (if ((status != VOTING)) | |
199 | 199 | then (status != REVEAL) | |
200 | 200 | else false) | |
201 | 201 | then throw("wrong status") | |
202 | 202 | else if (if ((vote != FEATURED)) | |
203 | 203 | then (vote != DELISTED) | |
204 | 204 | else false) | |
205 | 205 | then throw("wrong vote") | |
206 | 206 | else if (if ((status == FEATURED)) | |
207 | 207 | then (status == DELISTED) | |
208 | 208 | else false) | |
209 | 209 | then throw("votу has finished") | |
210 | 210 | else WriteSet([DataEntry(getKeyReveal(item, user), vote), DataEntry(getKeyVoteCount(item, vote), newVoteCount), DataEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM)) | |
211 | 211 | then vote | |
212 | 212 | else REVEAL)]) | |
213 | 213 | } | |
214 | 214 | ||
215 | 215 |
github/deemru/w8io/026f985 58.06 ms ◑