tx · 7Up1dH9x5tSpT7seE1tGUB2QV9Ggd7CaXKFRDrxhUo1M

3MwLNbzF4w298YSpa1CrASmgZQs4H7QnUKJ:  -0.04000000 Waves

2019.07.24 16:48 [600195] smart account 3MwLNbzF4w298YSpa1CrASmgZQs4H7QnUKJ > SELF 0.00000000 Waves

{ "type": 13, "id": "7Up1dH9x5tSpT7seE1tGUB2QV9Ggd7CaXKFRDrxhUo1M", "fee": 4000000, "feeAssetId": null, "timestamp": 1563976119646, "version": 1, "sender": "3MwLNbzF4w298YSpa1CrASmgZQs4H7QnUKJ", "senderPublicKey": "A2cDxBUnFcmQWri8JQ7Kpa7MNbLnBv1Q9P6vmo9Moj6C", "proofs": [ "3HU1jG9AAjSBZ7rWyrEgPAyYadghtFqsnbZeekejHA5cUaTb3mN6bQSzyw18zJSMqyGmZSjvwwt46nt1XA8dNy7V" ], "script": "base64:AAIDAAAAAAAAAAAAAAAUAAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAAETk9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QUAAAAEdXNlcgUAAAAEaGFzaAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEmdldEtleUNvbW1pdHNDb3VudAAAAAEFAAAABGl0ZW0JAABkAAAAAgUAAAAHY29tbWl0cwAAAAAAAAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEGdldEtleUl0ZW1TdGF0dXMAAAABBQAAAARpdGVtAwkAAAAAAAACBQAAAAdjb21taXRzBQAAAAZWT1RFUlMFAAAABlJFVkVBTAUAAAAGVk9USU5HBQAAAANuaWwAAAAAqS9DRw==", "chainId": 84, "height": 600195, "spentComplexity": 0 } View: original | compacted Prev: DkucYCo4DTSAgyCVSt89LcSrFC49kJfU3Y64dmqHb8Ae Next: ESF3T3qvTNZispPzjk3XFo3nz66p7nzpqLQc5FQ6WiAa Diff:
OldNewDifferences
6161 func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item))
6262
6363
64+func getKeyItemSupplier (item) = (item + "_owner")
65+
66+
6467 func getKeyVoteCount (item,vote) = ((item + "_res:") + vote)
6568
6669
7679 then throw("reached max num of voters")
7780 else if ((getValueCommit(item, user) != NONE))
7881 then throw("user has already participated")
79- else if (if ((status != NONE))
80- then (status != VOTING)
81- else false)
82- then throw("voting is not possible")
83- else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS))
84- then REVEAL
85- else VOTING)])
82+ else if ((getKeyItemSupplier(item) == NONE))
83+ then throw("item does not exist")
84+ else if (if ((status != NONE))
85+ then (status != VOTING)
86+ else false)
87+ then throw("voting is not possible")
88+ else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS))
89+ then REVEAL
90+ else VOTING)])
8691 }
8792
8893
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 getKeyCommit (item,user) = (((item + "_") + user) + "_commit")
4141
4242
4343 func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user))
4444
4545
4646 func getKeyCommitsCount (item) = (item + "_comcnt")
4747
4848
4949 func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item))
5050
5151
5252 func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal")
5353
5454
5555 func getVAlueRveal (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
64+func getKeyItemSupplier (item) = (item + "_owner")
65+
66+
6467 func getKeyVoteCount (item,vote) = ((item + "_res:") + vote)
6568
6669
6770 func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote))
6871
6972
7073 @Callable(i)
7174 func voteCommit (item,hash) = {
7275 let user = toBase58String(i.caller.bytes)
7376 let commits = getValueCommitsCount(item)
7477 let status = getValueItemStatus(item)
7578 if ((commits >= VOTERS))
7679 then throw("reached max num of voters")
7780 else if ((getValueCommit(item, user) != NONE))
7881 then throw("user has already participated")
79- else if (if ((status != NONE))
80- then (status != VOTING)
81- else false)
82- then throw("voting is not possible")
83- else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS))
84- then REVEAL
85- else VOTING)])
82+ else if ((getKeyItemSupplier(item) == NONE))
83+ then throw("item does not exist")
84+ else if (if ((status != NONE))
85+ then (status != VOTING)
86+ else false)
87+ then throw("voting is not possible")
88+ else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS))
89+ then REVEAL
90+ else VOTING)])
8691 }
8792
8893

github/deemru/w8io/169f3d6 
37.36 ms