tx · 9YWZEUdaZisAJ7AvsaToWskp7nGe4j4RcQqL5iih8Rjo

3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu:  -0.01400000 Waves

2020.08.27 21:44 [1151492] smart account 3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu > SELF 0.00000000 Waves

{ "type": 13, "id": "9YWZEUdaZisAJ7AvsaToWskp7nGe4j4RcQqL5iih8Rjo", "fee": 1400000, "feeAssetId": null, "timestamp": 1598553861864, "version": 1, "sender": "3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu", "senderPublicKey": "CBTEuFN6ku1LNaPuGHHTMh2CBb3kPa5D73XXTJvKydun", "proofs": [ "56gfYLqvrWkcv5v5mFLQCtu67etj5pmvS7yKMAfGBq8Xnr9XwFoPrfd6ZBqZ4G9rNuqcRt6YCc9f2o7iGDeKP1Uu" ], "script": "base64:AAIDAAAAAAAAABsIARIHCgUICAgICBIECgIICBIDCgEIEgMKAQgAAAAMAAAAAAZ1cFZvdGUCAAAABnVwdm90ZQAAAAAIZG93blZvdGUCAAAACGRvd252b3RlAAAAAAxhZG1pbkFkZHJlc3MBAAAAGgFUOLYhWIA2WAg9IJQBVCmgZJeEnZPD9jSLAQAAAA1nZXRQcm9maWxlS2V5AAAAAQAAAAJpZAkAASwAAAACBQAAAAJpZAIAAAAUX2VudHJlcHJlbmV1clByb2ZpbGUBAAAADGdldFN0YXR1c0tleQAAAAEAAAACaWQJAAEsAAAAAgUAAAACaWQCAAAAB19zdGF0dXMBAAAACmdldFZvdGVLZXkAAAACAAAAAmlkAAAABHR5cGUDCQAAAAAAAAIFAAAABHR5cGUCAAAABnVwdm90ZQkAASwAAAACBQAAAAJpZAIAAAAHX3Vwdm90ZQMJAAAAAAAAAgUAAAAEdHlwZQIAAAAIZG93bnZvdGUJAAEsAAAAAgUAAAACaWQCAAAACV9kb3dudm90ZQkAAAIAAAABAgAAABFJbnZhbGlkIHZvdGUgdHlwZQEAAAAMcHJvZmlsZUV4aXN0AAAAAQAA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HJlc3MJAAACAAAAAQIAAAAuT25seSBEeXpydXB0IEFkbWluIGNhbiBjYWxsIHRoaXMgZEFwcCBmdW5jdGlvbgMJAQAAAAxwcm9maWxlRXhpc3QAAAABBQAAAAZ2b3RlSWQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAAxnZXRTdGF0dXNLZXkAAAABBQAAAAZ2b3RlSWQCAAAABG9wZW4FAAAAA25pbAkAAAIAAAABAgAAAApJbnZhbGlkIElEAAAAAWkBAAAACWNsb3NlVm90ZQAAAAEAAAAGdm90ZUlkAwkBAAAAAiE9AAAAAggIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwUAAAAMYWRtaW5BZGRyZXNzCQAAAgAAAAECAAAALk9ubHkgRHl6cnVwdCBBZG1pbiBjYW4gY2FsbCB0aGlzIGRBcHAgZnVuY3Rpb24DCQEAAAAMcHJvZmlsZUV4aXN0AAAAAQUAAAAGdm90ZUlkCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAMZ2V0U3RhdHVzS2V5AAAAAQUAAAAGdm90ZUlkAgAAAAZjbG9zZWQFAAAAA25pbAkAAAIAAAABAgAAAApJbnZhbGlkIElEAAAAAMosPxc=", "chainId": 84, "height": 1151492, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4m7YTvePdAzignJRoWbXYNKoukdLpP5znYQdjjDXgJDc Next: Hee47hqHSerHkFYv38TzHviUUTXnxR8pze5pfAZz4927 Diff:
OldNewDifferences
4444 }
4545
4646
47+func getVoterKey (address,voteId) = ((((address + "_") + voteId) + "_") + "vote")
48+
49+
50+func getVoter (address,voteId) = match getString(this, getVoterKey(address, voteId)) {
51+ case a: String =>
52+ a
53+ case _ =>
54+ ""
55+}
56+
57+
58+func canVote (address,voteId) = {
59+ let voter = getVoter(address, voteId)
60+ if ((voter == ""))
61+ then true
62+ else false
63+ }
64+
65+
4766 @Callable(i)
4867 func addEntrepreneurProfile (name,avatar,bio,gender,location) = if ((i.caller.bytes != adminAddress))
4968 then throw("Only Dyzrupt Admin can call this dApp function")
5574
5675
5776 @Callable(i)
58-func vote (voteId,vote) = if (profileExist(voteId))
59- then if ((getVoteStatus(voteId) == "open"))
60- then if (if ((vote == upVote))
61- then true
62- else (vote == downVote))
63- then {
64- let voteCount = getVoteCount(voteId, vote)
65- let newVoteCount = (voteCount + 1)
66- WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount)])
67- }
68- else throw("Not a valid vote value")
69- else throw("This profile is not open for voting")
70- else throw("Invalid Profile")
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")
7192
7293
7394
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'
99
1010 func getProfileKey (id) = (id + "_entrepreneurProfile")
1111
1212
1313 func getStatusKey (id) = (id + "_status")
1414
1515
1616 func getVoteKey (id,type) = if ((type == "upvote"))
1717 then (id + "_upvote")
1818 else if ((type == "downvote"))
1919 then (id + "_downvote")
2020 else throw("Invalid vote type")
2121
2222
2323 func profileExist (id) = match getString(this, getProfileKey(id)) {
2424 case a: String =>
2525 true
2626 case _ =>
2727 false
2828 }
2929
3030
3131 func getVoteStatus (voteId) = match getString(this, getStatusKey(voteId)) {
3232 case a: String =>
3333 a
3434 case _ =>
3535 false
3636 }
3737
3838
3939 func getVoteCount (voteId,vote) = match getInteger(this, getVoteKey(voteId, vote)) {
4040 case a: Int =>
4141 a
4242 case _ =>
4343 throw("Not a valid vote ID")
4444 }
4545
4646
47+func getVoterKey (address,voteId) = ((((address + "_") + voteId) + "_") + "vote")
48+
49+
50+func getVoter (address,voteId) = match getString(this, getVoterKey(address, voteId)) {
51+ case a: String =>
52+ a
53+ case _ =>
54+ ""
55+}
56+
57+
58+func canVote (address,voteId) = {
59+ let voter = getVoter(address, voteId)
60+ if ((voter == ""))
61+ then true
62+ else false
63+ }
64+
65+
4766 @Callable(i)
4867 func addEntrepreneurProfile (name,avatar,bio,gender,location) = if ((i.caller.bytes != adminAddress))
4968 then throw("Only Dyzrupt Admin can call this dApp function")
5069 else {
5170 let transactionId = toBase58String(i.transactionId)
5271 WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open"), DataEntry(getVoteKey(transactionId, "downvote"), 0)])
5372 }
5473
5574
5675
5776 @Callable(i)
58-func vote (voteId,vote) = if (profileExist(voteId))
59- then if ((getVoteStatus(voteId) == "open"))
60- then if (if ((vote == upVote))
61- then true
62- else (vote == downVote))
63- then {
64- let voteCount = getVoteCount(voteId, vote)
65- let newVoteCount = (voteCount + 1)
66- WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount)])
67- }
68- else throw("Not a valid vote value")
69- else throw("This profile is not open for voting")
70- else throw("Invalid Profile")
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")
7192
7293
7394
7495 @Callable(i)
7596 func openVote (voteId) = if ((i.caller.bytes != adminAddress))
7697 then throw("Only Dyzrupt Admin can call this dApp function")
7798 else if (profileExist(voteId))
7899 then WriteSet([DataEntry(getStatusKey(voteId), "open")])
79100 else throw("Invalid ID")
80101
81102
82103
83104 @Callable(i)
84105 func closeVote (voteId) = if ((i.caller.bytes != adminAddress))
85106 then throw("Only Dyzrupt Admin can call this dApp function")
86107 else if (profileExist(voteId))
87108 then WriteSet([DataEntry(getStatusKey(voteId), "closed")])
88109 else throw("Invalid ID")
89110
90111

github/deemru/w8io/026f985 
25.18 ms