tx · 5divqDQeqFc7iw6u73i8qH4AEBw7DML5czvWYUeqokgD 3MsdfK4j8fgA65zhEyr7yMqYFZaZaDHQ1Q7: -0.00900000 Waves 2022.08.01 20:55 [2165753] smart account 3MsdfK4j8fgA65zhEyr7yMqYFZaZaDHQ1Q7 > SELF 0.00000000 Waves
{ "type": 13, "id": "5divqDQeqFc7iw6u73i8qH4AEBw7DML5czvWYUeqokgD", "fee": 900000, "feeAssetId": null, "timestamp": 1659376484355, "version": 2, "chainId": 84, "sender": "3MsdfK4j8fgA65zhEyr7yMqYFZaZaDHQ1Q7", "senderPublicKey": "WHz6KMz8NXiDY3SdJVcJnL6oFNzbL3sivL4dhb3E4em", "proofs": [ "U4RABWr899VFukLkXm8jjKQpybxHtzWwbknHoPet34wSv2VTWvEpjtohQH8MLhtc6owUHKX5Jv8x3vPeMdMPowX" ], "script": "base64:AAIFAAAAAAAAABcIAhIDCgEIEgMKAQgSAwoBCBIECgIIBAAAABUAAAAADERZWl9BU1NFVF9JRAEAAAAg3zps0tw/jE/1UGNUg8jPjkHKkKTlI05ittGCsjg0jKYAAAAAFFZFUklGSUNBVElPTl9TVE9SQUdFAQAAABoBVKmUKcc/0YXwTLy/eiHqHB2l8395VTBIlwAAAAAOTUlOX0RZWl9BTU9VTlQAAAAAAAX14QAAAAAADVZPVElOR19CTE9DS1MAAAAAAAAAAGQAAAAAC1ZPVEVfQ0xPU0VEAgAAAAZDTE9TRUQAAAAAC1ZPVEVfT1BFTkVEAgAAAARPUEVOAAAAAA9zdGF0dXNLZXlQcmVmaXgCAAAAB3N0YXR1c18AAAAADW9wZW5LZXlQcmVmaXgCAAAABW9wZW5fAAAAAA50b3RhbFllc1N1ZmZpeAIAAAAKX3RvdGFsX3llcwAAAAANdG90YWxOb1N1ZmZpeAIAAAAJX3RvdGFsX25vAAAAAA9yZXBheW1lbnRQcmVmaXgCAAAACnJlcGF5bWVudF8AAAAAEGFsbG93ZWRLZXlTdWZmaXgCAAAACF9hbGxvd2VkAQ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AJAAQaAAAAAgUAAAAEdGhpcwUAAAAJbm9Wb3RlS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACm5ld05vVm90ZXMJAABkAAAAAgUAAAAMbm9Wb3Rlc1NvRmFyAAAAAAAAAAABCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAAlub1ZvdGVLZXkFAAAACm5ld05vVm90ZXMJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAADHJlcGF5bWVudEtleQUAAAAGYW1vdW50BQAAAANuaWwFAAAAA25pbAUAAAAIbmV3RW50cnkAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleYGS/8M=", "height": 2165753, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FgEHQC1TkXNuxcVn68sMh5V1of9pKRoi5zA711RjDNsi Next: DEQzNdws84SnaAMmZa71DNvKKuJvd8BbBo4BPS13ytBv Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let DYZ_ASSET_ID = base58'G2Pb7CMztps7XEVGCiUuJkLiS3ZCo69APQNbJs2nz21j' | |
5 | 5 | ||
6 | - | let VERIFICATION_STORAGE = base58' | |
6 | + | let VERIFICATION_STORAGE = base58'3N5NjTu7M5vyZ89HvdR69jW2wLZ2Rwj8LNr' | |
7 | 7 | ||
8 | 8 | let MIN_DYZ_AMOUNT = 100000000 | |
9 | 9 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let DYZ_ASSET_ID = base58'G2Pb7CMztps7XEVGCiUuJkLiS3ZCo69APQNbJs2nz21j' | |
5 | 5 | ||
6 | - | let VERIFICATION_STORAGE = base58' | |
6 | + | let VERIFICATION_STORAGE = base58'3N5NjTu7M5vyZ89HvdR69jW2wLZ2Rwj8LNr' | |
7 | 7 | ||
8 | 8 | let MIN_DYZ_AMOUNT = 100000000 | |
9 | 9 | ||
10 | 10 | let VOTING_BLOCKS = 100 | |
11 | 11 | ||
12 | 12 | let VOTE_CLOSED = "CLOSED" | |
13 | 13 | ||
14 | 14 | let VOTE_OPENED = "OPEN" | |
15 | 15 | ||
16 | 16 | let statusKeyPrefix = "status_" | |
17 | 17 | ||
18 | 18 | let openKeyPrefix = "open_" | |
19 | 19 | ||
20 | 20 | let totalYesSuffix = "_total_yes" | |
21 | 21 | ||
22 | 22 | let totalNoSuffix = "_total_no" | |
23 | 23 | ||
24 | 24 | let repaymentPrefix = "repayment_" | |
25 | 25 | ||
26 | 26 | let allowedKeySuffix = "_allowed" | |
27 | 27 | ||
28 | 28 | func getStatusKey (id) = (statusKeyPrefix + id) | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func getOpenKey (id) = (openKeyPrefix + id) | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func getTotalYesKey (id) = (id + totalYesSuffix) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func getTotalNoKey (id) = (id + totalNoSuffix) | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func getVoteStatus (id) = getString(this, getStatusKey(id)) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func getRepaymentKey (id,address) = (((repaymentPrefix + id) + "_") + toString(address)) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getStartHeight (id) = match getInteger(this, getOpenKey(id)) { | |
47 | 47 | case n: Int => | |
48 | 48 | n | |
49 | 49 | case _ => | |
50 | 50 | -1 | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func getRefundAmount (repaymentKey) = match getInteger(this, repaymentKey) { | |
55 | 55 | case n: Int => | |
56 | 56 | n | |
57 | 57 | case _ => | |
58 | 58 | -1 | |
59 | 59 | } | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func isAllowed (address) = match getBoolean(Address(VERIFICATION_STORAGE), (toString(address) + allowedKeySuffix)) { | |
63 | 63 | case b: Boolean => | |
64 | 64 | b | |
65 | 65 | case _ => | |
66 | 66 | false | |
67 | 67 | } | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | @Callable(i) | |
71 | 71 | func openVote (id) = { | |
72 | 72 | let startHeightKey = getOpenKey(id) | |
73 | 73 | let alreadyVoting = getStartHeight(id) | |
74 | 74 | if ((alreadyVoting != -1)) | |
75 | 75 | then throw("Vote already ongoing for id!") | |
76 | 76 | else { | |
77 | 77 | let statusKey = getStatusKey(id) | |
78 | 78 | [StringEntry(statusKey, VOTE_OPENED), IntegerEntry(startHeightKey, height)] | |
79 | 79 | } | |
80 | 80 | } | |
81 | 81 | ||
82 | 82 | ||
83 | 83 | ||
84 | 84 | @Callable(i) | |
85 | 85 | func closeVote (id) = { | |
86 | 86 | let currentStartHeight = getStartHeight(id) | |
87 | 87 | if ((currentStartHeight == -1)) | |
88 | 88 | then throw("No vote found for id!") | |
89 | 89 | else if (((currentStartHeight + VOTING_BLOCKS) > height)) | |
90 | 90 | then throw("Vote can not be closed yet!") | |
91 | 91 | else { | |
92 | 92 | let statusKey = getStatusKey(id) | |
93 | 93 | [StringEntry(statusKey, VOTE_CLOSED)] | |
94 | 94 | } | |
95 | 95 | } | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | ||
99 | 99 | @Callable(i) | |
100 | 100 | func claim (id) = { | |
101 | 101 | let startHeight = getStartHeight(id) | |
102 | 102 | if ((startHeight == -1)) | |
103 | 103 | then throw("No vote started for this id!") | |
104 | 104 | else if (((startHeight + VOTING_BLOCKS) >= height)) | |
105 | 105 | then throw("You can only claim after vote ends!") | |
106 | 106 | else { | |
107 | 107 | let caller = i.caller | |
108 | 108 | let repaymentKey = getRepaymentKey(id, caller) | |
109 | 109 | let repayAmount = getRefundAmount(repaymentKey) | |
110 | 110 | let statusKey = getStatusKey(id) | |
111 | 111 | if ((repayAmount > 0)) | |
112 | 112 | then [ScriptTransfer(caller, repayAmount, DYZ_ASSET_ID), StringEntry(statusKey, VOTE_CLOSED), IntegerEntry(repaymentKey, 0)] | |
113 | 113 | else throw("Nothing to claim!") | |
114 | 114 | } | |
115 | 115 | } | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | ||
119 | 119 | @Callable(i) | |
120 | 120 | func vote (id,vote) = if ((size(i.payments) != 1)) | |
121 | 121 | then throw("One payment in DZY needs to be attached") | |
122 | 122 | else { | |
123 | 123 | let payment = value(i.payments[0]) | |
124 | 124 | let caller = i.caller | |
125 | 125 | if (!(isAllowed(caller))) | |
126 | 126 | then throw("Address not allowed to vote!") | |
127 | 127 | else { | |
128 | 128 | let amount = payment.amount | |
129 | 129 | if (!(isDefined(payment.assetId))) | |
130 | 130 | then throw("Payment in Waves not allowed!") | |
131 | 131 | else { | |
132 | 132 | let assetId = toBase58String(value(payment.assetId)) | |
133 | 133 | let repaymentKey = getRepaymentKey(id, caller) | |
134 | 134 | let refundAmount = getRefundAmount(repaymentKey) | |
135 | 135 | if ((refundAmount != -1)) | |
136 | 136 | then throw("Only one vote per id per address!") | |
137 | 137 | else if ((assetId != toBase58String(DYZ_ASSET_ID))) | |
138 | 138 | then throw("payment in DZY necessary!") | |
139 | 139 | else if ((amount != MIN_DYZ_AMOUNT)) | |
140 | 140 | then throw("payment amount wrong!") | |
141 | 141 | else { | |
142 | 142 | let voteStatus = getVoteStatus(id) | |
143 | 143 | if ((voteStatus == VOTE_CLOSED)) | |
144 | 144 | then throw("vote closed!") | |
145 | 145 | else { | |
146 | 146 | let openHeight = match getInteger(this, getOpenKey(id)) { | |
147 | 147 | case a: Int => | |
148 | 148 | a | |
149 | 149 | case _ => | |
150 | 150 | 0 | |
151 | 151 | } | |
152 | 152 | if ((height > (openHeight + VOTING_BLOCKS))) | |
153 | 153 | then throw("voting ended!") | |
154 | 154 | else { | |
155 | 155 | let newEntry = if ((vote == true)) | |
156 | 156 | then { | |
157 | 157 | let yesVoteKey = getTotalYesKey(id) | |
158 | 158 | let yesVotesSoFar = match getInteger(this, yesVoteKey) { | |
159 | 159 | case a: Int => | |
160 | 160 | a | |
161 | 161 | case _ => | |
162 | 162 | 0 | |
163 | 163 | } | |
164 | 164 | let newYesVotes = (yesVotesSoFar + 1) | |
165 | 165 | [IntegerEntry(yesVoteKey, newYesVotes), IntegerEntry(repaymentKey, amount)] | |
166 | 166 | } | |
167 | 167 | else if ((vote == false)) | |
168 | 168 | then { | |
169 | 169 | let noVoteKey = getTotalNoKey(id) | |
170 | 170 | let noVotesSoFar = match getInteger(this, noVoteKey) { | |
171 | 171 | case a: Int => | |
172 | 172 | a | |
173 | 173 | case _ => | |
174 | 174 | 0 | |
175 | 175 | } | |
176 | 176 | let newNoVotes = (noVotesSoFar + 1) | |
177 | 177 | [IntegerEntry(noVoteKey, newNoVotes), IntegerEntry(repaymentKey, amount)] | |
178 | 178 | } | |
179 | 179 | else nil | |
180 | 180 | newEntry | |
181 | 181 | } | |
182 | 182 | } | |
183 | 183 | } | |
184 | 184 | } | |
185 | 185 | } | |
186 | 186 | } | |
187 | 187 | ||
188 | 188 | ||
189 | 189 | @Verifier(tx) | |
190 | 190 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
191 | 191 |
github/deemru/w8io/169f3d6 26.85 ms ◑