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:AAIDAAAAAAAAABcIARIDCgEIEgMKAQgSAwoBCBIECgIICAAAAAYBAAAAB2lzT3duZXIAAAABAAAAB2FkZHJlc3MJAAAAAAAAAgUAAAAHYWRkcmVzcwUAAAAEdGhpcwEAAAANdHJ5R2V0SW50ZWdlcgAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAAFAAAAA3ZhbAEAAAAIZ2V0R3JvdXAAAAAABAAAAAN2YWwEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwIAAAAVd29ya2luZ19ncm91cF9tZW1iZXJzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWICAAAAAAUAAAADdmFsAQAAAA1pc0dyb3VwTWVtYmVyAAAAAQAAAAFhCQAAZgAAAAIJAQAAAA10cnlHZXRJbnRlZ2VyAAAAAQkA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WlnaHQAAAAAAAAAAAEJAAACAAAAAQIAAAAYVGhpcyB1c2VyIGFscmVhZHkgZXhpc3RzBAAAAAVncm91cAkBAAAACGdldEdyb3VwAAAAAAQAAAAIbmV3R3JvdXAJAAEsAAAAAgkAASwAAAACBQAAAAVncm91cAIAAAABOwUAAAANbWVtYmVyQWRkcmVzcwkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAVd29ya2luZ19ncm91cF9tZW1iZXJzBQAAAAhuZXdHcm91cAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAICAAAAFXdvcmtpbmdfZ3JvdXBfbWVtYmVyXwUAAAANbWVtYmVyQWRkcmVzcwIAAAAHX3dlaWdodAAAAAAAAAAAAQUAAAADbmlsAAAAAWkBAAAAEGRlY2lzaW9uT25NZW1iZXIAAAACAAAADW1lbWJlckFkZHJlc3MAAAANZGVjaXNpb25WYWx1ZQMJAQAAAAEhAAAAAQkBAAAAB2lzT3duZXIAAAABCAUAAAABaQAAAAZjYWxsZXIJAAACAAAAAQIAAAAYYWNjZXNzIG9ubHkgdG8gdGhlIG93bmVyCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAAC2Rhb19tZW1iZXJfBQAAAA1tZW1iZXJBZGRyZXNzCQEAAAAQZ2V0RGVjaXNpb25WYWx1ZQAAAAEFAAAADWRlY2lzaW9uVmFsdWUFAAAAA25pbAAAAABaP+3T", "height": 1521153, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: shQnctf2SZM4v4DR3auKUetjKZcQpvoY6DRj61KUhic Next: none Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func isOwner (address) = (address == this) | |
5 | + | ||
6 | + | ||
4 | 7 | func tryGetInteger (key) = { | |
5 | 8 | let val = match getInteger(this, key) { | |
6 | 9 | case b: Int => | |
10 | 13 | } | |
11 | 14 | val | |
12 | 15 | } | |
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) | |
27 | 16 | ||
28 | 17 | ||
29 | 18 | func getGroup () = { | |
37 | 26 | } | |
38 | 27 | ||
39 | 28 | ||
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") | |
48 | 52 | } | |
49 | 53 | ||
50 | 54 | ||
51 | - | func isGroupMember (a) = (tryGetInteger((("working_group_member_" + toString(a)) + "_weight")) > 0) | |
52 | 55 | ||
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 | + | } | |
53 | 63 | ||
54 | - | func canMemberVote (i) = (tryGetInteger((("dao_member_" + toString(i.caller)) + "_weight")) > 0) | |
55 | 64 | ||
56 | 65 | ||
57 | 66 | @Callable(i) | |
58 | - | func | |
59 | - | then throw("access only to the | |
60 | - | else if ((tryGetInteger(((" | |
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)) | |
61 | 70 | then throw("This user already exists") | |
62 | 71 | else { | |
63 | - | let group = | |
72 | + | let group = getGroup() | |
64 | 73 | 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)]) | |
68 | 75 | } | |
69 | 76 | ||
70 | 77 | ||
71 | 78 | ||
72 | 79 | @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))]) | |
84 | 83 | ||
85 | 84 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func isOwner (address) = (address == this) | |
5 | + | ||
6 | + | ||
4 | 7 | func tryGetInteger (key) = { | |
5 | 8 | let val = match getInteger(this, key) { | |
6 | 9 | case b: Int => | |
7 | 10 | b | |
8 | 11 | case _ => | |
9 | 12 | 0 | |
10 | 13 | } | |
11 | 14 | val | |
12 | 15 | } | |
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) | |
27 | 16 | ||
28 | 17 | ||
29 | 18 | func getGroup () = { | |
30 | 19 | let val = match getString(this, "working_group_members") { | |
31 | 20 | case b: String => | |
32 | 21 | b | |
33 | 22 | case _ => | |
34 | 23 | "" | |
35 | 24 | } | |
36 | 25 | val | |
37 | 26 | } | |
38 | 27 | ||
39 | 28 | ||
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") | |
48 | 52 | } | |
49 | 53 | ||
50 | 54 | ||
51 | - | func isGroupMember (a) = (tryGetInteger((("working_group_member_" + toString(a)) + "_weight")) > 0) | |
52 | 55 | ||
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 | + | } | |
53 | 63 | ||
54 | - | func canMemberVote (i) = (tryGetInteger((("dao_member_" + toString(i.caller)) + "_weight")) > 0) | |
55 | 64 | ||
56 | 65 | ||
57 | 66 | @Callable(i) | |
58 | - | func | |
59 | - | then throw("access only to the | |
60 | - | else if ((tryGetInteger(((" | |
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)) | |
61 | 70 | then throw("This user already exists") | |
62 | 71 | else { | |
63 | - | let group = | |
72 | + | let group = getGroup() | |
64 | 73 | 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)]) | |
68 | 75 | } | |
69 | 76 | ||
70 | 77 | ||
71 | 78 | ||
72 | 79 | @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))]) | |
84 | 83 | ||
85 | 84 |
github/deemru/w8io/026f985 32.14 ms ◑