tx · 5YQv2bZ7kt75bcNhsFzonMMpua6tV5Rka2kCf1wBLBH5

3N1NcGcztR7MMNbTmtNv96A9Q75b3foNWtk:  -0.01400000 Waves

2019.08.28 13:00 [650905] smart account 3N1NcGcztR7MMNbTmtNv96A9Q75b3foNWtk > SELF 0.00000000 Waves

{ "type": 13, "id": "5YQv2bZ7kt75bcNhsFzonMMpua6tV5Rka2kCf1wBLBH5", "fee": 1400000, "feeAssetId": null, "timestamp": 1566986439895, "version": 1, "sender": "3N1NcGcztR7MMNbTmtNv96A9Q75b3foNWtk", "senderPublicKey": "G2s7RQed7v8vaaSdJUzzvKbooceGFVF9y5SPF2pww4Vu", "proofs": [ "hvwnEJtB3LuXfexFBZ9YJYz5zaNbd418Q2ojpAbWEoSJaS3DBoQkFmyWR9EFVvCtn7krA9CnTuDtpaG7p7ZTf3p" ], "script": "base64:AwQAAAAHUHViS2V5MQEAAAAgaQxxSAhSITOlMYdvwKcfK7u/x0yzOg/68EH0ax0QlWUEAAAAB1B1YktleTIBAAAAILb58FcZXTIbjEshMW6ayDB2XcNop87YatlbtNE8j6N0BAAAAARzaWcxAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAB1B1YktleTEAAAAAAAAAAAEAAAAAAAAAAAAEAAAABHNpZzIDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQUAAAAHUHViS2V5MgAAAAAAAAAAAQAAAAAAAAAAAAkAAGYAAAACCQAAZAAAAAIFAAAABHNpZzEFAAAABHNpZzIAAAAAAAAAAADO+UOI", "chainId": 84, "height": 650905, "spentComplexity": 0 } View: original | compacted Prev: 6N8Je9stNvh5QMAWrtxEdmPHFDBC87GNQvtuzeq5ocTA Next: BMzFKFs8pjFohKncnrSD5vsVA25fF9ykaP4N1eCF8gmp Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
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 getKeyItemPrice (item) = (item + "_price")
41-
42-
43-func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item))
44-
45-
46-func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt")
47-
48-
49-func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
50-
51-
52-func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
53-
54-
55-func getKeyItemData (item) = (item + "_data")
56-
57-
58-func getKeyItemSupplier (item) = (item + "_owner")
59-
60-
61-func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
62-
63-
64-func getKeyBalanceSupplier (account) = (account + "_balance")
65-
66-
67-func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
68-
69-
70-func getKeyCommit (item,user) = (((item + "_") + user) + "_commit")
71-
72-
73-func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user))
74-
75-
76-func getKeyCommitsCount (item) = (item + "_comcnt")
77-
78-
79-func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item))
80-
81-
82-func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal")
83-
84-
85-func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user))
86-
87-
88-func getKeyItemStatus (item) = (item + "_status")
89-
90-
91-func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item))
92-
93-
94-func getKeyVoteCount (item,vote) = ((item + "_res:") + vote)
95-
96-
97-func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote))
98-
99-
100-let BLACKLISTED = "blacklist"
101-
102-func getExtAddressOracle () = extract(addressFromString("3N9f4YfQA9QPX1RiVvbhHYaChKw7B6giXrZ"))
103-
104-
105-func getExtKeyItemWhiteListStatus (account) = (account + "_verifier_status")
106-
107-
108-func getExtValueItemWhiteListStatus (oracle,account) = {
109- let str = match getString(oracle, getExtKeyItemWhiteListStatus(account)) {
110- case a: String =>
111- a
112- case _ =>
113- NONE
114- }
115- str
116- }
117-
118-
119-@Callable(i)
120-func addItem (title,price,data) = {
121- let supplierAddress = toBase58String(i.caller.bytes)
122- let item = getKeyItem(supplierAddress, title)
123- let supplierwhitelist = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress)
124- if ((0 >= price))
125- then throw("purchase amount cannot be higher than item pice")
126- else if ((getValueItemSupplier(item) != NONE))
127- then throw("an item is already exist")
128- else if ((supplierwhitelist == BLACKLISTED))
129- then throw("supplier's account as been blacklisted")
130- else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemWhiteListStatus(supplierAddress), supplierwhitelist)])
131- }
132-
133-
134-
135-@Callable(i)
136-func purchase (item) = {
137- let pmt = extract(i.payment)
138- if (isDefined(pmt.assetId))
139- then throw("Waves tokens only at the moment")
140- else {
141- let userAddress = toBase58String(i.caller.bytes)
142- let price = getValueItemPrice(item)
143- let supplierAddress = getValueItemSupplier(item)
144- if ((price > pmt.amount))
145- then throw("purchase amount cannot be less than item price")
146- else if ((pmt.amount > price))
147- then throw("purchase amount cannot be higher than item price")
148- else if ((supplierAddress == NONE))
149- then throw("supplier does not exist")
150- else WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))])
151- }
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 true
206- else (status == DELISTED))
207- then throw("worng 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-
218-@Verifier(tx)
219-func verify () = match tx {
220- case d: SetScriptTransaction =>
221- true
222- case d: DataTransaction =>
223- true
224- case d: TransferTransaction =>
225- true
226- case _ =>
227- true
228-}
229-
2+{-# CONTENT_TYPE EXPRESSION #-}
3+let PubKey1 = base58'854p8BYzrj6yBPRPmfQur3oF1Rjc1AJ548qRp5FT5kDa'
4+let PubKey2 = base58'DKGFPozLrsiR8NM4NJzqQaBYC8NyGYjuw2hDYicQVjco'
5+let sig1 = if (sigVerify(tx.bodyBytes, tx.proofs[0], PubKey1))
6+ then 1
7+ else 0
8+let sig2 = if (sigVerify(tx.bodyBytes, tx.proofs[1], PubKey2))
9+ then 1
10+ else 0
11+((sig1 + sig2) > 0)

github/deemru/w8io/169f3d6 
49.76 ms