tx · EigQthiRcwfkBtqGUVjmvMan6w8tvR4AEjRxD8abDnBX

3N2nCHvKXtFH8RUsGQB4LVEwVEWfTsT5i2B:  -0.01400000 Waves

2019.07.14 21:23 [585772] smart account 3N2nCHvKXtFH8RUsGQB4LVEwVEWfTsT5i2B > SELF 0.00000000 Waves

{ "type": 13, "id": "EigQthiRcwfkBtqGUVjmvMan6w8tvR4AEjRxD8abDnBX", "fee": 1400000, "feeAssetId": null, "timestamp": 1563128630922, "version": 1, "sender": "3N2nCHvKXtFH8RUsGQB4LVEwVEWfTsT5i2B", "senderPublicKey": "6NXakHCUpkyyHNuwDVZ4gYubvvbuP2qL6v2WzJhniSN1", "proofs": [ "3496ezq83cmZkDaTmU5VxsFV4Ekw4WEzQaBnDbp24RLiCMf2j6KyKEPPGDh6Fy7jysdzHUxfTzM7Pc9zvB4nJsWV" ], "script": "base64:AAIDAAAAAAAAAAAAAAAdAAAAAAZWT1RFUlMAAAAAAAAAAAQAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAAAAAAETk9ORQIAAAAEbm9uZQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAAETk9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RlaSB2b3RhbnRpIG5vbiDDqCBzdGF0byByYWdnaXVudG8DCQEAAAACIT0AAAACCQEAAAAOZ2V0VmFsdWVSZXZlYWwAAAACBQAAAARpdGVtBQAAAAR1c2VyBQAAAAROT05FCQAAAgAAAAECAAAAK2wndXRlbnRlIGhhIGdpw6AgcGFydGVjaXBhdG8gYWxsYSB2b3RhemlvbmUDAwkBAAAAAiE9AAAAAgUAAAAGc3RhdHVzBQAAAAZSRVZFQUwJAQAAAAIhPQAAAAIFAAAABnN0YXR1cwUAAAAGVk9USU5HBwkAAAIAAAABAgAAAAxTdGF0byBlcnJhdG8DAwkBAAAAAiE9AAAAAgUAAAAEdm90ZQUAAAAIRkVBVFVSRUQJAQAAAAIhPQAAAAIFAAAABHZvdGUFAAAACERFTElTVEVEBwkAAAIAAAABAgAAAAtWb3RvIGVycmF0bwMDCQAAAAAAAAIFAAAABnN0YXR1cwUAAAAIRkVBVFVSRUQGCQAAAAAAAAIFAAAABnN0YXR1cwUAAAAIREVMSVNURUQJAAACAAAAAQIAAAAbTGEgdm90YXppb25lIHNpIMOoIGNvbmNsdXNhCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAMZ2V0S2V5UmV2ZWFsAAAAAgUAAAAEaXRlbQUAAAAEdXNlcgUAAAAEdm90ZQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAD2dldEtleVZvdGVDb3VudAAAAAIFAAAABGl0ZW0FAAAABHZvdGUFAAAADG5ld1ZvdGVDb3VudAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEGdldEtleUl0ZW1TdGF0dXMAAAABBQAAAARpdGVtAwkAAGcAAAACBQAAAAxuZXdWb3RlQ291bnQFAAAABlFVT1JVTQUAAAAGVk9USU5HBQAAAAZSRVZFQUwFAAAAA25pbAAAAABcoM7w", "chainId": 84, "height": 585772, "spentComplexity": 0 } View: original | compacted Prev: BxAEFqLpLBmo8f6CiSvR8bTZPV5huyXPYvesVwkSBmJc Next: B4W5ixJoUcMmMq8uWTFLKxieQJmpjbE7UgW8Vo32Tat5 Diff:
OldNewDifferences
111111 else if (if ((status != NONE))
112112 then (status != VOTING)
113113 else false)
114- then throw("Votazione non possibile")
114+ then throw(("Votazione non possibile " + status))
115115 else {
116116 let newCommits = (commits + 1)
117117 WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), newCommits), DataEntry(getKeyItemStatus(item), if ((newCommits == VOTERS))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let VOTERS = 4
55
66 let QUORUM = 2
77
88 let VOTING = "voting"
99
1010 let REVEAL = "reveal"
1111
1212 let FEATURED = "featured"
1313
1414 let DELISTED = "delisted"
1515
1616 let NONE = "none"
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 getKeyCommit (item,user) = (((item + "_") + user) + "_commit")
4141
4242
4343 func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user))
4444
4545
4646 func getKeyCommitsCount (item) = (item + "_commit_count")
4747
4848
4949 func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item))
5050
5151
5252 func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal")
5353
5454
5555 func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user))
5656
5757
5858 func getKeyItemStatus (item) = (item + "_status")
5959
6060
6161 func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item))
6262
6363
6464 func getKeyVoteCount (item,vote) = ((item + "_res_") + vote)
6565
6666
6767 func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote))
6868
6969
7070 func getKeyItemPrice (item) = (item + "_price")
7171
7272
7373 func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item))
7474
7575
7676 func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt")
7777
7878
7979 func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
8080
8181
8282 func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
8383
8484
8585 func getKeyItemData (item) = (item + "_data")
8686
8787
8888 func getKeyItemSupplier (item) = (item + "_owner")
8989
9090
9191 func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
9292
9393
9494 func getKeyBalanceSupplier (account) = (account + "_balance")
9595
9696
9797 func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
9898
9999
100100 @Callable(i)
101101 func voteCommit (item,hash) = {
102102 let user = toBase58String(i.caller.bytes)
103103 let commits = getValueCommitsCount(item)
104104 let status = getValueItemStatus(item)
105105 if ((commits >= VOTERS))
106106 then throw("Raggiunto il numero massimo di voti")
107107 else if ((getValueCommit(item, user) != NONE))
108108 then throw("Hai già espresso un voto per questo articolo")
109109 else if ((getKeyItemSupplier(item) == NONE))
110110 then throw("L'articolo che vuoi votare non esiste")
111111 else if (if ((status != NONE))
112112 then (status != VOTING)
113113 else false)
114- then throw("Votazione non possibile")
114+ then throw(("Votazione non possibile " + status))
115115 else {
116116 let newCommits = (commits + 1)
117117 WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), newCommits), DataEntry(getKeyItemStatus(item), if ((newCommits == VOTERS))
118118 then REVEAL
119119 else VOTING)])
120120 }
121121 }
122122
123123
124124
125125 @Callable(i)
126126 func voteReveal (item,vote,salt) = {
127127 let user = toBase58String(i.caller.bytes)
128128 let status = getValueItemStatus(item)
129129 let newVoteCount = (getValueVoteCount(item, vote) + 1)
130130 if ((toBase58String(sha256(toBytes((vote + salt)))) != getValueCommit(item, user)))
131131 then throw("Reveal data is not valid")
132132 else if ((VOTERS > getValueCommitsCount(item)))
133133 then throw("Il numero massimo dei votanti non è stato raggiunto")
134134 else if ((getValueReveal(item, user) != NONE))
135135 then throw("l'utente ha già partecipato alla votazione")
136136 else if (if ((status != REVEAL))
137137 then (status != VOTING)
138138 else false)
139139 then throw("Stato errato")
140140 else if (if ((vote != FEATURED))
141141 then (vote != DELISTED)
142142 else false)
143143 then throw("Voto errato")
144144 else if (if ((status == FEATURED))
145145 then true
146146 else (status == DELISTED))
147147 then throw("La votazione si è conclusa")
148148 else WriteSet([DataEntry(getKeyReveal(item, user), vote), DataEntry(getKeyVoteCount(item, vote), newVoteCount), DataEntry(getKeyItemStatus(item), if ((newVoteCount >= QUORUM))
149149 then VOTING
150150 else REVEAL)])
151151 }
152152
153153

github/deemru/w8io/026f985 
42.80 ms