tx · Gt8czhHGAEVx2AXzEXDg1eGJZ4Eygpggf7EM6zuNmYLX

3N8X6wT7GZLavL2ayUQzwRD2kRFRSDyhkKS:  -0.01000000 Waves

2021.07.07 14:44 [1603142] smart account 3N8X6wT7GZLavL2ayUQzwRD2kRFRSDyhkKS > SELF 0.00000000 Waves

{ "type": 13, "id": "Gt8czhHGAEVx2AXzEXDg1eGJZ4Eygpggf7EM6zuNmYLX", "fee": 1000000, "feeAssetId": null, "timestamp": 1625658286409, "version": 2, "chainId": 84, "sender": "3N8X6wT7GZLavL2ayUQzwRD2kRFRSDyhkKS", "senderPublicKey": "7DT6yPGiY3eZiSytDKBx5ToZcjhem3SyxdX6Zz9fsMED", "proofs": [ "382DSoJHYEUofefkqKYFgymwJcCncYYHC2oT9E744eMnf2afq7C8M1ct64ZgY48cBzVqXRsQrGTBQRB4km8FDSJ7" ], "script": "base64:AAIFAAAAAAAAA9QIAhIFCgMIAQgSAwoBCBIAEgQKAggIEgUKAwgICBoKCgJhMRIETk9ORRoUCgJhMhIOZ2V0TnVtYmVyQnlLZXkaCQoCYTMSA2tleRoJCgJhNBIDbnVtGg0KAmE1EgckbWF0Y2gwGgcKAmE2EgFhGhEKAmE3EgtnZXRTdHJCeUtleRoJCgJhOBIDc3RyGhUKAmE5Eg9nZXRLZXlJdGVtUHJpY2UaCgoCYjESBGl0ZW0aFwoCYjISEWdldFZhbHVlSXRlbVByaWNlGhsKAmIzEhVnZXRLZXlVc2VySXRlbUNvdW50ZXIaCgoCYjQSBHVzZXIaHQoCYjUSF2dldFZhbHVlVXNlckl0ZW1Db3VudGVyGhAKAmI2EgpnZXRLZXlJdGVtGg4KAmI3EghzdXBwbGllchoLCgJiOBIFdGl0bGUaFAoCYjkSDmdldEtleUl0ZW1EYXRhGhgKAmMxEhJnZXRLZXlJdGVtU3VwcGxpZXIaGgoCYzISFGdldFZhbHVlSXRlbVN1cHBsaWVyGhsKAmMzEhVnZXRLZXlCYWxhbmNlU3VwcGxpZXIaDQo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mUzBQAAAAJmNwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQEAAAACZDkAAAABBQAAAAJiMQMJAABnAAAAAgUAAAACZjcFAAAAAmM3BQAAAAJlMwUAAAACYzkFAAAAA25pbAAAAABINCkL", "height": 1603142, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CxJDMt1pswwB5qoGmjnEmz5Ms1a9LmLechpxUmxRBkHJ Next: BHv4ThBwR6kcmZS9QrRxDDsDBb8CP9SPhmJeDJxE7zAH Diff:
OldNewDifferences
173173 then throw("max num of voters hasnt reached yet")
174174 else if ((getValueReveal(item, user) != NONE))
175175 then throw("user has already participated")
176- else if (if ((vote != FEATURED))
177- then (vote != DELISTED)
176+ else if (if ((status != VOTING))
177+ then (status != REVEAL)
178178 else false)
179- then throw("wrong vote")
180- else [StringEntry(getKeyReveal(item, user), vote), IntegerEntry(getKeyVoteCount(item, vote), newVoteCount), StringEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM))
181- then vote
182- else REVEAL)]
179+ then throw("wrong status")
180+ else if (if ((vote != FEATURED))
181+ then (vote != DELISTED)
182+ else false)
183+ then throw("wrong vote")
184+ else if (if ((status == FEATURED))
185+ then true
186+ else (status == DELISTED))
187+ then throw("vote has finished")
188+ else [StringEntry(getKeyReveal(item, user), vote), IntegerEntry(getKeyVoteCount(item, vote), newVoteCount), StringEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM))
189+ then vote
190+ else REVEAL)]
183191 }
184192
185193
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 @Callable(i)
101101 func addItem (title,price,data) = {
102102 let supplierAddress = toBase58String(i.caller.bytes)
103103 let item = getKeyItem(supplierAddress, title)
104104 if ((0 >= price))
105105 then throw("Purchase amount cannot be less than item price")
106106 else if ((getValueItemSupplier(item) != NONE))
107107 then throw("an item already exists")
108108 else [StringEntry(getKeyItemSupplier(item), supplierAddress), IntegerEntry(getKeyItemPrice(item), price), StringEntry(getKeyItemData(item), data)]
109109 }
110110
111111
112112
113113 @Callable(i)
114114 func purchase (item) = {
115115 let pmt = i.payments[0]
116116 if (isDefined(pmt.assetId))
117117 then throw("WAVES ONLY HHEUAWHEUAS")
118118 else {
119119 let userAddress = toBase58String(i.caller.bytes)
120120 let price = getValueItemPrice(item)
121121 let supplierAddress = getValueItemSupplier(item)
122122 if ((price > pmt.amount))
123123 then throw("Purchase amount cannot be less than item price")
124124 else if ((supplierAddress == NONE))
125125 then throw("Supplier does not exist")
126126 else [IntegerEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), IntegerEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))]
127127 }
128128 }
129129
130130
131131
132132 @Callable(i)
133133 func withdraw () = {
134134 let supplierAddress = toBase58String(i.caller.bytes)
135135 let balance = getValueBalanceSupplier(supplierAddress)
136136 if ((0 >= balance))
137137 then throw("insuficient balance")
138138 else [IntegerEntry(getKeyBalanceSupplier(supplierAddress), 0), ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)]
139139 }
140140
141141
142142
143143 @Callable(i)
144144 func voteCommit (item,hash) = {
145145 let user = toBase58String(i.caller.bytes)
146146 let commits = getValueCommitsCount(item)
147147 let status = getValueItemStatus(item)
148148 if ((commits >= VOTERS))
149149 then throw("Reached max num of voters")
150150 else if ((getValueCommit(item, user) != NONE))
151151 then throw("b1")
152152 else if ((getKeyItemSupplier(item) == NONE))
153153 then throw("b2")
154154 else if (if ((status != NONE))
155155 then (status != VOTING)
156156 else false)
157157 then throw("b3")
158158 else [StringEntry(getKeyCommit(item, user), hash), IntegerEntry(getKeyCommitsCount(item), (commits + 1)), StringEntry(getKeyItemStatus(item), if ((commits == VOTERS))
159159 then REVEAL
160160 else VOTING)]
161161 }
162162
163163
164164
165165 @Callable(i)
166166 func voteReveal (item,vote,salt) = {
167167 let user = toBase58String(i.caller.bytes)
168168 let status = getValueItemStatus(item)
169169 let newVoteCount = (getValueVoteCount(item, vote) + 1)
170170 if ((toBase58String(sha256(toBytes((vote + salt)))) != getValueCommit(item, user)))
171171 then throw("Reveal data is not valid")
172172 else if ((VOTERS > getValueCommitsCount(item)))
173173 then throw("max num of voters hasnt reached yet")
174174 else if ((getValueReveal(item, user) != NONE))
175175 then throw("user has already participated")
176- else if (if ((vote != FEATURED))
177- then (vote != DELISTED)
176+ else if (if ((status != VOTING))
177+ then (status != REVEAL)
178178 else false)
179- then throw("wrong vote")
180- else [StringEntry(getKeyReveal(item, user), vote), IntegerEntry(getKeyVoteCount(item, vote), newVoteCount), StringEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM))
181- then vote
182- else REVEAL)]
179+ then throw("wrong status")
180+ else if (if ((vote != FEATURED))
181+ then (vote != DELISTED)
182+ else false)
183+ then throw("wrong vote")
184+ else if (if ((status == FEATURED))
185+ then true
186+ else (status == DELISTED))
187+ then throw("vote has finished")
188+ else [StringEntry(getKeyReveal(item, user), vote), IntegerEntry(getKeyVoteCount(item, vote), newVoteCount), StringEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM))
189+ then vote
190+ else REVEAL)]
183191 }
184192
185193

github/deemru/w8io/026f985 
31.89 ms