tx · DrPGLQ7jynfqSm8qYppi4tFQ1ph6N6NmghLSsPp7kegr 3Ms6Ht5bdVJa6sQnRBUg9nfNpEp7obSad8o: -0.05000000 Waves 2019.08.12 17:47 [627983] smart account 3Ms6Ht5bdVJa6sQnRBUg9nfNpEp7obSad8o > SELF 0.00000000 Waves
{ "type": 13, "id": "DrPGLQ7jynfqSm8qYppi4tFQ1ph6N6NmghLSsPp7kegr", "fee": 5000000, "feeAssetId": null, "timestamp": 1565621290931, "version": 1, "sender": "3Ms6Ht5bdVJa6sQnRBUg9nfNpEp7obSad8o", "senderPublicKey": "Ebb2ffqL8cMnNmXPNvHLy53xrK7t5WaSFhneCPBSoxop", "proofs": [ "2io7Mkpb7qz7D2kz3McNzECwC8577s9ZuV9ixvNiVuzkjTAYoxoA7Ak2pLG7yCawrhW7LLnSjuMqFDpkQSewQu2Y" ], "script": "base64:AAIDAAAAAAAAAAAAAAAhAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWkFAAAAByRtYXRjaDAFAAAAAWkAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzBQAAAAROT05FBQAAAANzdHIBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfcHJpY2UBAAAAEWdldFZhbHVlSXRlbVByaWNlAAAAAQAAAARpdGVtCQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABCQEAAAAPZ2V0S2V5S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AAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEGdldEtleUl0ZW1TdGF0dXMAAAABBQAAAARpdGVtAwkAAGcAAAACBQAAAAxuZXdWb3RlQ291bnQFAAAABlFVT1JVTQUAAAAEdm90ZQUAAAAGUkVWRUFMBQAAAANuaWwAAAAAOTduIQ==", "chainId": 84, "height": 627983, "spentComplexity": 0 } View: original | compacted Prev: 8a2RiMTdezb3nFeqn3CoJmhibQ5LRMj89RXbnF1PDPx1 Next: hWNzYPHuTVB71rnqoXWv4X9QiMhYQsDzPAM3MJ7HoNS Diff:
Old | New | Differences | |
---|---|---|---|
97 | 97 | func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote)) | |
98 | 98 | ||
99 | 99 | ||
100 | - | func getExtAddressOracle () = | |
100 | + | func getExtAddressOracle () = extract(addressFromString("3MwyDYbjXQ9VRWnPkubmGgypox7663uCLxT")) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | let BLACKLISTED = "blacklisted" | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func getExtValueItemWhiteListStatus (oracle,account) = { | |
109 | - | let str = match getString( | |
109 | + | let str = match getString(oracle, getExtKeyItemWhiteListStatus(account)) { | |
110 | 110 | case a: String => | |
111 | 111 | a | |
112 | 112 | case _ => | |
120 | 120 | func addItem (title,price,data) = { | |
121 | 121 | let supplierAddress = toBase58String(inv.caller.bytes) | |
122 | 122 | let item = getKeyItem(supplierAddress, title) | |
123 | - | let VARgetExtKeyItemWhiteListStatus = getExtKeyItemWhiteListStatus(supplierAddress) | |
124 | - | let VARgetExtAddressOracle = getExtAddressOracle() | |
125 | - | let supplierWhiteList = getExtValueItemWhiteListStatus(addressFromStringValue("3MwyDYbjXQ9VRWnPkubmGgypox7663uCLxT"), getExtKeyItemWhiteListStatus(supplierAddress)) | |
126 | - | throw(("supplierWhiteList: " + supplierWhiteList)) | |
123 | + | let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress) | |
124 | + | if ((0 >= price)) | |
125 | + | then throw("Please add valid price") | |
126 | + | else if ((getValueItemSupplier(item) != NONE)) | |
127 | + | then throw((item + " - item already exists")) | |
128 | + | else if ((supplierWhiteList == BLACKLISTED)) | |
129 | + | then throw((("The supplier " + supplierAddress) + " was blacklisted")) | |
130 | + | else WriteSet([DataEntry(getKeyItemSuplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
127 | 131 | } | |
128 | 132 | ||
129 | 133 |
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 i: Int => | |
9 | 9 | i | |
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 s: String => | |
20 | 20 | s | |
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 getKeyItemSuplier (item) = (item + "_owner") | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func getValueItemSupplier (item) = getStrByKey(getKeyItemSuplier(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 | - | func getExtAddressOracle () = | |
100 | + | func getExtAddressOracle () = extract(addressFromString("3MwyDYbjXQ9VRWnPkubmGgypox7663uCLxT")) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | let BLACKLISTED = "blacklisted" | |
104 | 104 | ||
105 | 105 | func getExtKeyItemWhiteListStatus (account) = (account + "_verifier_status") | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func getExtValueItemWhiteListStatus (oracle,account) = { | |
109 | - | let str = match getString( | |
109 | + | let str = match getString(oracle, getExtKeyItemWhiteListStatus(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(inv) | |
120 | 120 | func addItem (title,price,data) = { | |
121 | 121 | let supplierAddress = toBase58String(inv.caller.bytes) | |
122 | 122 | let item = getKeyItem(supplierAddress, title) | |
123 | - | let VARgetExtKeyItemWhiteListStatus = getExtKeyItemWhiteListStatus(supplierAddress) | |
124 | - | let VARgetExtAddressOracle = getExtAddressOracle() | |
125 | - | let supplierWhiteList = getExtValueItemWhiteListStatus(addressFromStringValue("3MwyDYbjXQ9VRWnPkubmGgypox7663uCLxT"), getExtKeyItemWhiteListStatus(supplierAddress)) | |
126 | - | throw(("supplierWhiteList: " + supplierWhiteList)) | |
123 | + | let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress) | |
124 | + | if ((0 >= price)) | |
125 | + | then throw("Please add valid price") | |
126 | + | else if ((getValueItemSupplier(item) != NONE)) | |
127 | + | then throw((item + " - item already exists")) | |
128 | + | else if ((supplierWhiteList == BLACKLISTED)) | |
129 | + | then throw((("The supplier " + supplierAddress) + " was blacklisted")) | |
130 | + | else WriteSet([DataEntry(getKeyItemSuplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)]) | |
127 | 131 | } | |
128 | 132 | ||
129 | 133 | ||
130 | 134 | ||
131 | 135 | @Callable(inv) | |
132 | 136 | func purchase (item) = { | |
133 | 137 | let payment = extract(inv.payment) | |
134 | 138 | if (isDefined(payment.assetId)) | |
135 | 139 | then throw("Only payments in WAVES are avalible") | |
136 | 140 | else { | |
137 | 141 | let userAddress = toBase58String(inv.caller.bytes) | |
138 | 142 | let price = getValueItemPrice(item) | |
139 | 143 | let supplierAddress = getValueItemSupplier(item) | |
140 | 144 | if ((price > payment.amount)) | |
141 | 145 | then throw("Please send exact coupon price") | |
142 | 146 | else if ((payment.amount > price)) | |
143 | 147 | then throw("Please send exact coupon price") | |
144 | 148 | else WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + payment.amount))]) | |
145 | 149 | } | |
146 | 150 | } | |
147 | 151 | ||
148 | 152 | ||
149 | 153 | ||
150 | 154 | @Callable(inv) | |
151 | 155 | func withdraw () = { | |
152 | 156 | let supplierAddress = toBase58String(inv.caller.bytes) | |
153 | 157 | let balance = getValueBalanceSupplier(supplierAddress) | |
154 | 158 | if ((0 >= balance)) | |
155 | 159 | then throw("Ballance is zero") | |
156 | 160 | else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)])) | |
157 | 161 | } | |
158 | 162 | ||
159 | 163 | ||
160 | 164 | ||
161 | 165 | @Callable(inv) | |
162 | 166 | func voteCommit (item,hash) = { | |
163 | 167 | let user = toBase58String(inv.caller.bytes) | |
164 | 168 | let commits = getValueCommitsCount(item) | |
165 | 169 | let status = getValueItemStatus(item) | |
166 | 170 | if ((commits >= VOTERS)) | |
167 | 171 | then throw("We have reached necessary number of voters") | |
168 | 172 | else if ((getValueCommit(item, user) != NONE)) | |
169 | 173 | then throw("User has already voted") | |
170 | 174 | else if ((getKeyItemSuplier(item) == NONE)) | |
171 | 175 | then throw("Item does not exist") | |
172 | 176 | else if (if ((status != NONE)) | |
173 | 177 | then (status != VOTING) | |
174 | 178 | else false) | |
175 | 179 | then throw("Voting is not possible") | |
176 | 180 | else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS)) | |
177 | 181 | then REVEAL | |
178 | 182 | else VOTING)]) | |
179 | 183 | } | |
180 | 184 | ||
181 | 185 | ||
182 | 186 | ||
183 | 187 | @Callable(inv) | |
184 | 188 | func revealVotes (item,vote,salt) = { | |
185 | 189 | let user = toBase58String(inv.caller.bytes) | |
186 | 190 | let commits = getValueCommitsCount(item) | |
187 | 191 | let status = getValueItemStatus(item) | |
188 | 192 | let newVoteCount = (getValueVoteCount(item, vote) + 1) | |
189 | 193 | if ((toBase58String(sha256(toBytes((vote + salt)))) != getValueCommit(item, user))) | |
190 | 194 | then throw("Reveal data is not valid") | |
191 | 195 | else if ((VOTERS > getValueCommitsCount(item))) | |
192 | 196 | then throw("Necessary number of voters hasn't reached yet") | |
193 | 197 | else if ((getValueReveal(item, user) != NONE)) | |
194 | 198 | then throw("User has already revealed his vote") | |
195 | 199 | else if (if ((status != VOTING)) | |
196 | 200 | then (status != REVEAL) | |
197 | 201 | else false) | |
198 | 202 | then throw("Wrong status of vote") | |
199 | 203 | else if (if ((vote != FEATURED)) | |
200 | 204 | then (vote != DELISTED) | |
201 | 205 | else false) | |
202 | 206 | then throw("Wrong vote") | |
203 | 207 | else if (if ((status == FEATURED)) | |
204 | 208 | then true | |
205 | 209 | else (status == DELISTED)) | |
206 | 210 | then throw("Voting complited") | |
207 | 211 | else WriteSet([DataEntry(getKeyReveal(item, user), vote), DataEntry(getKeyVoteCount(item, vote), newVoteCount), DataEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM)) | |
208 | 212 | then vote | |
209 | 213 | else REVEAL)]) | |
210 | 214 | } | |
211 | 215 | ||
212 | 216 |
github/deemru/w8io/026f985 41.12 ms ◑