tx · D5JfhdyXPUWHQGmiLD4YFQDZiWJUbDK9kASXsJVYjexF 3N7JoxehscqKiXcuQ1iEQ6pEv6mZvnYS9mC: -0.01400000 Waves 2019.07.23 17:23 [598748] smart account 3N7JoxehscqKiXcuQ1iEQ6pEv6mZvnYS9mC > SELF 0.00000000 Waves
{ "type": 13, "id": "D5JfhdyXPUWHQGmiLD4YFQDZiWJUbDK9kASXsJVYjexF", "fee": 1400000, "feeAssetId": null, "timestamp": 1563891879228, "version": 1, "sender": "3N7JoxehscqKiXcuQ1iEQ6pEv6mZvnYS9mC", "senderPublicKey": "JDxkwPYhkU5rnVfdAuA1TbJzA7QCMhHjS4Dz2zP48Z8j", "proofs": [ "2Egop12ZH47aWT4WnEHQ91LQkhn7dPJZAthtEqP95yPJggXrpC5K2iQ7hMHkEjCtVXBjBVVaeECa7q7b8xywe5PG" ], "script": "base64:AAIDAAAAAAAAAAAAAAAiAAAAAAlPUkFDTEVBRFICAAAAIzNNcThDeXoxTkRCRDdtejZxeWMxNjRZTktTdW5zcnZKRkJNAAAAAAtCTEFDS0xJU1RFRAIAAAAJYmxhY2tsaXN0AAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkAB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AAR1c2VyBQAAAAR2b3RlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAPZ2V0S2V5Vm90ZUNvdW50AAAAAgUAAAAEaXRlbQUAAAAEdm90ZQUAAAAMbmV3Vm90ZUNvdW50CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAQZ2V0S2V5SXRlbVN0YXR1cwAAAAEFAAAABGl0ZW0DCQAAZwAAAAIFAAAADG5ld1ZvdGVDb3VudAUAAAAGUVVPUlVNBQAAAAR2b3RlBQAAAAZSRVZFQUwFAAAAA25pbAAAAAAWSA/t", "chainId": 84, "height": 598748, "spentComplexity": 0 } View: original | compacted Prev: J4rwvrztBWa94MVsHq5k9FDJspqcG2tUaNziP2wLW4nN Next: none Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let ORACLEADR = "3Mq8Cyz1NDBD7mz6qyc164YNKSunsrvJFBM" | |
5 | + | ||
6 | + | let BLACKLISTED = "blacklist" | |
7 | + | ||
4 | 8 | let NONE = "none" | |
5 | 9 | ||
6 | 10 | let VOTERS = 3 | |
97 | 101 | func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote)) | |
98 | 102 | ||
99 | 103 | ||
104 | + | func getExtAddressOracle () = extract(addressFromString(ORACLEADR)) | |
105 | + | ||
106 | + | ||
107 | + | func getExtKeyItemWhitelistStatus (account) = (account + "_verifier_status") | |
108 | + | ||
109 | + | ||
110 | + | func getExtValueItemWhitelistStatus (oracle,account) = { | |
111 | + | let str = match getString(oracle, getExtKeyItemWhitelistStatus(account)) { | |
112 | + | case a: String => | |
113 | + | a | |
114 | + | case _ => | |
115 | + | NONE | |
116 | + | } | |
117 | + | str | |
118 | + | } | |
119 | + | ||
120 | + | ||
100 | 121 | @Callable(i) | |
101 | 122 | func addItem (title,price,data) = { | |
102 | 123 | let supplierAddress = toBase58String(i.caller.bytes) | |
103 | 124 | let item = getKeyItem(supplierAddress, title) | |
125 | + | let supplierWhitelist = getExtValueItemWhitelistStatus(getExtAddressOracle(), supplierAddress) | |
104 | 126 | if ((0 >= price)) | |
105 | 127 | then throw("purchase amount cannot be less than item price") | |
106 | 128 | else if ((getValueItemSupplier(item) != NONE)) | |
107 | 129 | then throw("an item is already exist") | |
108 | - | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
130 | + | else if ((supplierWhitelist == BLACKLISTED)) | |
131 | + | then throw("supplier 's account has been blacklisted'") | |
132 | + | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemWhitelistStatus(supplierAddress), supplierWhitelist)]) | |
109 | 133 | } | |
110 | 134 | ||
111 | 135 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let ORACLEADR = "3Mq8Cyz1NDBD7mz6qyc164YNKSunsrvJFBM" | |
5 | + | ||
6 | + | let BLACKLISTED = "blacklist" | |
7 | + | ||
4 | 8 | let NONE = "none" | |
5 | 9 | ||
6 | 10 | let VOTERS = 3 | |
7 | 11 | ||
8 | 12 | let QUORUM = 2 | |
9 | 13 | ||
10 | 14 | let VOTING = "voting" | |
11 | 15 | ||
12 | 16 | let REVEAL = "reveal" | |
13 | 17 | ||
14 | 18 | let FEATURED = "featured" | |
15 | 19 | ||
16 | 20 | let DELISTED = "delisted" | |
17 | 21 | ||
18 | 22 | func getNumberByKey (key) = { | |
19 | 23 | let num = match getInteger(this, key) { | |
20 | 24 | case a: Int => | |
21 | 25 | a | |
22 | 26 | case _ => | |
23 | 27 | 0 | |
24 | 28 | } | |
25 | 29 | num | |
26 | 30 | } | |
27 | 31 | ||
28 | 32 | ||
29 | 33 | func getStrByKey (key) = { | |
30 | 34 | let str = match getString(this, key) { | |
31 | 35 | case a: String => | |
32 | 36 | a | |
33 | 37 | case _ => | |
34 | 38 | NONE | |
35 | 39 | } | |
36 | 40 | str | |
37 | 41 | } | |
38 | 42 | ||
39 | 43 | ||
40 | 44 | func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt") | |
41 | 45 | ||
42 | 46 | ||
43 | 47 | func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item)) | |
44 | 48 | ||
45 | 49 | ||
46 | 50 | func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title))))) | |
47 | 51 | ||
48 | 52 | ||
49 | 53 | func getKeyItemData (item) = (item + "_data") | |
50 | 54 | ||
51 | 55 | ||
52 | 56 | func getKeyItemSupplier (item) = (item + "_owner") | |
53 | 57 | ||
54 | 58 | ||
55 | 59 | func getKeyItemPrice (item) = (item + "_price") | |
56 | 60 | ||
57 | 61 | ||
58 | 62 | func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item)) | |
59 | 63 | ||
60 | 64 | ||
61 | 65 | func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item)) | |
62 | 66 | ||
63 | 67 | ||
64 | 68 | func getKeyBalanceSupplier (account) = (account + "_balance") | |
65 | 69 | ||
66 | 70 | ||
67 | 71 | func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account)) | |
68 | 72 | ||
69 | 73 | ||
70 | 74 | func getKeyCommit (item,user) = (((item + "_") + user) + "_commit") | |
71 | 75 | ||
72 | 76 | ||
73 | 77 | func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user)) | |
74 | 78 | ||
75 | 79 | ||
76 | 80 | func getKeyCommitsCount (item) = (item + "_itmcnt") | |
77 | 81 | ||
78 | 82 | ||
79 | 83 | func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item)) | |
80 | 84 | ||
81 | 85 | ||
82 | 86 | func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal") | |
83 | 87 | ||
84 | 88 | ||
85 | 89 | func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user)) | |
86 | 90 | ||
87 | 91 | ||
88 | 92 | func getKeyItemStatus (item) = (item + "_status") | |
89 | 93 | ||
90 | 94 | ||
91 | 95 | func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item)) | |
92 | 96 | ||
93 | 97 | ||
94 | 98 | func getKeyVoteCount (item,vote) = ((item + "_res:") + vote) | |
95 | 99 | ||
96 | 100 | ||
97 | 101 | func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote)) | |
98 | 102 | ||
99 | 103 | ||
104 | + | func getExtAddressOracle () = extract(addressFromString(ORACLEADR)) | |
105 | + | ||
106 | + | ||
107 | + | func getExtKeyItemWhitelistStatus (account) = (account + "_verifier_status") | |
108 | + | ||
109 | + | ||
110 | + | func getExtValueItemWhitelistStatus (oracle,account) = { | |
111 | + | let str = match getString(oracle, getExtKeyItemWhitelistStatus(account)) { | |
112 | + | case a: String => | |
113 | + | a | |
114 | + | case _ => | |
115 | + | NONE | |
116 | + | } | |
117 | + | str | |
118 | + | } | |
119 | + | ||
120 | + | ||
100 | 121 | @Callable(i) | |
101 | 122 | func addItem (title,price,data) = { | |
102 | 123 | let supplierAddress = toBase58String(i.caller.bytes) | |
103 | 124 | let item = getKeyItem(supplierAddress, title) | |
125 | + | let supplierWhitelist = getExtValueItemWhitelistStatus(getExtAddressOracle(), supplierAddress) | |
104 | 126 | if ((0 >= price)) | |
105 | 127 | then throw("purchase amount cannot be less than item price") | |
106 | 128 | else if ((getValueItemSupplier(item) != NONE)) | |
107 | 129 | then throw("an item is already exist") | |
108 | - | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
130 | + | else if ((supplierWhitelist == BLACKLISTED)) | |
131 | + | then throw("supplier 's account has been blacklisted'") | |
132 | + | else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemWhitelistStatus(supplierAddress), supplierWhitelist)]) | |
109 | 133 | } | |
110 | 134 | ||
111 | 135 | ||
112 | 136 | ||
113 | 137 | @Callable(i) | |
114 | 138 | func purchase (item) = { | |
115 | 139 | let pmt = extract(i.payment) | |
116 | 140 | if (isDefined(pmt.assetId)) | |
117 | 141 | then throw("WAVES tokens only at moment") | |
118 | 142 | else { | |
119 | 143 | let userAddress = toBase58String(i.caller.bytes) | |
120 | 144 | let price = getValueItemPrice(item) | |
121 | 145 | let supplierAddress = getValueItemSupplier(item) | |
122 | 146 | if ((price > pmt.amount)) | |
123 | 147 | then throw("purchase amout cannot be less than item price") | |
124 | 148 | else if ((pmt.amount > price)) | |
125 | 149 | then throw("purchase amount cannot be higher than item price") | |
126 | 150 | else if ((supplierAddress == NONE)) | |
127 | 151 | then throw("supplier dose not exist") | |
128 | 152 | else WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))]) | |
129 | 153 | } | |
130 | 154 | } | |
131 | 155 | ||
132 | 156 | ||
133 | 157 | ||
134 | 158 | @Callable(i) | |
135 | 159 | func withdraw () = { | |
136 | 160 | let supplierAddress = toBase58String(i.caller.bytes) | |
137 | 161 | let balance = getValueBalanceSupplier(supplierAddress) | |
138 | 162 | if ((0 >= balance)) | |
139 | 163 | then throw("insufficient balance") | |
140 | 164 | else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)])) | |
141 | 165 | } | |
142 | 166 | ||
143 | 167 | ||
144 | 168 | ||
145 | 169 | @Callable(i) | |
146 | 170 | func voteCommit (item,hash) = { | |
147 | 171 | let user = toBase58String(i.caller.bytes) | |
148 | 172 | let commits = getValueCommitsCount(item) | |
149 | 173 | let status = getValueItemStatus(item) | |
150 | 174 | if ((commits >= VOTERS)) | |
151 | 175 | then throw("reach maximum of voters") | |
152 | 176 | else if ((getValueCommit(item, user) != NONE)) | |
153 | 177 | then throw("user has already participated") | |
154 | 178 | else if ((getKeyItemSupplier(item) == NONE)) | |
155 | 179 | then throw("item dose not exist") | |
156 | 180 | else if (if ((status != NONE)) | |
157 | 181 | then (status != VOTING) | |
158 | 182 | else false) | |
159 | 183 | then throw("voting is not possible") | |
160 | 184 | else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS)) | |
161 | 185 | then REVEAL | |
162 | 186 | else VOTING)]) | |
163 | 187 | } | |
164 | 188 | ||
165 | 189 | ||
166 | 190 | ||
167 | 191 | @Callable(i) | |
168 | 192 | func voteReveal (item,vote,salt) = { | |
169 | 193 | let user = toBase58String(i.caller.bytes) | |
170 | 194 | let status = getValueItemStatus(item) | |
171 | 195 | let newVoteCount = (getValueVoteCount(item, vote) + 1) | |
172 | 196 | let computed = toBase58String(sha256(toBytes((vote + salt)))) | |
173 | 197 | if ((computed != getValueCommit(item, user))) | |
174 | 198 | then throw("reveal data is not valid") | |
175 | 199 | else if ((VOTERS > getValueCommitsCount(item))) | |
176 | 200 | then throw("maximum voter has not reached yet") | |
177 | 201 | else if ((getValueReveal(item, user) != NONE)) | |
178 | 202 | then throw("user has already participated") | |
179 | 203 | else if (if ((status != VOTING)) | |
180 | 204 | then (status != REVEAL) | |
181 | 205 | else false) | |
182 | 206 | then throw("wrong status") | |
183 | 207 | else if (if ((vote != FEATURED)) | |
184 | 208 | then (vote != DELISTED) | |
185 | 209 | else false) | |
186 | 210 | then throw("wrong vote") | |
187 | 211 | else if (if ((status == FEATURED)) | |
188 | 212 | then true | |
189 | 213 | else (status == FEATURED)) | |
190 | 214 | then throw("vote has finished") | |
191 | 215 | else WriteSet([DataEntry(getKeyReveal(item, user), vote), DataEntry(getKeyVoteCount(item, vote), newVoteCount), DataEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM)) | |
192 | 216 | then vote | |
193 | 217 | else REVEAL)]) | |
194 | 218 | } | |
195 | 219 | ||
196 | 220 |
github/deemru/w8io/169f3d6 85.08 ms ◑