tx · GxsMfURcFG7DZ71zwitNWCsD7VcJVVKr7UsfxkfziJx3 3MqZkBUDKbXPKEq2sMtxtSahzX5n8AVDTyT: -0.01700000 Waves 2021.05.20 16:00 [1534034] smart account 3MqZkBUDKbXPKEq2sMtxtSahzX5n8AVDTyT > SELF 0.00000000 Waves
{ "type": 13, "id": "GxsMfURcFG7DZ71zwitNWCsD7VcJVVKr7UsfxkfziJx3", "fee": 1700000, "feeAssetId": null, "timestamp": 1621515632821, "version": 2, "chainId": 84, "sender": "3MqZkBUDKbXPKEq2sMtxtSahzX5n8AVDTyT", "senderPublicKey": "5CSJYiEQvEGm3vH52UCQRkmhw7TV5ZzRhWptXi2hjM7T", "proofs": [ "4scjU5TdmtoyxDJTTmA8GVgyo66i8koEtyiiBb4BFrFCUyn197hXVG2LA5MJ8FzB6X5UFRP1Ef1zsNrH7jEng3fX" ], "script": "base64:AAIDAAAAAAAAACEIARIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSBAoCCAgAAAAHAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAgAAAAAFAAAAA3ZhbAEAAAAJaXNNYW5hZ2VyAAAAAQAAAAdhZGRyZXNzCQAAAAAAAAIFAAAAB2FkZHJlc3MFAAAABHRoaXMBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAABQAAAAN2YWwBAAAADmlzV29ya2luZ0dyb3VwAAAAAQAAAAFhCQAAAAAAAAIJAQAAAAx0cnlHZXRTdH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Al2b3RpbmdLZXkFAAAADm5ld1ZvdGluZ1N0YXRlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAh2b3RlZEtleQUAAAALbmV3Vm90ZWRWYWwJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACHZvdGVzS2V5BQAAAAx2b3RlVmFsdWVJbnQFAAAAA25pbAkAAAIAAAABCQABLAAAAAICAAAAG1lvdSBoYXZlIG5vIHJpZ2h0cy4gQ2FsbGVyIAUAAAAGY2FsbGVyAAAAAPrynjQ=", "height": 1534034, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 45wYiWKPL6oEZ4bkbGpGGM5VuAwxqJPAJ9nJeNqCQK2Y Next: none Diff:
Old | New | Differences | |
---|---|---|---|
55 | 55 | then throw("This user already exists") | |
56 | 56 | else { | |
57 | 57 | let group = getDAOMember() | |
58 | - | if ((lastIndexOf(group, address | |
58 | + | if ((lastIndexOf(group, address) != unit)) | |
59 | 59 | then throw("This user is already in the group") | |
60 | 60 | else { | |
61 | 61 | let newGroup = ((group + ";") + address) | |
79 | 79 | then throw("access only to the DAO Manager") | |
80 | 80 | else { | |
81 | 81 | let group = getDAOMember() | |
82 | - | if ((lastIndexOf(group, address | |
82 | + | if ((lastIndexOf(group, address) != unit)) | |
83 | 83 | then throw("This user is already in the group") | |
84 | 84 | else { | |
85 | 85 | let newGroup = ((group + ";") + address) | |
101 | 101 | case _ => | |
102 | 102 | "" | |
103 | 103 | } | |
104 | - | if ((lastIndexOf(group, address | |
104 | + | if ((lastIndexOf(group, address) != unit)) | |
105 | 105 | then throw("This user is already in the group") | |
106 | 106 | else { | |
107 | 107 | let newGroup = ((group + ";") + address) | |
123 | 123 | case _ => | |
124 | 124 | "" | |
125 | 125 | } | |
126 | - | if ((lastIndexOf(group, address | |
126 | + | if ((lastIndexOf(group, address) != unit)) | |
127 | 127 | then throw("This user is already in the group") | |
128 | 128 | else { | |
129 | 129 | let newGroup = ((group + ";") + address) |
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 getDAOMember () = { | |
36 | 36 | let val = match getString(this, "dao_members") { | |
37 | 37 | case b: String => | |
38 | 38 | b | |
39 | 39 | case _ => | |
40 | 40 | "" | |
41 | 41 | } | |
42 | 42 | val | |
43 | 43 | } | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getVoteValue (s) = if ((s == "like")) | |
47 | 47 | then 1 | |
48 | 48 | else if ((s == "dislike")) | |
49 | 49 | then -1 | |
50 | 50 | else throw(("You need to vote with 'like' or 'dislike' value. You specified:" + s)) | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | @Callable(i) | |
54 | 54 | func aProposeCandidateForDAOMember (address) = if ((tryGetInteger((("member_" + address) + "_voting_state")) != 0)) | |
55 | 55 | then throw("This user already exists") | |
56 | 56 | else { | |
57 | 57 | let group = getDAOMember() | |
58 | - | if ((lastIndexOf(group, address | |
58 | + | if ((lastIndexOf(group, address) != unit)) | |
59 | 59 | then throw("This user is already in the group") | |
60 | 60 | else { | |
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 | ||
70 | 70 | @Callable(i) | |
71 | 71 | func mRejectDAOMember (address) = if (!(isManager(i.caller))) | |
72 | 72 | then throw("access only to the DAO Manager") | |
73 | 73 | else WriteSet([DataEntry((("dao_member_" + address) + "_status"), "rejected")]) | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | ||
77 | 77 | @Callable(i) | |
78 | 78 | func mAddDAOMember (address) = if (!(isManager(i.caller))) | |
79 | 79 | then throw("access only to the DAO Manager") | |
80 | 80 | else { | |
81 | 81 | let group = getDAOMember() | |
82 | - | if ((lastIndexOf(group, address | |
82 | + | if ((lastIndexOf(group, address) != unit)) | |
83 | 83 | then throw("This user is already in the group") | |
84 | 84 | else { | |
85 | 85 | let newGroup = ((group + ";") + address) | |
86 | 86 | let groupSize = tryGetInteger("dao_members_size") | |
87 | 87 | let newGroupSize = (groupSize + 1) | |
88 | 88 | WriteSet([DataEntry((("dao_member_" + address) + "_status"), "approved"), DataEntry("dao_members", newGroup), DataEntry("dao_members_size", newGroupSize)]) | |
89 | 89 | } | |
90 | 90 | } | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | ||
94 | 94 | @Callable(i) | |
95 | 95 | func mAddWorkingGroup (address) = if (!(isManager(i.caller))) | |
96 | 96 | then throw("access only to the DAO Manager") | |
97 | 97 | else { | |
98 | 98 | let group = match getString(this, "dao_wg_members") { | |
99 | 99 | case b: String => | |
100 | 100 | b | |
101 | 101 | case _ => | |
102 | 102 | "" | |
103 | 103 | } | |
104 | - | if ((lastIndexOf(group, address | |
104 | + | if ((lastIndexOf(group, address) != unit)) | |
105 | 105 | then throw("This user is already in the group") | |
106 | 106 | else { | |
107 | 107 | let newGroup = ((group + ";") + address) | |
108 | 108 | let groupSize = tryGetInteger("dao_wg_size") | |
109 | 109 | let newGroupSize = (groupSize + 1) | |
110 | 110 | WriteSet([DataEntry((("dao_wg_member_" + address) + "_status"), "approved"), DataEntry("dao_wg_members", newGroup), DataEntry("dao_wg_size", newGroupSize)]) | |
111 | 111 | } | |
112 | 112 | } | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | ||
116 | 116 | @Callable(i) | |
117 | 117 | func mAddMembershipWorkingGroup (address) = if (!(isManager(i.caller))) | |
118 | 118 | then throw("access only to the DAO Manager") | |
119 | 119 | else { | |
120 | 120 | let group = match getString(this, "dao_mwg_members") { | |
121 | 121 | case b: String => | |
122 | 122 | b | |
123 | 123 | case _ => | |
124 | 124 | "" | |
125 | 125 | } | |
126 | - | if ((lastIndexOf(group, address | |
126 | + | if ((lastIndexOf(group, address) != unit)) | |
127 | 127 | then throw("This user is already in the group") | |
128 | 128 | else { | |
129 | 129 | let newGroup = ((group + ";") + address) | |
130 | 130 | let groupSize = tryGetInteger("dao_mwg_size") | |
131 | 131 | let newGroupSize = (groupSize + 1) | |
132 | 132 | WriteSet([DataEntry((("dao_mwg_member_" + address) + "_status"), "approved"), DataEntry("dao_mwg_members", newGroup), DataEntry("dao_mwg_size", newGroupSize)]) | |
133 | 133 | } | |
134 | 134 | } | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | ||
138 | 138 | @Callable(i) | |
139 | 139 | func wmgMembershipVoteForDAOMember (candidateAddress,voteValue) = { | |
140 | 140 | let caller = toString(i.caller) | |
141 | 141 | let membershipAddress = toString(i.caller) | |
142 | 142 | let voteValueInt = getVoteValue(voteValue) | |
143 | 143 | let votingKey = (("dao_member_" + candidateAddress) + "_vote") | |
144 | 144 | let votedKey = (("dao_member_" + candidateAddress) + "_voted") | |
145 | 145 | let votesKey = ((("dao_member_" + candidateAddress) + "_votes_") + caller) | |
146 | 146 | let votedVal = match getString(this, votedKey) { | |
147 | 147 | case b: String => | |
148 | 148 | b | |
149 | 149 | case _ => | |
150 | 150 | "" | |
151 | 151 | } | |
152 | 152 | let newVotedVal = ((caller + ";") + votedVal) | |
153 | 153 | let votingState = tryGetInteger(votingKey) | |
154 | 154 | let newVotingState = (votingState + voteValueInt) | |
155 | 155 | let mwgStatusVal = tryGetString((("dao_mwg_member_" + caller) + "_status")) | |
156 | 156 | if ((mwgStatusVal == "approved")) | |
157 | 157 | then if ((tryGetInteger(((("dao_member_" + candidateAddress) + "_votes_") + caller)) > 0)) | |
158 | 158 | then throw(("You have already voted. Caller " + caller)) | |
159 | 159 | else WriteSet([DataEntry(votingKey, newVotingState), DataEntry(votedKey, newVotedVal), DataEntry(votesKey, voteValueInt)]) | |
160 | 160 | else throw(("You have no rights. Caller " + caller)) | |
161 | 161 | } | |
162 | 162 | ||
163 | 163 |
github/deemru/w8io/169f3d6 33.56 ms ◑