tx · G1cQvyASiH1oJeHT6wACYjaG6epz6QvSStuxWnxq5SXQ

3NASTFHC1YtW7GLjJc29iqiECnSnqeTA3Ry:  -0.10000000 Waves

2021.05.11 17:42 [1521153] smart account 3NASTFHC1YtW7GLjJc29iqiECnSnqeTA3Ry > SELF 0.00000000 Waves

{ "type": 13, "id": "G1cQvyASiH1oJeHT6wACYjaG6epz6QvSStuxWnxq5SXQ", "fee": 10000000, "feeAssetId": null, "timestamp": 1620744142364, "version": 2, "chainId": 84, "sender": "3NASTFHC1YtW7GLjJc29iqiECnSnqeTA3Ry", "senderPublicKey": "3nb9JsU2MgGoFtV4Rfm9aMbNRLr8hM9YJ6heMENC8hon", "proofs": [ "KUrPP8h563yuShvwCSb284HQA2KyTQpvJUX4WSD9hSHQUWeX7rARhoU759tYHELY6FQb4zgC3TzKeHpUTDFdxrq" ], "script": "base64:AAIDAAAAAAAAABcIARIDCgEIEgMKAQgSAwoBCBIECgIICAAAAAYBAAAAB2lzT3duZXIAAAABAAAAB2FkZHJlc3MJAAAAAAAAAgUAAAAHYWRkcmVzcwUAAAAEdGhpcwEAAAANdHJ5R2V0SW50ZWdlcgAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAAFAAAAA3ZhbAEAAAAIZ2V0R3JvdXAAAAAABAAAAAN2YWwEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwIAAAAVd29ya2luZ19ncm91cF9tZW1iZXJzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWICAAAAAAUAAAADdmFsAQAAAA1pc0dyb3VwTWVtYmVyAAAAAQAAAAFhCQAAZgAAAAIJAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQk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ZWlnaHQAAAAAAAAAAAEJAAACAAAAAQIAAAAYVGhpcyB1c2VyIGFscmVhZHkgZXhpc3RzBAAAAAVncm91cAkBAAAACGdldEdyb3VwAAAAAAQAAAAIbmV3R3JvdXAJAAEsAAAAAgkAASwAAAACBQAAAAVncm91cAIAAAABOwUAAAANbWVtYmVyQWRkcmVzcwkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAVd29ya2luZ19ncm91cF9tZW1iZXJzBQAAAAhuZXdHcm91cAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAICAAAAFXdvcmtpbmdfZ3JvdXBfbWVtYmVyXwUAAAANbWVtYmVyQWRkcmVzcwIAAAAHX3dlaWdodAAAAAAAAAAAAQUAAAADbmlsAAAAAWkBAAAAEGRlY2lzaW9uT25NZW1iZXIAAAACAAAADW1lbWJlckFkZHJlc3MAAAANZGVjaXNpb25WYWx1ZQMJAQAAAAEhAAAAAQkBAAAAB2lzT3duZXIAAAABCAUAAAABaQAAAAZjYWxsZXIJAAACAAAAAQIAAAAYYWNjZXNzIG9ubHkgdG8gdGhlIG93bmVyCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAAC2Rhb19tZW1iZXJfBQAAAA1tZW1iZXJBZGRyZXNzCQEAAAAQZ2V0RGVjaXNpb25WYWx1ZQAAAAEFAAAADWRlY2lzaW9uVmFsdWUFAAAAA25pbAAAAABaP+3T", "height": 1521153, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: shQnctf2SZM4v4DR3auKUetjKZcQpvoY6DRj61KUhic Next: none Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+func isOwner (address) = (address == this)
5+
6+
47 func tryGetInteger (key) = {
58 let val = match getInteger(this, key) {
69 case b: Int =>
1013 }
1114 val
1215 }
13-
14-
15-func tryGetString (key) = {
16- let val = match getString(this, key) {
17- case b: String =>
18- b
19- case _ =>
20- ""
21- }
22- val
23- }
24-
25-
26-func isOwner (address) = (address == this)
2716
2817
2918 func getGroup () = {
3726 }
3827
3928
40-func getMembers () = {
41- let val = match getString(this, "dao_members") {
42- case b: String =>
43- b
44- case _ =>
45- ""
46- }
47- val
29+func isGroupMember (a) = (tryGetInteger((("working_group_member_" + toString(a)) + "_weight")) > 0)
30+
31+
32+func isVoted (a) = (tryGetInteger((("working_group_member_" + toString(a)) + "_weight")) > 0)
33+
34+
35+func getDecisionValue (d) = if ((d == "rejected"))
36+ then "rejected"
37+ else if ((d == "approved"))
38+ then "approved"
39+ else throw("you need to vote with 'approved' or 'rejected' value")
40+
41+
42+@Callable(i)
43+func votesOnMember (memberAddress) = {
44+ let votingKey = (("dao_member_" + memberAddress) + "_voting_state")
45+ let votesAmountState = (tryGetInteger(votingKey) + 1)
46+ let caller = toString(i.caller)
47+ if (if (!(isGroupMember(i.caller)))
48+ then (tryGetInteger(((caller + "_voted_working_group_members_for_") + memberAddress)) != 1)
49+ else false)
50+ then WriteSet([DataEntry(votingKey, votesAmountState), DataEntry(((caller + "_voted_working_group_members_for_") + memberAddress), 1)])
51+ else throw("You have no rights or you have already voted")
4852 }
4953
5054
51-func isGroupMember (a) = (tryGetInteger((("working_group_member_" + toString(a)) + "_weight")) > 0)
5255
56+@Callable(i)
57+func proposeMember (memberAddress) = {
58+ let caller = toString(i.caller)
59+ if ((tryGetInteger(("dao_member_" + memberAddress)) == 1))
60+ then throw("This user already exists")
61+ else WriteSet([DataEntry(("dao_member_" + memberAddress), "proposed")])
62+ }
5363
54-func canMemberVote (i) = (tryGetInteger((("dao_member_" + toString(i.caller)) + "_weight")) > 0)
5564
5665
5766 @Callable(i)
58-func addDAOMember (memberAddress) = if (!(isOwner(i.caller)))
59- then throw("access only to the DAO owner")
60- else if ((tryGetInteger((("dao_member_" + memberAddress) + "_weight")) == 1))
67+func addGroupMember (memberAddress) = if (!(isOwner(i.caller)))
68+ then throw("access only to the owner")
69+ else if ((tryGetInteger((("working_group_member_" + memberAddress) + "_weight")) == 1))
6170 then throw("This user already exists")
6271 else {
63- let group = getMembers()
72+ let group = getGroup()
6473 let newGroup = ((group + ";") + memberAddress)
65- let groupSize = tryGetInteger("dao_size")
66- let newGroupSize = (groupSize + 1)
67- WriteSet([DataEntry("dao_members", newGroup), DataEntry("dao_size", newGroupSize), DataEntry((("dao_member_" + memberAddress) + "_weight"), 1)])
74+ WriteSet([DataEntry("working_group_members", newGroup), DataEntry((("working_group_member_" + memberAddress) + "_weight"), 1)])
6875 }
6976
7077
7178
7279 @Callable(i)
73-func addGroupMember (memberAddress) = if (!(isOwner(i.caller)))
74- then throw("access only to the DAO owner")
75- else if ((tryGetInteger((("working_group_member_" + memberAddress) + "_weight")) == 1))
76- then throw("This user already exists")
77- else {
78- let group = getGroup()
79- let newGroup = ((group + ";") + memberAddress)
80- let groupSize = tryGetInteger("working_group_size")
81- let newGroupSize = (groupSize + 1)
82- WriteSet([DataEntry("working_group_members", newGroup), DataEntry("working_group_size", newGroupSize), DataEntry((("working_group_member_" + memberAddress) + "_weight"), 1)])
83- }
80+func decisionOnMember (memberAddress,decisionValue) = if (!(isOwner(i.caller)))
81+ then throw("access only to the owner")
82+ else WriteSet([DataEntry(("dao_member_" + memberAddress), getDecisionValue(decisionValue))])
8483
8584
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+func isOwner (address) = (address == this)
5+
6+
47 func tryGetInteger (key) = {
58 let val = match getInteger(this, key) {
69 case b: Int =>
710 b
811 case _ =>
912 0
1013 }
1114 val
1215 }
13-
14-
15-func tryGetString (key) = {
16- let val = match getString(this, key) {
17- case b: String =>
18- b
19- case _ =>
20- ""
21- }
22- val
23- }
24-
25-
26-func isOwner (address) = (address == this)
2716
2817
2918 func getGroup () = {
3019 let val = match getString(this, "working_group_members") {
3120 case b: String =>
3221 b
3322 case _ =>
3423 ""
3524 }
3625 val
3726 }
3827
3928
40-func getMembers () = {
41- let val = match getString(this, "dao_members") {
42- case b: String =>
43- b
44- case _ =>
45- ""
46- }
47- val
29+func isGroupMember (a) = (tryGetInteger((("working_group_member_" + toString(a)) + "_weight")) > 0)
30+
31+
32+func isVoted (a) = (tryGetInteger((("working_group_member_" + toString(a)) + "_weight")) > 0)
33+
34+
35+func getDecisionValue (d) = if ((d == "rejected"))
36+ then "rejected"
37+ else if ((d == "approved"))
38+ then "approved"
39+ else throw("you need to vote with 'approved' or 'rejected' value")
40+
41+
42+@Callable(i)
43+func votesOnMember (memberAddress) = {
44+ let votingKey = (("dao_member_" + memberAddress) + "_voting_state")
45+ let votesAmountState = (tryGetInteger(votingKey) + 1)
46+ let caller = toString(i.caller)
47+ if (if (!(isGroupMember(i.caller)))
48+ then (tryGetInteger(((caller + "_voted_working_group_members_for_") + memberAddress)) != 1)
49+ else false)
50+ then WriteSet([DataEntry(votingKey, votesAmountState), DataEntry(((caller + "_voted_working_group_members_for_") + memberAddress), 1)])
51+ else throw("You have no rights or you have already voted")
4852 }
4953
5054
51-func isGroupMember (a) = (tryGetInteger((("working_group_member_" + toString(a)) + "_weight")) > 0)
5255
56+@Callable(i)
57+func proposeMember (memberAddress) = {
58+ let caller = toString(i.caller)
59+ if ((tryGetInteger(("dao_member_" + memberAddress)) == 1))
60+ then throw("This user already exists")
61+ else WriteSet([DataEntry(("dao_member_" + memberAddress), "proposed")])
62+ }
5363
54-func canMemberVote (i) = (tryGetInteger((("dao_member_" + toString(i.caller)) + "_weight")) > 0)
5564
5665
5766 @Callable(i)
58-func addDAOMember (memberAddress) = if (!(isOwner(i.caller)))
59- then throw("access only to the DAO owner")
60- else if ((tryGetInteger((("dao_member_" + memberAddress) + "_weight")) == 1))
67+func addGroupMember (memberAddress) = if (!(isOwner(i.caller)))
68+ then throw("access only to the owner")
69+ else if ((tryGetInteger((("working_group_member_" + memberAddress) + "_weight")) == 1))
6170 then throw("This user already exists")
6271 else {
63- let group = getMembers()
72+ let group = getGroup()
6473 let newGroup = ((group + ";") + memberAddress)
65- let groupSize = tryGetInteger("dao_size")
66- let newGroupSize = (groupSize + 1)
67- WriteSet([DataEntry("dao_members", newGroup), DataEntry("dao_size", newGroupSize), DataEntry((("dao_member_" + memberAddress) + "_weight"), 1)])
74+ WriteSet([DataEntry("working_group_members", newGroup), DataEntry((("working_group_member_" + memberAddress) + "_weight"), 1)])
6875 }
6976
7077
7178
7279 @Callable(i)
73-func addGroupMember (memberAddress) = if (!(isOwner(i.caller)))
74- then throw("access only to the DAO owner")
75- else if ((tryGetInteger((("working_group_member_" + memberAddress) + "_weight")) == 1))
76- then throw("This user already exists")
77- else {
78- let group = getGroup()
79- let newGroup = ((group + ";") + memberAddress)
80- let groupSize = tryGetInteger("working_group_size")
81- let newGroupSize = (groupSize + 1)
82- WriteSet([DataEntry("working_group_members", newGroup), DataEntry("working_group_size", newGroupSize), DataEntry((("working_group_member_" + memberAddress) + "_weight"), 1)])
83- }
80+func decisionOnMember (memberAddress,decisionValue) = if (!(isOwner(i.caller)))
81+ then throw("access only to the owner")
82+ else WriteSet([DataEntry(("dao_member_" + memberAddress), getDecisionValue(decisionValue))])
8483
8584

github/deemru/w8io/026f985 
32.14 ms