tx · 752eT2Co8GFow7ozvXL4xyUAWij8Y86tdqKofbUUvmQ1

3N1MvvKPNWqQ9JWYV1vWE84GnMKP3mENpSg:  -0.01400000 Waves

2019.06.26 02:28 [558307] smart account 3N1MvvKPNWqQ9JWYV1vWE84GnMKP3mENpSg > SELF 0.00000000 Waves

{ "type": 13, "id": "752eT2Co8GFow7ozvXL4xyUAWij8Y86tdqKofbUUvmQ1", "fee": 1400000, "feeAssetId": null, "timestamp": 1561505355772, "version": 1, "sender": "3N1MvvKPNWqQ9JWYV1vWE84GnMKP3mENpSg", "senderPublicKey": "GBcKAM5muVn8dBji3B7ciEqt4XzrT4CBrAKXoTVfbw7", "proofs": [ "42aSVef2FVZ4hhpp5XLsWTnjq8G6pow4yELj1gbE1x4euogoaC8TcLEetkjSfpMsCwA37BegQYrRrxS5mGnQ5mz4" ], "script": "base64:AAIDAAAAAAAAAAAAAAAbAAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAA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0VmFsdWVDb21taXQAAAACBQAAAARpdGVtBQAAAAR1c2VyBQAAAAROT05FCQAAAgAAAAECAAAAHVVzZXIgaGFzIGFscmVhZHkgcGFydGljaXBhdGVkAwkAAAAAAAACCQEAAAASZ2V0S2V5SXRlbVN1cHBsaWVyAAAAAQUAAAAEaXRlbQUAAAAETk9ORQkAAAIAAAABAgAAABNJdGVtIGRvZXMgbm90IGV4aXN0AwMJAQAAAAIhPQAAAAIFAAAABnN0YXR1cwUAAAAETk9ORQkBAAAAAiE9AAAAAgUAAAAGc3RhdHVzBQAAAAZWT1RJTkcHCQAAAgAAAAECAAAAFlZvdGluZyBpcyBub3QgcG9zc2libGUJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAAxnZXRLZXlDb21taXQAAAACBQAAAARpdGVtBQAAAAR1c2VyBQAAAARoYXNoCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAASZ2V0S2V5Q29tbWl0c0NvdW50AAAAAQUAAAAEaXRlbQkAAGQAAAACBQAAAAdjb21taXRzAAAAAAAAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAQZ2V0S2V5SXRlbVN0YXR1cwAAAAEFAAAABGl0ZW0DCQAAAAAAAAIFAAAAB2NvbW1pdHMFAAAABlZPVEVSUwUAAAAGUkVWRUFMBQAAAAZWT1RJTkcFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5egI6wg==", "chainId": 84, "height": 558307, "spentComplexity": 0 } View: original | compacted Prev: BqFxuN1Eh7KdG6MYLp1B8ACeqaWWiXa6jXVyQvYw2xYH Next: EALXEC9wXp8w3Yb74H7jeuEBCvFbGG8hAxYPqGrTkYjr Diff:
OldNewDifferences
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let NONE = "none"
5+
6+let VOTERS = 3
7+
8+let QUORUM = 2
9+
10+let VOTING = "voting"
11+
12+let REVEAL = "reveal"
513
614 func getNumberByKey (key) = {
715 let num = match getInteger(this, key) {
5563 func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
5664
5765
66+func getKeyCommit (item,user) = (((item + "_") + user) + "_commit")
67+
68+
69+func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user))
70+
71+
72+func getKeyCommitsCount (item) = (item + "_comcnt")
73+
74+
75+func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item))
76+
77+
78+func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal")
79+
80+
81+func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user))
82+
83+
84+func getKeyItemStatus (item) = (item + "_status")
85+
86+
87+func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item))
88+
89+
90+func getKeyVoteCount (item,vote) = ((item + "_res:") + vote)
91+
92+
93+func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote))
94+
95+
5896 @Callable(i)
5997 func addItem (title,price,data) = {
6098 let supplierAddress = toBase58String(i.caller.bytes)
99137 }
100138
101139
140+
141+@Callable(i)
142+func voteCommit (item,hash) = {
143+ let user = toBase58String(i.caller.bytes)
144+ let commits = getValueCommitsCount(item)
145+ let status = getValueItemStatus(item)
146+ if ((commits >= VOTERS))
147+ then throw("Reached max numbers of voters")
148+ else if ((getValueCommit(item, user) != NONE))
149+ then throw("User has already participated")
150+ else if ((getKeyItemSupplier(item) == NONE))
151+ then throw("Item does not exist")
152+ else if (if ((status != NONE))
153+ then (status != VOTING)
154+ else false)
155+ then throw("Voting is not possible")
156+ else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS))
157+ then REVEAL
158+ else VOTING)])
159+ }
160+
161+
102162 @Verifier(tx)
103163 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
104164
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let NONE = "none"
5+
6+let VOTERS = 3
7+
8+let QUORUM = 2
9+
10+let VOTING = "voting"
11+
12+let REVEAL = "reveal"
513
614 func getNumberByKey (key) = {
715 let num = match getInteger(this, key) {
816 case a: Int =>
917 a
1018 case _ =>
1119 0
1220 }
1321 num
1422 }
1523
1624
1725 func getStrByKey (key) = {
1826 let str = match getString(this, key) {
1927 case a: String =>
2028 a
2129 case _ =>
2230 NONE
2331 }
2432 str
2533 }
2634
2735
2836 func getKeyItemPrice (item) = (item + "_price")
2937
3038
3139 func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item))
3240
3341
3442 func getKeyUserItemCounter (user,item) = ((item + "_user") + "_cnt")
3543
3644
3745 func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
3846
3947
4048 func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
4149
4250
4351 func getKeyItemData (item) = (item + "_data")
4452
4553
4654 func getKeyItemSupplier (item) = (item + "_owner")
4755
4856
4957 func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
5058
5159
5260 func getKeyBalanceSupplier (account) = (account + "_balance")
5361
5462
5563 func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
5664
5765
66+func getKeyCommit (item,user) = (((item + "_") + user) + "_commit")
67+
68+
69+func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user))
70+
71+
72+func getKeyCommitsCount (item) = (item + "_comcnt")
73+
74+
75+func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item))
76+
77+
78+func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal")
79+
80+
81+func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user))
82+
83+
84+func getKeyItemStatus (item) = (item + "_status")
85+
86+
87+func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item))
88+
89+
90+func getKeyVoteCount (item,vote) = ((item + "_res:") + vote)
91+
92+
93+func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote))
94+
95+
5896 @Callable(i)
5997 func addItem (title,price,data) = {
6098 let supplierAddress = toBase58String(i.caller.bytes)
6199 let item = getKeyItem(supplierAddress, title)
62100 if ((0 >= price))
63101 then throw("Purchase amount cannot be less that item price")
64102 else if ((getValueItemSupplier(item) != NONE))
65103 then throw("This item already exist")
66104 else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)])
67105 }
68106
69107
70108
71109 @Callable(i)
72110 func purchase (item) = {
73111 let pmt = extract(i.payment)
74112 if (isDefined(pmt.assetId))
75113 then throw("Waves token only at this moment")
76114 else {
77115 let userAddress = toBase58String(i.caller.bytes)
78116 let price = getValueItemPrice(item)
79117 let supplierAddress = getValueItemSupplier(item)
80118 if ((price > pmt.amount))
81119 then throw("Purchase amount can not be less than item price")
82120 else if ((pmt.amount > price))
83121 then throw("Purchase amount can not be higher than item price")
84122 else if ((supplierAddress == NONE))
85123 then throw("Supplier does not exist")
86124 else WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))])
87125 }
88126 }
89127
90128
91129
92130 @Callable(i)
93131 func withdraw () = {
94132 let supplierAddress = toBase58String(i.caller.bytes)
95133 let balance = getValueBalanceSupplier(supplierAddress)
96134 if ((0 >= balance))
97135 then throw("Insufficient Balance")
98136 else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)]))
99137 }
100138
101139
140+
141+@Callable(i)
142+func voteCommit (item,hash) = {
143+ let user = toBase58String(i.caller.bytes)
144+ let commits = getValueCommitsCount(item)
145+ let status = getValueItemStatus(item)
146+ if ((commits >= VOTERS))
147+ then throw("Reached max numbers of voters")
148+ else if ((getValueCommit(item, user) != NONE))
149+ then throw("User has already participated")
150+ else if ((getKeyItemSupplier(item) == NONE))
151+ then throw("Item does not exist")
152+ else if (if ((status != NONE))
153+ then (status != VOTING)
154+ else false)
155+ then throw("Voting is not possible")
156+ else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS))
157+ then REVEAL
158+ else VOTING)])
159+ }
160+
161+
102162 @Verifier(tx)
103163 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
104164

github/deemru/w8io/169f3d6 
55.46 ms