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