tx · 4xXcqbMedyXKeU6emzZNDwysCqiyTFpmqVG1ysNrxSzm 3N8X6wT7GZLavL2ayUQzwRD2kRFRSDyhkKS: -0.01000000 Waves 2021.07.09 11:21 [1605830] smart account 3N8X6wT7GZLavL2ayUQzwRD2kRFRSDyhkKS > SELF 0.00000000 Waves
{ "type": 13, "id": "4xXcqbMedyXKeU6emzZNDwysCqiyTFpmqVG1ysNrxSzm", "fee": 1000000, "feeAssetId": null, "timestamp": 1625818932907, "version": 2, "chainId": 84, "sender": "3N8X6wT7GZLavL2ayUQzwRD2kRFRSDyhkKS", "senderPublicKey": "7DT6yPGiY3eZiSytDKBx5ToZcjhem3SyxdX6Zz9fsMED", "proofs": [ "KBVTFkQjoR83dvLabSk7ZURLF9CshP3mmatT3e9GjbMCK5MB6AvarvCTjx3JMKU8CT9m2zUdjecxvnEdUxaVcGj" ], "script": "base64:AAIFAAAAAAAABHMIAhIFCgMIAQgSAwoBCBIAEgQKAggIEgUKAwgICBoKCgJhMRIETk9ORRoUCgJhMhIOZ2V0TnVtYmVyQnlLZXkaCQoCYTMSA2tleRoJCgJhNBIDbnVtGg0KAmE1EgckbWF0Y2gwGgcKAmE2EgFhGhEKAmE3EgtnZXRTdHJCeUtleRoJCgJhOBIDc3RyGhUKAmE5Eg9nZXRLZXlJdGVtUHJpY2UaCgoCYjESBGl0ZW0aFwoCYjISEWdldFZhbHVlSXRlbVByaWNlGhsKAmIzEhVnZXRLZXlVc2VySXRlbUNvdW50ZXIaCgoCYjQSBHVzZXIaHQoCYjUSF2dldFZhbHVlVXNlckl0ZW1Db3VudGVyGhAKAmI2EgpnZXRLZXlJdGVtGg4KAmI3EghzdXBwbGllchoLCgJiOBIFdGl0bGUaFAoCYjkSDmdldEtleUl0ZW1EYXRhGhgKAmMxEhJnZXRLZXlJdGVtU3VwcGxpZXIaGgoCYzISFGdldFZhbHVlSXRlbVN1cHBsaWVyGhsKAmMzEhVnZXRLZXlCYWxhbmNlU3VwcGxpZXIaDQoCYzQ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AEsAAAAAgUAAAACZTMFAAAAAmczCQEAAAACZDQAAAACBQAAAAJiMQUAAAACYjQJAAACAAAAAQIAAAAYUmV2ZWFsIGRhdGEgaXMgbm90IHZhbGlkAwkAAGYAAAACBQAAAAJjNgkBAAAAAmQ2AAAAAQUAAAACYjEJAAACAAAAAQIAAAAjbWF4IG51bSBvZiB2b3RlcnMgaGFzbnQgcmVhY2hlZCB5ZXQDCQEAAAACIT0AAAACCQEAAAACZDgAAAACBQAAAAJiMQUAAAACYjQFAAAAAmExCQAAAgAAAAECAAAAHXVzZXIgaGFzIGFscmVhZHkgcGFydGljaXBhdGVkAwMJAQAAAAIhPQAAAAIFAAAAAmcyBQAAAAJjOAkBAAAAAiE9AAAAAgUAAAACZzIFAAAAAmM5BwkAAAIAAAABAgAAAAx3cm9uZyBzdGF0dXMDAwkBAAAAAiE9AAAAAgUAAAACZTMFAAAAAmQxCQEAAAACIT0AAAACBQAAAAJlMwUAAAACZDIHCQAAAgAAAAECAAAACndyb25nIHZvdGUDAwkAAAAAAAACBQAAAAJnMgUAAAACZDEGCQAAAAAAAAIFAAAAAmcyBQAAAAJkMgkAAAIAAAABAgAAABF2b3RlIGhhcyBmaW5pc2hlZAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQEAAAACZDcAAAACBQAAAAJiMQUAAAACYjQFAAAAAmUzCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQEAAAACZTIAAAACBQAAAAJiMQUAAAACZTMFAAAAAmc0CQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAQAAAAJkOQAAAAEFAAAAAmIxAwkAAGcAAAACBQAAAAJnNAUAAAACYzcFAAAAAmUzBQAAAAJjOQUAAAADbmlsAAAAABqVcT0=", "height": 1605830, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8Q6qQTJxNYGn4KqABFLK8pBB3RyJUVckeA74sKvQzFWa Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
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 () = value(addressFromString("3MsbiyFyy8B3aN3kF8ntda474SPn4YMVkiq")) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | let BLACKLISTED = "blacklist" | |
104 | 104 | ||
105 | 105 | func getExtKeyItemWhiteListStatus (account) = (account + "_verifier_status") | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func getExtValueItemWhiteListStatus (oracle,account) = { | |
109 | 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(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 = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress) | |
124 | 124 | if ((0 >= price)) | |
125 | 125 | then throw("Purchase amount cannot be less than item price") | |
126 | 126 | else if ((getValueItemSupplier(item) != NONE)) | |
127 | 127 | then throw("an item already exists") | |
128 | 128 | else if ((supplierWhiteList == BLACKLISTED)) | |
129 | 129 | then throw("supplier's account has been blacklisted") | |
130 | 130 | else [StringEntry(getKeyItemSupplier(item), supplierAddress), IntegerEntry(getKeyItemPrice(item), price), StringEntry(getKeyItemData(item), data), StringEntry(getExtKeyItemWhiteListStatus(supplierAddress), supplierWhiteList)] | |
131 | 131 | } | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | ||
135 | 135 | @Callable(i) | |
136 | 136 | func purchase (item) = { | |
137 | 137 | let pmt = i.payments[0] | |
138 | 138 | if (isDefined(pmt.assetId)) | |
139 | 139 | then throw("WAVES ONLY HHEUAWHEUAS") | |
140 | 140 | else { | |
141 | 141 | let userAddress = toBase58String(i.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 cannot be less than item price") | |
146 | 146 | else if ((supplierAddress == NONE)) | |
147 | 147 | then throw("Supplier does not exist") | |
148 | 148 | else [IntegerEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), IntegerEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))] | |
149 | 149 | } | |
150 | 150 | } | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | ||
154 | 154 | @Callable(i) | |
155 | 155 | func withdraw () = { | |
156 | 156 | let supplierAddress = toBase58String(i.caller.bytes) | |
157 | 157 | let balance = getValueBalanceSupplier(supplierAddress) | |
158 | 158 | if ((0 >= balance)) | |
159 | 159 | then throw("insuficient balance") | |
160 | 160 | else [IntegerEntry(getKeyBalanceSupplier(supplierAddress), 0), ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)] | |
161 | 161 | } | |
162 | 162 | ||
163 | 163 | ||
164 | 164 | ||
165 | 165 | @Callable(i) | |
166 | 166 | func voteCommit (item,hash) = { | |
167 | 167 | let user = toBase58String(i.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("b1") | |
174 | 174 | else if ((getKeyItemSupplier(item) == NONE)) | |
175 | 175 | then throw("b2") | |
176 | 176 | else if (if ((status != NONE)) | |
177 | 177 | then (status != VOTING) | |
178 | 178 | else false) | |
179 | 179 | then throw("b3") | |
180 | 180 | else [StringEntry(getKeyCommit(item, user), hash), IntegerEntry(getKeyCommitsCount(item), (commits + 1)), StringEntry(getKeyItemStatus(item), if ((commits == VOTERS)) | |
181 | 181 | then REVEAL | |
182 | 182 | else VOTING)] | |
183 | 183 | } | |
184 | 184 | ||
185 | 185 | ||
186 | 186 | ||
187 | 187 | @Callable(i) | |
188 | 188 | func voteReveal (item,vote,salt) = { | |
189 | 189 | let user = toBase58String(i.caller.bytes) | |
190 | 190 | let status = getValueItemStatus(item) | |
191 | 191 | let newVoteCount = (getValueVoteCount(item, vote) + 1) | |
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 hasnt 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 true | |
208 | 208 | else (status == DELISTED)) | |
209 | 209 | then throw("vote has finished") | |
210 | 210 | else [StringEntry(getKeyReveal(item, user), vote), IntegerEntry(getKeyVoteCount(item, vote), newVoteCount), StringEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM)) | |
211 | 211 | then vote | |
212 | 212 | else REVEAL)] | |
213 | 213 | } | |
214 | 214 | ||
215 | 215 |
github/deemru/w8io/026f985 32.86 ms ◑