tx · 2Gc1ChoJABFaa7RwRLbV8Bhmimxor89mL2NM5UcxyheH

3N4LwDMgdFYmuTPSSMDG9XUBxh58SuFrkg5:  -0.01400000 Waves

2019.07.03 07:42 [568769] smart account 3N4LwDMgdFYmuTPSSMDG9XUBxh58SuFrkg5 > SELF 0.00000000 Waves

{ "type": 13, "id": "2Gc1ChoJABFaa7RwRLbV8Bhmimxor89mL2NM5UcxyheH", "fee": 1400000, "feeAssetId": null, "timestamp": 1562128894460, "version": 1, "sender": "3N4LwDMgdFYmuTPSSMDG9XUBxh58SuFrkg5", "senderPublicKey": "Gxyog9TfcQ5vAbvv8M5gFtxfN6YDuSzQPnn2QPLZHQ8W", "proofs": [ "4ikYuGQx48ArvJAJd91edoBKZWfZTvdbStAvKeQv6ssSYHCU7CJvjQGrcakba4FNHJH65PCuFfpLffRETnZZmVeH" ], "script": "base64:AAIDAAAAAAAAAAAAAAAhAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfcHJpY2UBAAAAEWdldFZhbHVlSXRlbVByaWNlAAAAAQAAAARpdGVtCQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABCQEAAAAPZ2V0S2V5SXRlb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mV3Vm90ZUNvdW50BQAAAAZRVU9SVU0FAAAABHZvdGUFAAAABlJFVkVBTAUAAAADbmlsAAAAAHhFkrk=", "chainId": 84, "height": 568769, "spentComplexity": 0 } View: original | compacted Prev: 9eBwpAHo8Af81WbbsHZk4tSipb5ZoE72TvpAro9FR5Dh Next: none Diff:
OldNewDifferences
108108 func getExtValueItemStatus (oracle,account) = {
109109 let str = match getString(oracle, getExtKeyItemStatus(account)) {
110110 case a: String =>
111- account
111+ a
112112 case _ =>
113113 NONE
114114 }
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 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 () = extract(addressFromString("3N4ynv5cxsVeGSMoHBhiKKYcMmgZcDz8rzh"))
101101
102102
103103 let BLACKLISTED = "blacklisted"
104104
105105 func getExtKeyItemStatus (supplierAddress) = (supplierAddress + "_verified_status")
106106
107107
108108 func getExtValueItemStatus (oracle,account) = {
109109 let str = match getString(oracle, getExtKeyItemStatus(account)) {
110110 case a: String =>
111- account
111+ 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 = getExtValueItemStatus(getExtAddressOracle(), supplierAddress)
124124 if ((0 >= price))
125125 then throw("purchase amount cannot be less than price")
126126 else if ((getValueItemSupplier(item) != NONE))
127127 then throw("an item is already exist")
128128 else if ((supplierWhiteList == BLACKLISTED))
129129 then throw("your account is blacklisted")
130130 else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data), DataEntry(getExtKeyItemStatus(supplierAddress), supplierWhiteList)])
131131 }
132132
133133
134134
135135 @Callable(tx)
136136 func purchase (item) = {
137137 let pmt = extract(tx.payment)
138138 if (isDefined(pmt.assetId))
139139 then throw("You can use only Waves to purchase an item")
140140 else {
141141 let customerAddress = toBase58String(tx.caller.bytes)
142142 let price = getValueItemPrice(item)
143143 let supplierAddress = getValueItemSupplier(item)
144144 if ((price > pmt.amount))
145145 then throw("purchase amount less than item price")
146146 else if ((pmt.amount > price))
147147 then throw("purchase amount higher than item price")
148148 else WriteSet([DataEntry(getKeyUserItemCounter(customerAddress, item), (getValueUserItemCounter(customerAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))])
149149 }
150150 }
151151
152152
153153
154154 @Callable(txi)
155155 func withdraw () = {
156156 let supplierAddress = toBase58String(txi.caller.bytes)
157157 let balance = getValueBalanceSupplier(supplierAddress)
158158 if ((0 >= balance))
159159 then throw("insufficient funds")
160160 else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)]))
161161 }
162162
163163
164164
165165 @Callable(iv)
166166 func voteCommit (item,hash) = {
167167 let user = toBase58String(iv.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("user has already participated")
174174 else if ((getKeyItemSupplier(item) == NONE))
175175 then throw("item does not exist")
176176 else if (if ((status != NONE))
177177 then (status != VOTING)
178178 else false)
179179 then throw("voting is not possible")
180180 else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS))
181181 then REVEAL
182182 else VOTING)])
183183 }
184184
185185
186186
187187 @Callable(ivr)
188188 func voteReveal (item,vote,salt) = {
189189 let user = toBase58String(ivr.caller.bytes)
190190 let status = getValueItemStatus(item)
191191 let newVoteCount = getValueVoteCount(item, vote)
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 has not 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 (status == DELISTED)
208208 else false)
209209 then throw("votу has finished")
210210 else WriteSet([DataEntry(getKeyReveal(item, user), vote), DataEntry(getKeyVoteCount(item, vote), newVoteCount), DataEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM))
211211 then vote
212212 else REVEAL)])
213213 }
214214
215215

github/deemru/w8io/026f985 
58.06 ms