tx · 4PowKbGM3TwQxivTpbGo3qvQWVDdmuXxgoZepVti6JCB 3NCWSjcUAhGhiYzzraCCnNX4TddwyQwyWth: -0.10000000 Waves 2021.05.19 17:27 [1532676] smart account 3NCWSjcUAhGhiYzzraCCnNX4TddwyQwyWth > SELF 0.00000000 Waves
{ "type": 13, "id": "4PowKbGM3TwQxivTpbGo3qvQWVDdmuXxgoZepVti6JCB", "fee": 10000000, "feeAssetId": null, "timestamp": 1621434483626, "version": 2, "chainId": 84, "sender": "3NCWSjcUAhGhiYzzraCCnNX4TddwyQwyWth", "senderPublicKey": "BCg7jdRfQcaboBTzVmr2Eito8UizZHxQ5X7D7nX915vx", "proofs": [ "2i7m5jYbRPdXHnfTh9GKhKPW9TbtEs1wrAqUWo2txMm9Z57A6qJAGa1ascTASTBk2PU1DLzKtaVKguUPtYqDSBjp" ], "script": "base64:AAIDAAAAAAAAACEIARIDCgEIEgMKAQgSAwoBCBIDCgEIEgMKAQgSBAoCCAgAAAALAQAAAAx0cnlHZXRTdHJpbmcAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAgAAAAAFAAAAA3ZhbAEAAAAJaXNNYW5hZ2VyAAAAAQAAAAdhZGRyZXNzCQAAAAAAAAIFAAAAB2FkZHJlc3MFAAAABHRoaXMBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAABQAAAAN2YWwBAAAAGGlzTWVtYmVyc2hpcFdvcmtpbmdHcm91cAAAAAEAAAABYQkAAAAAAAACCQEAAAAMdHJ5R2V0U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JzaGlwVm90ZWRGb3JDYW5kaWRhdGUAAAACBQAAABFtZW1iZXJzaGlwQWRkcmVzcwUAAAAQY2FuZGlkYXRlQWRkcmVzcwkAAAIAAAABAgAAABZZb3UgaGF2ZSBhbHJlYWR5IHZvdGVkCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgUAAAARbWVtYmVyc2hpcEFkZHJlc3MCAAAAB192b3RlZF8FAAAAEGNhbmRpZGF0ZUFkZHJlc3MAAAAAAAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACXZvdGluZ0tleQUAAAAObmV3Vm90aW5nU3RhdGUFAAAAA25pbAkAAAIAAAABAgAAABJZb3UgaGF2ZSBubyByaWdodHMAAAAAzpICqw==", "height": 1532676, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 6wR2GaD9sWATZNww29xUJBKtj81ZpYAMb4xrRFGpdBkW Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func tryGetString (key) = { | |
5 | + | let val = match getString(this, key) { | |
6 | + | case b: String => | |
7 | + | b | |
8 | + | case _ => | |
9 | + | "" | |
10 | + | } | |
11 | + | val | |
12 | + | } | |
13 | + | ||
14 | + | ||
15 | + | func isManager (address) = (address == this) | |
16 | + | ||
17 | + | ||
18 | + | func tryGetInteger (key) = { | |
19 | + | let val = match getInteger(this, key) { | |
20 | + | case b: Int => | |
21 | + | b | |
22 | + | case _ => | |
23 | + | 0 | |
24 | + | } | |
25 | + | val | |
26 | + | } | |
27 | + | ||
28 | + | ||
29 | + | func isMembershipWorkingGroup (a) = (tryGetString((("membership_" + toString(a)) + "_status")) == "approved") | |
30 | + | ||
31 | + | ||
32 | + | func isWorkingGroup (a) = (tryGetString((("working_group_" + toString(a)) + "_status")) == "approved") | |
33 | + | ||
34 | + | ||
35 | + | func isDAOMember (a) = (tryGetString((("dao_member_" + toString(a)) + "_status")) == "approved") | |
36 | + | ||
37 | + | ||
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 | + | ||
51 | + | ||
52 | + | func getDAOMember () = { | |
53 | + | let val = match getString(this, "dao_members") { | |
54 | + | case b: String => | |
55 | + | b | |
56 | + | case _ => | |
57 | + | "" | |
58 | + | } | |
59 | + | val | |
60 | + | } | |
61 | + | ||
62 | + | ||
63 | + | func getMembershipWorkingGroup () = { | |
64 | + | let val = match getString(this, "membership_working_group_members") { | |
65 | + | case b: String => | |
66 | + | b | |
67 | + | case _ => | |
68 | + | "" | |
69 | + | } | |
70 | + | val | |
71 | + | } | |
72 | + | ||
73 | + | ||
74 | + | func getVoteValue (s) = if ((s == "like")) | |
75 | + | then 1 | |
76 | + | else if ((s == "dislike")) | |
77 | + | then -1 | |
78 | + | else throw(("You need to vote with 'like' or 'dislike' value. You specified:" + s)) | |
79 | + | ||
80 | + | ||
81 | + | @Callable(i) | |
82 | + | func aProposeCandidateForDAOMember (address) = if ((tryGetInteger((("member_" + address) + "_voting_state")) != 0)) | |
83 | + | then throw("This user already exists") | |
84 | + | else WriteSet([DataEntry((("dao_member_" + address) + "_status"), "propose")]) | |
85 | + | ||
86 | + | ||
87 | + | ||
88 | + | @Callable(i) | |
89 | + | func mRejectedDAOMember (address) = if (!(isManager(i.caller))) | |
90 | + | then throw("access only to the DAO Manager") | |
91 | + | else WriteSet([DataEntry((("dao_member_" + address) + "_status"), "rejected")]) | |
92 | + | ||
93 | + | ||
94 | + | ||
95 | + | @Callable(i) | |
96 | + | func mAddDAOMember (address) = if (!(isManager(i.caller))) | |
97 | + | then throw("access only to the DAO Manager") | |
98 | + | else { | |
99 | + | let group = getDAOMember() | |
100 | + | let newGroup = ((group + ";") + address) | |
101 | + | let groupSize = tryGetInteger("dao_members_size") | |
102 | + | let newGroupSize = (groupSize + 1) | |
103 | + | WriteSet([DataEntry((("dao_member_" + address) + "_status"), "approved"), DataEntry("dao_members", newGroup), DataEntry("dao_members_size", newGroupSize)]) | |
104 | + | } | |
105 | + | ||
106 | + | ||
107 | + | ||
108 | + | @Callable(i) | |
109 | + | func mAddWorkingGroup (address) = if (!(isManager(i.caller))) | |
110 | + | then throw("access only to the DAO Manager") | |
111 | + | else { | |
112 | + | let group = getWorkingGroup() | |
113 | + | let newGroup = ((group + ";") + address) | |
114 | + | let groupSize = tryGetInteger("working_group_size") | |
115 | + | let newGroupSize = (groupSize + 1) | |
116 | + | WriteSet([DataEntry((("working_group_member_" + address) + "_status"), "approved"), DataEntry("working_group_members", newGroup), DataEntry("working_group_size", newGroupSize)]) | |
117 | + | } | |
118 | + | ||
119 | + | ||
120 | + | ||
121 | + | @Callable(i) | |
122 | + | func mAddMembershipWorkingGroup (address) = if (!(isManager(i.caller))) | |
123 | + | then throw("access only to the DAO Manager") | |
124 | + | else { | |
125 | + | let group = getMembershipWorkingGroup() | |
126 | + | let newGroup = ((group + ";") + address) | |
127 | + | let groupSize = tryGetInteger("membership_working_group_members_size") | |
128 | + | let newGroupSize = (groupSize + 1) | |
129 | + | WriteSet([DataEntry((("membership_" + address) + "_status"), "approved"), DataEntry("membership_working_group_members", newGroup), DataEntry("membership_working_group_members_size", newGroupSize)]) | |
130 | + | } | |
131 | + | ||
132 | + | ||
133 | + | ||
134 | + | @Callable(i) | |
135 | + | func wmgMembershipVoteForDAOMember (candidateAddress,voteValue) = { | |
136 | + | let membershipAddress = toString(i.caller) | |
137 | + | let voteValueInt = getVoteValue(voteValue) | |
138 | + | let votingKey = (("member_" + candidateAddress) + "_voting_state") | |
139 | + | let votingState = tryGetInteger(votingKey) | |
140 | + | let newVotingState = (votingState + voteValueInt) | |
141 | + | if (isMembershipWorkingGroup(i.caller)) | |
142 | + | then if (isMembershipVotedForCandidate(membershipAddress, candidateAddress)) | |
143 | + | then throw("You have already voted") | |
144 | + | else WriteSet([DataEntry(((membershipAddress + "_voted_") + candidateAddress), 1), DataEntry(votingKey, newVotingState)]) | |
145 | + | else throw("You have no rights") | |
146 | + | } | |
147 | + | ||
148 | + |
github/deemru/w8io/026f985 15.77 ms ◑