tx · 2LWdK7r7uoez56TT8bc4tiDad1gybJAZASphcLrmif9g 3N4LqYvK8toVfW83bVrzvm4VoA55PB21Bmy: -0.14000000 Waves 2021.11.10 08:56 [1784526] smart account 3N4LqYvK8toVfW83bVrzvm4VoA55PB21Bmy > SELF 0.00000000 Waves
{ "type": 13, "id": "2LWdK7r7uoez56TT8bc4tiDad1gybJAZASphcLrmif9g", "fee": 14000000, "feeAssetId": null, "timestamp": 1636523758722, "version": 2, "chainId": 84, "sender": "3N4LqYvK8toVfW83bVrzvm4VoA55PB21Bmy", "senderPublicKey": "9NPkhjF6pssidKGhnMzHn9auzo5q5fPBaabRQBx7CaFq", "proofs": [ "2vMm1cwZFFGJBZdNHnzkQTqydMvhL2ZjgDHdSZnrGrWhQiHoRANqkSRZbJW9CEUhgg9oS5cfqSKF2NtcAMq8HL9Q", "uE1MvtNGtWGNVACW54t5eYDHfMx95Qax5m1U3CbcqP7TKokxJ2YMHQ7mAMTvjiCXRhT1o78mnjpPVLcyyNLLgZ2" ], "script": "base64:AAIFAAAAAAAAACkIAhIAEgQKAggIEgQKAgEBEgMKAQESAwoBARIAEgMKAQESABIAEgASAAAAAB4AAAAADGFkbWluUHViS2V5MQEAAAAgfFhre1LFpY1nHGv0qWq0IqeZxOUsuXuODcQ0QWjNUHgAAAAADGFkbWluUHViS2V5MgEAAAAgfFhre1LFpY1nHGv0qWq0IqeZxOUsuXuODcQ0QWjNUHgAAAAADGFkbWluUHViS2V5MwEAAAAgfFhre1LFpY1nHGv0qWq0IqeZxOUsuXuODcQ0QWjNUHgAAAAAFGFkbWluUHViS2V5U3RhcnRTdG9wAQAAACB8WGt7UsWljWcca/SparQip5nE5Sy5e44NxDRBaM1QeAAAAAAJa2V5QWN0aXZlAgAAAAZhY3RpdmUAAAAACGtleUNhdXNlAgAAAA5zaHV0ZG93bl9jYXVzZQAAAAAMa2V5Vm90ZVN0YXJ0AgAAABF2b3RlX3N0YXJ0X2hlaWdodAAAAAAKa2V5Vm90ZUVu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kbWluUHViS2V5MQAAAAAAAAAAAQAAAAAAAAAAAAQAAAASYWRtaW5QdWJLZXkyU2lnbmVkAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAEFAAAADGFkbWluUHViS2V5MgAAAAAAAAAAAQAAAAAAAAAAAAQAAAASYWRtaW5QdWJLZXkzU2lnbmVkAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAIFAAAADGFkbWluUHViS2V5MwAAAAAAAAAAAQAAAAAAAAAAAAkAAGcAAAACCQAAZAAAAAIJAABkAAAAAgUAAAASYWRtaW5QdWJLZXkxU2lnbmVkBQAAABJhZG1pblB1YktleTJTaWduZWQFAAAAEmFkbWluUHViS2V5M1NpZ25lZAAAAAAAAAAAAn7mjGM=", "height": 1784526, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: B1B6KvePp4gbFQBM4KBaSwhkGzWJxfY2S4jLNApuCrqQ Next: EhJpCDTLCjqP38hYoxDQTegcF1ZzkwQekKcsvp64sVe2 Diff:
Old | New | Differences | |
---|---|---|---|
203 | 203 | func withdrawENNO (withdrawAmount) = if (!(isActive)) | |
204 | 204 | then throw("DApp is inactive at this moment") | |
205 | 205 | else { | |
206 | - | let | |
207 | - | let availableToWithdraw = ( | |
206 | + | let userENNOLocked = getUserENNOLocked(i.caller) | |
207 | + | let availableToWithdraw = (userENNOLocked - getVal((toString(i.caller) + keyUserENNOVoted))) | |
208 | 208 | let finalWithdrawAmount = (availableToWithdraw - withdrawAmount) | |
209 | 209 | if ((0 >= finalWithdrawAmount)) | |
210 | 210 | then throw("Your Enno is locked") | |
211 | 211 | else if ((0 >= finalWithdrawAmount)) | |
212 | 212 | then throw("withdrawAmount <= 0") | |
213 | 213 | else { | |
214 | - | let | |
214 | + | let totalENNOLocked = getTotalENNOLocked() | |
215 | 215 | if ((finalWithdrawAmount > totalENNOLocked)) | |
216 | 216 | then throw("withdrawAmount is more than available to withdraw") | |
217 | 217 | else if ((finalWithdrawAmount > userENNOLocked)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let adminPubKey1 = base58'9NPkhjF6pssidKGhnMzHn9auzo5q5fPBaabRQBx7CaFq' | |
5 | 5 | ||
6 | 6 | let adminPubKey2 = base58'9NPkhjF6pssidKGhnMzHn9auzo5q5fPBaabRQBx7CaFq' | |
7 | 7 | ||
8 | 8 | let adminPubKey3 = base58'9NPkhjF6pssidKGhnMzHn9auzo5q5fPBaabRQBx7CaFq' | |
9 | 9 | ||
10 | 10 | let adminPubKeyStartStop = base58'9NPkhjF6pssidKGhnMzHn9auzo5q5fPBaabRQBx7CaFq' | |
11 | 11 | ||
12 | 12 | let keyActive = "active" | |
13 | 13 | ||
14 | 14 | let keyCause = "shutdown_cause" | |
15 | 15 | ||
16 | 16 | let keyVoteStart = "vote_start_height" | |
17 | 17 | ||
18 | 18 | let keyVoteEnd = "vote_end_height" | |
19 | 19 | ||
20 | 20 | let keyVoteYes = "yes_amount" | |
21 | 21 | ||
22 | 22 | let keyUserENNOVoted = "_ENNO_vote" | |
23 | 23 | ||
24 | 24 | let keyUserENNOVotedHeight = "_ENNO_vote_height" | |
25 | 25 | ||
26 | 26 | let keyUserENNOVotedValue = "_ENNO_vote_value" | |
27 | 27 | ||
28 | 28 | let keyUserENNOVotedYESValue = "_ENNO_vote_yes_share" | |
29 | 29 | ||
30 | 30 | let keyTotalYesVoted = "total_ENNO_vote_yes" | |
31 | 31 | ||
32 | 32 | let keyUserENNOLocked = "_ENNO_amount" | |
33 | 33 | ||
34 | 34 | let keyTotalENNOLocked = "total_ENNO_amount" | |
35 | 35 | ||
36 | 36 | let keyUserENNOClaimedAmount = "_ENNO_claimed_amount" | |
37 | 37 | ||
38 | 38 | let keyUserENNOLastClaimedAmount = "_ENNO_last_claimed_amount" | |
39 | 39 | ||
40 | 40 | let keyUserENNOLockedTag = "share_" | |
41 | 41 | ||
42 | 42 | let isActive = valueOrElse(getBoolean(this, keyActive), true) | |
43 | 43 | ||
44 | 44 | let shareData = base58'9NPkhjF6pssidKGhnMzHn9auzo5q5fPBaabRQBx7CaFq' | |
45 | 45 | ||
46 | 46 | let ENNO = base58'6TmLfry3GRQoVSaesGSnp6NtZKveYgEopTLsjaGgXoso' | |
47 | 47 | ||
48 | 48 | func suspend (cause) = [BooleanEntry(keyActive, false), StringEntry(keyCause, cause)] | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func getUserENNOLocked (user) = valueOrElse(getInteger(this, (toString(user) + keyUserENNOLocked)), 0) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func getTotalENNOLocked () = valueOrElse(getInteger(this, keyTotalENNOLocked), 0) | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func getUserVoteData (user,key) = valueOrElse(getInteger(this, (toString(user) + key)), 0) | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func getVal (key) = valueOrElse(getInteger(this, key), 0) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func getCallerShare (caller) = { | |
64 | 64 | let callerShare = getInteger(addressFromPublicKey(shareData), (keyUserENNOLockedTag + toString(caller))) | |
65 | 65 | let callerShareAmount = match callerShare { | |
66 | 66 | case share: Int => | |
67 | 67 | share | |
68 | 68 | case share: Unit => | |
69 | 69 | throw("Only governance qualifiers can call this function.") | |
70 | 70 | case _ => | |
71 | 71 | throw("Match error") | |
72 | 72 | } | |
73 | 73 | callerShareAmount | |
74 | 74 | } | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func getClaimedAmount (caller) = { | |
78 | 78 | let callerWithdrawn = getInteger(this, (toString(caller) + keyUserENNOClaimedAmount)) | |
79 | 79 | let callerWithdrawnAmount = match callerWithdrawn { | |
80 | 80 | case share: Int => | |
81 | 81 | share | |
82 | 82 | case share: Unit => | |
83 | 83 | 0 | |
84 | 84 | case _ => | |
85 | 85 | throw("Match error") | |
86 | 86 | } | |
87 | 87 | callerWithdrawnAmount | |
88 | 88 | } | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func setShare (amount) = { | |
92 | 92 | let deltaHeight = (getVal(keyVoteEnd) - height) | |
93 | 93 | let share = fraction(amount, deltaHeight, 100000000) | |
94 | 94 | share | |
95 | 95 | } | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | @Callable(i) | |
99 | 99 | func claimAirdrop () = if (!(isActive)) | |
100 | 100 | then throw("DApp is inactive at this moment") | |
101 | 101 | else { | |
102 | 102 | let share = getVal((toString(i.caller) + keyUserENNOVotedYESValue)) | |
103 | 103 | if ((0 >= share)) | |
104 | 104 | then throw("You already claimed or you have not participated.") | |
105 | 105 | else { | |
106 | 106 | let total = getVal(keyTotalYesVoted) | |
107 | 107 | let result = fraction(share, 100000000, total) | |
108 | 108 | [IntegerEntry((toString(i.caller) + "_airdrop"), result), DeleteEntry((toString(i.caller) + keyUserENNOVotedYESValue)), DeleteEntry((toString(i.caller) + keyUserENNOVoted))] | |
109 | 109 | } | |
110 | 110 | } | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | 114 | @Callable(i) | |
115 | 115 | func deleteEntry (address1,address2) = if (!(isActive)) | |
116 | 116 | then throw("DApp is inactive at this moment") | |
117 | 117 | else [DeleteEntry((address1 + "_airdrop")), DeleteEntry((address1 + keyUserENNOVotedYESValue)), DeleteEntry((address1 + keyUserENNOVoted)), DeleteEntry((address2 + "_airdrop")), DeleteEntry((address2 + keyUserENNOVotedYESValue)), DeleteEntry((address2 + keyUserENNOVoted))] | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | ||
121 | 121 | @Callable(i) | |
122 | 122 | func initVote (start,end) = if (!(isActive)) | |
123 | 123 | then throw("DApp is inactive at this moment") | |
124 | 124 | else [IntegerEntry(keyVoteStart, start), IntegerEntry(keyVoteEnd, end), IntegerEntry(keyTotalYesVoted, 0)] | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | ||
128 | 128 | @Callable(i) | |
129 | 129 | func unvote (voteAmount) = if (!(isActive)) | |
130 | 130 | then throw("DApp is inactive at this moment") | |
131 | 131 | else if ((getVal(keyVoteStart) > height)) | |
132 | 132 | then throw("Voting has not started yet.") | |
133 | 133 | else if ((height > getVal(keyVoteEnd))) | |
134 | 134 | then throw("Voting has already ended.") | |
135 | 135 | else { | |
136 | 136 | let totalYes = getVal(keyTotalYesVoted) | |
137 | 137 | let userVotedYes = getUserVoteData(i.caller, keyUserENNOVotedYESValue) | |
138 | 138 | let userENNOVoted = getUserVoteData(i.caller, keyUserENNOVoted) | |
139 | 139 | let userENNOVotedNew = (userENNOVoted - voteAmount) | |
140 | 140 | if ((0 > userENNOVotedNew)) | |
141 | 141 | then throw("Vote amount is less than available.") | |
142 | 142 | else { | |
143 | 143 | let userVoteValue = setShare(voteAmount) | |
144 | 144 | let userENNOVotedNewShare = (userVotedYes - userVoteValue) | |
145 | 145 | let newTotalYesVoted = (totalYes - userVoteValue) | |
146 | 146 | [IntegerEntry((toString(i.caller) + keyUserENNOVotedYESValue), userENNOVotedNewShare), IntegerEntry((toString(i.caller) + keyUserENNOVoted), userENNOVotedNew), IntegerEntry(keyTotalYesVoted, newTotalYesVoted)] | |
147 | 147 | } | |
148 | 148 | } | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | ||
152 | 152 | @Callable(i) | |
153 | 153 | func vote (voteAmount) = if (!(isActive)) | |
154 | 154 | then throw("DApp is inactive at this moment") | |
155 | 155 | else if ((getVal(keyVoteStart) > height)) | |
156 | 156 | then throw("Voting has not started yet.") | |
157 | 157 | else if ((height > getVal(keyVoteEnd))) | |
158 | 158 | then throw("Voting has already ended.") | |
159 | 159 | else { | |
160 | 160 | let totalYes = getVal(keyTotalYesVoted) | |
161 | 161 | let userVotedYes = getUserVoteData(i.caller, keyUserENNOVotedYESValue) | |
162 | 162 | let userENNOVoted = getUserVoteData(i.caller, keyUserENNOVoted) | |
163 | 163 | let userENNOLocked = getUserVoteData(i.caller, keyUserENNOLocked) | |
164 | 164 | let userENNOVotedNew = (userENNOVoted + voteAmount) | |
165 | 165 | if ((0 > userENNOVotedNew)) | |
166 | 166 | then throw("Vote amount is more than available.") | |
167 | 167 | else { | |
168 | 168 | let availableVote = (userENNOLocked - userENNOVoted) | |
169 | 169 | let userVoteValue = setShare(voteAmount) | |
170 | 170 | if ((voteAmount > availableVote)) | |
171 | 171 | then throw("Vote amount is more than available.") | |
172 | 172 | else { | |
173 | 173 | let userENNOVotedNewShare = (userVotedYes + userVoteValue) | |
174 | 174 | let newTotalYesVoted = (totalYes + userVoteValue) | |
175 | 175 | [IntegerEntry((toString(i.caller) + keyUserENNOVotedYESValue), userENNOVotedNewShare), IntegerEntry((toString(i.caller) + keyUserENNOVoted), userENNOVotedNew), IntegerEntry(keyTotalYesVoted, newTotalYesVoted)] | |
176 | 176 | } | |
177 | 177 | } | |
178 | 178 | } | |
179 | 179 | ||
180 | 180 | ||
181 | 181 | ||
182 | 182 | @Callable(i) | |
183 | 183 | func lockENNO () = if (!(isActive)) | |
184 | 184 | then throw("DApp is inactive at this moment") | |
185 | 185 | else { | |
186 | 186 | let $t065816656 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
187 | 187 | let pmtAmount = $t065816656._1 | |
188 | 188 | let pmtAssetId = $t065816656._2 | |
189 | 189 | if ((pmtAssetId != ENNO)) | |
190 | 190 | then throw("Incorrect payment assetId only Enno Cash is allowed.") | |
191 | 191 | else { | |
192 | 192 | let userENNOLocked = getUserENNOLocked(i.caller) | |
193 | 193 | let userENNOLockedNew = (userENNOLocked + pmtAmount) | |
194 | 194 | let totalENNOLocked = getTotalENNOLocked() | |
195 | 195 | let totalENNOLockedNew = (totalENNOLocked + pmtAmount) | |
196 | 196 | [IntegerEntry((toString(i.caller) + keyUserENNOLocked), userENNOLockedNew), IntegerEntry(keyTotalENNOLocked, totalENNOLockedNew)] | |
197 | 197 | } | |
198 | 198 | } | |
199 | 199 | ||
200 | 200 | ||
201 | 201 | ||
202 | 202 | @Callable(i) | |
203 | 203 | func withdrawENNO (withdrawAmount) = if (!(isActive)) | |
204 | 204 | then throw("DApp is inactive at this moment") | |
205 | 205 | else { | |
206 | - | let | |
207 | - | let availableToWithdraw = ( | |
206 | + | let userENNOLocked = getUserENNOLocked(i.caller) | |
207 | + | let availableToWithdraw = (userENNOLocked - getVal((toString(i.caller) + keyUserENNOVoted))) | |
208 | 208 | let finalWithdrawAmount = (availableToWithdraw - withdrawAmount) | |
209 | 209 | if ((0 >= finalWithdrawAmount)) | |
210 | 210 | then throw("Your Enno is locked") | |
211 | 211 | else if ((0 >= finalWithdrawAmount)) | |
212 | 212 | then throw("withdrawAmount <= 0") | |
213 | 213 | else { | |
214 | - | let | |
214 | + | let totalENNOLocked = getTotalENNOLocked() | |
215 | 215 | if ((finalWithdrawAmount > totalENNOLocked)) | |
216 | 216 | then throw("withdrawAmount is more than available to withdraw") | |
217 | 217 | else if ((finalWithdrawAmount > userENNOLocked)) | |
218 | 218 | then throw("You are trying to unstake more than you have staked.") | |
219 | 219 | else { | |
220 | 220 | let totalENNOLockedNew = (totalENNOLocked - finalWithdrawAmount) | |
221 | 221 | let userENNOamountNew = (userENNOLocked - finalWithdrawAmount) | |
222 | 222 | [IntegerEntry((toString(i.caller) + keyUserENNOLocked), userENNOamountNew), IntegerEntry(keyTotalENNOLocked, totalENNOLockedNew), ScriptTransfer(i.caller, finalWithdrawAmount, ENNO)] | |
223 | 223 | } | |
224 | 224 | } | |
225 | 225 | } | |
226 | 226 | ||
227 | 227 | ||
228 | 228 | ||
229 | 229 | @Callable(i) | |
230 | 230 | func claimAndWithdrawENNO () = if (!(isActive)) | |
231 | 231 | then throw("DApp is inactive at this moment") | |
232 | 232 | else { | |
233 | 233 | let userShare = getCallerShare(i.originCaller) | |
234 | 234 | let userClaimedAmount = getClaimedAmount(i.originCaller) | |
235 | 235 | let claimAmount = (userShare - userClaimedAmount) | |
236 | 236 | let totalENNOLocked = getTotalENNOLocked() | |
237 | 237 | if ((claimAmount > totalENNOLocked)) | |
238 | 238 | then throw("claimAmount is more than available to withdraw") | |
239 | 239 | else if ((0 >= claimAmount)) | |
240 | 240 | then throw("Claim amount must be bigger than 0") | |
241 | 241 | else { | |
242 | 242 | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
243 | 243 | [IntegerEntry((toString(i.originCaller) + keyUserENNOClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.originCaller) + keyUserENNOLastClaimedAmount), claimAmount), ScriptTransfer(i.originCaller, claimAmount, ENNO)] | |
244 | 244 | } | |
245 | 245 | } | |
246 | 246 | ||
247 | 247 | ||
248 | 248 | ||
249 | 249 | @Callable(i) | |
250 | 250 | func claimAndStakeENNO () = if (!(isActive)) | |
251 | 251 | then throw("DApp is inactive at this moment") | |
252 | 252 | else { | |
253 | 253 | let userShare = getCallerShare(i.originCaller) | |
254 | 254 | let userClaimedAmount = getClaimedAmount(i.originCaller) | |
255 | 255 | let claimAmount = (userShare - userClaimedAmount) | |
256 | 256 | if ((0 >= claimAmount)) | |
257 | 257 | then throw("Claim amount must be bigger than 0") | |
258 | 258 | else { | |
259 | 259 | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
260 | 260 | let userENNOLocked = getUserENNOLocked(i.originCaller) | |
261 | 261 | let userENNOLockedNew = (userENNOLocked + claimAmount) | |
262 | 262 | let totalENNOLocked = getTotalENNOLocked() | |
263 | 263 | let totalENNOLockedNew = (totalENNOLocked + claimAmount) | |
264 | 264 | [IntegerEntry((toString(i.originCaller) + keyUserENNOLocked), userENNOLockedNew), IntegerEntry((toString(i.originCaller) + keyUserENNOClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.originCaller) + keyUserENNOLastClaimedAmount), claimAmount), IntegerEntry(keyTotalENNOLocked, totalENNOLockedNew)] | |
265 | 265 | } | |
266 | 266 | } | |
267 | 267 | ||
268 | 268 | ||
269 | 269 | ||
270 | 270 | @Callable(i) | |
271 | 271 | func shutdown () = if (!(isActive)) | |
272 | 272 | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, keyCause), "the cause wasn't specified"))) | |
273 | 273 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStartStop], i.callerPublicKey))) | |
274 | 274 | then throw("Only admin can call this function") | |
275 | 275 | else suspend("Paused by admin") | |
276 | 276 | ||
277 | 277 | ||
278 | 278 | ||
279 | 279 | @Callable(i) | |
280 | 280 | func activate () = if (isActive) | |
281 | 281 | then throw("DApp is already active") | |
282 | 282 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStartStop], i.callerPublicKey))) | |
283 | 283 | then throw("Only admin can call this function") | |
284 | 284 | else [BooleanEntry(keyActive, true), DeleteEntry(keyCause)] | |
285 | 285 | ||
286 | 286 | ||
287 | 287 | @Verifier(tx) | |
288 | 288 | func verify () = { | |
289 | 289 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
290 | 290 | then 1 | |
291 | 291 | else 0 | |
292 | 292 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
293 | 293 | then 1 | |
294 | 294 | else 0 | |
295 | 295 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
296 | 296 | then 1 | |
297 | 297 | else 0 | |
298 | 298 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
299 | 299 | } | |
300 | 300 |
github/deemru/w8io/169f3d6 43.27 ms ◑