tx · 4pJp6fXhx13VbFwBwAmthdpDrNoxYK3beBYHdygJXtaN 3MtDLeyidS96LFXudNHqdZY8MjyZ8puffVG: -0.01900000 Waves 2021.04.11 01:46 [1476961] smart account 3MtDLeyidS96LFXudNHqdZY8MjyZ8puffVG > SELF 0.00000000 Waves
{ "type": 13, "id": "4pJp6fXhx13VbFwBwAmthdpDrNoxYK3beBYHdygJXtaN", "fee": 1900000, "feeAssetId": null, "timestamp": 1618094814608, "version": 2, "chainId": 84, "sender": "3MtDLeyidS96LFXudNHqdZY8MjyZ8puffVG", "senderPublicKey": "HUu7GXogwBSiz24cc85R5vrrESNuUhrWDgFDFqXaZNhz", "proofs": [ "2fLSNjg9LL5t9C6nRwoPRE4v3VMqRu8FoQqoqYP7HiZWgCiZ69LdciAPTCKnQZK6pJXuV1mga7VnUeHL58RWD1cq" ], "script": "base64:AAIDAAAAAAAAACoIARIAEgkKBwgICAgICAgSBAoCCAgSAwoBCBIECgIICBIDCgEIEgMKAQgAAAAPAAAAAAxtYWluQ29udHJhY3QJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQIAAAAjM05CcEdqWXhpd3hLZlpodXFlc2hVc2Z4WlhWc3hldlZLaFgAAAAABlFVT1JVTQAAAAAAAAAAAQEAAAANdHJ5R2V0SW50ZWdlcgAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAAFAAAAA3ZhbAEAAAAMdHJ5R2V0U3RyaW5nAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgIAAAAABQAAAAN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AAAEFAAAACXZvdGluZ0tleQAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAUAAAADbmlsCQAAAgAAAAECAAAAFWNoZWNrcyBhcmUgbm90IHBhc3NlZAAAAAFpAQAAAApyZWplY3RUYXNrAAAAAQAAAAZ0YXNrSWQDCQEAAAANaXNHcm91cE1lbWJlcgAAAAEIBQAAAAFpAAAABmNhbGxlcgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAICAAAABnRhc2tzXwUAAAAGdGFza0lkAgAAAAdfc3RhdHVzAgAAAAhyZWplY3RlZAUAAAADbmlsCQAAAgAAAAECAAAAIGdyYW50cyB3b3JraW5nIGdyb3VwIGFjY2VzcyBvbmx5AAAAAPbztTI=", "height": 1476961, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let mainContract = addressFromStringValue("3NBpGjYxiwxKfZhuqeshUsfxZXVsxevVKhX") | |
5 | + | ||
6 | + | let QUORUM = 1 | |
7 | + | ||
8 | + | func tryGetInteger (key) = { | |
9 | + | let val = match getInteger(this, key) { | |
10 | + | case b: Int => | |
11 | + | b | |
12 | + | case _ => | |
13 | + | 0 | |
14 | + | } | |
15 | + | val | |
16 | + | } | |
17 | + | ||
18 | + | ||
19 | + | func tryGetString (key) = { | |
20 | + | let val = match getString(this, key) { | |
21 | + | case b: String => | |
22 | + | b | |
23 | + | case _ => | |
24 | + | "" | |
25 | + | } | |
26 | + | val | |
27 | + | } | |
28 | + | ||
29 | + | ||
30 | + | func isOwner (address) = (address == this) | |
31 | + | ||
32 | + | ||
33 | + | func getGroup () = { | |
34 | + | let val = match getString(mainContract, "working_group_members") { | |
35 | + | case b: String => | |
36 | + | b | |
37 | + | case _ => | |
38 | + | "" | |
39 | + | } | |
40 | + | val | |
41 | + | } | |
42 | + | ||
43 | + | ||
44 | + | func getMembers () = { | |
45 | + | let val = match getString(mainContract, "dao_members") { | |
46 | + | case b: String => | |
47 | + | b | |
48 | + | case _ => | |
49 | + | "" | |
50 | + | } | |
51 | + | val | |
52 | + | } | |
53 | + | ||
54 | + | ||
55 | + | func getDAOSize () = { | |
56 | + | let val = match getInteger(mainContract, "dao_size") { | |
57 | + | case b: Int => | |
58 | + | b | |
59 | + | case _ => | |
60 | + | 0 | |
61 | + | } | |
62 | + | val | |
63 | + | } | |
64 | + | ||
65 | + | ||
66 | + | func isGroupMember (a) = { | |
67 | + | let val = match getInteger(mainContract, (("working_group_member_" + toString(a)) + "_weight")) { | |
68 | + | case b: Int => | |
69 | + | b | |
70 | + | case _ => | |
71 | + | 0 | |
72 | + | } | |
73 | + | (val > 0) | |
74 | + | } | |
75 | + | ||
76 | + | ||
77 | + | func canMemberVote (address) = { | |
78 | + | let val = match getInteger(mainContract, (("dao_member_" + toString(address)) + "_weight")) { | |
79 | + | case b: Int => | |
80 | + | b | |
81 | + | case _ => | |
82 | + | 0 | |
83 | + | } | |
84 | + | (val > 0) | |
85 | + | } | |
86 | + | ||
87 | + | ||
88 | + | func getVoteValue (s) = if ((s == "like")) | |
89 | + | then 1 | |
90 | + | else if ((s == "dislike")) | |
91 | + | then -1 | |
92 | + | else throw("you need to vote with 'like' or 'dislike' value") | |
93 | + | ||
94 | + | ||
95 | + | func addTaskConditions (address) = if (!(isGroupMember(address))) | |
96 | + | then throw("grants working group access only") | |
97 | + | else true | |
98 | + | ||
99 | + | ||
100 | + | func addRewardConditions (address,taskId) = if (!(isGroupMember(address))) | |
101 | + | then throw("grants working group access only") | |
102 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "")) | |
103 | + | then throw("grant isn`t new") | |
104 | + | else true | |
105 | + | ||
106 | + | ||
107 | + | func voteForTaskProposalConditions (address,taskId) = if (!(canMemberVote(address))) | |
108 | + | then throw("you can't vote") | |
109 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "proposed")) | |
110 | + | then throw("voting is closed or not started") | |
111 | + | else if ((tryGetInteger(((("tasks_" + taskId) + "_voted_") + toString(address))) != 0)) | |
112 | + | then throw("you have already voted") | |
113 | + | else true | |
114 | + | ||
115 | + | ||
116 | + | func finishTaskProposalVotingConditions (address,taskId) = if (!(isGroupMember(address))) | |
117 | + | then throw("grants working group access only") | |
118 | + | else if ((tryGetString((("tasks_" + taskId) + "_status")) != "proposed")) | |
119 | + | then throw("voting is not active") | |
120 | + | else if ((QUORUM > ((tryGetInteger((("tasks_" + taskId) + "_voting_amount")) * 100) / getDAOSize()))) | |
121 | + | then throw((("more than " + toString(QUORUM)) + "% members have to vote before finishing the voting")) | |
122 | + | else true | |
123 | + | ||
124 | + | ||
125 | + | @Callable(i) | |
126 | + | func initContract () = WriteSet([DataEntry("data_provider_description_<en>", "Waves Association DAO"), DataEntry("data_provider_email", "[email protected]"), DataEntry("data_provider_lang_list", "en"), DataEntry("data_provider_link", "https://dao.wavesassociation.org"), DataEntry("data_provider_name", "Waves Association DAO"), DataEntry("data_provider_version", 0), DataEntry("inited", true)]) | |
127 | + | ||
128 | + | ||
129 | + | ||
130 | + | @Callable(i) | |
131 | + | func addProposal (tokenId,description,email,link,logo,ticker,hash) = if (addTaskConditions(i.caller)) | |
132 | + | then WriteSet([DataEntry((("description_<en>_<" + tokenId) + ">"), description), DataEntry((("email_<" + tokenId) + ">"), email), DataEntry((("logo_<" + tokenId) + ">"), logo), DataEntry((("ticker_<" + tokenId) + ">"), ticker), DataEntry((("link_<" + tokenId) + ">"), link), DataEntry((("tasks_" + tokenId) + "_hash"), hash), DataEntry((("version_<" + tokenId) + ">"), 0), DataEntry((("status_<" + tokenId) + ">"), 0), DataEntry((("tasks_" + tokenId) + "_status"), "proposed")]) | |
133 | + | else throw("checks are not passed") | |
134 | + | ||
135 | + | ||
136 | + | ||
137 | + | @Callable(i) | |
138 | + | func resetHash (taskId,hash) = WriteSet([DataEntry((("tasks_" + taskId) + "_hash"), hash)]) | |
139 | + | ||
140 | + | ||
141 | + | ||
142 | + | @Callable(i) | |
143 | + | func hideTask (taskId) = WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "hide")]) | |
144 | + | ||
145 | + | ||
146 | + | ||
147 | + | @Callable(i) | |
148 | + | func voteForTaskProposal (taskId,voteValue) = if (voteForTaskProposalConditions(i.caller, taskId)) | |
149 | + | then { | |
150 | + | let voteKey = ((("tasks_" + taskId) + "_voted_") + toString(i.caller)) | |
151 | + | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
152 | + | let votingState = tryGetInteger(votingKey) | |
153 | + | let votesAmountKey = (("tasks_" + taskId) + "_voting_amount") | |
154 | + | let votesAmountState = (tryGetInteger(votingKey) + 1) | |
155 | + | let voteValueInt = getVoteValue(voteValue) | |
156 | + | let newVotingState = (votingState + voteValueInt) | |
157 | + | WriteSet([DataEntry(votingKey, newVotingState), DataEntry(voteKey, voteValueInt), DataEntry(votesAmountKey, votesAmountState)]) | |
158 | + | } | |
159 | + | else throw("checks are not passed") | |
160 | + | ||
161 | + | ||
162 | + | ||
163 | + | @Callable(i) | |
164 | + | func finishTaskProposalVoting (taskId) = if (finishTaskProposalVotingConditions(i.caller, taskId)) | |
165 | + | then { | |
166 | + | let votingKey = (("tasks_" + taskId) + "_voting_state") | |
167 | + | WriteSet([DataEntry((("tasks_" + taskId) + "_status"), if ((tryGetInteger(votingKey) > 0)) | |
168 | + | then "approved" | |
169 | + | else "rejected"), DataEntry((("status_<" + taskId) + ">"), if ((tryGetInteger(votingKey) > 0)) | |
170 | + | then 2 | |
171 | + | else 0)]) | |
172 | + | } | |
173 | + | else throw("checks are not passed") | |
174 | + | ||
175 | + | ||
176 | + | ||
177 | + | @Callable(i) | |
178 | + | func rejectTask (taskId) = if (isGroupMember(i.caller)) | |
179 | + | then WriteSet([DataEntry((("tasks_" + taskId) + "_status"), "rejected")]) | |
180 | + | else throw("grants working group access only") | |
181 | + | ||
182 | + |
github/deemru/w8io/169f3d6 23.57 ms ◑