tx · Hinax6ffABTrFnTZJjnGM5bwxvx2h8tVdyAPfTKy3ngD 3Mvbw1Sx9xtM6akJrBPorkPpp4B3sJRFPFX: -0.10000000 Waves 2020.11.14 02:47 [1264280] smart account 3Mvbw1Sx9xtM6akJrBPorkPpp4B3sJRFPFX > SELF 0.00000000 Waves
{ "type": 13, "id": "Hinax6ffABTrFnTZJjnGM5bwxvx2h8tVdyAPfTKy3ngD", "fee": 10000000, "feeAssetId": null, "timestamp": 1605311256100, "version": 2, "chainId": 84, "sender": "3Mvbw1Sx9xtM6akJrBPorkPpp4B3sJRFPFX", "senderPublicKey": "EFfb2ZQ2kJQnnQeHgudF4Fu2ksNzAhonmzpG5RvJdKE4", "proofs": [ "4z7JkAdH9fMiD3pPgViqJ9EwfDoCr6qpnHijeDNs9zWkbQmDqTGbv9Jeg1dnNUpBUmtTEcj8xWAx6WD7HFrGWWye" ], "script": "base64:AAIDAAAAAAAAADQIARIECgIICBIDCgEIEgMKAQgSBwoFCAgICAgSBAoCCAgSBAoCCAgSBQoDCAgBEgQKAggIAAAACAEAAAANdHJ5R2V0SW50ZWdlcgAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAAFAAAAA3ZhbAEAAAAMdHJ5R2V0U3RyaW5nAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgIAAAAABQAAAAN2YWwBAAAAB2lzT3duZXIAAAABAAAAB2FkZHJlc3MJAAAAAAAAAgUAAAAHYWRkcmVzcwUAAAAEdGhpcwEAAAAIZ2V0R3JvdXAAAAAABAAAAAN2YWwEA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VzAgAAAAhhcHByb3ZlZAUAAAADbmlsAAAAAHhUajE=", "height": 1264280, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GqVyAygt5iyztNYsoZ1b4rYDVPB1rMxGEW7L8pkApN9H Next: DqgTFoJNHsMDyyMbbfFyUefftanjm4ZasVuJwfj4rVPZ Diff:
Old | New | Differences | |
---|---|---|---|
115 | 115 | "" | |
116 | 116 | } | |
117 | 117 | let newApplicantsList = ((currentApplicantsList + ";") + toString(i.caller)) | |
118 | - | ScriptResult(WriteSet([DataEntry((((("template_" + templateId) + "_app_") + toString(i.caller)) + "_status"), "requested"), DataEntry((((("template_" + templateId) + "_app_") + toString(i.caller)) + "_details"), details), DataEntry(listKey, newApplicantsList)]), TransferSet([ScriptTransfer(i.caller, 500000, unit)])) | |
118 | + | let applicantKey = drop(toString(i.caller), 25) | |
119 | + | ScriptResult(WriteSet([DataEntry((((("template_" + templateId) + "_app_") + applicantKey) + "_status"), "requested"), DataEntry((((("template_" + templateId) + "_app_") + applicantKey) + "_details"), details), DataEntry((((("template_" + templateId) + "_app_") + applicantKey) + "_id"), toString(i.caller)), DataEntry(listKey, newApplicantsList)]), TransferSet([ScriptTransfer(i.caller, 900000, unit)])) | |
119 | 120 | } | |
120 | 121 | ||
121 | 122 | ||
128 | 129 | else if (!(canMemberVote(i, templateId))) | |
129 | 130 | then throw("this member is not certified to vote") | |
130 | 131 | else { | |
131 | - | let voteKey = ((((("template_" + templateId) + "_app_") + applicant) + "_vote_") + toString(i.caller)) | |
132 | + | let voteHash = (drop(toString(i.caller), 25) + drop(applicant, 25)) | |
133 | + | let voteKey = ((("template_" + templateId) + "_app_") + voteHash) | |
132 | 134 | let vote = tryGetInteger(voteKey) | |
133 | 135 | if ((vote != 0)) | |
134 | 136 | then throw("this member has already voted on this applicant") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func tryGetInteger (key) = { | |
5 | 5 | let val = match getInteger(this, key) { | |
6 | 6 | case b: Int => | |
7 | 7 | b | |
8 | 8 | case _ => | |
9 | 9 | 0 | |
10 | 10 | } | |
11 | 11 | val | |
12 | 12 | } | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func tryGetString (key) = { | |
16 | 16 | let val = match getString(this, key) { | |
17 | 17 | case b: String => | |
18 | 18 | b | |
19 | 19 | case _ => | |
20 | 20 | "" | |
21 | 21 | } | |
22 | 22 | val | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func isOwner (address) = (address == this) | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func getGroup () = { | |
30 | 30 | let val = match getString(this, "working_members") { | |
31 | 31 | case b: String => | |
32 | 32 | b | |
33 | 33 | case _ => | |
34 | 34 | "" | |
35 | 35 | } | |
36 | 36 | val | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func getMembers (centerAddress) = { | |
41 | 41 | let val = match getString(this, (("center_" + centerAddress) + "_members")) { | |
42 | 42 | case b: String => | |
43 | 43 | b | |
44 | 44 | case _ => | |
45 | 45 | "" | |
46 | 46 | } | |
47 | 47 | val | |
48 | 48 | } | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func isAuthor (a,templateId) = (tryGetString((("template_" + templateId) + "_proposed")) == toString(a)) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func isGroupMember (a) = (tryGetInteger(("working_member_" + toString(a))) > 0) | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func canMemberVote (i,templateId) = { | |
58 | 58 | let centerAddress = tryGetString((("template_" + templateId) + "_center")) | |
59 | 59 | (tryGetInteger(((("center_" + centerAddress) + "_member_") + toString(i.caller))) > 0) | |
60 | 60 | } | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | @Callable(i) | |
64 | 64 | func addDAOMember (memberAddress,centerAddress) = if (!(isOwner(i.caller))) | |
65 | 65 | then throw("access only to the DAO owner") | |
66 | 66 | else { | |
67 | 67 | let group = getMembers(centerAddress) | |
68 | 68 | let newGroup = ((group + ";") + memberAddress) | |
69 | 69 | let groupSize = tryGetInteger((("center_" + centerAddress) + "_size")) | |
70 | 70 | let newGroupSize = (groupSize + 1) | |
71 | 71 | WriteSet([DataEntry((("center_" + centerAddress) + "_members"), newGroup), DataEntry((("center_" + centerAddress) + "_size"), newGroupSize), DataEntry(((("center_" + centerAddress) + "_member_") + memberAddress), 1)]) | |
72 | 72 | } | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | ||
76 | 76 | @Callable(i) | |
77 | 77 | func addGroupMember (memberAddress) = if (!(isOwner(i.caller))) | |
78 | 78 | then throw("access only to the DAO owner") | |
79 | 79 | else { | |
80 | 80 | let group = getGroup() | |
81 | 81 | let newGroup = ((group + ";") + memberAddress) | |
82 | 82 | let groupSize = tryGetInteger("working_size") | |
83 | 83 | let newGroupSize = (groupSize + 1) | |
84 | 84 | WriteSet([DataEntry("working_members", newGroup), DataEntry("working_size", newGroupSize), DataEntry(("working_member_" + memberAddress), 1)]) | |
85 | 85 | } | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | ||
89 | 89 | @Callable(i) | |
90 | 90 | func proposeTemplate (title) = WriteSet([DataEntry((("template_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("template_" + toBase58String(i.transactionId)) + "_status"), "proposed"), DataEntry((("template_" + toBase58String(i.transactionId)) + "_proposed"), toString(i.caller))]) | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | ||
94 | 94 | @Callable(i) | |
95 | 95 | func addTemplateDetails (templateId,description,author,company,link) = if (!(isAuthor(i.caller, templateId))) | |
96 | 96 | then throw("author access only") | |
97 | 97 | else WriteSet([DataEntry((("template_" + templateId) + "_description"), description), DataEntry((("template_" + templateId) + "_author"), author), DataEntry((("template_" + templateId) + "_company"), company), DataEntry((("template_" + templateId) + "_link"), link)]) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | ||
101 | 101 | @Callable(i) | |
102 | 102 | func acceptTemplate (templateId,certifier) = if (!(isGroupMember(i.caller))) | |
103 | 103 | then throw("government working group access only") | |
104 | 104 | else WriteSet([DataEntry((("template_" + templateId) + "_center"), certifier), DataEntry((("template_" + templateId) + "_status"), "accepted")]) | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | ||
108 | 108 | @Callable(i) | |
109 | 109 | func requestCertificate (templateId,details) = { | |
110 | 110 | let listKey = (("template_" + templateId) + "_applicants") | |
111 | 111 | let currentApplicantsList = match getString(this, listKey) { | |
112 | 112 | case b: String => | |
113 | 113 | b | |
114 | 114 | case _ => | |
115 | 115 | "" | |
116 | 116 | } | |
117 | 117 | let newApplicantsList = ((currentApplicantsList + ";") + toString(i.caller)) | |
118 | - | ScriptResult(WriteSet([DataEntry((((("template_" + templateId) + "_app_") + toString(i.caller)) + "_status"), "requested"), DataEntry((((("template_" + templateId) + "_app_") + toString(i.caller)) + "_details"), details), DataEntry(listKey, newApplicantsList)]), TransferSet([ScriptTransfer(i.caller, 500000, unit)])) | |
118 | + | let applicantKey = drop(toString(i.caller), 25) | |
119 | + | ScriptResult(WriteSet([DataEntry((((("template_" + templateId) + "_app_") + applicantKey) + "_status"), "requested"), DataEntry((((("template_" + templateId) + "_app_") + applicantKey) + "_details"), details), DataEntry((((("template_" + templateId) + "_app_") + applicantKey) + "_id"), toString(i.caller)), DataEntry(listKey, newApplicantsList)]), TransferSet([ScriptTransfer(i.caller, 900000, unit)])) | |
119 | 120 | } | |
120 | 121 | ||
121 | 122 | ||
122 | 123 | ||
123 | 124 | @Callable(i) | |
124 | 125 | func voteForApplicant (templateId,applicant,voteValue) = if (if ((voteValue != -1)) | |
125 | 126 | then (voteValue != 1) | |
126 | 127 | else false) | |
127 | 128 | then throw("vote value needs to be 1 or -1") | |
128 | 129 | else if (!(canMemberVote(i, templateId))) | |
129 | 130 | then throw("this member is not certified to vote") | |
130 | 131 | else { | |
131 | - | let voteKey = ((((("template_" + templateId) + "_app_") + applicant) + "_vote_") + toString(i.caller)) | |
132 | + | let voteHash = (drop(toString(i.caller), 25) + drop(applicant, 25)) | |
133 | + | let voteKey = ((("template_" + templateId) + "_app_") + voteHash) | |
132 | 134 | let vote = tryGetInteger(voteKey) | |
133 | 135 | if ((vote != 0)) | |
134 | 136 | then throw("this member has already voted on this applicant") | |
135 | 137 | else { | |
136 | 138 | let teamVotesAmountKey = (((("template_" + templateId) + "_app_") + applicant) + "_votes") | |
137 | 139 | let teamScoreKey = (((("template_" + templateId) + "_app_") + applicant) + "_score") | |
138 | 140 | let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey)) | |
139 | 141 | let newTeamScore = (voteValue + tryGetInteger(teamScoreKey)) | |
140 | 142 | WriteSet([DataEntry(voteKey, voteValue), DataEntry(teamScoreKey, newTeamScore)]) | |
141 | 143 | } | |
142 | 144 | } | |
143 | 145 | ||
144 | 146 | ||
145 | 147 | ||
146 | 148 | @Callable(i) | |
147 | 149 | func finishApplicantVoting (templateId,applicant) = { | |
148 | 150 | func isApplicantVotedEnough (templateId,applicant) = { | |
149 | 151 | let templateMinimumScore = (("template_" + templateId) + "_min_score") | |
150 | 152 | let teamScoreAmountKey = (((("template_" + templateId) + "_app_") + applicant) + "_score") | |
151 | 153 | let teamScore = tryGetInteger(teamScoreAmountKey) | |
152 | 154 | if ((teamScore > 0)) | |
153 | 155 | then true | |
154 | 156 | else throw(("not enough votes to make decision on " + applicant)) | |
155 | 157 | } | |
156 | 158 | ||
157 | 159 | if (!(isApplicantVotedEnough(templateId, applicant))) | |
158 | 160 | then throw("not enough experts voted to issue certificate") | |
159 | 161 | else WriteSet([DataEntry((((("template_" + templateId) + "_app_") + applicant) + "_status"), "approved")]) | |
160 | 162 | } | |
161 | 163 | ||
162 | 164 |
github/deemru/w8io/169f3d6 36.20 ms ◑