tx · 1WWTFMu5bdszJd9Xv7dXM5iPomBLpKvUAknz8mBaFd5

3N1MvvKPNWqQ9JWYV1vWE84GnMKP3mENpSg:  -0.01400000 Waves

2019.07.05 12:53 [572054] smart account 3N1MvvKPNWqQ9JWYV1vWE84GnMKP3mENpSg > SELF 0.00000000 Waves

{ "type": 13, "id": "1WWTFMu5bdszJd9Xv7dXM5iPomBLpKvUAknz8mBaFd5", "fee": 1400000, "feeAssetId": null, "timestamp": 1562320482924, "version": 1, "sender": "3N1MvvKPNWqQ9JWYV1vWE84GnMKP3mENpSg", "senderPublicKey": "GBcKAM5muVn8dBji3B7ciEqt4XzrT4CBrAKXoTVfbw7", "proofs": [ "5apbr5qkuHYjSADWAfLWvwHYA1TWNXqfK57Mcv4h8dHdeVefvBWEs7YTUtsm1Qpgt3puHuMWmcgUpZf5rnxjGQWY" ], "script": "base64:AAIDAAAAAAAAAAAAAAAhAAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAAETk9ORQUAAA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VZvdGVDb3VudAAAAAIFAAAABGl0ZW0FAAAABHZvdGUFAAAADG5ld1ZvdGVDb3VudAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEGdldEtleUl0ZW1TdGF0dXMAAAABBQAAAARpdGVtAwkAAGcAAAACBQAAAAxuZXdWb3RlQ291bnQFAAAABlFVT1JVTQUAAAAEdm90ZQUAAAAGUkVWRUFMBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlee9+EMI=", "chainId": 84, "height": 572054, "spentComplexity": 0 } View: original | compacted Prev: HapicqVsT1h5UBtqTNRejEFy53GYLSyzd6dtkpMDXVBv Next: none Diff:
OldNewDifferences
9797 func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote))
9898
9999
100+func getExtAddressOracle () = extract(addressFromString("3N3M8E7uF1QstBzTMeobiUg1rGFttQNbgCz"))
101+
102+
103+let BLACKLISTED = "blacklist"
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(i)
101120 func addItem (title,price,data) = {
102121 let supplierAddress = toBase58String(i.caller.bytes)
103122 let item = getKeyItem(supplierAddress, title)
123+ let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress)
104124 if ((0 >= price))
105125 then throw("Purchase amount cannot be less that item price")
106126 else if ((getValueItemSupplier(item) != NONE))
107127 then throw("This item already exist")
108- else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)])
128+ else if ((supplierWhiteList == BLACKLISTED))
129+ then throw("Supplier's account has been blacklisted")
130+ else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemWhiteListStatus(supplierAddress), supplierWhiteList)])
109131 }
110132
111133
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let NONE = "none"
55
66 let VOTERS = 3
77
88 let QUORUM = 2
99
1010 let VOTING = "voting"
1111
1212 let REVEAL = "reveal"
1313
1414 let FEATURED = "featured"
1515
1616 let DELISTED = "delisted"
1717
1818 func getNumberByKey (key) = {
1919 let num = match getInteger(this, key) {
2020 case a: Int =>
2121 a
2222 case _ =>
2323 0
2424 }
2525 num
2626 }
2727
2828
2929 func getStrByKey (key) = {
3030 let str = match getString(this, key) {
3131 case a: String =>
3232 a
3333 case _ =>
3434 NONE
3535 }
3636 str
3737 }
3838
3939
4040 func getKeyItemPrice (item) = (item + "_price")
4141
4242
4343 func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item))
4444
4545
4646 func getKeyUserItemCounter (user,item) = ((item + "_user") + "_cnt")
4747
4848
4949 func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
5050
5151
5252 func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
5353
5454
5555 func getKeyItemData (item) = (item + "_data")
5656
5757
5858 func getKeyItemSupplier (item) = (item + "_owner")
5959
6060
6161 func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
6262
6363
6464 func getKeyBalanceSupplier (account) = (account + "_balance")
6565
6666
6767 func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
6868
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("3N3M8E7uF1QstBzTMeobiUg1rGFttQNbgCz"))
101+
102+
103+let BLACKLISTED = "blacklist"
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(i)
101120 func addItem (title,price,data) = {
102121 let supplierAddress = toBase58String(i.caller.bytes)
103122 let item = getKeyItem(supplierAddress, title)
123+ let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress)
104124 if ((0 >= price))
105125 then throw("Purchase amount cannot be less that item price")
106126 else if ((getValueItemSupplier(item) != NONE))
107127 then throw("This item already exist")
108- else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)])
128+ else if ((supplierWhiteList == BLACKLISTED))
129+ then throw("Supplier's account has been blacklisted")
130+ else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemWhiteListStatus(supplierAddress), supplierWhiteList)])
109131 }
110132
111133
112134
113135 @Callable(i)
114136 func purchase (item) = {
115137 let pmt = extract(i.payment)
116138 if (isDefined(pmt.assetId))
117139 then throw("Waves token only at this moment")
118140 else {
119141 let userAddress = toBase58String(i.caller.bytes)
120142 let price = getValueItemPrice(item)
121143 let supplierAddress = getValueItemSupplier(item)
122144 if ((price > pmt.amount))
123145 then throw("Purchase amount can not be less than item price")
124146 else if ((pmt.amount > price))
125147 then throw("Purchase amount can not be higher than item price")
126148 else if ((supplierAddress == NONE))
127149 then throw("Supplier does not exist")
128150 else WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))])
129151 }
130152 }
131153
132154
133155
134156 @Callable(i)
135157 func withdraw () = {
136158 let supplierAddress = toBase58String(i.caller.bytes)
137159 let balance = getValueBalanceSupplier(supplierAddress)
138160 if ((0 >= balance))
139161 then throw("Insufficient Balance")
140162 else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)]))
141163 }
142164
143165
144166
145167 @Callable(i)
146168 func voteCommit (item,hash) = {
147169 let user = toBase58String(i.caller.bytes)
148170 let commits = getValueCommitsCount(item)
149171 let status = getValueItemStatus(item)
150172 if ((commits >= VOTERS))
151173 then throw("Reached max numbers of voters")
152174 else if ((getValueCommit(item, user) != NONE))
153175 then throw("User has already participated")
154176 else if ((getKeyItemSupplier(item) == NONE))
155177 then throw("Item does not exist")
156178 else if (if ((status != NONE))
157179 then (status != VOTING)
158180 else false)
159181 then throw("Voting is not possible")
160182 else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS))
161183 then REVEAL
162184 else VOTING)])
163185 }
164186
165187
166188
167189 @Callable(i)
168190 func voteReveal (item,vote,salt) = {
169191 let user = toBase58String(i.caller.bytes)
170192 let status = getValueItemStatus(item)
171193 let newVoteCount = (getValueVoteCount(item, vote) + 1)
172194 if ((toBase58String(sha256(toBytes((vote + salt)))) != getValueCommit(item, user)))
173195 then throw("reveal data is not valid")
174196 else if ((VOTERS > getValueCommitsCount(item)))
175197 then throw("Max number of votes hasn't been reached yet")
176198 else if ((getValueReveal(item, user) != NONE))
177199 then throw("user has already participated")
178200 else if (if ((status != VOTING))
179201 then (status != REVEAL)
180202 else false)
181203 then throw("wrong status")
182204 else if (if ((vote != FEATURED))
183205 then (vote != DELISTED)
184206 else false)
185207 then throw("wrong vote")
186208 else if (if ((status == FEATURED))
187209 then true
188210 else (status == DELISTED))
189211 then throw("Vote has finished")
190212 else WriteSet([DataEntry(getKeyReveal(item, user), vote), DataEntry(getKeyVoteCount(item, vote), newVoteCount), DataEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM))
191213 then vote
192214 else REVEAL)])
193215 }
194216
195217
196218 @Verifier(tx)
197219 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
198220

github/deemru/w8io/026f985 
42.24 ms