tx · 4KDDd5S3MytT4T1xu9WTj8YEXNmcouUZPxkbwqb7naad 3N2ewmJdcFYwdM3mPpRapXZ1aaSWTpTGuE5: -0.01000000 Waves 2021.05.11 17:47 [1521162] smart account 3N2ewmJdcFYwdM3mPpRapXZ1aaSWTpTGuE5 > SELF 0.00000000 Waves
{ "type": 13, "id": "4KDDd5S3MytT4T1xu9WTj8YEXNmcouUZPxkbwqb7naad", "fee": 1000000, "feeAssetId": null, "timestamp": 1620744497605, "version": 2, "chainId": 84, "sender": "3N2ewmJdcFYwdM3mPpRapXZ1aaSWTpTGuE5", "senderPublicKey": "2icPa3y8k81CaH7dsVJZZjVYGYkD35waVbs6YAzU1oaL", "proofs": [ "5VpvhFTVmwriB6tBn4GqZFNp8zCKaa3mWg9KL26KPMaZjGgWjfMMpd5oF5C7fgV5mmRwtSeYVru3wmU2AXZnzSQW" ], "script": "base64:AAIDAAAAAAAAABcIARIDCgEIEgMKAQgSAwoBCBIECgIICAAAAAYBAAAAB2lzT3duZXIAAAABAAAAB2FkZHJlc3MJAAAAAAAAAgUAAAAHYWRkcmVzcwUAAAAEdGhpcwEAAAANdHJ5R2V0SW50ZWdlcgAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWIAAAAAAAAAAAAFAAAAA3ZhbAEAAAAIZ2V0R3JvdXAAAAAABAAAAAN2YWwEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwIAAAAVd29ya2luZ19ncm91cF9tZW1iZXJzAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWICAAAAAAUAAAADdmFsAQAAAA1pc0dyb3VwTWVtYmVyAAAAAQAAAAFhCQAAZgAAAAIJAQAAAA10cnlHZXRJbnRlZ2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MCAAAAB193ZWlnaHQAAAAAAAAAAAEJAAACAAAAAQIAAAAYVGhpcyB1c2VyIGFscmVhZHkgZXhpc3RzBAAAAAVncm91cAkBAAAACGdldEdyb3VwAAAAAAQAAAAIbmV3R3JvdXAJAAEsAAAAAgkAASwAAAACBQAAAAVncm91cAIAAAABOwUAAAANbWVtYmVyQWRkcmVzcwkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAVd29ya2luZ19ncm91cF9tZW1iZXJzBQAAAAhuZXdHcm91cAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAICAAAAFXdvcmtpbmdfZ3JvdXBfbWVtYmVyXwUAAAANbWVtYmVyQWRkcmVzcwIAAAAHX3dlaWdodAAAAAAAAAAAAQUAAAADbmlsAAAAAWkBAAAAEGRlY2lzaW9uT25NZW1iZXIAAAACAAAADW1lbWJlckFkZHJlc3MAAAANZGVjaXNpb25WYWx1ZQMJAQAAAAEhAAAAAQkBAAAAB2lzT3duZXIAAAABCAUAAAABaQAAAAZjYWxsZXIJAAACAAAAAQIAAAAYYWNjZXNzIG9ubHkgdG8gdGhlIG93bmVyCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAAC2Rhb19tZW1iZXJfBQAAAA1tZW1iZXJBZGRyZXNzCQEAAAAQZ2V0RGVjaXNpb25WYWx1ZQAAAAEFAAAADWRlY2lzaW9uVmFsdWUFAAAAA25pbAAAAABaP+3T", "height": 1521162, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: EJ4gHxD333XTKq6HgkPLh4dea2xP298voC6tDBopeEGU Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func isOwner (address) = (address == this) | |
5 | + | ||
6 | + | ||
7 | + | func tryGetInteger (key) = { | |
8 | + | let val = match getInteger(this, key) { | |
9 | + | case b: Int => | |
10 | + | b | |
11 | + | case _ => | |
12 | + | 0 | |
13 | + | } | |
14 | + | val | |
15 | + | } | |
16 | + | ||
17 | + | ||
18 | + | func getGroup () = { | |
19 | + | let val = match getString(this, "working_group_members") { | |
20 | + | case b: String => | |
21 | + | b | |
22 | + | case _ => | |
23 | + | "" | |
24 | + | } | |
25 | + | val | |
26 | + | } | |
27 | + | ||
28 | + | ||
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") | |
52 | + | } | |
53 | + | ||
54 | + | ||
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 | + | } | |
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | @Callable(i) | |
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)) | |
70 | + | then throw("This user already exists") | |
71 | + | else { | |
72 | + | let group = getGroup() | |
73 | + | let newGroup = ((group + ";") + memberAddress) | |
74 | + | WriteSet([DataEntry("working_group_members", newGroup), DataEntry((("working_group_member_" + memberAddress) + "_weight"), 1)]) | |
75 | + | } | |
76 | + | ||
77 | + | ||
78 | + | ||
79 | + | @Callable(i) | |
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))]) | |
83 | + | ||
84 | + |
github/deemru/w8io/169f3d6 19.38 ms ◑