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