tx · Hku3UNMeQaGQ4pZdTnXnr5schyymfJB55eAfUeVMsiUQ

3Mvbw1Sx9xtM6akJrBPorkPpp4B3sJRFPFX:  -0.10000000 Waves

2020.11.13 03:37 [1262841] smart account 3Mvbw1Sx9xtM6akJrBPorkPpp4B3sJRFPFX > SELF 0.00000000 Waves

{ "type": 13, "id": "Hku3UNMeQaGQ4pZdTnXnr5schyymfJB55eAfUeVMsiUQ", "fee": 10000000, "feeAssetId": null, "timestamp": 1605227846576, "version": 2, "chainId": 84, "sender": "3Mvbw1Sx9xtM6akJrBPorkPpp4B3sJRFPFX", "senderPublicKey": "EFfb2ZQ2kJQnnQeHgudF4Fu2ksNzAhonmzpG5RvJdKE4", "proofs": [ "4A1mktBiPoq6jRUV3P6qMMU58YEX7DHEy1YbLojUwFxz7A3vGo7MiyR8vhm9KRji598QqnNQ7mCHvvdnjSgevx84" ], "script": "base64:AAIDAAAAAAAAADQIARIECgIICBIDCgEIEgMKAQgSBwoFCAgICAgSBAoCCAgSBAoCCAgSBQoDCAgBEgQKAggIAAAACAEAAAANdHJ5R2V0SW50ZWdlcgAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAAFAAAAA3ZhbAEAAAAMdHJ5R2V0U3RyaW5nAAAAAQAAAANrZXkEAAAAA3ZhbAQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYgUAAAAHJG1hdGNoMAUAAAABYgIAAAAABQAAAAN2YWwBAAAAB2lzT3duZXIAAAABAAAAB2FkZHJlc3MJAAAAAAAAAgUAAAAHYWRkcmVzcwUAAAAEdGhpcwEAAAAIZ2V0R3JvdXAAAAAABAAAAAN2YWwEAAAAByR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AAAAIJAAEsAAAAAgIAAAAJdGVtcGxhdGVfBQAAAAp0ZW1wbGF0ZUlkAgAAAApfbWluX3Njb3JlBAAAABJ0ZWFtU2NvcmVBbW91bnRLZXkJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAJdGVtcGxhdGVfBQAAAAp0ZW1wbGF0ZUlkAgAAAAtfYXBwbGljYW50XwUAAAAJYXBwbGljYW50AgAAAAZfc2NvcmUEAAAACXRlYW1TY29yZQkBAAAADXRyeUdldEludGVnZXIAAAABBQAAABJ0ZWFtU2NvcmVBbW91bnRLZXkDCQAAZgAAAAIFAAAACXRlYW1TY29yZQAAAAAAAAAAAAYJAAACAAAAAQkAASwAAAACAgAAACVub3QgZW5vdWdoIHZvdGVzIHRvIG1ha2UgZGVjaXNpb24gb24gBQAAAAlhcHBsaWNhbnQDCQEAAAABIQAAAAEJAQAAABZpc0FwcGxpY2FudFZvdGVkRW5vdWdoAAAAAgUAAAAKdGVtcGxhdGVJZAUAAAAJYXBwbGljYW50CQAAAgAAAAECAAAALW5vdCBlbm91Z2ggZXhwZXJ0cyB2b3RlZCB0byBpc3N1ZSBjZXJ0aWZpY2F0ZQkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAl0ZW1wbGF0ZV8FAAAACnRlbXBsYXRlSWQCAAAAC19hcHBsaWNhbnRfBQAAAAlhcHBsaWNhbnQCAAAAB19zdGF0dXMCAAAACGFwcHJvdmVkBQAAAANuaWwAAAAA39qltA==", "height": 1262841, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CsHX5iLp8QwrQtzxyHrUtArQJ1qjrEaXKhaNh5oCLuiF Next: GqVyAygt5iyztNYsoZ1b4rYDVPB1rMxGEW7L8pkApN9H Diff:
OldNewDifferences
2727
2828
2929 func getGroup () = {
30- let val = match getString(this, "working_group") {
30+ let val = match getString(this, "working_members") {
3131 case b: String =>
3232 b
3333 case _ =>
3737 }
3838
3939
40-func getMembers () = {
41- let val = match getString(this, "dao_members") {
40+func getMembers (centerAddress) = {
41+ let val = match getString(this, (("center_" + centerAddress) + "_members")) {
4242 case b: String =>
4343 b
4444 case _ =>
4848 }
4949
5050
51-func isGroupMember (a) = (tryGetInteger(("group_member_" + toString(a))) > 0)
51+func isAuthor (a,templateId) = (tryGetString((("template_" + templateId) + "_proposed")) == toString(a))
52+
53+
54+func isGroupMember (a) = (tryGetInteger(("working_member_" + toString(a))) > 0)
5255
5356
5457 func canMemberVote (i,templateId) = {
6164 func addDAOMember (memberAddress,centerAddress) = if (!(isOwner(i.caller)))
6265 then throw("access only to the DAO owner")
6366 else {
64- let group = getMembers()
67+ let group = getMembers(centerAddress)
6568 let newGroup = ((group + ";") + memberAddress)
66- let groupSize = tryGetInteger("dao_size")
69+ let groupSize = tryGetInteger((("center_" + centerAddress) + "_size"))
6770 let newGroupSize = (groupSize + 1)
68- WriteSet([DataEntry("dao_members", newGroup), DataEntry("dao_size", newGroupSize), DataEntry(((("center_" + centerAddress) + "_member_") + memberAddress), 1)])
71+ WriteSet([DataEntry((("center_" + centerAddress) + "_members"), newGroup), DataEntry((("center_" + centerAddress) + "_size"), newGroupSize), DataEntry(((("center_" + centerAddress) + "_member_") + memberAddress), 1)])
6972 }
7073
7174
7679 else {
7780 let group = getGroup()
7881 let newGroup = ((group + ";") + memberAddress)
79- let groupSize = tryGetInteger("working_group_size")
82+ let groupSize = tryGetInteger("working_size")
8083 let newGroupSize = (groupSize + 1)
81- WriteSet([DataEntry("working_group", newGroup), DataEntry("working_group_size", newGroupSize), DataEntry(("group_member_" + memberAddress), 1)])
84+ WriteSet([DataEntry("working_members", newGroup), DataEntry("working_size", newGroupSize), DataEntry(("working_member_" + memberAddress), 1)])
8285 }
8386
8487
8588
8689 @Callable(i)
87-func proposeTemplate (title) = WriteSet([DataEntry((("template_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("template_" + toBase58String(i.transactionId)) + "_status"), "proposed"), DataEntry((("template_" + toBase58String(i.transactionId)) + "_proposed_by"), toString(i.caller))])
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+
92+
93+
94+@Callable(i)
95+func addTemplateDetails (templateId,description,author,company,link) = if (!(isAuthor(i.caller, templateId)))
96+ then throw("author access only")
97+ else WriteSet([DataEntry((("template_" + templateId) + "_description"), description), DataEntry((("template_" + templateId) + "_author"), author), DataEntry((("template_" + templateId) + "_company"), company), DataEntry((("template_" + templateId) + "_link"), link)])
8898
8999
90100
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func tryGetInteger (key) = {
55 let val = match getInteger(this, key) {
66 case b: Int =>
77 b
88 case _ =>
99 0
1010 }
1111 val
1212 }
1313
1414
1515 func tryGetString (key) = {
1616 let val = match getString(this, key) {
1717 case b: String =>
1818 b
1919 case _ =>
2020 ""
2121 }
2222 val
2323 }
2424
2525
2626 func isOwner (address) = (address == this)
2727
2828
2929 func getGroup () = {
30- let val = match getString(this, "working_group") {
30+ let val = match getString(this, "working_members") {
3131 case b: String =>
3232 b
3333 case _ =>
3434 ""
3535 }
3636 val
3737 }
3838
3939
40-func getMembers () = {
41- let val = match getString(this, "dao_members") {
40+func getMembers (centerAddress) = {
41+ let val = match getString(this, (("center_" + centerAddress) + "_members")) {
4242 case b: String =>
4343 b
4444 case _ =>
4545 ""
4646 }
4747 val
4848 }
4949
5050
51-func isGroupMember (a) = (tryGetInteger(("group_member_" + toString(a))) > 0)
51+func isAuthor (a,templateId) = (tryGetString((("template_" + templateId) + "_proposed")) == toString(a))
52+
53+
54+func isGroupMember (a) = (tryGetInteger(("working_member_" + toString(a))) > 0)
5255
5356
5457 func canMemberVote (i,templateId) = {
5558 let centerAddress = tryGetString((("template_" + templateId) + "_center"))
5659 (tryGetInteger(((("center_" + centerAddress) + "_member_") + toString(i.caller))) > 0)
5760 }
5861
5962
6063 @Callable(i)
6164 func addDAOMember (memberAddress,centerAddress) = if (!(isOwner(i.caller)))
6265 then throw("access only to the DAO owner")
6366 else {
64- let group = getMembers()
67+ let group = getMembers(centerAddress)
6568 let newGroup = ((group + ";") + memberAddress)
66- let groupSize = tryGetInteger("dao_size")
69+ let groupSize = tryGetInteger((("center_" + centerAddress) + "_size"))
6770 let newGroupSize = (groupSize + 1)
68- WriteSet([DataEntry("dao_members", newGroup), DataEntry("dao_size", newGroupSize), DataEntry(((("center_" + centerAddress) + "_member_") + memberAddress), 1)])
71+ WriteSet([DataEntry((("center_" + centerAddress) + "_members"), newGroup), DataEntry((("center_" + centerAddress) + "_size"), newGroupSize), DataEntry(((("center_" + centerAddress) + "_member_") + memberAddress), 1)])
6972 }
7073
7174
7275
7376 @Callable(i)
7477 func addGroupMember (memberAddress) = if (!(isOwner(i.caller)))
7578 then throw("access only to the DAO owner")
7679 else {
7780 let group = getGroup()
7881 let newGroup = ((group + ";") + memberAddress)
79- let groupSize = tryGetInteger("working_group_size")
82+ let groupSize = tryGetInteger("working_size")
8083 let newGroupSize = (groupSize + 1)
81- WriteSet([DataEntry("working_group", newGroup), DataEntry("working_group_size", newGroupSize), DataEntry(("group_member_" + memberAddress), 1)])
84+ WriteSet([DataEntry("working_members", newGroup), DataEntry("working_size", newGroupSize), DataEntry(("working_member_" + memberAddress), 1)])
8285 }
8386
8487
8588
8689 @Callable(i)
87-func proposeTemplate (title) = WriteSet([DataEntry((("template_" + toBase58String(i.transactionId)) + "_title"), title), DataEntry((("template_" + toBase58String(i.transactionId)) + "_status"), "proposed"), DataEntry((("template_" + toBase58String(i.transactionId)) + "_proposed_by"), toString(i.caller))])
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+
92+
93+
94+@Callable(i)
95+func addTemplateDetails (templateId,description,author,company,link) = if (!(isAuthor(i.caller, templateId)))
96+ then throw("author access only")
97+ else WriteSet([DataEntry((("template_" + templateId) + "_description"), description), DataEntry((("template_" + templateId) + "_author"), author), DataEntry((("template_" + templateId) + "_company"), company), DataEntry((("template_" + templateId) + "_link"), link)])
8898
8999
90100
91101 @Callable(i)
92102 func acceptTemplate (templateId,certifier) = if (!(isGroupMember(i.caller)))
93103 then throw("government working group access only")
94104 else WriteSet([DataEntry((("template_" + templateId) + "_center"), certifier), DataEntry((("template_" + templateId) + "_status"), "accepted")])
95105
96106
97107
98108 @Callable(i)
99109 func requestCertificate (templateId,details) = {
100110 let listKey = (("template_" + templateId) + "_applicants")
101111 let currentApplicantsList = match getString(this, listKey) {
102112 case b: String =>
103113 b
104114 case _ =>
105115 ""
106116 }
107117 let newApplicantsList = ((currentApplicantsList + ";") + toString(i.caller))
108118 ScriptResult(WriteSet([DataEntry((((("template_" + templateId) + "_applicant_") + toString(i.caller)) + "_status"), "requested"), DataEntry((((("template_" + templateId) + "_applicant_") + toString(i.caller)) + "_details"), details), DataEntry(listKey, newApplicantsList)]), TransferSet([ScriptTransfer(i.caller, 500000, unit)]))
109119 }
110120
111121
112122
113123 @Callable(i)
114124 func voteForApplicant (templateId,applicant,voteValue) = if (if ((voteValue != -1))
115125 then (voteValue != 1)
116126 else false)
117127 then throw("vote value needs to be 1 or -1")
118128 else if (!(canMemberVote(i, templateId)))
119129 then throw("this member is not certified to vote")
120130 else {
121131 let voteKey = ((((("template_" + templateId) + "_applicant_") + applicant) + "_vote_") + toString(i.caller))
122132 let vote = tryGetInteger(voteKey)
123133 if ((vote != 0))
124134 then throw("this member has already voted on this applicant")
125135 else {
126136 let teamVotesAmountKey = (((("template_" + templateId) + "_applicant_") + applicant) + "_votes")
127137 let teamScoreKey = (((("template_" + templateId) + "_applicant_") + applicant) + "_score")
128138 let teamVotesAmount = (1 + tryGetInteger(teamVotesAmountKey))
129139 let newTeamScore = (voteValue + tryGetInteger(teamScoreKey))
130140 WriteSet([DataEntry(voteKey, voteValue), DataEntry(teamScoreKey, newTeamScore)])
131141 }
132142 }
133143
134144
135145
136146 @Callable(i)
137147 func finishApplicantVoting (templateId,applicant) = {
138148 func isApplicantVotedEnough (templateId,applicant) = {
139149 let templateMinimumScore = (("template_" + templateId) + "_min_score")
140150 let teamScoreAmountKey = (((("template_" + templateId) + "_applicant_") + applicant) + "_score")
141151 let teamScore = tryGetInteger(teamScoreAmountKey)
142152 if ((teamScore > 0))
143153 then true
144154 else throw(("not enough votes to make decision on " + applicant))
145155 }
146156
147157 if (!(isApplicantVotedEnough(templateId, applicant)))
148158 then throw("not enough experts voted to issue certificate")
149159 else WriteSet([DataEntry((((("template_" + templateId) + "_applicant_") + applicant) + "_status"), "approved")])
150160 }
151161
152162

github/deemru/w8io/169f3d6 
40.64 ms