tx · 4b6PdzzyQ68eM2GtTohqKqv138JWnKEVbYAXJHyztpbf 3N4LqYvK8toVfW83bVrzvm4VoA55PB21Bmy: -0.14000000 Waves 2021.11.09 15:21 [1783457] smart account 3N4LqYvK8toVfW83bVrzvm4VoA55PB21Bmy > SELF 0.00000000 Waves
{ "type": 13, "id": "4b6PdzzyQ68eM2GtTohqKqv138JWnKEVbYAXJHyztpbf", "fee": 14000000, "feeAssetId": null, "timestamp": 1636460493226, "version": 2, "chainId": 84, "sender": "3N4LqYvK8toVfW83bVrzvm4VoA55PB21Bmy", "senderPublicKey": "9NPkhjF6pssidKGhnMzHn9auzo5q5fPBaabRQBx7CaFq", "proofs": [ "43sNmY9AmHYX8JmmRcdQJEz8SA4vpNAr5VmpFPZvCN1wqZPwvGDQ7SBKK7DrAPXLXuHAMkzMrttYMLEHuLgyChqk", "3EptaPAvjH5L5rsbP4pNgeG2QfRGdkhDw5gfk4zjYzBmXS5kpUPker5CDD5qVG2gqunrQCiQexuRox6VzMyJ6udz" ], "script": "base64:AAIFAAAAAAAAACQIAhIAEgQKAggIEgQKAgEBEgMKAQESABIDCgEBEgASABIAEgAAAAAeAAAAAAxhZG1pblB1YktleTEBAAAAIHxYa3tSxaWNZxxr9KlqtCKnmcTlLLl7jg3ENEFozVB4AAAAAAxhZG1pblB1YktleTIBAAAAIHxYa3tSxaWNZxxr9KlqtCKnmcTlLLl7jg3ENEFozVB4AAAAAAxhZG1pblB1YktleTMBAAAAIHxYa3tSxaWNZxxr9KlqtCKnmcTlLLl7jg3ENEFozVB4AAAAABRhZG1pblB1YktleVN0YXJ0U3RvcAEAAAAgfFhre1LFpY1nHGv0qWq0IqeZxOUsuXuODcQ0QWjNUHgAAAAACWtleUFjdGl2ZQIAAAAGYWN0aXZlAAAAAAhrZXlDYXVzZQIAAAAOc2h1dGRvd25fY2F1c2UAAAAADGtleVZvdGVTdGFydAIAAAARdm90ZV9zdGFydF9oZWlnaHQAAAAACmtleVZvdGVFbmQCAAAAD3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AAACBQAAAAxhZG1pblB1YktleTEJAARMAAAAAgUAAAAMYWRtaW5QdWJLZXkyCQAETAAAAAIFAAAADGFkbWluUHViS2V5MwkABEwAAAACBQAAABRhZG1pblB1YktleVN0YXJ0U3RvcAUAAAADbmlsCAUAAAABaQAAAA9jYWxsZXJQdWJsaWNLZXkJAAACAAAAAQIAAAAhT25seSBhZG1pbiBjYW4gY2FsbCB0aGlzIGZ1bmN0aW9uCQAETAAAAAIJAQAAAAxCb29sZWFuRW50cnkAAAACBQAAAAlrZXlBY3RpdmUGCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEFAAAACGtleUNhdXNlBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAABJhZG1pblB1YktleTFTaWduZWQDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAMYWRtaW5QdWJLZXkxAAAAAAAAAAABAAAAAAAAAAAABAAAABJhZG1pblB1YktleTJTaWduZWQDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAQUAAAAMYWRtaW5QdWJLZXkyAAAAAAAAAAABAAAAAAAAAAAABAAAABJhZG1pblB1YktleTNTaWduZWQDCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAgUAAAAMYWRtaW5QdWJLZXkzAAAAAAAAAAABAAAAAAAAAAAACQAAZwAAAAIJAABkAAAAAgkAAGQAAAACBQAAABJhZG1pblB1YktleTFTaWduZWQFAAAAEmFkbWluUHViS2V5MlNpZ25lZAUAAAASYWRtaW5QdWJLZXkzU2lnbmVkAAAAAAAAAAAC0g948Q==", "height": 1783457, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: C55Fe8rZmV4TsdFMzUaZJntH3oy7a47PFpK5EUMzAE7V Next: 7bQjiBrxkQt8q58Pha2jDK8cZUtDAZdPqhKeTZXJLaVr Diff:
Old | New | Differences | |
---|---|---|---|
174 | 174 | @Callable(i) | |
175 | 175 | func withdrawENNO (withdrawAmount) = if (!(isActive)) | |
176 | 176 | then throw("DApp is inactive at this moment") | |
177 | - | else if ((0 >= withdrawAmount)) | |
178 | - | then throw("withdrawAmount <= 0") | |
179 | - | else { | |
180 | - | let totalENNOLocked = getTotalENNOLocked() | |
181 | - | let userENNOLocked = getUserENNOLocked(i.caller) | |
182 | - | if ((withdrawAmount > totalENNOLocked)) | |
183 | - | then throw("withdrawAmount is more than available to withdraw") | |
184 | - | else if ((withdrawAmount > userENNOLocked)) | |
185 | - | then throw("You are trying to unstake more than you have staked.") | |
186 | - | else { | |
187 | - | let totalENNOLockedNew = (totalENNOLocked - withdrawAmount) | |
188 | - | let userENNOamountNew = (userENNOLocked - withdrawAmount) | |
189 | - | [IntegerEntry((toString(i.caller) + keyUserENNOLocked), userENNOamountNew), IntegerEntry(keyTotalENNOLocked, totalENNOLockedNew), ScriptTransfer(i.caller, withdrawAmount, ENNO)] | |
190 | - | } | |
191 | - | } | |
177 | + | else { | |
178 | + | let finalWithdrawAmount = (getVal((toString(i.caller) + keyUserENNOVoted)) - withdrawAmount) | |
179 | + | if ((0 >= finalWithdrawAmount)) | |
180 | + | then throw("DApp is inactive at this moment") | |
181 | + | else if ((0 >= finalWithdrawAmount)) | |
182 | + | then throw("withdrawAmount <= 0") | |
183 | + | else { | |
184 | + | let totalENNOLocked = getTotalENNOLocked() | |
185 | + | let userENNOLocked = getUserENNOLocked(i.caller) | |
186 | + | if ((finalWithdrawAmount > totalENNOLocked)) | |
187 | + | then throw("withdrawAmount is more than available to withdraw") | |
188 | + | else if ((finalWithdrawAmount > userENNOLocked)) | |
189 | + | then throw("You are trying to unstake more than you have staked.") | |
190 | + | else { | |
191 | + | let totalENNOLockedNew = (totalENNOLocked - finalWithdrawAmount) | |
192 | + | let userENNOamountNew = (userENNOLocked - finalWithdrawAmount) | |
193 | + | [IntegerEntry((toString(i.caller) + keyUserENNOLocked), userENNOamountNew), IntegerEntry(keyTotalENNOLocked, totalENNOLockedNew), ScriptTransfer(i.caller, finalWithdrawAmount, ENNO)] | |
194 | + | } | |
195 | + | } | |
196 | + | } | |
192 | 197 | ||
193 | 198 | ||
194 | 199 |
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 | let total = getVal(keyTotalYesVoted) | |
104 | 104 | let result = fraction(share, 100000000, total) | |
105 | 105 | [IntegerEntry((toString(i.caller) + "_airdrop"), result), DeleteEntry((toString(i.caller) + keyUserENNOVotedYESValue)), DeleteEntry((toString(i.caller) + keyUserENNOVoted))] | |
106 | 106 | } | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | ||
110 | 110 | @Callable(i) | |
111 | 111 | func deleteEntry (address1,address2) = if (!(isActive)) | |
112 | 112 | then throw("DApp is inactive at this moment") | |
113 | 113 | else [DeleteEntry((address1 + "airdrop")), DeleteEntry((address1 + "_airdrop")), DeleteEntry((address1 + keyUserENNOVotedYESValue)), DeleteEntry((address1 + keyUserENNOVoted)), DeleteEntry((address2 + "airdrop")), DeleteEntry((address2 + "_airdrop")), DeleteEntry((address2 + keyUserENNOVotedYESValue)), DeleteEntry((address2 + keyUserENNOVoted))] | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | ||
117 | 117 | @Callable(i) | |
118 | 118 | func initVote (start,end) = if (!(isActive)) | |
119 | 119 | then throw("DApp is inactive at this moment") | |
120 | 120 | else [IntegerEntry(keyVoteStart, start), IntegerEntry(keyVoteEnd, end), IntegerEntry(keyTotalYesVoted, 0)] | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | ||
124 | 124 | @Callable(i) | |
125 | 125 | func vote (voteAmount) = if (!(isActive)) | |
126 | 126 | then throw("DApp is inactive at this moment") | |
127 | 127 | else if ((getVal(keyVoteStart) > height)) | |
128 | 128 | then throw("Voting has not started yet.") | |
129 | 129 | else if ((height > getVal(keyVoteEnd))) | |
130 | 130 | then throw("Voting has already ended.") | |
131 | 131 | else { | |
132 | 132 | let totalYes = getVal(keyTotalYesVoted) | |
133 | 133 | let userVotedYes = getUserVoteData(i.caller, keyUserENNOVotedYESValue) | |
134 | 134 | let userENNOVoted = getUserVoteData(i.caller, keyUserENNOVoted) | |
135 | 135 | let userENNOLocked = getUserVoteData(i.caller, keyUserENNOLocked) | |
136 | 136 | let userENNOVotedNew = (userENNOVoted + voteAmount) | |
137 | 137 | if ((0 > userENNOVotedNew)) | |
138 | 138 | then throw("Vote amount is more than available.") | |
139 | 139 | else { | |
140 | 140 | let availableVote = (userENNOLocked - userENNOVoted) | |
141 | 141 | let userVoteValue = setShare(voteAmount) | |
142 | 142 | if ((voteAmount > availableVote)) | |
143 | 143 | then throw("Vote amount is more than available.") | |
144 | 144 | else { | |
145 | 145 | let userENNOVotedNewShare = (userVotedYes + userVoteValue) | |
146 | 146 | let newTotalYesVoted = (totalYes + userENNOVotedNewShare) | |
147 | 147 | [IntegerEntry((toString(i.caller) + keyUserENNOVotedYESValue), userENNOVotedNewShare), IntegerEntry((toString(i.caller) + keyUserENNOVoted), userENNOVotedNew), IntegerEntry(keyTotalYesVoted, newTotalYesVoted)] | |
148 | 148 | } | |
149 | 149 | } | |
150 | 150 | } | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | ||
154 | 154 | @Callable(i) | |
155 | 155 | func lockENNO () = if (!(isActive)) | |
156 | 156 | then throw("DApp is inactive at this moment") | |
157 | 157 | else { | |
158 | 158 | let $t053865461 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
159 | 159 | let pmtAmount = $t053865461._1 | |
160 | 160 | let pmtAssetId = $t053865461._2 | |
161 | 161 | if ((pmtAssetId != ENNO)) | |
162 | 162 | then throw("Incorrect payment assetId only Enno Cash is allowed.") | |
163 | 163 | else { | |
164 | 164 | let userENNOLocked = getUserENNOLocked(i.caller) | |
165 | 165 | let userENNOLockedNew = (userENNOLocked + pmtAmount) | |
166 | 166 | let totalENNOLocked = getTotalENNOLocked() | |
167 | 167 | let totalENNOLockedNew = (totalENNOLocked + pmtAmount) | |
168 | 168 | [IntegerEntry((toString(i.caller) + keyUserENNOLocked), userENNOLockedNew), IntegerEntry(keyTotalENNOLocked, totalENNOLockedNew)] | |
169 | 169 | } | |
170 | 170 | } | |
171 | 171 | ||
172 | 172 | ||
173 | 173 | ||
174 | 174 | @Callable(i) | |
175 | 175 | func withdrawENNO (withdrawAmount) = if (!(isActive)) | |
176 | 176 | then throw("DApp is inactive at this moment") | |
177 | - | else if ((0 >= withdrawAmount)) | |
178 | - | then throw("withdrawAmount <= 0") | |
179 | - | else { | |
180 | - | let totalENNOLocked = getTotalENNOLocked() | |
181 | - | let userENNOLocked = getUserENNOLocked(i.caller) | |
182 | - | if ((withdrawAmount > totalENNOLocked)) | |
183 | - | then throw("withdrawAmount is more than available to withdraw") | |
184 | - | else if ((withdrawAmount > userENNOLocked)) | |
185 | - | then throw("You are trying to unstake more than you have staked.") | |
186 | - | else { | |
187 | - | let totalENNOLockedNew = (totalENNOLocked - withdrawAmount) | |
188 | - | let userENNOamountNew = (userENNOLocked - withdrawAmount) | |
189 | - | [IntegerEntry((toString(i.caller) + keyUserENNOLocked), userENNOamountNew), IntegerEntry(keyTotalENNOLocked, totalENNOLockedNew), ScriptTransfer(i.caller, withdrawAmount, ENNO)] | |
190 | - | } | |
191 | - | } | |
177 | + | else { | |
178 | + | let finalWithdrawAmount = (getVal((toString(i.caller) + keyUserENNOVoted)) - withdrawAmount) | |
179 | + | if ((0 >= finalWithdrawAmount)) | |
180 | + | then throw("DApp is inactive at this moment") | |
181 | + | else if ((0 >= finalWithdrawAmount)) | |
182 | + | then throw("withdrawAmount <= 0") | |
183 | + | else { | |
184 | + | let totalENNOLocked = getTotalENNOLocked() | |
185 | + | let userENNOLocked = getUserENNOLocked(i.caller) | |
186 | + | if ((finalWithdrawAmount > totalENNOLocked)) | |
187 | + | then throw("withdrawAmount is more than available to withdraw") | |
188 | + | else if ((finalWithdrawAmount > userENNOLocked)) | |
189 | + | then throw("You are trying to unstake more than you have staked.") | |
190 | + | else { | |
191 | + | let totalENNOLockedNew = (totalENNOLocked - finalWithdrawAmount) | |
192 | + | let userENNOamountNew = (userENNOLocked - finalWithdrawAmount) | |
193 | + | [IntegerEntry((toString(i.caller) + keyUserENNOLocked), userENNOamountNew), IntegerEntry(keyTotalENNOLocked, totalENNOLockedNew), ScriptTransfer(i.caller, finalWithdrawAmount, ENNO)] | |
194 | + | } | |
195 | + | } | |
196 | + | } | |
192 | 197 | ||
193 | 198 | ||
194 | 199 | ||
195 | 200 | @Callable(i) | |
196 | 201 | func claimAndWithdrawENNO () = if (!(isActive)) | |
197 | 202 | then throw("DApp is inactive at this moment") | |
198 | 203 | else { | |
199 | 204 | let userShare = getCallerShare(i.originCaller) | |
200 | 205 | let userClaimedAmount = getClaimedAmount(i.originCaller) | |
201 | 206 | let claimAmount = (userShare - userClaimedAmount) | |
202 | 207 | let totalENNOLocked = getTotalENNOLocked() | |
203 | 208 | if ((claimAmount > totalENNOLocked)) | |
204 | 209 | then throw("claimAmount is more than available to withdraw") | |
205 | 210 | else if ((0 >= claimAmount)) | |
206 | 211 | then throw("Claim amount must be bigger than 0") | |
207 | 212 | else { | |
208 | 213 | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
209 | 214 | [IntegerEntry((toString(i.originCaller) + keyUserENNOClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.originCaller) + keyUserENNOLastClaimedAmount), claimAmount), ScriptTransfer(i.originCaller, claimAmount, ENNO)] | |
210 | 215 | } | |
211 | 216 | } | |
212 | 217 | ||
213 | 218 | ||
214 | 219 | ||
215 | 220 | @Callable(i) | |
216 | 221 | func claimAndStakeENNO () = if (!(isActive)) | |
217 | 222 | then throw("DApp is inactive at this moment") | |
218 | 223 | else { | |
219 | 224 | let userShare = getCallerShare(i.originCaller) | |
220 | 225 | let userClaimedAmount = getClaimedAmount(i.originCaller) | |
221 | 226 | let claimAmount = (userShare - userClaimedAmount) | |
222 | 227 | if ((0 >= claimAmount)) | |
223 | 228 | then throw("Claim amount must be bigger than 0") | |
224 | 229 | else { | |
225 | 230 | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
226 | 231 | let userENNOLocked = getUserENNOLocked(i.originCaller) | |
227 | 232 | let userENNOLockedNew = (userENNOLocked + claimAmount) | |
228 | 233 | let totalENNOLocked = getTotalENNOLocked() | |
229 | 234 | let totalENNOLockedNew = (totalENNOLocked + claimAmount) | |
230 | 235 | [IntegerEntry((toString(i.originCaller) + keyUserENNOLocked), userENNOLockedNew), IntegerEntry((toString(i.originCaller) + keyUserENNOClaimedAmount), userClaimedAmountNew), IntegerEntry((toString(i.originCaller) + keyUserENNOLastClaimedAmount), claimAmount), IntegerEntry(keyTotalENNOLocked, totalENNOLockedNew)] | |
231 | 236 | } | |
232 | 237 | } | |
233 | 238 | ||
234 | 239 | ||
235 | 240 | ||
236 | 241 | @Callable(i) | |
237 | 242 | func shutdown () = if (!(isActive)) | |
238 | 243 | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, keyCause), "the cause wasn't specified"))) | |
239 | 244 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStartStop], i.callerPublicKey))) | |
240 | 245 | then throw("Only admin can call this function") | |
241 | 246 | else suspend("Paused by admin") | |
242 | 247 | ||
243 | 248 | ||
244 | 249 | ||
245 | 250 | @Callable(i) | |
246 | 251 | func activate () = if (isActive) | |
247 | 252 | then throw("DApp is already active") | |
248 | 253 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStartStop], i.callerPublicKey))) | |
249 | 254 | then throw("Only admin can call this function") | |
250 | 255 | else [BooleanEntry(keyActive, true), DeleteEntry(keyCause)] | |
251 | 256 | ||
252 | 257 | ||
253 | 258 | @Verifier(tx) | |
254 | 259 | func verify () = { | |
255 | 260 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
256 | 261 | then 1 | |
257 | 262 | else 0 | |
258 | 263 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
259 | 264 | then 1 | |
260 | 265 | else 0 | |
261 | 266 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
262 | 267 | then 1 | |
263 | 268 | else 0 | |
264 | 269 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
265 | 270 | } | |
266 | 271 |
github/deemru/w8io/169f3d6 36.87 ms ◑