tx · Gkn3Nth4r1z3Yarb99jk6jdyBFX8qdrscZp2i7fzSxKq

3MwvNguAJMnh3pKUiuzDRBemNh75bdBjyVr:  -0.01400000 Waves

2019.07.30 14:32 [608783] smart account 3MwvNguAJMnh3pKUiuzDRBemNh75bdBjyVr > SELF 0.00000000 Waves

{ "type": 13, "id": "Gkn3Nth4r1z3Yarb99jk6jdyBFX8qdrscZp2i7fzSxKq", "fee": 1400000, "feeAssetId": null, "timestamp": 1564486298816, "version": 1, "sender": "3MwvNguAJMnh3pKUiuzDRBemNh75bdBjyVr", "senderPublicKey": "6ujKbRwbiQw9xBPcWiwb6LJbvyH3fWurt5YUViqNiWza", "proofs": [ "gTR77a24JnjT8GfvF2Vo6HeQ9123Uy86zzTLY6uBqAUL89NTvTtZkSnrVR5XkEFbDHrY9ZyhAS6Wkb3cyGsNy9M" ], "script": "base64:AAIDAAAAAAAAAAAAAAAdAAAAAAROT05FAgAAAARub25lAAAAAAZWT1RFUlMAAAAAAAAAAAMAAAAABlFVT1JVTQAAAAAAAAAAAgAAAAAGVk9USU5HAgAAAAZ2b3RpbmcAAAAABlJFVkVBTAIAAAAGcmV2ZWFsAAAAAAhGRUFUVVJFRAIAAAAIZmVhdHVyZWQAAAAACERFTElTVEVEAgAAAAhkZWxpc3RlZAEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAADbnVtBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAABQAAAANudW0BAAAAC2dldFN0ckJ5S2V5AAAAAQAAAANrZXkEAAAAA3N0cgQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQUAAAAETk9ORQUAAAADc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tbWl0cwUAAAAGVk9URVJTCQAAAgAAAAECAAAAGXJlYWNoZWQgbWF4IG51bSBvZiB2b3RlcnMDCQEAAAACIT0AAAACCQEAAAAOZ2V0VmFsdWVDb21taXQAAAACBQAAAARpdGVtBQAAAAR1c2VyBQAAAAROT05FCQAAAgAAAAECAAAAHXVzZXIgaGFzIGFscmVhZHkgcGFydGljaXBhdGVkAwkAAAAAAAACCQEAAAASZ2V0S2V5SXRlbVN1cHBsaWVyAAAAAQUAAAAEaXRlbQUAAAAETk9ORQkAAAIAAAABAgAAABNpdGVtIGRvZXMgbm90IGV4aXN0AwMJAQAAAAIhPQAAAAIFAAAABnN0YXR1cwUAAAAETk9ORQkBAAAAAiE9AAAAAgUAAAAGc3RhdHVzBQAAAAZWT1RJTkcHCQAAAgAAAAECAAAAFnZvdGluZyBpcyBub3QgcG9zc2libGUJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAAxnZXRLZXlDb21taXQAAAACBQAAAARpdGVtBQAAAAR1c2VyBQAAAARoYXNoCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAASZ2V0S2V5Q29tbWl0c0NvdW50AAAAAQUAAAAEaXRlbQkAAGQAAAACBQAAAAdjb21taXRzAAAAAAAAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAQZ2V0S2V5SXRlbVN0YXR1cwAAAAEFAAAABGl0ZW0DCQAAAAAAAAIFAAAAB2NvbW1pdHMFAAAABlZPVEVSUwUAAAAGUkVWRUFMBQAAAAZWT1RJTkcFAAAAA25pbAAAAAC2nh7S", "chainId": 84, "height": 608783, "spentComplexity": 0 } View: original | compacted Prev: 5Z19XKjFHUc7tZqwwvcAyJcHX8j9DW5TVVYGqptGFia2 Next: 9DbJ6vDWKVQwvRMBibfp76QWCaWzimWKXp3HYsmZVuVT 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"
13+
14+let FEATURED = "featured"
15+
16+let DELISTED = "delisted"
517
618 func getNumberByKey (key) = {
719 let num = match getInteger(this, key) {
5567 func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
5668
5769
70+func getKeyCommit (item,user) = (((item + "_") + user) + "_commit")
71+
72+
73+func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user))
74+
75+
76+func getKeyCommitsCount (item) = (item + "_comcnt")
77+
78+
79+func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item))
80+
81+
82+func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal")
83+
84+
85+func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user))
86+
87+
88+func getKeyItemStatus (item) = (item + "_status")
89+
90+
91+func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item))
92+
93+
94+func getKeyVoteCount (item,vote) = ((item + "_res") + vote)
95+
96+
97+func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote))
98+
99+
58100 @Callable(i)
59101 func addItem (title,price,data) = {
60102 let supplierAddress = toBase58String(i.caller.bytes)
99141 }
100142
101143
144+
145+@Callable(i)
146+func voteCommit (item,hash) = {
147+ let user = toBase58String(i.caller.bytes)
148+ let commits = getValueCommitsCount(item)
149+ let status = getValueItemStatus(item)
150+ if ((commits >= VOTERS))
151+ then throw("reached max num of voters")
152+ else if ((getValueCommit(item, user) != NONE))
153+ then throw("user has already participated")
154+ else if ((getKeyItemSupplier(item) == NONE))
155+ then throw("item does not exist")
156+ else if (if ((status != NONE))
157+ then (status != VOTING)
158+ else false)
159+ then throw("voting is not possible")
160+ else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS))
161+ then REVEAL
162+ else VOTING)])
163+ }
164+
165+
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"
13+
14+let FEATURED = "featured"
15+
16+let DELISTED = "delisted"
517
618 func getNumberByKey (key) = {
719 let num = match getInteger(this, key) {
820 case a: Int =>
921 a
1022 case _ =>
1123 0
1224 }
1325 num
1426 }
1527
1628
1729 func getStrByKey (key) = {
1830 let str = match getString(this, key) {
1931 case a: String =>
2032 a
2133 case _ =>
2234 NONE
2335 }
2436 str
2537 }
2638
2739
2840 func getKeyItemPrice (item) = (item + "_price")
2941
3042
3143 func getValueItemPrice (item) = getNumberByKey(getKeyItemPrice(item))
3244
3345
3446 func getKeyUserItemCounter (user,item) = (((item + "_") + user) + "_cnt")
3547
3648
3749 func getValueUserItemCounter (user,item) = getNumberByKey(getKeyUserItemCounter(user, item))
3850
3951
4052 func getKeyItem (supplier,title) = ("item_" + toBase58String(sha256(toBytes((supplier + title)))))
4153
4254
4355 func getKeyItemData (item) = (item + "_data")
4456
4557
4658 func getKeyItemSupplier (item) = (item + "_owner")
4759
4860
4961 func getValueItemSupplier (item) = getStrByKey(getKeyItemSupplier(item))
5062
5163
5264 func getKeyBalanceSupplier (account) = (account + "_balance")
5365
5466
5567 func getValueBalanceSupplier (account) = getNumberByKey(getKeyBalanceSupplier(account))
5668
5769
70+func getKeyCommit (item,user) = (((item + "_") + user) + "_commit")
71+
72+
73+func getValueCommit (item,user) = getStrByKey(getKeyCommit(item, user))
74+
75+
76+func getKeyCommitsCount (item) = (item + "_comcnt")
77+
78+
79+func getValueCommitsCount (item) = getNumberByKey(getKeyCommitsCount(item))
80+
81+
82+func getKeyReveal (item,user) = (((item + "_") + user) + "_reveal")
83+
84+
85+func getValueReveal (item,user) = getStrByKey(getKeyReveal(item, user))
86+
87+
88+func getKeyItemStatus (item) = (item + "_status")
89+
90+
91+func getValueItemStatus (item) = getStrByKey(getKeyItemStatus(item))
92+
93+
94+func getKeyVoteCount (item,vote) = ((item + "_res") + vote)
95+
96+
97+func getValueVoteCount (item,vote) = getNumberByKey(getKeyVoteCount(item, vote))
98+
99+
58100 @Callable(i)
59101 func addItem (title,price,data) = {
60102 let supplierAddress = toBase58String(i.caller.bytes)
61103 let item = getKeyItem(supplierAddress, title)
62104 if ((0 >= price))
63105 then throw("purchase amount cannot be less than item price")
64106 else if ((getValueItemSupplier(item) != NONE))
65107 then throw("an item is already exist")
66108 else WriteSet([DataEntry(getKeyItemSupplier(item), supplierAddress), DataEntry(getKeyItemPrice(item), price), DataEntry(getKeyItemData(item), data)])
67109 }
68110
69111
70112
71113 @Callable(i)
72114 func purchaseItem (item) = {
73115 let pmt = extract(i.payment)
74116 if (isDefined(pmt.assetId))
75117 then throw("WAVES tokens only at the moment")
76118 else {
77119 let userAddress = toBase58String(i.caller.bytes)
78120 let price = getValueItemPrice(item)
79121 let supplierAddress = getValueItemSupplier(item)
80122 if ((price > pmt.amount))
81123 then throw("purchase amount cannot be less than item price")
82124 else if ((pmt.amount > price))
83125 then throw("purchase amount cannot be higher than item price")
84126 else if ((supplierAddress == NONE))
85127 then throw("supplier does not exist")
86128 else WriteSet([DataEntry(getKeyUserItemCounter(userAddress, item), (getValueUserItemCounter(userAddress, item) + 1)), DataEntry(getKeyBalanceSupplier(supplierAddress), (getValueBalanceSupplier(supplierAddress) + pmt.amount))])
87129 }
88130 }
89131
90132
91133
92134 @Callable(i)
93135 func withdraw () = {
94136 let supplierAddress = toBase58String(i.caller.bytes)
95137 let balance = getValueBalanceSupplier(supplierAddress)
96138 if ((0 >= balance))
97139 then throw("insuficiente balance")
98140 else ScriptResult(WriteSet([DataEntry(getKeyBalanceSupplier(supplierAddress), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(supplierAddress), balance, unit)]))
99141 }
100142
101143
144+
145+@Callable(i)
146+func voteCommit (item,hash) = {
147+ let user = toBase58String(i.caller.bytes)
148+ let commits = getValueCommitsCount(item)
149+ let status = getValueItemStatus(item)
150+ if ((commits >= VOTERS))
151+ then throw("reached max num of voters")
152+ else if ((getValueCommit(item, user) != NONE))
153+ then throw("user has already participated")
154+ else if ((getKeyItemSupplier(item) == NONE))
155+ then throw("item does not exist")
156+ else if (if ((status != NONE))
157+ then (status != VOTING)
158+ else false)
159+ then throw("voting is not possible")
160+ else WriteSet([DataEntry(getKeyCommit(item, user), hash), DataEntry(getKeyCommitsCount(item), (commits + 1)), DataEntry(getKeyItemStatus(item), if ((commits == VOTERS))
161+ then REVEAL
162+ else VOTING)])
163+ }
164+
165+

github/deemru/w8io/026f985 
24.77 ms