tx · C7WcVVowR6tq4aiRVXHGkRjuMDfbqf8DoEQtW6iPDXLF 3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu: -0.01400000 Waves 2020.09.12 13:58 [1174013] smart account 3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu > SELF 0.00000000 Waves
{ "type": 13, "id": "C7WcVVowR6tq4aiRVXHGkRjuMDfbqf8DoEQtW6iPDXLF", "fee": 1400000, "feeAssetId": null, "timestamp": 1599908385681, "version": 2, "chainId": 84, "sender": "3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu", "senderPublicKey": "CBTEuFN6ku1LNaPuGHHTMh2CBb3kPa5D73XXTJvKydun", "proofs": [ "Jeb4MAFdWfCNiXYNhDywXencgQqvLwMvniUa6co6nAigf7Zb8muJQJAXF2t7mYjJpF8xAReu5qKkhuLKUoJMn7c" ], "script": "base64:AAIDAAAAAAAAACAIARIHCgUICAgICBIECgIICBIDCgEIEgMKAQgSAwoBCAAAAA8AAAAABnVwVm90ZQIAAAAGdXB2b3RlAAAAAA1hZG1pbkFkZHJlc3MxAQAAABoBVDi2IViANlgIPSCUAVQpoGSXhJ2Tw/Y0iwAAAAANYWRtaW5BZGRyZXNzMgEAAAAaAVTlj1A9878YQ058BBZUI9QC+LwgFva37DoAAAAADWFkbWluQWRkcmVzczMBAAAAGgFUrs609CRmf+XvZDjrx5XoefavLLpzyJEYAAAAAAVkeXpJZAEAAAAgfqtB2c5SyrdhjTSeT2NUMvY45D97zjqBcAiarzFPFmsBAAAADWdldFByb2ZpbGVLZXkAAAABAAAAAmlkCQABLAAAAAIFAAAAAmlkAgAAABRfZW50cmVwcmVuZXVyUHJvZmlsZQEAAAAMZ2V0U3RhdHVzS2V5AAAAAQAAAAJpZAkAASwAAAACBQAAAAJpZAIAAAAHX3N0YXR1cwEAAAARZ2V0Vm90ZXJBbW91bnRLZXkAAAACAAAAAmlkAAAABnZvdGVJZAkAASwAAAACCQABLAAAAAIJAAEsAAAAAgUAAAACaWQCAAAAA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AAAV2b3RlcgUAAAAGdm90ZUlkBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQkAAAIAAAABAgAAACVZb3UgZGlkbid0IHZvdGUgZm9yIHRoaXMgZW50cmVwcmVuZXVyAwkAAAAAAAACBQAAAA1jdXJyZW50QW1vdW50AAAAAAAAAAAACQAAAgAAAAECAAAAJFNlZW1zIHlvdSBoYXZlIHByZXZpb3VzbHkgd2l0aGRyYXduLgkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkAAAAAAAAAAAAFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADWN1cnJlbnRBbW91bnQFAAAABWR5eklkBQAAAANuaWwJAAACAAAAAQIAAAA2Q2FuJ3Qgd2l0aGRyYXcgdm90ZSBhbW91bnQgd2hpbGUgdm90aW5nIGlzIHN0aWxsIG9wZW4uCQAAAgAAAAECAAAAJVlvdSBkaWRuJ3Qgdm90ZSBmb3IgdGhpcyBlbnRyZXByZW5ldXIAAAAAn/u/UQ==", "height": 1174013, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Eu4ZUxXSzux8gxzQ5NgSd9Q2fsroLQcUNT2UPQ8QUbG4 Next: 8zETtHEGFeQC7sj9BVa8oWJXRAake1TwX9zFQgnECrps Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let upVote = "upvote" | |
5 | 5 | ||
6 | - | let adminAddress = base58'3Mu5woJ54s7vHJgaeNcJ4C9ByfdmMF2jpjC' | |
6 | + | let adminAddress1 = base58'3Mu5woJ54s7vHJgaeNcJ4C9ByfdmMF2jpjC' | |
7 | + | ||
8 | + | let adminAddress2 = base58'3NAqtCScgFynCuRLUoXm2BHTdu8suatCe7b' | |
9 | + | ||
10 | + | let adminAddress3 = base58'3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu' | |
7 | 11 | ||
8 | 12 | let dyzId = base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G' | |
9 | 13 | ||
65 | 69 | ||
66 | 70 | ||
67 | 71 | @Callable(i) | |
68 | - | func addEntrepreneurProfile (name,avatar,bio,gender,location) = if ((i.caller.bytes != adminAddress)) | |
72 | + | func addEntrepreneurProfile (name,avatar,bio,gender,location) = if (if (if ((i.caller.bytes != adminAddress1)) | |
73 | + | then true | |
74 | + | else (i.caller.bytes != adminAddress2)) | |
75 | + | then true | |
76 | + | else (i.caller.bytes != adminAddress3)) | |
69 | 77 | then throw("Only Dyzrupt Admin can call this dApp function") | |
70 | 78 | else { | |
71 | 79 | let transactionId = toBase58String(i.transactionId) | |
100 | 108 | ||
101 | 109 | ||
102 | 110 | @Callable(i) | |
103 | - | func openVote (voteId) = if ((i.caller.bytes != adminAddress)) | |
111 | + | func openVote (voteId) = if (if (if ((i.caller.bytes != adminAddress1)) | |
112 | + | then true | |
113 | + | else (i.caller.bytes != adminAddress2)) | |
114 | + | then true | |
115 | + | else (i.caller.bytes != adminAddress3)) | |
104 | 116 | then throw("Only Dyzrupt Admin can call this dApp function") | |
105 | 117 | else if (profileExist(voteId)) | |
106 | 118 | then WriteSet([DataEntry(getStatusKey(voteId), "open")]) | |
109 | 121 | ||
110 | 122 | ||
111 | 123 | @Callable(i) | |
112 | - | func closeVote (voteId) = if ((i.caller.bytes != adminAddress)) | |
124 | + | func closeVote (voteId) = if (if (if ((i.caller.bytes != adminAddress1)) | |
125 | + | then true | |
126 | + | else (i.caller.bytes != adminAddress2)) | |
127 | + | then true | |
128 | + | else (i.caller.bytes != adminAddress3)) | |
113 | 129 | then throw("Only Dyzrupt Admin can call this dApp function") | |
114 | 130 | else if (profileExist(voteId)) | |
115 | 131 | then WriteSet([DataEntry(getStatusKey(voteId), "closed")]) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let upVote = "upvote" | |
5 | 5 | ||
6 | - | let adminAddress = base58'3Mu5woJ54s7vHJgaeNcJ4C9ByfdmMF2jpjC' | |
6 | + | let adminAddress1 = base58'3Mu5woJ54s7vHJgaeNcJ4C9ByfdmMF2jpjC' | |
7 | + | ||
8 | + | let adminAddress2 = base58'3NAqtCScgFynCuRLUoXm2BHTdu8suatCe7b' | |
9 | + | ||
10 | + | let adminAddress3 = base58'3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu' | |
7 | 11 | ||
8 | 12 | let dyzId = base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G' | |
9 | 13 | ||
10 | 14 | func getProfileKey (id) = (id + "_entrepreneurProfile") | |
11 | 15 | ||
12 | 16 | ||
13 | 17 | func getStatusKey (id) = (id + "_status") | |
14 | 18 | ||
15 | 19 | ||
16 | 20 | func getVoterAmountKey (id,voteId) = (((id + "_") + voteId) + "_amount") | |
17 | 21 | ||
18 | 22 | ||
19 | 23 | func getVoteKey (id,type) = if ((type == "upvote")) | |
20 | 24 | then (id + "_upvote") | |
21 | 25 | else throw("Invalid vote type") | |
22 | 26 | ||
23 | 27 | ||
24 | 28 | func profileExist (id) = match getString(this, getProfileKey(id)) { | |
25 | 29 | case a: String => | |
26 | 30 | true | |
27 | 31 | case _ => | |
28 | 32 | false | |
29 | 33 | } | |
30 | 34 | ||
31 | 35 | ||
32 | 36 | func getVoteStatus (voteId) = match getString(this, getStatusKey(voteId)) { | |
33 | 37 | case a: String => | |
34 | 38 | a | |
35 | 39 | case _ => | |
36 | 40 | false | |
37 | 41 | } | |
38 | 42 | ||
39 | 43 | ||
40 | 44 | func getVoteCount (voteId,vote) = match getInteger(this, getVoteKey(voteId, vote)) { | |
41 | 45 | case a: Int => | |
42 | 46 | a | |
43 | 47 | case _ => | |
44 | 48 | throw("Not a valid vote ID") | |
45 | 49 | } | |
46 | 50 | ||
47 | 51 | ||
48 | 52 | func getVoterKey (address,voteId) = ((((address + "_") + voteId) + "_") + "vote") | |
49 | 53 | ||
50 | 54 | ||
51 | 55 | func getVoter (address,voteId) = match getString(this, getVoterKey(address, voteId)) { | |
52 | 56 | case a: String => | |
53 | 57 | a | |
54 | 58 | case _ => | |
55 | 59 | "" | |
56 | 60 | } | |
57 | 61 | ||
58 | 62 | ||
59 | 63 | func canVote (address,voteId) = { | |
60 | 64 | let voter = getVoter(address, voteId) | |
61 | 65 | if ((voter == "")) | |
62 | 66 | then true | |
63 | 67 | else false | |
64 | 68 | } | |
65 | 69 | ||
66 | 70 | ||
67 | 71 | @Callable(i) | |
68 | - | func addEntrepreneurProfile (name,avatar,bio,gender,location) = if ((i.caller.bytes != adminAddress)) | |
72 | + | func addEntrepreneurProfile (name,avatar,bio,gender,location) = if (if (if ((i.caller.bytes != adminAddress1)) | |
73 | + | then true | |
74 | + | else (i.caller.bytes != adminAddress2)) | |
75 | + | then true | |
76 | + | else (i.caller.bytes != adminAddress3)) | |
69 | 77 | then throw("Only Dyzrupt Admin can call this dApp function") | |
70 | 78 | else { | |
71 | 79 | let transactionId = toBase58String(i.transactionId) | |
72 | 80 | WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open")]) | |
73 | 81 | } | |
74 | 82 | ||
75 | 83 | ||
76 | 84 | ||
77 | 85 | @Callable(i) | |
78 | 86 | func vote (voteId,vote) = { | |
79 | 87 | let pmt = extract(i.payment) | |
80 | 88 | let voter = toBase58String(i.caller.bytes) | |
81 | 89 | if ((pmt.amount == 0)) | |
82 | 90 | then throw("You cannot vote without paying voting fee") | |
83 | 91 | else if ((pmt.assetId != base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G')) | |
84 | 92 | then throw("You can only vote with DYZRUPT token") | |
85 | 93 | else if (canVote(voter, voteId)) | |
86 | 94 | then if (profileExist(voteId)) | |
87 | 95 | then if ((getVoteStatus(voteId) == "open")) | |
88 | 96 | then if ((vote == upVote)) | |
89 | 97 | then { | |
90 | 98 | let voteCount = getVoteCount(voteId, vote) | |
91 | 99 | let newVoteCount = (voteCount + 1) | |
92 | 100 | ScriptResult(WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount), DataEntry(getVoterKey(voter, voteId), voteId), DataEntry(getVoterAmountKey(voter, voteId), pmt.amount)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)])) | |
93 | 101 | } | |
94 | 102 | else throw("Not a valid vote value") | |
95 | 103 | else throw("This profile is not open for voting") | |
96 | 104 | else throw("Invalid Profile") | |
97 | 105 | else throw("You can't vote twice") | |
98 | 106 | } | |
99 | 107 | ||
100 | 108 | ||
101 | 109 | ||
102 | 110 | @Callable(i) | |
103 | - | func openVote (voteId) = if ((i.caller.bytes != adminAddress)) | |
111 | + | func openVote (voteId) = if (if (if ((i.caller.bytes != adminAddress1)) | |
112 | + | then true | |
113 | + | else (i.caller.bytes != adminAddress2)) | |
114 | + | then true | |
115 | + | else (i.caller.bytes != adminAddress3)) | |
104 | 116 | then throw("Only Dyzrupt Admin can call this dApp function") | |
105 | 117 | else if (profileExist(voteId)) | |
106 | 118 | then WriteSet([DataEntry(getStatusKey(voteId), "open")]) | |
107 | 119 | else throw("Invalid ID") | |
108 | 120 | ||
109 | 121 | ||
110 | 122 | ||
111 | 123 | @Callable(i) | |
112 | - | func closeVote (voteId) = if ((i.caller.bytes != adminAddress)) | |
124 | + | func closeVote (voteId) = if (if (if ((i.caller.bytes != adminAddress1)) | |
125 | + | then true | |
126 | + | else (i.caller.bytes != adminAddress2)) | |
127 | + | then true | |
128 | + | else (i.caller.bytes != adminAddress3)) | |
113 | 129 | then throw("Only Dyzrupt Admin can call this dApp function") | |
114 | 130 | else if (profileExist(voteId)) | |
115 | 131 | then WriteSet([DataEntry(getStatusKey(voteId), "closed")]) | |
116 | 132 | else throw("Invalid ID") | |
117 | 133 | ||
118 | 134 | ||
119 | 135 | ||
120 | 136 | @Callable(i) | |
121 | 137 | func withdraw (voteId) = { | |
122 | 138 | let voter = toBase58String(i.caller.bytes) | |
123 | 139 | if ((getVoter(voter, voteId) != "")) | |
124 | 140 | then if ((getVoteStatus(voteId) == "closed")) | |
125 | 141 | then { | |
126 | 142 | let currentKey = getVoterAmountKey(voter, voteId) | |
127 | 143 | let currentAmount = match getInteger(this, currentKey) { | |
128 | 144 | case a: Int => | |
129 | 145 | a | |
130 | 146 | case _ => | |
131 | 147 | throw("You didn't vote for this entrepreneur") | |
132 | 148 | } | |
133 | 149 | if ((currentAmount == 0)) | |
134 | 150 | then throw("Seems you have previously withdrawn.") | |
135 | 151 | else ScriptResult(WriteSet([DataEntry(currentKey, 0)]), TransferSet([ScriptTransfer(i.caller, currentAmount, dyzId)])) | |
136 | 152 | } | |
137 | 153 | else throw("Can't withdraw vote amount while voting is still open.") | |
138 | 154 | else throw("You didn't vote for this entrepreneur") | |
139 | 155 | } | |
140 | 156 | ||
141 | 157 |
github/deemru/w8io/026f985 44.51 ms ◑