tx · Hee47hqHSerHkFYv38TzHviUUTXnxR8pze5pfAZz4927

3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu:  -0.01400000 Waves

2020.09.03 02:18 [1160424] smart account 3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu > SELF 0.00000000 Waves

{ "type": 13, "id": "Hee47hqHSerHkFYv38TzHviUUTXnxR8pze5pfAZz4927", "fee": 1400000, "feeAssetId": null, "timestamp": 1599088704057, "version": 1, "sender": "3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu", "senderPublicKey": "CBTEuFN6ku1LNaPuGHHTMh2CBb3kPa5D73XXTJvKydun", "proofs": [ "5dkQntpBzgMEE7Q1xfFKbt6vLKfecos9pHNsA4UEhf6TjAz9F5ut4iX4L1A3iywiZdN7cM7q5N7MHYEXDQ8JBbgi" ], "script": "base64:AAIDAAAAAAAAABsIARIHCgUICAgICBIECgIICBIDCgEIEgMKAQgAAAANAAAAAAZ1cFZvdGUCAAAABnVwdm90ZQAAAAAIZG93blZvdGUCAAAACGRvd252b3RlAAAAAAxhZG1pbkFkZHJlc3MBAAAAGgFUOLYhWIA2WAg9IJQBVCmgZJeEnZPD9jSLAAAAAAVkeXpJZAEAAAAgfqtB2c5SyrdhjTSeT2NUMvY45D97zjqBcAiarzFPFmsBAAAADWdldFByb2ZpbGVLZXkAAAABAAAAAmlkCQABLAAAAAIFAAAAAmlkAgAAABRfZW50cmVwcmVuZXVyUHJvZmlsZQEAAAAMZ2V0U3RhdHVzS2V5AAAAAQAAAAJpZAkAASwAAAACBQAAAAJpZAIAAAAHX3N0YXR1cwEAAAAKZ2V0Vm90ZUtleQAAAAIAAAACaWQAAAAEdHlwZQMJAAAAAAAAAgUAAAAEdHlwZQIAAAAGdXB2b3RlCQABLAAAAAIFAAAAAmlkAgAAAAdfdXB2b3RlAwkAAAAAAAACBQAAAAR0eXBlAgAAAAhkb3dudm90ZQkAASwAAAACBQAAAAJpZAIAAAAJX2Rvd252b3RlCQAAAgAAAAECAAAA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ZAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAADGdldFN0YXR1c0tleQAAAAEFAAAABnZvdGVJZAIAAAAGY2xvc2VkBQAAAANuaWwJAAACAAAAAQIAAAAKSW52YWxpZCBJRAAAAACIRUyu", "chainId": 84, "height": 1160424, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9YWZEUdaZisAJ7AvsaToWskp7nGe4j4RcQqL5iih8Rjo Next: 6fefZLiPHpWLS8x1Q8epL6WFoW7Bv1DKzBf8E7zJZTyv Diff:
OldNewDifferences
66 let downVote = "downvote"
77
88 let adminAddress = base58'3Mu5woJ54s7vHJgaeNcJ4C9ByfdmMF2jpjC'
9+
10+let dyzId = base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G'
911
1012 func getProfileKey (id) = (id + "_entrepreneurProfile")
1113
7476
7577
7678 @Callable(i)
77-func vote (voteId,vote) = if (canVote(toBase58String(i.caller.bytes), voteId))
78- then if (profileExist(voteId))
79- then if ((getVoteStatus(voteId) == "open"))
80- then if (if ((vote == upVote))
81- then true
82- else (vote == downVote))
83- then {
84- let voteCount = getVoteCount(voteId, vote)
85- let newVoteCount = (voteCount + 1)
86- WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount), DataEntry(getVoterKey(toBase58String(i.caller.bytes), voteId), voteId)])
87- }
88- else throw("Not a valid vote value")
89- else throw("This profile is not open for voting")
90- else throw("Invalid Profile")
91- else throw("You can't vote twice")
79+func vote (voteId,vote) = {
80+ let pmt = extract(i.payment)
81+ if ((pmt.amount == 0))
82+ then throw("You cannot vote without paying voting fee")
83+ else if ((pmt.assetId != base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G'))
84+ then throw("You can only vote with DYZRUPT token")
85+ else if (canVote(toBase58String(i.caller.bytes), voteId))
86+ then if (profileExist(voteId))
87+ then if ((getVoteStatus(voteId) == "open"))
88+ then if (if ((vote == upVote))
89+ then true
90+ else (vote == downVote))
91+ then {
92+ let voteCount = getVoteCount(voteId, vote)
93+ let newVoteCount = (voteCount + 1)
94+ ScriptResult(WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount), DataEntry(getVoterKey(toBase58String(i.caller.bytes), voteId), voteId)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)]))
95+ }
96+ else throw("Not a valid vote value")
97+ else throw("This profile is not open for voting")
98+ else throw("Invalid Profile")
99+ else throw("You can't vote twice")
100+ }
92101
93102
94103
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let upVote = "upvote"
55
66 let downVote = "downvote"
77
88 let adminAddress = base58'3Mu5woJ54s7vHJgaeNcJ4C9ByfdmMF2jpjC'
9+
10+let dyzId = base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G'
911
1012 func getProfileKey (id) = (id + "_entrepreneurProfile")
1113
1214
1315 func getStatusKey (id) = (id + "_status")
1416
1517
1618 func getVoteKey (id,type) = if ((type == "upvote"))
1719 then (id + "_upvote")
1820 else if ((type == "downvote"))
1921 then (id + "_downvote")
2022 else throw("Invalid vote type")
2123
2224
2325 func profileExist (id) = match getString(this, getProfileKey(id)) {
2426 case a: String =>
2527 true
2628 case _ =>
2729 false
2830 }
2931
3032
3133 func getVoteStatus (voteId) = match getString(this, getStatusKey(voteId)) {
3234 case a: String =>
3335 a
3436 case _ =>
3537 false
3638 }
3739
3840
3941 func getVoteCount (voteId,vote) = match getInteger(this, getVoteKey(voteId, vote)) {
4042 case a: Int =>
4143 a
4244 case _ =>
4345 throw("Not a valid vote ID")
4446 }
4547
4648
4749 func getVoterKey (address,voteId) = ((((address + "_") + voteId) + "_") + "vote")
4850
4951
5052 func getVoter (address,voteId) = match getString(this, getVoterKey(address, voteId)) {
5153 case a: String =>
5254 a
5355 case _ =>
5456 ""
5557 }
5658
5759
5860 func canVote (address,voteId) = {
5961 let voter = getVoter(address, voteId)
6062 if ((voter == ""))
6163 then true
6264 else false
6365 }
6466
6567
6668 @Callable(i)
6769 func addEntrepreneurProfile (name,avatar,bio,gender,location) = if ((i.caller.bytes != adminAddress))
6870 then throw("Only Dyzrupt Admin can call this dApp function")
6971 else {
7072 let transactionId = toBase58String(i.transactionId)
7173 WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open"), DataEntry(getVoteKey(transactionId, "downvote"), 0)])
7274 }
7375
7476
7577
7678 @Callable(i)
77-func vote (voteId,vote) = if (canVote(toBase58String(i.caller.bytes), voteId))
78- then if (profileExist(voteId))
79- then if ((getVoteStatus(voteId) == "open"))
80- then if (if ((vote == upVote))
81- then true
82- else (vote == downVote))
83- then {
84- let voteCount = getVoteCount(voteId, vote)
85- let newVoteCount = (voteCount + 1)
86- WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount), DataEntry(getVoterKey(toBase58String(i.caller.bytes), voteId), voteId)])
87- }
88- else throw("Not a valid vote value")
89- else throw("This profile is not open for voting")
90- else throw("Invalid Profile")
91- else throw("You can't vote twice")
79+func vote (voteId,vote) = {
80+ let pmt = extract(i.payment)
81+ if ((pmt.amount == 0))
82+ then throw("You cannot vote without paying voting fee")
83+ else if ((pmt.assetId != base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G'))
84+ then throw("You can only vote with DYZRUPT token")
85+ else if (canVote(toBase58String(i.caller.bytes), voteId))
86+ then if (profileExist(voteId))
87+ then if ((getVoteStatus(voteId) == "open"))
88+ then if (if ((vote == upVote))
89+ then true
90+ else (vote == downVote))
91+ then {
92+ let voteCount = getVoteCount(voteId, vote)
93+ let newVoteCount = (voteCount + 1)
94+ ScriptResult(WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount), DataEntry(getVoterKey(toBase58String(i.caller.bytes), voteId), voteId)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)]))
95+ }
96+ else throw("Not a valid vote value")
97+ else throw("This profile is not open for voting")
98+ else throw("Invalid Profile")
99+ else throw("You can't vote twice")
100+ }
92101
93102
94103
95104 @Callable(i)
96105 func openVote (voteId) = if ((i.caller.bytes != adminAddress))
97106 then throw("Only Dyzrupt Admin can call this dApp function")
98107 else if (profileExist(voteId))
99108 then WriteSet([DataEntry(getStatusKey(voteId), "open")])
100109 else throw("Invalid ID")
101110
102111
103112
104113 @Callable(i)
105114 func closeVote (voteId) = if ((i.caller.bytes != adminAddress))
106115 then throw("Only Dyzrupt Admin can call this dApp function")
107116 else if (profileExist(voteId))
108117 then WriteSet([DataEntry(getStatusKey(voteId), "closed")])
109118 else throw("Invalid ID")
110119
111120

github/deemru/w8io/169f3d6 
34.43 ms