tx · BJDfwcmjqUKqpfacbemW46YvHaYBST5o9NspvXdNAYV5

3Mx5pS14NDFkP1S4qqhighzQg2HWRU5TiZE:  -1.40000000 Waves

2019.08.20 11:49 [639232] smart account 3Mx5pS14NDFkP1S4qqhighzQg2HWRU5TiZE > SELF 0.00000000 Waves

{ "type": 13, "id": "BJDfwcmjqUKqpfacbemW46YvHaYBST5o9NspvXdNAYV5", "fee": 140000000, "feeAssetId": null, "timestamp": 1566291006240, "version": 1, "sender": "3Mx5pS14NDFkP1S4qqhighzQg2HWRU5TiZE", "senderPublicKey": "DCytZavupJsU4qnkbkLMLmGJfsEDYHFX1PW3NuNhqgTu", "proofs": [ "VunrHg17znhRuiE8KXa1xjXQMaxcsv7ciL63QMyWp7RTERcQPeXcE1HhfWEi9iE6MEbZF5o73LE2X9d2aYwpYZP" ], "script": "base64:AwQAAAAHUHViS2V5MQEAAAAgaQxxSAhSITOlMYdvwKcfK7u/x0yzOg/68EH0ax0QlWUEAAAAB1B1YktleTIBAAAAILb58FcZXTIbjEshMW6ayDB2XcNop87YatlbtNE8j6N0BAAAAARzaWcxAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAB1B1YktleTEAAAAAAAAAAAEAAAAAAAAAAAAEAAAABHNpZzIDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQUAAAAHUHViS2V5MgAAAAAAAAAAAQAAAAAAAAAAAAkAAGYAAAACCQAAZAAAAAIFAAAABHNpZzEFAAAABHNpZzIAAAAAAAAAAADO+UOI", "chainId": 84, "height": 639232, "spentComplexity": 0 } View: original | compacted Prev: 5i46xwyoA64jjqN3wSkKbY5SUrUoWeMcgJWgf5UXSt6T Next: 6qXY1sZtwYizvsroPrnTCv3tgbB6uhpcVB8TbBX4NEZT 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-let BLACKLISTED = "blacklist"
19-
20-func getExtAddressOracle () = extract(addressFromString("3MvxJX4xU8zUvxskVVKt8MgV3WoDKRjha9J"))
21-
22-
23-func getExtKeyItemWhiteListStatus (account) = (account + "_verifier_status")
24-
25-
26-func getExtValueItemWhiteListStatus (oracle,account) = {
27- let str = match getString(oracle, getExtKeyItemWhiteListStatus(account)) {
28- case a: String =>
29- a
30- case _ =>
31- NONE
32- }
33- str
34- }
35-
36-
37-func getNumberByKey (key) = {
38- let num = match getInteger(this, key) {
39- case a: Int =>
40- a
41- case _ =>
42- 0
43- }
44- num
45- }
46-
47-
48-func getStrByKey (key) = {
49- let str = match getString(this, key) {
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 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/873ac7e 
31.98 ms