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:AAIFAAAAAAAABHMIAhIFCgMIAQgSAwoBCBIAEgQKAggIEgUKAwgICBoKCgJhMRIETk9ORRoUCgJhMhIOZ2V0TnVtYmVyQnlLZXkaCQoCYTMSA2tleRoJCgJhNBIDbnVtGg0KAmE1EgckbWF0Y2gwGgcKAmE2EgFhGhEKAmE3EgtnZXRTdHJCeUtleRoJCgJhOBIDc3RyGhUKAmE5Eg9nZXRLZXlJdGVtUHJpY2UaCgoCYjESBGl0ZW0aFwoCYjISEWdldFZhbHVlSXRlbVByaWNlGhsKAmIzEhVnZXRLZXlVc2VySXRlbUNvdW50ZXIaCgoCYjQSBHVzZXIaHQoCYjUSF2dldFZhbHVlVXNlckl0ZW1Db3VudGVyGhAKAmI2EgpnZXRLZXlJdGVtGg4KAmI3EghzdXBwbGllchoLCgJiOBIFdGl0bGUaFAoCYjkSDmdldEtleUl0ZW1EYXRhGhgKAmMxEhJnZXRLZXlJdGVtU3VwcGxpZXIaGgoCYzISFGdldFZhbHVlSXRlbVN1cHBsaWVyGhsKAmMzEhVnZXRLZXlCYWxhbmNlU3VwcGxpZXIaDQoCYz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AAEsAAAAAgUAAAACZTMFAAAAAmczCQEAAAACZDQAAAACBQAAAAJiMQUAAAACYjQJAAACAAAAAQIAAAAYUmV2ZWFsIGRhdGEgaXMgbm90IHZhbGlkAwkAAGYAAAACBQAAAAJjNgkBAAAAAmQ2AAAAAQUAAAACYjEJAAACAAAAAQIAAAAjbWF4IG51bSBvZiB2b3RlcnMgaGFzbnQgcmVhY2hlZCB5ZXQDCQEAAAACIT0AAAACCQEAAAACZDgAAAACBQAAAAJiMQUAAAACYjQFAAAAAmExCQAAAgAAAAECAAAAHXVzZXIgaGFzIGFscmVhZHkgcGFydGljaXBhdGVkAwMJAQAAAAIhPQAAAAIFAAAAAmcyBQAAAAJjOAkBAAAAAiE9AAAAAgUAAAACZzIFAAAAAmM5BwkAAAIAAAABAgAAAAx3cm9uZyBzdGF0dXMDAwkBAAAAAiE9AAAAAgUAAAACZTMFAAAAAmQxCQEAAAACIT0AAAACBQAAAAJlMwUAAAACZDIHCQAAAgAAAAECAAAACndyb25nIHZvdGUDAwkAAAAAAAACBQAAAAJnMgUAAAACZDEGCQAAAAAAAAIFAAAAAmcyBQAAAAJkMgkAAAIAAAABAgAAABF2b3RlIGhhcyBmaW5pc2hlZAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQEAAAACZDcAAAACBQAAAAJiMQUAAAACYjQFAAAAAmUzCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQEAAAACZTIAAAACBQAAAAJiMQUAAAACZTMFAAAAAmc0CQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAQAAAAJkOQAAAAEFAAAAAmIxAwkAAGcAAAACBQAAAAJnNAUAAAACYzcFAAAAAmUzBQAAAAJjOQUAAAADbmlsAAAAABqVcT0=", "height": 1605830, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8Q6qQTJxNYGn4KqABFLK8pBB3RyJUVckeA74sKvQzFWa Next: none Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
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 a: Int =>
99 a
1010 case _ =>
1111 0
1212 }
1313 num
1414 }
1515
1616
1717 func getStrByKey (key) = {
1818 let str = match getString(this, key) {
1919 case a: String =>
2020 a
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 getKeyItemSupplier (item) = (item + "_owner")
4747
4848
4949 func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(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
100100 func getExtAddressOracle () = value(addressFromString("3MsbiyFyy8B3aN3kF8ntda474SPn4YMVkiq"))
101101
102102
103103 let BLACKLISTED = "blacklist"
104104
105105 func getExtKeyItemWhiteListStatus (account) = (account + "_verifier_status")
106106
107107
108108 func getExtValueItemWhiteListStatus (oracle,account) = {
109109 let str = match getString(oracle, getExtKeyItemWhiteListStatus(account)) {
110110 case a: String =>
111111 a
112112 case _ =>
113113 NONE
114114 }
115115 str
116116 }
117117
118118
119119 @Callable(i)
120120 func addItem (title,price,data) = {
121121 let supplierAddress = toBase58String(i.caller.bytes)
122122 let item = getKeyItem(supplierAddress, title)
123123 let supplierWhiteList = getExtValueItemWhiteListStatus(getExtAddressOracle(), supplierAddress)
124124 if ((0 >= price))
125125 then throw("Purchase amount cannot be less than item price")
126126 else if ((getValueItemSupplier(item) != NONE))
127127 then throw("an item already exists")
128128 else if ((supplierWhiteList == BLACKLISTED))
129129 then throw("supplier's account has been blacklisted")
130130 else [StringEntry(getKeyItemSupplier(item), supplierAddress), IntegerEntry(getKeyItemPrice(item), price), StringEntry(getKeyItemData(item), data), StringEntry(getExtKeyItemWhiteListStatus(supplierAddress), supplierWhiteList)]
131131 }
132132
133133
134134
135135 @Callable(i)
136136 func purchase (item) = {
137137 let pmt = i.payments[0]
138138 if (isDefined(pmt.assetId))
139139 then throw("WAVES ONLY HHEUAWHEUAS")
140140 else {
141141 let userAddress = toBase58String(i.caller.bytes)
142142 let price = getValueItemPrice(item)
143143 let supplierAddress = getValueItemSupplier(item)
144144 if ((price > pmt.amount))
145145 then throw("Purchase amount cannot be less than item price")
146146 else if ((supplierAddress == NONE))
147147 then throw("Supplier does not exist")
148148 else [IntegerEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), IntegerEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))]
149149 }
150150 }
151151
152152
153153
154154 @Callable(i)
155155 func withdraw () = {
156156 let supplierAddress = toBase58String(i.caller.bytes)
157157 let balance = getValueBalanceSupplier(supplierAddress)
158158 if ((0 >= balance))
159159 then throw("insuficient balance")
160160 else [IntegerEntry(getKeyBalanceSupplier(supplierAddress), 0), ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)]
161161 }
162162
163163
164164
165165 @Callable(i)
166166 func voteCommit (item,hash) = {
167167 let user = toBase58String(i.caller.bytes)
168168 let commits = getValueCommitsCount(item)
169169 let status = getValueItemStatus(item)
170170 if ((commits >= VOTERS))
171171 then throw("Reached max num of voters")
172172 else if ((getValueCommit(item, user) != NONE))
173173 then throw("b1")
174174 else if ((getKeyItemSupplier(item) == NONE))
175175 then throw("b2")
176176 else if (if ((status != NONE))
177177 then (status != VOTING)
178178 else false)
179179 then throw("b3")
180180 else [StringEntry(getKeyCommit(item, user), hash), IntegerEntry(getKeyCommitsCount(item), (commits + 1)), StringEntry(getKeyItemStatus(item), if ((commits == VOTERS))
181181 then REVEAL
182182 else VOTING)]
183183 }
184184
185185
186186
187187 @Callable(i)
188188 func voteReveal (item,vote,salt) = {
189189 let user = toBase58String(i.caller.bytes)
190190 let status = getValueItemStatus(item)
191191 let newVoteCount = (getValueVoteCount(item, vote) + 1)
192192 if ((toBase58String(sha256(toBytes((vote + salt)))) != getValueCommit(item, user)))
193193 then throw("Reveal data is not valid")
194194 else if ((VOTERS > getValueCommitsCount(item)))
195195 then throw("max num of voters hasnt reached yet")
196196 else if ((getValueReveal(item, user) != NONE))
197197 then throw("user has already participated")
198198 else if (if ((status != VOTING))
199199 then (status != REVEAL)
200200 else false)
201201 then throw("wrong status")
202202 else if (if ((vote != FEATURED))
203203 then (vote != DELISTED)
204204 else false)
205205 then throw("wrong vote")
206206 else if (if ((status == FEATURED))
207207 then true
208208 else (status == DELISTED))
209209 then throw("vote has finished")
210210 else [StringEntry(getKeyReveal(item, user), vote), IntegerEntry(getKeyVoteCount(item, vote), newVoteCount), StringEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM))
211211 then vote
212212 else REVEAL)]
213213 }
214214
215215

github/deemru/w8io/026f985 
32.86 ms