tx · Qi6YjdcN5N9KcyLFrL2wXvGrTmR5wczeWNH2e1BhcT7 3MqZkBUDKbXPKEq2sMtxtSahzX5n8AVDTyT: -0.04000000 Waves 2021.05.20 12:58 [1533850] smart account 3MqZkBUDKbXPKEq2sMtxtSahzX5n8AVDTyT > SELF 0.00000000 Waves
{ "type": 13, "id": "Qi6YjdcN5N9KcyLFrL2wXvGrTmR5wczeWNH2e1BhcT7", "fee": 4000000, "feeAssetId": null, "timestamp": 1621504754154, "version": 2, "chainId": 84, "sender": "3MqZkBUDKbXPKEq2sMtxtSahzX5n8AVDTyT", "senderPublicKey": "5CSJYiEQvEGm3vH52UCQRkmhw7TV5ZzRhWptXi2hjM7T", "proofs": [ "2fWHTsiZNrzdUeTZ5u8hWnYQzcvjiQFVUpSDdv4UkgoWb5VquS7sEVLtaRj8bMMqYFtEdPoMKbHfy5Jm2DCtq64F" ], "script": "base64:AAIDAAAAAAAAACEIARIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSBAoCCAgAAAAIAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAgAAAAAFAAAAA3ZhbAEAAAAJaXNNYW5hZ2VyAAAAAQAAAAdhZGRyZXNzCQAAAAAAAAIFAAAAB2FkZHJlc3MFAAAABHRoaXMBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAABQAAAAN2YWwBAAAADmlzV29ya2luZ0dyb3VwAAAAAQAAAAFhCQAAAAAAAAIJAQAAAAx0cn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Q98wJSNYn5rmFg7Ld Next: 3Vczk9k5BYTDuyMTMvwkxEu2p5BXdTavJ1FoUaKU2VHk Diff:
Old | New | Differences | |
---|---|---|---|
135 | 135 | case _ => | |
136 | 136 | "" | |
137 | 137 | } | |
138 | + | let newVotedVal = ((caller + ";") + votedVal) | |
138 | 139 | let votingState = tryGetInteger(votingKey) | |
139 | 140 | let newVotingState = (votingState + voteValueInt) | |
140 | 141 | let mwgStatusVal = tryGetString((("dao_mwg_member_" + caller) + "_status")) | |
141 | 142 | if ((mwgStatusVal == "approved")) | |
142 | 143 | then if (isMembershipVotedForCandidate(membershipAddress, candidateAddress)) | |
143 | 144 | then throw(("You have already voted. Caller " + caller)) | |
144 | - | else WriteSet([DataEntry(((membershipAddress + "_voted_") + candidateAddress), 1), DataEntry(votingKey, newVotingState), DataEntry(votedKey, | |
145 | + | else WriteSet([DataEntry(((membershipAddress + "_voted_") + candidateAddress), 1), DataEntry(votingKey, newVotingState), DataEntry(votedKey, newVotedVal)]) | |
145 | 146 | else throw(("You have no rights. Caller " + caller)) | |
146 | 147 | } | |
147 | 148 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func tryGetString (key) = { | |
5 | 5 | let val = match getString(this, key) { | |
6 | 6 | case b: String => | |
7 | 7 | b | |
8 | 8 | case _ => | |
9 | 9 | "" | |
10 | 10 | } | |
11 | 11 | val | |
12 | 12 | } | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func isManager (address) = (address == this) | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func tryGetInteger (key) = { | |
19 | 19 | let val = match getInteger(this, key) { | |
20 | 20 | case b: Int => | |
21 | 21 | b | |
22 | 22 | case _ => | |
23 | 23 | 0 | |
24 | 24 | } | |
25 | 25 | val | |
26 | 26 | } | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func isWorkingGroup (a) = (tryGetString((("working_group_" + toString(a)) + "_status")) == "approved") | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func isDAOMember (a) = (tryGetString((("dao_member_" + toString(a)) + "_status")) == "approved") | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func isMembershipVotedForCandidate (membershipAddress,candidateAddress) = (tryGetInteger(((membershipAddress + "_voted_") + candidateAddress)) > 0) | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func getDAOMember () = { | |
39 | 39 | let val = match getString(this, "dao_members") { | |
40 | 40 | case b: String => | |
41 | 41 | b | |
42 | 42 | case _ => | |
43 | 43 | "" | |
44 | 44 | } | |
45 | 45 | val | |
46 | 46 | } | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func getVoteValue (s) = if ((s == "like")) | |
50 | 50 | then 1 | |
51 | 51 | else if ((s == "dislike")) | |
52 | 52 | then -1 | |
53 | 53 | else throw(("You need to vote with 'like' or 'dislike' value. You specified:" + s)) | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | @Callable(i) | |
57 | 57 | func aProposeCandidateForDAOMember (address) = if ((tryGetInteger((("member_" + address) + "_voting_state")) != 0)) | |
58 | 58 | then throw("This user already exists") | |
59 | 59 | else { | |
60 | 60 | let group = getDAOMember() | |
61 | 61 | let newGroup = ((group + ";") + address) | |
62 | 62 | let groupSize = tryGetInteger("dao_members_size") | |
63 | 63 | let newGroupSize = (groupSize + 1) | |
64 | 64 | WriteSet([DataEntry((("dao_member_" + address) + "_status"), "propose"), DataEntry("dao_members", newGroup), DataEntry("dao_members_size", newGroupSize)]) | |
65 | 65 | } | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | 69 | @Callable(i) | |
70 | 70 | func mRejectDAOMember (address) = if (!(isManager(i.caller))) | |
71 | 71 | then throw("access only to the DAO Manager") | |
72 | 72 | else WriteSet([DataEntry((("dao_member_" + address) + "_status"), "rejected")]) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | ||
76 | 76 | @Callable(i) | |
77 | 77 | func mAddDAOMember (address) = if (!(isManager(i.caller))) | |
78 | 78 | then throw("access only to the DAO Manager") | |
79 | 79 | else { | |
80 | 80 | let group = getDAOMember() | |
81 | 81 | let newGroup = ((group + ";") + address) | |
82 | 82 | let groupSize = tryGetInteger("dao_members_size") | |
83 | 83 | let newGroupSize = (groupSize + 1) | |
84 | 84 | WriteSet([DataEntry((("dao_member_" + address) + "_status"), "approved"), DataEntry("dao_members", newGroup), DataEntry("dao_members_size", newGroupSize)]) | |
85 | 85 | } | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | ||
89 | 89 | @Callable(i) | |
90 | 90 | func mAddWorkingGroup (address) = if (!(isManager(i.caller))) | |
91 | 91 | then throw("access only to the DAO Manager") | |
92 | 92 | else { | |
93 | 93 | let group = match getString(this, "dao_wg_members") { | |
94 | 94 | case b: String => | |
95 | 95 | b | |
96 | 96 | case _ => | |
97 | 97 | "" | |
98 | 98 | } | |
99 | 99 | let newGroup = ((group + ";") + address) | |
100 | 100 | let groupSize = tryGetInteger("dao_wg_size") | |
101 | 101 | let newGroupSize = (groupSize + 1) | |
102 | 102 | WriteSet([DataEntry((("dao_wg_member_" + address) + "_status"), "approved"), DataEntry("dao_wg_members", newGroup), DataEntry("dao_wg_size", newGroupSize)]) | |
103 | 103 | } | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | ||
107 | 107 | @Callable(i) | |
108 | 108 | func mAddMembershipWorkingGroup (address) = if (!(isManager(i.caller))) | |
109 | 109 | then throw("access only to the DAO Manager") | |
110 | 110 | else { | |
111 | 111 | let group = match getString(this, "dao_mwg_members") { | |
112 | 112 | case b: String => | |
113 | 113 | b | |
114 | 114 | case _ => | |
115 | 115 | "" | |
116 | 116 | } | |
117 | 117 | let newGroup = ((group + ";") + address) | |
118 | 118 | let groupSize = tryGetInteger("dao_mwg_size") | |
119 | 119 | let newGroupSize = (groupSize + 1) | |
120 | 120 | WriteSet([DataEntry((("dao_mwg_member_" + address) + "_status"), "approved"), DataEntry("dao_mwg_members", newGroup), DataEntry("dao_mwg_size", newGroupSize)]) | |
121 | 121 | } | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | ||
125 | 125 | @Callable(i) | |
126 | 126 | func wmgMembershipVoteForDAOMember (candidateAddress,voteValue) = { | |
127 | 127 | let caller = toString(i.caller) | |
128 | 128 | let membershipAddress = toString(i.caller) | |
129 | 129 | let voteValueInt = getVoteValue(voteValue) | |
130 | 130 | let votingKey = (("dao_member_" + candidateAddress) + "_vote") | |
131 | 131 | let votedKey = (("dao_member_" + candidateAddress) + "_voted") | |
132 | 132 | let votedVal = match getString(this, votedKey) { | |
133 | 133 | case b: String => | |
134 | 134 | b | |
135 | 135 | case _ => | |
136 | 136 | "" | |
137 | 137 | } | |
138 | + | let newVotedVal = ((caller + ";") + votedVal) | |
138 | 139 | let votingState = tryGetInteger(votingKey) | |
139 | 140 | let newVotingState = (votingState + voteValueInt) | |
140 | 141 | let mwgStatusVal = tryGetString((("dao_mwg_member_" + caller) + "_status")) | |
141 | 142 | if ((mwgStatusVal == "approved")) | |
142 | 143 | then if (isMembershipVotedForCandidate(membershipAddress, candidateAddress)) | |
143 | 144 | then throw(("You have already voted. Caller " + caller)) | |
144 | - | else WriteSet([DataEntry(((membershipAddress + "_voted_") + candidateAddress), 1), DataEntry(votingKey, newVotingState), DataEntry(votedKey, | |
145 | + | else WriteSet([DataEntry(((membershipAddress + "_voted_") + candidateAddress), 1), DataEntry(votingKey, newVotingState), DataEntry(votedKey, newVotedVal)]) | |
145 | 146 | else throw(("You have no rights. Caller " + caller)) | |
146 | 147 | } | |
147 | 148 | ||
148 | 149 |
github/deemru/w8io/026f985 30.03 ms ◑