tx · HFskWEnArcjTzSSihpoCWMVWWSkwHhL977bGZu6qcBnm 3N2ewmJdcFYwdM3mPpRapXZ1aaSWTpTGuE5: -1.00000000 Waves 2021.05.11 18:19 [1521189] smart account 3N2ewmJdcFYwdM3mPpRapXZ1aaSWTpTGuE5 > SELF 0.00000000 Waves
{ "type": 13, "id": "HFskWEnArcjTzSSihpoCWMVWWSkwHhL977bGZu6qcBnm", "fee": 100000000, "feeAssetId": null, "timestamp": 1620746410386, "version": 2, "chainId": 84, "sender": "3N2ewmJdcFYwdM3mPpRapXZ1aaSWTpTGuE5", "senderPublicKey": "2icPa3y8k81CaH7dsVJZZjVYGYkD35waVbs6YAzU1oaL", "proofs": [ "qxDTMMkbDjjUhTBGEQUGpNpzXCCX3HJmcGEczK8LdX2c7fTSai1PfgnhXBWWoYywZp6Xj3gLk8KKNWX41ZGeMec" ], "script": "base64:AAIDAAAAAAAAABcIARIDCgEIEgMKAQgSAwoBCBIECgIICAAAAAYBAAAAB2lzT3duZXIAAAABAAAAB2FkZHJlc3MJAAAAAAAAAgUAAAAHYWRkcmVzcwUAAAAEdGhpcwEAAAANdHJ5R2V0SW50ZWdlcgAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAAFAAAAA3ZhbAEAAAAIZ2V0R3JvdXAAAAAABAAAAAN2YWwEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwIAAAAVd29ya2luZ19ncm91cF9tZW1iZXJzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWICAAAAAAUAAAADdmFsAQAAAA1pc0dyb3VwTWVtYmVyAAAAAQAAAAFhCQAAZgAAAAIJAQAAAA10cnlHZXRJbnRlZ2VyAA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kAAAIAAAABAgAAABhUaGlzIHVzZXIgYWxyZWFkeSBleGlzdHMEAAAABWdyb3VwCQEAAAAIZ2V0R3JvdXAAAAAABAAAAAhuZXdHcm91cAkAASwAAAACCQABLAAAAAIFAAAABWdyb3VwAgAAAAE7BQAAAA1tZW1iZXJBZGRyZXNzCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAABV3b3JraW5nX2dyb3VwX21lbWJlcnMFAAAACG5ld0dyb3VwCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAVd29ya2luZ19ncm91cF9tZW1iZXJfBQAAAA1tZW1iZXJBZGRyZXNzAgAAAAdfd2VpZ2h0AAAAAAAAAAABBQAAAANuaWwAAAABaQEAAAAQZGVjaXNpb25Pbk1lbWJlcgAAAAIAAAANbWVtYmVyQWRkcmVzcwAAAA1kZWNpc2lvblZhbHVlAwkBAAAAASEAAAABCQEAAAAHaXNPd25lcgAAAAEIBQAAAAFpAAAABmNhbGxlcgkAAAIAAAABAgAAABhhY2Nlc3Mgb25seSB0byB0aGUgb3duZXIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAALZGFvX21lbWJlcl8FAAAADW1lbWJlckFkZHJlc3MJAQAAABBnZXREZWNpc2lvblZhbHVlAAAAAQUAAAANZGVjaXNpb25WYWx1ZQUAAAADbmlsAAAAAExkbdQ=", "height": 1521189, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8mLTC3JyCWbF5FC8DfuXWxuF7vgtixhKyGzzd7LJry5k Next: none Diff:
Old | New | Differences | |
---|---|---|---|
46 | 46 | let caller = toString(i.caller) | |
47 | 47 | if (isGroupMember(i.caller)) | |
48 | 48 | then if ((tryGetInteger(((caller + "_voted_working_group_members_for_") + memberAddress)) != 1)) | |
49 | - | then WriteSet([DataEntry(votingKey, votesAmountState), DataEntry(((caller + "_voted_ | |
49 | + | then WriteSet([DataEntry(votingKey, votesAmountState), DataEntry(((caller + "_voted_for_") + memberAddress), 1)]) | |
50 | 50 | else throw("You have already voted") | |
51 | 51 | else throw("You have no rights") | |
52 | 52 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func isOwner (address) = (address == this) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func tryGetInteger (key) = { | |
8 | 8 | let val = match getInteger(this, key) { | |
9 | 9 | case b: Int => | |
10 | 10 | b | |
11 | 11 | case _ => | |
12 | 12 | 0 | |
13 | 13 | } | |
14 | 14 | val | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func getGroup () = { | |
19 | 19 | let val = match getString(this, "working_group_members") { | |
20 | 20 | case b: String => | |
21 | 21 | b | |
22 | 22 | case _ => | |
23 | 23 | "" | |
24 | 24 | } | |
25 | 25 | val | |
26 | 26 | } | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func isGroupMember (a) = (tryGetInteger((("working_group_member_" + toString(a)) + "_weight")) > 0) | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func isVoted (a) = (tryGetInteger((("working_group_member_" + toString(a)) + "_weight")) > 0) | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func getDecisionValue (d) = if ((d == "rejected")) | |
36 | 36 | then "rejected" | |
37 | 37 | else if ((d == "approved")) | |
38 | 38 | then "approved" | |
39 | 39 | else throw("you need to vote with 'approved' or 'rejected' value") | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | @Callable(i) | |
43 | 43 | func votesOnMember (memberAddress) = { | |
44 | 44 | let votingKey = (("dao_member_" + memberAddress) + "_voting_state") | |
45 | 45 | let votesAmountState = (tryGetInteger(votingKey) + 1) | |
46 | 46 | let caller = toString(i.caller) | |
47 | 47 | if (isGroupMember(i.caller)) | |
48 | 48 | then if ((tryGetInteger(((caller + "_voted_working_group_members_for_") + memberAddress)) != 1)) | |
49 | - | then WriteSet([DataEntry(votingKey, votesAmountState), DataEntry(((caller + "_voted_ | |
49 | + | then WriteSet([DataEntry(votingKey, votesAmountState), DataEntry(((caller + "_voted_for_") + memberAddress), 1)]) | |
50 | 50 | else throw("You have already voted") | |
51 | 51 | else throw("You have no rights") | |
52 | 52 | } | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | ||
56 | 56 | @Callable(i) | |
57 | 57 | func proposeMember (memberAddress) = { | |
58 | 58 | let caller = toString(i.caller) | |
59 | 59 | if ((tryGetInteger(("dao_member_" + memberAddress)) == 1)) | |
60 | 60 | then throw("This user already exists") | |
61 | 61 | else WriteSet([DataEntry(("dao_member_" + memberAddress), "proposed")]) | |
62 | 62 | } | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | ||
66 | 66 | @Callable(i) | |
67 | 67 | func addGroupMember (memberAddress) = if (!(isOwner(i.caller))) | |
68 | 68 | then throw("access only to the owner") | |
69 | 69 | else if ((tryGetInteger((("working_group_member_" + memberAddress) + "_weight")) == 1)) | |
70 | 70 | then throw("This user already exists") | |
71 | 71 | else { | |
72 | 72 | let group = getGroup() | |
73 | 73 | let newGroup = ((group + ";") + memberAddress) | |
74 | 74 | WriteSet([DataEntry("working_group_members", newGroup), DataEntry((("working_group_member_" + memberAddress) + "_weight"), 1)]) | |
75 | 75 | } | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | ||
79 | 79 | @Callable(i) | |
80 | 80 | func decisionOnMember (memberAddress,decisionValue) = if (!(isOwner(i.caller))) | |
81 | 81 | then throw("access only to the owner") | |
82 | 82 | else WriteSet([DataEntry(("dao_member_" + memberAddress), getDecisionValue(decisionValue))]) | |
83 | 83 | ||
84 | 84 |
github/deemru/w8io/169f3d6 58.07 ms ◑