tx · 45wYiWKPL6oEZ4bkbGpGGM5VuAwxqJPAJ9nJeNqCQK2Y

3MqZkBUDKbXPKEq2sMtxtSahzX5n8AVDTyT:  -0.01700000 Waves

2021.05.20 15:38 [1534011] smart account 3MqZkBUDKbXPKEq2sMtxtSahzX5n8AVDTyT > SELF 0.00000000 Waves

{ "type": 13, "id": "45wYiWKPL6oEZ4bkbGpGGM5VuAwxqJPAJ9nJeNqCQK2Y", "fee": 1700000, "feeAssetId": null, "timestamp": 1621514290320, "version": 2, "chainId": 84, "sender": "3MqZkBUDKbXPKEq2sMtxtSahzX5n8AVDTyT", "senderPublicKey": "5CSJYiEQvEGm3vH52UCQRkmhw7TV5ZzRhWptXi2hjM7T", "proofs": [ "4Cmn2HV4iCiM5uC86x7sjouA5tJd2uNTGjBm6TUGxQpQEhLZbxrUYXSbo8E2LWJNSYdeQSaHJHtkZEuKezAtBVLh" ], "script": "base64:AAIDAAAAAAAAACEIARIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSBAoCCAgAAAAHAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAgAAAAAFAAAAA3ZhbAEAAAAJaXNNYW5hZ2VyAAAAAQAAAAdhZGRyZXNzCQAAAAAAAAIFAAAAB2FkZHJlc3MFAAAABHRoaXMBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAABQAAAAN2YWwBAAAADmlzV29ya2luZ0dyb3VwAAAAAQAAAAFhCQAAAAAAAAIJAQAA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GVyCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAl2b3RpbmdLZXkFAAAADm5ld1ZvdGluZ1N0YXRlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAAAh2b3RlZEtleQUAAAALbmV3Vm90ZWRWYWwJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACHZvdGVzS2V5BQAAAAx2b3RlVmFsdWVJbnQFAAAAA25pbAkAAAIAAAABCQABLAAAAAICAAAAG1lvdSBoYXZlIG5vIHJpZ2h0cy4gQ2FsbGVyIAUAAAAGY2FsbGVyAAAAAAY/V+Q=", "height": 1534011, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3Vczk9k5BYTDuyMTMvwkxEu2p5BXdTavJ1FoUaKU2VHk Next: GxsMfURcFG7DZ71zwitNWCsD7VcJVVKr7UsfxkfziJx3 Diff:
OldNewDifferences
5555 then throw("This user already exists")
5656 else {
5757 let group = getDAOMember()
58- let newGroup = ((group + ";") + address)
59- let groupSize = tryGetInteger("dao_members_size")
60- let newGroupSize = (groupSize + 1)
61- WriteSet([DataEntry((("dao_member_" + address) + "_status"), "propose"), DataEntry("dao_members", newGroup), DataEntry("dao_members_size", newGroupSize)])
58+ if ((lastIndexOf(group, address, 0) != 0))
59+ then throw("This user is already in the group")
60+ else {
61+ let newGroup = ((group + ";") + address)
62+ let groupSize = tryGetInteger("dao_members_size")
63+ let newGroupSize = (groupSize + 1)
64+ WriteSet([DataEntry((("dao_member_" + address) + "_status"), "propose"), DataEntry("dao_members", newGroup), DataEntry("dao_members_size", newGroupSize)])
65+ }
6266 }
6367
6468
7579 then throw("access only to the DAO Manager")
7680 else {
7781 let group = getDAOMember()
78- let newGroup = ((group + ";") + address)
79- let groupSize = tryGetInteger("dao_members_size")
80- let newGroupSize = (groupSize + 1)
81- WriteSet([DataEntry((("dao_member_" + address) + "_status"), "approved"), DataEntry("dao_members", newGroup), DataEntry("dao_members_size", newGroupSize)])
82+ if ((lastIndexOf(group, address, 0) != 0))
83+ then throw("This user is already in the group")
84+ else {
85+ let newGroup = ((group + ";") + address)
86+ let groupSize = tryGetInteger("dao_members_size")
87+ let newGroupSize = (groupSize + 1)
88+ WriteSet([DataEntry((("dao_member_" + address) + "_status"), "approved"), DataEntry("dao_members", newGroup), DataEntry("dao_members_size", newGroupSize)])
89+ }
8290 }
8391
8492
93101 case _ =>
94102 ""
95103 }
96- let newGroup = ((group + ";") + address)
97- let groupSize = tryGetInteger("dao_wg_size")
98- let newGroupSize = (groupSize + 1)
99- WriteSet([DataEntry((("dao_wg_member_" + address) + "_status"), "approved"), DataEntry("dao_wg_members", newGroup), DataEntry("dao_wg_size", newGroupSize)])
104+ if ((lastIndexOf(group, address, 0) != 0))
105+ then throw("This user is already in the group")
106+ else {
107+ let newGroup = ((group + ";") + address)
108+ let groupSize = tryGetInteger("dao_wg_size")
109+ let newGroupSize = (groupSize + 1)
110+ WriteSet([DataEntry((("dao_wg_member_" + address) + "_status"), "approved"), DataEntry("dao_wg_members", newGroup), DataEntry("dao_wg_size", newGroupSize)])
111+ }
100112 }
101113
102114
111123 case _ =>
112124 ""
113125 }
114- let newGroup = ((group + ";") + address)
115- let groupSize = tryGetInteger("dao_mwg_size")
116- let newGroupSize = (groupSize + 1)
117- WriteSet([DataEntry((("dao_mwg_member_" + address) + "_status"), "approved"), DataEntry("dao_mwg_members", newGroup), DataEntry("dao_mwg_size", newGroupSize)])
126+ if ((lastIndexOf(group, address, 0) != 0))
127+ then throw("This user is already in the group")
128+ else {
129+ let newGroup = ((group + ";") + address)
130+ let groupSize = tryGetInteger("dao_mwg_size")
131+ let newGroupSize = (groupSize + 1)
132+ WriteSet([DataEntry((("dao_mwg_member_" + address) + "_status"), "approved"), DataEntry("dao_mwg_members", newGroup), DataEntry("dao_mwg_size", newGroupSize)])
133+ }
118134 }
119135
120136
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func tryGetString (key) = {
55 let val = match getString(this, key) {
66 case b: String =>
77 b
88 case _ =>
99 ""
1010 }
1111 val
1212 }
1313
1414
1515 func isManager (address) = (address == this)
1616
1717
1818 func tryGetInteger (key) = {
1919 let val = match getInteger(this, key) {
2020 case b: Int =>
2121 b
2222 case _ =>
2323 0
2424 }
2525 val
2626 }
2727
2828
2929 func isWorkingGroup (a) = (tryGetString((("working_group_" + toString(a)) + "_status")) == "approved")
3030
3131
3232 func isDAOMember (a) = (tryGetString((("dao_member_" + toString(a)) + "_status")) == "approved")
3333
3434
3535 func getDAOMember () = {
3636 let val = match getString(this, "dao_members") {
3737 case b: String =>
3838 b
3939 case _ =>
4040 ""
4141 }
4242 val
4343 }
4444
4545
4646 func getVoteValue (s) = if ((s == "like"))
4747 then 1
4848 else if ((s == "dislike"))
4949 then -1
5050 else throw(("You need to vote with 'like' or 'dislike' value. You specified:" + s))
5151
5252
5353 @Callable(i)
5454 func aProposeCandidateForDAOMember (address) = if ((tryGetInteger((("member_" + address) + "_voting_state")) != 0))
5555 then throw("This user already exists")
5656 else {
5757 let group = getDAOMember()
58- let newGroup = ((group + ";") + address)
59- let groupSize = tryGetInteger("dao_members_size")
60- let newGroupSize = (groupSize + 1)
61- WriteSet([DataEntry((("dao_member_" + address) + "_status"), "propose"), DataEntry("dao_members", newGroup), DataEntry("dao_members_size", newGroupSize)])
58+ if ((lastIndexOf(group, address, 0) != 0))
59+ then throw("This user is already in the group")
60+ else {
61+ let newGroup = ((group + ";") + address)
62+ let groupSize = tryGetInteger("dao_members_size")
63+ let newGroupSize = (groupSize + 1)
64+ WriteSet([DataEntry((("dao_member_" + address) + "_status"), "propose"), DataEntry("dao_members", newGroup), DataEntry("dao_members_size", newGroupSize)])
65+ }
6266 }
6367
6468
6569
6670 @Callable(i)
6771 func mRejectDAOMember (address) = if (!(isManager(i.caller)))
6872 then throw("access only to the DAO Manager")
6973 else WriteSet([DataEntry((("dao_member_" + address) + "_status"), "rejected")])
7074
7175
7276
7377 @Callable(i)
7478 func mAddDAOMember (address) = if (!(isManager(i.caller)))
7579 then throw("access only to the DAO Manager")
7680 else {
7781 let group = getDAOMember()
78- let newGroup = ((group + ";") + address)
79- let groupSize = tryGetInteger("dao_members_size")
80- let newGroupSize = (groupSize + 1)
81- WriteSet([DataEntry((("dao_member_" + address) + "_status"), "approved"), DataEntry("dao_members", newGroup), DataEntry("dao_members_size", newGroupSize)])
82+ if ((lastIndexOf(group, address, 0) != 0))
83+ then throw("This user is already in the group")
84+ else {
85+ let newGroup = ((group + ";") + address)
86+ let groupSize = tryGetInteger("dao_members_size")
87+ let newGroupSize = (groupSize + 1)
88+ WriteSet([DataEntry((("dao_member_" + address) + "_status"), "approved"), DataEntry("dao_members", newGroup), DataEntry("dao_members_size", newGroupSize)])
89+ }
8290 }
8391
8492
8593
8694 @Callable(i)
8795 func mAddWorkingGroup (address) = if (!(isManager(i.caller)))
8896 then throw("access only to the DAO Manager")
8997 else {
9098 let group = match getString(this, "dao_wg_members") {
9199 case b: String =>
92100 b
93101 case _ =>
94102 ""
95103 }
96- let newGroup = ((group + ";") + address)
97- let groupSize = tryGetInteger("dao_wg_size")
98- let newGroupSize = (groupSize + 1)
99- WriteSet([DataEntry((("dao_wg_member_" + address) + "_status"), "approved"), DataEntry("dao_wg_members", newGroup), DataEntry("dao_wg_size", newGroupSize)])
104+ if ((lastIndexOf(group, address, 0) != 0))
105+ then throw("This user is already in the group")
106+ else {
107+ let newGroup = ((group + ";") + address)
108+ let groupSize = tryGetInteger("dao_wg_size")
109+ let newGroupSize = (groupSize + 1)
110+ WriteSet([DataEntry((("dao_wg_member_" + address) + "_status"), "approved"), DataEntry("dao_wg_members", newGroup), DataEntry("dao_wg_size", newGroupSize)])
111+ }
100112 }
101113
102114
103115
104116 @Callable(i)
105117 func mAddMembershipWorkingGroup (address) = if (!(isManager(i.caller)))
106118 then throw("access only to the DAO Manager")
107119 else {
108120 let group = match getString(this, "dao_mwg_members") {
109121 case b: String =>
110122 b
111123 case _ =>
112124 ""
113125 }
114- let newGroup = ((group + ";") + address)
115- let groupSize = tryGetInteger("dao_mwg_size")
116- let newGroupSize = (groupSize + 1)
117- WriteSet([DataEntry((("dao_mwg_member_" + address) + "_status"), "approved"), DataEntry("dao_mwg_members", newGroup), DataEntry("dao_mwg_size", newGroupSize)])
126+ if ((lastIndexOf(group, address, 0) != 0))
127+ then throw("This user is already in the group")
128+ else {
129+ let newGroup = ((group + ";") + address)
130+ let groupSize = tryGetInteger("dao_mwg_size")
131+ let newGroupSize = (groupSize + 1)
132+ WriteSet([DataEntry((("dao_mwg_member_" + address) + "_status"), "approved"), DataEntry("dao_mwg_members", newGroup), DataEntry("dao_mwg_size", newGroupSize)])
133+ }
118134 }
119135
120136
121137
122138 @Callable(i)
123139 func wmgMembershipVoteForDAOMember (candidateAddress,voteValue) = {
124140 let caller = toString(i.caller)
125141 let membershipAddress = toString(i.caller)
126142 let voteValueInt = getVoteValue(voteValue)
127143 let votingKey = (("dao_member_" + candidateAddress) + "_vote")
128144 let votedKey = (("dao_member_" + candidateAddress) + "_voted")
129145 let votesKey = ((("dao_member_" + candidateAddress) + "_votes_") + caller)
130146 let votedVal = match getString(this, votedKey) {
131147 case b: String =>
132148 b
133149 case _ =>
134150 ""
135151 }
136152 let newVotedVal = ((caller + ";") + votedVal)
137153 let votingState = tryGetInteger(votingKey)
138154 let newVotingState = (votingState + voteValueInt)
139155 let mwgStatusVal = tryGetString((("dao_mwg_member_" + caller) + "_status"))
140156 if ((mwgStatusVal == "approved"))
141157 then if ((tryGetInteger(((("dao_member_" + candidateAddress) + "_votes_") + caller)) > 0))
142158 then throw(("You have already voted. Caller " + caller))
143159 else WriteSet([DataEntry(votingKey, newVotingState), DataEntry(votedKey, newVotedVal), DataEntry(votesKey, voteValueInt)])
144160 else throw(("You have no rights. Caller " + caller))
145161 }
146162
147163

github/deemru/w8io/169f3d6 
32.43 ms