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