tx · F842c7KVBcC5ZbSDz6Ko4yzAk9JTKtZQHDXokCMw6qgG 3MvRNiiunRy51KJXcLmZhUzrm9fXfMcapuB: -1.03420100 Waves 2021.05.20 11:17 [1533744] smart account 3MvRNiiunRy51KJXcLmZhUzrm9fXfMcapuB > SELF 0.00000000 Waves
{ "type": 13, "id": "F842c7KVBcC5ZbSDz6Ko4yzAk9JTKtZQHDXokCMw6qgG", "fee": 103420100, "feeAssetId": null, "timestamp": 1621498639569, "version": 2, "chainId": 84, "sender": "3MvRNiiunRy51KJXcLmZhUzrm9fXfMcapuB", "senderPublicKey": "AJhgEzWrvQYvLJdZ4bDYWy3W5H1h7UqSPwUyzSKsTYuh", "proofs": [ "4izK7aicxb89epvQAoTyBR3L5Gk7jyUErgC7rUifLBrUdApcWmc87g6bUZBderBWhmyEVpp3twRimGjFpUmx6YKb" ], "script": "base64:AAIDAAAAAAAAACEIARIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSBAoCCAgAAAAKAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAgAAAAAFAAAAA3ZhbAEAAAAJaXNNYW5hZ2VyAAAAAQAAAAdhZGRyZXNzCQAAAAAAAAIFAAAAB2FkZHJlc3MFAAAABHRoaXMBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAABQAAAAN2YWwBAAAAGGlzTWVtYmVyc2hpcFdvcmtpbmdHcm91cAAAAAEAAAABYQkAAAAAAAACCQEAAAAMdHJ5R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| compacted Prev: EDbQzqyGHXKBgtmbPkaRDZu5VkHpjRoDC8MDEgbR7gf1 Next: 4y8mgbkhuMgVNkCJ8VnMzgoNS4Zw4x3LgwVHzPsR8XzM Diff:
Old | New | Differences | |
---|---|---|---|
36 | 36 | ||
37 | 37 | ||
38 | 38 | func isMembershipVotedForCandidate (membershipAddress,candidateAddress) = (tryGetInteger(((membershipAddress + "_voted_") + candidateAddress)) > 0) | |
39 | - | ||
40 | - | ||
41 | - | func getWorkingGroup () = { | |
42 | - | let val = match getString(this, "working_group_members") { | |
43 | - | case b: String => | |
44 | - | b | |
45 | - | case _ => | |
46 | - | "" | |
47 | - | } | |
48 | - | val | |
49 | - | } | |
50 | 39 | ||
51 | 40 | ||
52 | 41 | func getDAOMember () = { | |
115 | 104 | func mAddWorkingGroup (address) = if (!(isManager(i.caller))) | |
116 | 105 | then throw("access only to the DAO Manager") | |
117 | 106 | else { | |
118 | - | let group = getWorkingGroup() | |
107 | + | let group = match getString(this, "dao_wg_members") { | |
108 | + | case b: String => | |
109 | + | b | |
110 | + | case _ => | |
111 | + | "" | |
112 | + | } | |
119 | 113 | let newGroup = ((group + ";") + address) | |
120 | - | let groupSize = tryGetInteger(" | |
114 | + | let groupSize = tryGetInteger("dao_wg_size") | |
121 | 115 | let newGroupSize = (groupSize + 1) | |
122 | - | WriteSet([DataEntry(((" | |
116 | + | WriteSet([DataEntry((("dao_wg_" + address) + "_status"), "approved"), DataEntry("dao_wg_members", newGroup), DataEntry("dao_wg_size", newGroupSize)]) | |
123 | 117 | } | |
124 | 118 | ||
125 | 119 |
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 isMembershipWorkingGroup (a) = (tryGetString((("membership_" + toString(a)) + "_status")) == "approved") | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func isWorkingGroup (a) = (tryGetString((("working_group_" + toString(a)) + "_status")) == "approved") | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func isDAOMember (a) = (tryGetString((("dao_member_" + toString(a)) + "_status")) == "approved") | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func isMembershipVotedForCandidate (membershipAddress,candidateAddress) = (tryGetInteger(((membershipAddress + "_voted_") + candidateAddress)) > 0) | |
39 | - | ||
40 | - | ||
41 | - | func getWorkingGroup () = { | |
42 | - | let val = match getString(this, "working_group_members") { | |
43 | - | case b: String => | |
44 | - | b | |
45 | - | case _ => | |
46 | - | "" | |
47 | - | } | |
48 | - | val | |
49 | - | } | |
50 | 39 | ||
51 | 40 | ||
52 | 41 | func getDAOMember () = { | |
53 | 42 | let val = match getString(this, "dao_members") { | |
54 | 43 | case b: String => | |
55 | 44 | b | |
56 | 45 | case _ => | |
57 | 46 | "" | |
58 | 47 | } | |
59 | 48 | val | |
60 | 49 | } | |
61 | 50 | ||
62 | 51 | ||
63 | 52 | func getMembershipWorkingGroup () = { | |
64 | 53 | let val = match getString(this, "membership_working_group_members") { | |
65 | 54 | case b: String => | |
66 | 55 | b | |
67 | 56 | case _ => | |
68 | 57 | "" | |
69 | 58 | } | |
70 | 59 | val | |
71 | 60 | } | |
72 | 61 | ||
73 | 62 | ||
74 | 63 | func getVoteValue (s) = if ((s == "like")) | |
75 | 64 | then 1 | |
76 | 65 | else if ((s == "dislike")) | |
77 | 66 | then -1 | |
78 | 67 | else throw(("You need to vote with 'like' or 'dislike' value. You specified:" + s)) | |
79 | 68 | ||
80 | 69 | ||
81 | 70 | @Callable(i) | |
82 | 71 | func aProposeCandidateForDAOMember (address) = if ((tryGetInteger((("member_" + address) + "_voting_state")) != 0)) | |
83 | 72 | then throw("This user already exists") | |
84 | 73 | else { | |
85 | 74 | let group = getDAOMember() | |
86 | 75 | let newGroup = ((group + ";") + address) | |
87 | 76 | let groupSize = tryGetInteger("dao_members_size") | |
88 | 77 | let newGroupSize = (groupSize + 1) | |
89 | 78 | WriteSet([DataEntry((("dao_member_" + address) + "_status"), "propose"), DataEntry("dao_members", newGroup), DataEntry("dao_members_size", newGroupSize)]) | |
90 | 79 | } | |
91 | 80 | ||
92 | 81 | ||
93 | 82 | ||
94 | 83 | @Callable(i) | |
95 | 84 | func mRejectDAOMember (address) = if (!(isManager(i.caller))) | |
96 | 85 | then throw("access only to the DAO Manager") | |
97 | 86 | else WriteSet([DataEntry((("dao_member_" + address) + "_status"), "rejected")]) | |
98 | 87 | ||
99 | 88 | ||
100 | 89 | ||
101 | 90 | @Callable(i) | |
102 | 91 | func mAddDAOMember (address) = if (!(isManager(i.caller))) | |
103 | 92 | then throw("access only to the DAO Manager") | |
104 | 93 | else { | |
105 | 94 | let group = getDAOMember() | |
106 | 95 | let newGroup = ((group + ";") + address) | |
107 | 96 | let groupSize = tryGetInteger("dao_members_size") | |
108 | 97 | let newGroupSize = (groupSize + 1) | |
109 | 98 | WriteSet([DataEntry((("dao_member_" + address) + "_status"), "approved"), DataEntry("dao_members", newGroup), DataEntry("dao_members_size", newGroupSize)]) | |
110 | 99 | } | |
111 | 100 | ||
112 | 101 | ||
113 | 102 | ||
114 | 103 | @Callable(i) | |
115 | 104 | func mAddWorkingGroup (address) = if (!(isManager(i.caller))) | |
116 | 105 | then throw("access only to the DAO Manager") | |
117 | 106 | else { | |
118 | - | let group = getWorkingGroup() | |
107 | + | let group = match getString(this, "dao_wg_members") { | |
108 | + | case b: String => | |
109 | + | b | |
110 | + | case _ => | |
111 | + | "" | |
112 | + | } | |
119 | 113 | let newGroup = ((group + ";") + address) | |
120 | - | let groupSize = tryGetInteger(" | |
114 | + | let groupSize = tryGetInteger("dao_wg_size") | |
121 | 115 | let newGroupSize = (groupSize + 1) | |
122 | - | WriteSet([DataEntry(((" | |
116 | + | WriteSet([DataEntry((("dao_wg_" + address) + "_status"), "approved"), DataEntry("dao_wg_members", newGroup), DataEntry("dao_wg_size", newGroupSize)]) | |
123 | 117 | } | |
124 | 118 | ||
125 | 119 | ||
126 | 120 | ||
127 | 121 | @Callable(i) | |
128 | 122 | func mAddMembershipWorkingGroup (address) = if (!(isManager(i.caller))) | |
129 | 123 | then throw("access only to the DAO Manager") | |
130 | 124 | else { | |
131 | 125 | let group = getMembershipWorkingGroup() | |
132 | 126 | let newGroup = ((group + ";") + address) | |
133 | 127 | let groupSize = tryGetInteger("membership_working_group_members_size") | |
134 | 128 | let newGroupSize = (groupSize + 1) | |
135 | 129 | WriteSet([DataEntry((("membership_" + address) + "_status"), "approved"), DataEntry("membership_working_group_members", newGroup), DataEntry("membership_working_group_members_size", newGroupSize)]) | |
136 | 130 | } | |
137 | 131 | ||
138 | 132 | ||
139 | 133 | ||
140 | 134 | @Callable(i) | |
141 | 135 | func wmgMembershipVoteForDAOMember (candidateAddress,voteValue) = { | |
142 | 136 | let membershipAddress = toString(i.caller) | |
143 | 137 | let voteValueInt = getVoteValue(voteValue) | |
144 | 138 | let votingKey = (("dao_member_" + candidateAddress) + "_vote") | |
145 | 139 | let votedKey = (("dao_member_" + candidateAddress) + "_voted") | |
146 | 140 | let votedVal = match getString(this, votedKey) { | |
147 | 141 | case b: String => | |
148 | 142 | b | |
149 | 143 | case _ => | |
150 | 144 | "" | |
151 | 145 | } | |
152 | 146 | let votingState = tryGetInteger(votingKey) | |
153 | 147 | let newVotingState = (votingState + voteValueInt) | |
154 | 148 | if (isMembershipWorkingGroup(i.caller)) | |
155 | 149 | then if (isMembershipVotedForCandidate(membershipAddress, candidateAddress)) | |
156 | 150 | then throw("You have already voted") | |
157 | 151 | else WriteSet([DataEntry(((membershipAddress + "_voted_") + candidateAddress), 1), DataEntry(votingKey, newVotingState), DataEntry(votedKey, votedVal)]) | |
158 | 152 | else throw("You have no rights") | |
159 | 153 | } | |
160 | 154 | ||
161 | 155 |
github/deemru/w8io/026f985 34.06 ms ◑