tx · H1bYLn1n6CughXPjDrXiLPhCLts9tzsqT7peTDhD3Xdi

3Ms6Ht5bdVJa6sQnRBUg9nfNpEp7obSad8o:  -0.05000000 Waves

2019.08.12 17:05 [627933] smart account 3Ms6Ht5bdVJa6sQnRBUg9nfNpEp7obSad8o > SELF 0.00000000 Waves

{ "type": 13, "id": "H1bYLn1n6CughXPjDrXiLPhCLts9tzsqT7peTDhD3Xdi", "fee": 5000000, "feeAssetId": null, "timestamp": 1565618746092, "version": 1, "sender": "3Ms6Ht5bdVJa6sQnRBUg9nfNpEp7obSad8o", "senderPublicKey": "Ebb2ffqL8cMnNmXPNvHLy53xrK7t5WaSFhneCPBSoxop", "proofs": [ "4p29wAXnHbGrSj11hXyJwrbHHiysbRqfD4xw1sNEUuVXndWJge3GBhGVHy1HCFyo3HEUpufRWWv9LZt4EaDYrta7" ], "script": "base64:AAIDAAAAAAAAAAAAAAAhAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWkFAAAAByRtYXRjaDAFAAAAAWkAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzBQAAAAROT05FBQAAAANzdHIBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfcHJpY2UBAAAAEWdldFZhbHVlSXRlbVByaWNlAAAAAQAAAARpdGVtCQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABCQEAAAAPZ2V0S2V5SXRlbV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dm90ZQUAAAAMbmV3Vm90ZUNvdW50CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAQZ2V0S2V5SXRlbVN0YXR1cwAAAAEFAAAABGl0ZW0DCQAAZwAAAAIFAAAADG5ld1ZvdGVDb3VudAUAAAAGUVVPUlVNBQAAAAR2b3RlBQAAAAZSRVZFQUwFAAAAA25pbAAAAAA6bK+S", "chainId": 84, "height": 627933, "spentComplexity": 0 } View: original | compacted Prev: 33b3ZCKUHopEFAKjKDrPdigTdUDPXJLddNNXvkTgnhJi Next: E88ZinuGmcc7gmjkciyuttLizS5J97mPAx77aqWrDPVL Diff:
OldNewDifferences
9797 func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote))
9898
9999
100+func getExtAddressOracle () = extract(addressFromString("3MwyDYbjXQ9VRWnPkubmGgypox7663uCLxT"))
101+
102+
103+let BLACKLISTED = "blacklisted"
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+
100119 @Callable(inv)
101120 func addItem (title,price,data) = {
102121 let supplierAddress = toBase58String(inv.caller.bytes)
103122 let item = getKeyItem(supplierAddress, title)
123+ let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), getExtKeyItemWhiteListStatus(supplierAddress))
104124 if ((0 >= price))
105125 then throw("Please add valid price")
106126 else if ((getValueItemSupplier(item) != NONE))
107127 then throw((item + " - item already exists"))
108- else WriteSet([DataEntry(getKeyItemSuplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)])
128+ else if ((supplierWhiteList == BLACKLISTED))
129+ then throw((("The supplier " + supplierAddress) + " was blacklisted"))
130+ else WriteSet([DataEntry(getKeyItemSuplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)])
109131 }
110132
111133
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let NONE = "none"
55
66 func getNumberByKey (key) = {
77 let num = match getInteger(this, key) {
88 case i: Int =>
99 i
1010 case _ =>
1111 0
1212 }
1313 num
1414 }
1515
1616
1717 func getStrByKey (key) = {
1818 let str = match getString(this, key) {
1919 case s: String =>
2020 s
2121 case _ =>
2222 NONE
2323 }
2424 str
2525 }
2626
2727
2828 func getKeyItemPrice (item) = (item + "_price")
2929
3030
3131 func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item))
3232
3333
3434 func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt")
3535
3636
3737 func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
3838
3939
4040 func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
4141
4242
4343 func getKeyItemData (item) = (item + "_data")
4444
4545
4646 func getKeyItemSuplier (item) = (item + "_owner")
4747
4848
4949 func getValueItemSupplier (item) = getStrByKey(getKeyItemSuplier(item))
5050
5151
5252 func getKeyBalanceSupplier (account) = (account + "_balance")
5353
5454
5555 func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
5656
5757
5858 let VOTERS = 3
5959
6060 let QUORUM = 2
6161
6262 let VOTING = "voting"
6363
6464 let REVEAL = "reveal"
6565
6666 let FEATURED = "featured"
6767
6868 let DELISTED = "delisted"
6969
7070 func getKeyCommit (item,user) = (((item + "_") + user) + "_commit")
7171
7272
7373 func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user))
7474
7575
7676 func getKeyCommitsCount (item) = (item + "_comcnt")
7777
7878
7979 func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item))
8080
8181
8282 func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal")
8383
8484
8585 func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user))
8686
8787
8888 func getKeyItemStatus (item) = (item + "_status")
8989
9090
9191 func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item))
9292
9393
9494 func getKeyVoteCount (item,vote) = ((item + "_res:") + vote)
9595
9696
9797 func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote))
9898
9999
100+func getExtAddressOracle () = extract(addressFromString("3MwyDYbjXQ9VRWnPkubmGgypox7663uCLxT"))
101+
102+
103+let BLACKLISTED = "blacklisted"
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+
100119 @Callable(inv)
101120 func addItem (title,price,data) = {
102121 let supplierAddress = toBase58String(inv.caller.bytes)
103122 let item = getKeyItem(supplierAddress, title)
123+ let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), getExtKeyItemWhiteListStatus(supplierAddress))
104124 if ((0 >= price))
105125 then throw("Please add valid price")
106126 else if ((getValueItemSupplier(item) != NONE))
107127 then throw((item + " - item already exists"))
108- else WriteSet([DataEntry(getKeyItemSuplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)])
128+ else if ((supplierWhiteList == BLACKLISTED))
129+ then throw((("The supplier " + supplierAddress) + " was blacklisted"))
130+ else WriteSet([DataEntry(getKeyItemSuplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)])
109131 }
110132
111133
112134
113135 @Callable(inv)
114136 func purchase (item) = {
115137 let payment = extract(inv.payment)
116138 if (isDefined(payment.assetId))
117139 then throw("Only payments in WAVES are avalible")
118140 else {
119141 let userAddress = toBase58String(inv.caller.bytes)
120142 let price = getValueItemPrice(item)
121143 let supplierAddress = getValueItemSupplier(item)
122144 if ((price > payment.amount))
123145 then throw("Please send exact coupon price")
124146 else if ((payment.amount > price))
125147 then throw("Please send exact coupon price")
126148 else WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + payment.amount))])
127149 }
128150 }
129151
130152
131153
132154 @Callable(inv)
133155 func withdraw () = {
134156 let supplierAddress = toBase58String(inv.caller.bytes)
135157 let balance = getValueBalanceSupplier(supplierAddress)
136158 if ((0 >= balance))
137159 then throw("Ballance is zero")
138160 else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)]))
139161 }
140162
141163
142164
143165 @Callable(inv)
144166 func voteCommit (item,hash) = {
145167 let user = toBase58String(inv.caller.bytes)
146168 let commits = getValueCommitsCount(item)
147169 let status = getValueItemStatus(item)
148170 if ((commits >= VOTERS))
149171 then throw("We have reached necessary number of voters")
150172 else if ((getValueCommit(item, user) != NONE))
151173 then throw("User has already voted")
152174 else if ((getKeyItemSuplier(item) == NONE))
153175 then throw("Item does not exist")
154176 else if (if ((status != NONE))
155177 then (status != VOTING)
156178 else false)
157179 then throw("Voting is not possible")
158180 else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS))
159181 then REVEAL
160182 else VOTING)])
161183 }
162184
163185
164186
165187 @Callable(inv)
166188 func revealVotes (item,vote,salt) = {
167189 let user = toBase58String(inv.caller.bytes)
168190 let commits = getValueCommitsCount(item)
169191 let status = getValueItemStatus(item)
170192 let newVoteCount = (getValueVoteCount(item, vote) + 1)
171193 if ((toBase58String(sha256(toBytes((vote + salt)))) != getValueCommit(item, user)))
172194 then throw("Reveal data is not valid")
173195 else if ((VOTERS > getValueCommitsCount(item)))
174196 then throw("Necessary number of voters hasn't reached yet")
175197 else if ((getValueReveal(item, user) != NONE))
176198 then throw("User has already revealed his vote")
177199 else if (if ((status != VOTING))
178200 then (status != REVEAL)
179201 else false)
180202 then throw("Wrong status of vote")
181203 else if (if ((vote != FEATURED))
182204 then (vote != DELISTED)
183205 else false)
184206 then throw("Wrong vote")
185207 else if (if ((status == FEATURED))
186208 then true
187209 else (status == DELISTED))
188210 then throw("Voting complited")
189211 else WriteSet([DataEntry(getKeyReveal(item, user), vote), DataEntry(getKeyVoteCount(item, vote), newVoteCount), DataEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM))
190212 then vote
191213 else REVEAL)])
192214 }
193215
194216

github/deemru/w8io/026f985 
39.93 ms