tx · 5DHqA3M2YdRrmdfsQpq33J9SEPAjaTbp5wQLUFoUQrem 3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh: -0.01000000 Waves 2023.05.18 16:32 [2583460] smart account 3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh > SELF 0.00000000 Waves
{ "type": 13, "id": "5DHqA3M2YdRrmdfsQpq33J9SEPAjaTbp5wQLUFoUQrem", "fee": 1000000, "feeAssetId": null, "timestamp": 1684416758290, "version": 2, "chainId": 84, "sender": "3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh", "senderPublicKey": "EU9obW1yVhR8qug3EmXPeew3DMagvJFQzY5Ku8bmcsU7", "proofs": [ "q6oYP7LuyFrrX18GJQyEtUw2GapGuY24iYNhexhZbyexwDyPJoAcE5CeihHHj2fQCSRKr7UcCi4wCS4YA9AwPrU" ], "script": "base64:BgIbCAISBwoFCAgBAQESABIDCgEBEgASAwoBARIAHAAJc2VwYXJhdG9yAgJfXwAQY29udHJhY3RGaWxlbmFtZQIZdm90aW5nX2VtaXNzaW9uX3JhdGUucmlkZQAOa2V5RXBvY2hMZW5ndGgJALkJAgkAzAgCAgIlcwkAzAgCAgtlcG9jaExlbmd0aAUDbmlsBQlzZXBhcmF0b3IAE2tleUVtaXNzaW9uQ29udHJhY3QJALkJAgkAzAgCAgIlcwkAzAgCAhBlbWlzc2lvbkNvbnRyYWN0BQNuaWwFCXNlcGFyYXRvcgATa2V5Qm9vc3RpbmdDb250cmFjdAkAuQkCCQDMCAICAiVzCQDMCAICEGJvb3N0aW5nQ29udHJhY3QFA25pbAUJc2VwYXJhdG9yAAxrZXlUaHJlc2hvbGQJALkJAgkAzAgCAgIlcwkAzAgCAg92b3RpbmdUaHJlc2hvbGQFA25pbAUJc2VwYXJhdG9yAA9rZXlSYXRlUGVyQmxvY2sJALkJAgkAzAgCAgQlcyVzCQDMCAICDHJhdGVQZXJCbG9jawkAzAgCAgdjdXJyZW50BQNuaWwFCXNlcGFyY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lSW52b2tlCQDMCAIJAQxJbnRlZ2VyRW50cnkCCQEOa2V5U3RhcnRIZWlnaHQABQZoZWlnaHQJAMwIAgkBC1N0cmluZ0VudHJ5AgkBD2tleVZvdGluZ1Jlc3VsdAAJAQp0b3RhbFZvdGVzAwIBMAIBMAIBMAUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuANd5PrQ=", "height": 2583460, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7ZVgY8jEJDCALb44jGL7Varwv6yL21rwCsaATfF7SH6g Next: 5xyV5DreQwUrG6MptNFBGysfgzpq4U1WF4Bc4AhsAsjn Diff:
Old | New | Differences | |
---|---|---|---|
37 | 37 | func totalVotes (totalIncrease,totalNone,totalDecrease) = makeString(["%d%d%d", totalIncrease, totalNone, totalDecrease], separator) | |
38 | 38 | ||
39 | 39 | ||
40 | - | func keyVote (voterAddress) = makeString(["%s%s", "vote", voterAddress], separator) | |
40 | + | func keyVote (voterAddress,startHeight) = makeString(["%s%s%d", "vote", voterAddress, toString(startHeight)], separator) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func keyVoteValue (gwxAmount,vote) = { | |
147 | 147 | ||
148 | 148 | @Callable(i) | |
149 | 149 | func vote (inFavor) = { | |
150 | - | let votingFinishHeight = (value(getInteger(keyStartHeight())) + value(getInteger(keyEpochLength))) | |
150 | + | let startHeight = getIntegerValue(keyStartHeight()) | |
151 | + | let votingFinishHeight = (startHeight + value(getInteger(keyEpochLength))) | |
151 | 152 | let checks = [if ((votingFinishHeight > height)) | |
152 | 153 | then true | |
153 | 154 | else throwErr("too late to vote"), if (containsElement([1, 0, -1], inFavor)) | |
161 | 162 | else throwErr("you don't have gwx") | |
162 | 163 | if ((notZero == notZero)) | |
163 | 164 | then { | |
164 | - | let vote = match getString(keyVote(toString(i.caller))) { | |
165 | + | let vote = match getString(keyVote(toString(i.caller), startHeight)) { | |
165 | 166 | case s: String => | |
166 | 167 | let vote = split(s, separator) | |
167 | 168 | let voteValue = vote[1] | |
211 | 212 | let newNoneVotes = (parseIntValue(votesForCurrent) + asInt(gwxAmount)) | |
212 | 213 | [votesForIncrease, toString(newNoneVotes), votesForDecrease] | |
213 | 214 | } | |
214 | - | let voteKey = keyVote(toString(i.caller)) | |
215 | + | let voteKey = keyVote(toString(i.caller), startHeight) | |
215 | 216 | let voteValue = keyVoteValue(toString(asInt(gwxAmount)), inFavor) | |
216 | 217 | $Tuple2([StringEntry(keyVotingResult(), totalVotes(newPositiveAndNegativeVotes[0], newPositiveAndNegativeVotes[1], newPositiveAndNegativeVotes[2])), StringEntry(voteKey, voteValue)], unit) | |
217 | 218 | } | |
226 | 227 | ||
227 | 228 | @Callable(i) | |
228 | 229 | func cancelVote () = { | |
230 | + | let startHeight = getIntegerValue(keyStartHeight()) | |
229 | 231 | let userAddress = if ((i.caller == this)) | |
230 | 232 | then toString(i.originCaller) | |
231 | 233 | else toString(i.caller) | |
234 | 236 | else throwErr("no vote")] | |
235 | 237 | if ((checks == checks)) | |
236 | 238 | then { | |
237 | - | let vote = split(value(getString(keyVote(userAddress))), separator) | |
239 | + | let vote = split(value(getString(keyVote(userAddress, startHeight))), separator) | |
238 | 240 | let voteValue = vote[1] | |
239 | 241 | let voteType = vote[2] | |
240 | 242 | let votingResult = split(value(getString(keyVotingResult())), separator) | |
244 | 246 | let actions = if ((voteType == "increase")) | |
245 | 247 | then { | |
246 | 248 | let newIncreaseVotes = (parseIntValue(votesForIncrease) - parseIntValue(voteValue)) | |
247 | - | ||
249 | + | [StringEntry(keyVotingResult(), totalVotes(toString(newIncreaseVotes), votesForCurrent, votesForDecrease))] | |
248 | 250 | } | |
249 | 251 | else if ((voteType == "decrease")) | |
250 | 252 | then { | |
251 | 253 | let newDecreaseVotes = (parseIntValue(votesForDecrease) - parseIntValue(voteValue)) | |
252 | - | ||
254 | + | [StringEntry(keyVotingResult(), totalVotes(votesForIncrease, votesForCurrent, toString(newDecreaseVotes)))] | |
253 | 255 | } | |
254 | 256 | else { | |
255 | 257 | let newCurrentVotes = (parseIntValue(votesForCurrent) - parseIntValue(voteValue)) | |
256 | - | ||
258 | + | [StringEntry(keyVotingResult(), totalVotes(votesForIncrease, toString(newCurrentVotes), votesForDecrease))] | |
257 | 259 | } | |
258 | - | actions | |
260 | + | let defaultActions = [DeleteEntry(keyVote(userAddress, startHeight))] | |
261 | + | (actions ++ defaultActions) | |
259 | 262 | } | |
260 | 263 | else throw("Strict value is not equal to itself.") | |
261 | 264 | } | |
288 | 291 | let votesForDecrease = parseIntValue(votingResult[3]) | |
289 | 292 | let allVotes = ((votesForIncrease + votesForCurrent) + votesForDecrease) | |
290 | 293 | let threshold = getIntOrFail(keyThreshold) | |
291 | - | let $ | |
292 | - | let increasedRate = $ | |
293 | - | let currentRate = $ | |
294 | - | let decreasedRate = $ | |
294 | + | let $t092319311 = getRateChangeAmountsINTERNAL() | |
295 | + | let increasedRate = $t092319311._1 | |
296 | + | let currentRate = $t092319311._2 | |
297 | + | let decreasedRate = $t092319311._3 | |
295 | 298 | let votesList = [votesForIncrease, votesForCurrent, votesForDecrease] | |
296 | 299 | let newRate = if (if ((threshold > allVotes)) | |
297 | 300 | then true |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "__" | |
5 | 5 | ||
6 | 6 | let contractFilename = "voting_emission_rate.ride" | |
7 | 7 | ||
8 | 8 | let keyEpochLength = makeString(["%s", "epochLength"], separator) | |
9 | 9 | ||
10 | 10 | let keyEmissionContract = makeString(["%s", "emissionContract"], separator) | |
11 | 11 | ||
12 | 12 | let keyBoostingContract = makeString(["%s", "boostingContract"], separator) | |
13 | 13 | ||
14 | 14 | let keyThreshold = makeString(["%s", "votingThreshold"], separator) | |
15 | 15 | ||
16 | 16 | let keyRatePerBlock = makeString(["%s%s", "ratePerBlock", "current"], separator) | |
17 | 17 | ||
18 | 18 | let keyRatePerBlockMax = makeString(["%s%s", "ratePerBlockMax", "current"], separator) | |
19 | 19 | ||
20 | 20 | let keyRateChangeStep = makeString(["%s", "rateChangeStep"], separator) | |
21 | 21 | ||
22 | 22 | func throwErr (s) = throw(((contractFilename + ": ") + s)) | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " is not defined")) | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func getIntOrFail (key) = valueOrErrorMessage(getInteger(this, key), (key + " is not defined")) | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func keyStartHeight () = makeString(["%s", "startHeight"], separator) | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func keyVotingResult () = makeString(["%s", "votingResult"], separator) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func totalVotes (totalIncrease,totalNone,totalDecrease) = makeString(["%d%d%d", totalIncrease, totalNone, totalDecrease], separator) | |
38 | 38 | ||
39 | 39 | ||
40 | - | func keyVote (voterAddress) = makeString(["%s%s", "vote", voterAddress], separator) | |
40 | + | func keyVote (voterAddress,startHeight) = makeString(["%s%s%d", "vote", voterAddress, toString(startHeight)], separator) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func keyVoteValue (gwxAmount,vote) = { | |
44 | 44 | let key = if ((vote == 1)) | |
45 | 45 | then makeString(["%d%s", gwxAmount, "increase"], separator) | |
46 | 46 | else if ((vote == -1)) | |
47 | 47 | then makeString(["%d%s", gwxAmount, "decrease"], separator) | |
48 | 48 | else makeString(["%d%s", gwxAmount, "current"], separator) | |
49 | 49 | key | |
50 | 50 | } | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | let boostingContract = addressFromStringValue(getStringOrFail(keyBoostingContract)) | |
54 | 54 | ||
55 | 55 | let emissionContract = addressFromStringValue(getStringOrFail(keyEmissionContract)) | |
56 | 56 | ||
57 | 57 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
64 | 64 | case s: String => | |
65 | 65 | addressFromStringValue(s) | |
66 | 66 | case _ => | |
67 | 67 | this | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func managerPublicKeyOrUnit () = { | |
72 | 72 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
73 | 73 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
74 | 74 | case s: String => | |
75 | 75 | fromBase58String(s) | |
76 | 76 | case _: Unit => | |
77 | 77 | unit | |
78 | 78 | case _ => | |
79 | 79 | throw("Match error") | |
80 | 80 | } | |
81 | 81 | } | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func isManager (i) = match managerPublicKeyOrUnit() { | |
85 | 85 | case pk: ByteVector => | |
86 | 86 | (i.callerPublicKey == pk) | |
87 | 87 | case _: Unit => | |
88 | 88 | (i.caller == this) | |
89 | 89 | case _ => | |
90 | 90 | throw("Match error") | |
91 | 91 | } | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func mustManager (i) = if (isManager(i)) | |
95 | 95 | then true | |
96 | 96 | else throwErr("permission denied") | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func asInt (val) = match val { | |
100 | 100 | case valInt: Int => | |
101 | 101 | valInt | |
102 | 102 | case _ => | |
103 | 103 | throwErr("failed to cast into Integer") | |
104 | 104 | } | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | func calcNewRate (ratePerBlockMax,ratePerBlock,changeStep) = { | |
108 | 108 | let maxAllowed = fraction(100, ratePerBlockMax, 120) | |
109 | 109 | let increasedRate = min([fraction((100 + changeStep), ratePerBlock, 100), maxAllowed]) | |
110 | 110 | let decreasedRate = max([fraction((100 - changeStep), ratePerBlock, 100), 0]) | |
111 | 111 | $Tuple3(increasedRate, ratePerBlock, decreasedRate) | |
112 | 112 | } | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func getRateChangeAmountsINTERNAL () = { | |
116 | 116 | let ratePerBlockMax = getIntegerValue(emissionContract, keyRatePerBlockMax) | |
117 | 117 | let ratePerBlock = getIntegerValue(emissionContract, keyRatePerBlock) | |
118 | 118 | let rateChangeStep = getIntegerValue(this, keyRateChangeStep) | |
119 | 119 | calcNewRate(ratePerBlockMax, ratePerBlock, rateChangeStep) | |
120 | 120 | } | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | @Callable(i) | |
124 | 124 | func constructor (boostingContractPrm,emissionContractPrm,votingDurationPrm,threshold,rateChangeStep) = { | |
125 | 125 | let checks = [if (isDefined(addressFromString(boostingContractPrm))) | |
126 | 126 | then true | |
127 | 127 | else throwErr("Invalid boosting contract address"), if (isDefined(addressFromString(emissionContractPrm))) | |
128 | 128 | then true | |
129 | 129 | else throwErr("Invalid emission contract address"), if ((votingDurationPrm > 0)) | |
130 | 130 | then true | |
131 | 131 | else throwErr("Invalid voting duration"), if ((threshold > 0)) | |
132 | 132 | then true | |
133 | 133 | else throwErr("invalid threshold"), if ((rateChangeStep > 0)) | |
134 | 134 | then true | |
135 | 135 | else throwErr("invalid rateChangeStep")] | |
136 | 136 | if ((checks == checks)) | |
137 | 137 | then $Tuple2([StringEntry(keyBoostingContract, boostingContractPrm), StringEntry(keyEmissionContract, emissionContractPrm), IntegerEntry(keyEpochLength, votingDurationPrm), IntegerEntry(keyThreshold, threshold), IntegerEntry(keyRateChangeStep, rateChangeStep), IntegerEntry(keyStartHeight(), height), StringEntry(keyVotingResult(), totalVotes("0", "0", "0"))], unit) | |
138 | 138 | else throw("Strict value is not equal to itself.") | |
139 | 139 | } | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | ||
143 | 143 | @Callable(i) | |
144 | 144 | func getRateChangeAmountsREADONLY () = $Tuple2(nil, getRateChangeAmountsINTERNAL()) | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | ||
148 | 148 | @Callable(i) | |
149 | 149 | func vote (inFavor) = { | |
150 | - | let votingFinishHeight = (value(getInteger(keyStartHeight())) + value(getInteger(keyEpochLength))) | |
150 | + | let startHeight = getIntegerValue(keyStartHeight()) | |
151 | + | let votingFinishHeight = (startHeight + value(getInteger(keyEpochLength))) | |
151 | 152 | let checks = [if ((votingFinishHeight > height)) | |
152 | 153 | then true | |
153 | 154 | else throwErr("too late to vote"), if (containsElement([1, 0, -1], inFavor)) | |
154 | 155 | then true | |
155 | 156 | else throwErr("not valid argument")] | |
156 | 157 | if ((checks == checks)) | |
157 | 158 | then { | |
158 | 159 | let gwxAmount = invoke(boostingContract, "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), votingFinishHeight], nil) | |
159 | 160 | let notZero = if ((asInt(gwxAmount) > 0)) | |
160 | 161 | then true | |
161 | 162 | else throwErr("you don't have gwx") | |
162 | 163 | if ((notZero == notZero)) | |
163 | 164 | then { | |
164 | - | let vote = match getString(keyVote(toString(i.caller))) { | |
165 | + | let vote = match getString(keyVote(toString(i.caller), startHeight)) { | |
165 | 166 | case s: String => | |
166 | 167 | let vote = split(s, separator) | |
167 | 168 | let voteValue = vote[1] | |
168 | 169 | let voteType = vote[2] | |
169 | 170 | let isVoteTypeSimilar = if (if (if ((voteType == "increase")) | |
170 | 171 | then (inFavor == 1) | |
171 | 172 | else false) | |
172 | 173 | then true | |
173 | 174 | else if ((voteType == "decrease")) | |
174 | 175 | then (inFavor == -1) | |
175 | 176 | else false) | |
176 | 177 | then true | |
177 | 178 | else if ((voteType == "current")) | |
178 | 179 | then (inFavor == 0) | |
179 | 180 | else false | |
180 | 181 | let isVoteValueSimilar = if (isVoteTypeSimilar) | |
181 | 182 | then (asInt(gwxAmount) == parseIntValue(voteValue)) | |
182 | 183 | else false | |
183 | 184 | let isNewVoteSimilar = if (if (isVoteTypeSimilar) | |
184 | 185 | then isVoteValueSimilar | |
185 | 186 | else false) | |
186 | 187 | then throwErr("you already voted") | |
187 | 188 | else invoke(this, "cancelVote", nil, nil) | |
188 | 189 | isNewVoteSimilar | |
189 | 190 | case u: Unit => | |
190 | 191 | u | |
191 | 192 | case _ => | |
192 | 193 | throw("Match error") | |
193 | 194 | } | |
194 | 195 | if ((vote == vote)) | |
195 | 196 | then { | |
196 | 197 | let votingResult = split(value(getString(keyVotingResult())), separator) | |
197 | 198 | let votesForIncrease = votingResult[1] | |
198 | 199 | let votesForCurrent = votingResult[2] | |
199 | 200 | let votesForDecrease = votingResult[3] | |
200 | 201 | let newPositiveAndNegativeVotes = if ((inFavor == 1)) | |
201 | 202 | then { | |
202 | 203 | let newPositiveVotes = (parseIntValue(votesForIncrease) + asInt(gwxAmount)) | |
203 | 204 | [toString(newPositiveVotes), votesForCurrent, votesForDecrease] | |
204 | 205 | } | |
205 | 206 | else if ((inFavor == -1)) | |
206 | 207 | then { | |
207 | 208 | let newNegativeVotes = (parseIntValue(votesForCurrent) + asInt(gwxAmount)) | |
208 | 209 | [votesForIncrease, votesForCurrent, toString(newNegativeVotes)] | |
209 | 210 | } | |
210 | 211 | else { | |
211 | 212 | let newNoneVotes = (parseIntValue(votesForCurrent) + asInt(gwxAmount)) | |
212 | 213 | [votesForIncrease, toString(newNoneVotes), votesForDecrease] | |
213 | 214 | } | |
214 | - | let voteKey = keyVote(toString(i.caller)) | |
215 | + | let voteKey = keyVote(toString(i.caller), startHeight) | |
215 | 216 | let voteValue = keyVoteValue(toString(asInt(gwxAmount)), inFavor) | |
216 | 217 | $Tuple2([StringEntry(keyVotingResult(), totalVotes(newPositiveAndNegativeVotes[0], newPositiveAndNegativeVotes[1], newPositiveAndNegativeVotes[2])), StringEntry(voteKey, voteValue)], unit) | |
217 | 218 | } | |
218 | 219 | else throw("Strict value is not equal to itself.") | |
219 | 220 | } | |
220 | 221 | else throw("Strict value is not equal to itself.") | |
221 | 222 | } | |
222 | 223 | else throw("Strict value is not equal to itself.") | |
223 | 224 | } | |
224 | 225 | ||
225 | 226 | ||
226 | 227 | ||
227 | 228 | @Callable(i) | |
228 | 229 | func cancelVote () = { | |
230 | + | let startHeight = getIntegerValue(keyStartHeight()) | |
229 | 231 | let userAddress = if ((i.caller == this)) | |
230 | 232 | then toString(i.originCaller) | |
231 | 233 | else toString(i.caller) | |
232 | 234 | let checks = [if (isDefined(getString(keyVotingResult()))) | |
233 | 235 | then true | |
234 | 236 | else throwErr("no vote")] | |
235 | 237 | if ((checks == checks)) | |
236 | 238 | then { | |
237 | - | let vote = split(value(getString(keyVote(userAddress))), separator) | |
239 | + | let vote = split(value(getString(keyVote(userAddress, startHeight))), separator) | |
238 | 240 | let voteValue = vote[1] | |
239 | 241 | let voteType = vote[2] | |
240 | 242 | let votingResult = split(value(getString(keyVotingResult())), separator) | |
241 | 243 | let votesForIncrease = votingResult[1] | |
242 | 244 | let votesForCurrent = votingResult[2] | |
243 | 245 | let votesForDecrease = votingResult[3] | |
244 | 246 | let actions = if ((voteType == "increase")) | |
245 | 247 | then { | |
246 | 248 | let newIncreaseVotes = (parseIntValue(votesForIncrease) - parseIntValue(voteValue)) | |
247 | - | ||
249 | + | [StringEntry(keyVotingResult(), totalVotes(toString(newIncreaseVotes), votesForCurrent, votesForDecrease))] | |
248 | 250 | } | |
249 | 251 | else if ((voteType == "decrease")) | |
250 | 252 | then { | |
251 | 253 | let newDecreaseVotes = (parseIntValue(votesForDecrease) - parseIntValue(voteValue)) | |
252 | - | ||
254 | + | [StringEntry(keyVotingResult(), totalVotes(votesForIncrease, votesForCurrent, toString(newDecreaseVotes)))] | |
253 | 255 | } | |
254 | 256 | else { | |
255 | 257 | let newCurrentVotes = (parseIntValue(votesForCurrent) - parseIntValue(voteValue)) | |
256 | - | ||
258 | + | [StringEntry(keyVotingResult(), totalVotes(votesForIncrease, toString(newCurrentVotes), votesForDecrease))] | |
257 | 259 | } | |
258 | - | actions | |
260 | + | let defaultActions = [DeleteEntry(keyVote(userAddress, startHeight))] | |
261 | + | (actions ++ defaultActions) | |
259 | 262 | } | |
260 | 263 | else throw("Strict value is not equal to itself.") | |
261 | 264 | } | |
262 | 265 | ||
263 | 266 | ||
264 | 267 | ||
265 | 268 | @Callable(i) | |
266 | 269 | func setThreshold (newThreshold) = { | |
267 | 270 | let checks = [mustManager(i), if ((newThreshold > 0)) | |
268 | 271 | then true | |
269 | 272 | else throwErr("invalid threshold")] | |
270 | 273 | if ((checks == checks)) | |
271 | 274 | then $Tuple2([IntegerEntry(keyThreshold, newThreshold)], unit) | |
272 | 275 | else throw("Strict value is not equal to itself.") | |
273 | 276 | } | |
274 | 277 | ||
275 | 278 | ||
276 | 279 | ||
277 | 280 | @Callable(i) | |
278 | 281 | func finalize () = { | |
279 | 282 | let votingFinishHeight = (value(getInteger(keyStartHeight())) + value(getInteger(keyEpochLength))) | |
280 | 283 | let checks = [if ((height >= votingFinishHeight)) | |
281 | 284 | then true | |
282 | 285 | else throwErr("insufficient height for completion")] | |
283 | 286 | if ((checks == checks)) | |
284 | 287 | then { | |
285 | 288 | let votingResult = split(value(getString(keyVotingResult())), separator) | |
286 | 289 | let votesForIncrease = parseIntValue(votingResult[1]) | |
287 | 290 | let votesForCurrent = parseIntValue(votingResult[2]) | |
288 | 291 | let votesForDecrease = parseIntValue(votingResult[3]) | |
289 | 292 | let allVotes = ((votesForIncrease + votesForCurrent) + votesForDecrease) | |
290 | 293 | let threshold = getIntOrFail(keyThreshold) | |
291 | - | let $ | |
292 | - | let increasedRate = $ | |
293 | - | let currentRate = $ | |
294 | - | let decreasedRate = $ | |
294 | + | let $t092319311 = getRateChangeAmountsINTERNAL() | |
295 | + | let increasedRate = $t092319311._1 | |
296 | + | let currentRate = $t092319311._2 | |
297 | + | let decreasedRate = $t092319311._3 | |
295 | 298 | let votesList = [votesForIncrease, votesForCurrent, votesForDecrease] | |
296 | 299 | let newRate = if (if ((threshold > allVotes)) | |
297 | 300 | then true | |
298 | 301 | else (votesForCurrent == max(votesList))) | |
299 | 302 | then unit | |
300 | 303 | else if ((votesForIncrease == max(votesList))) | |
301 | 304 | then increasedRate | |
302 | 305 | else decreasedRate | |
303 | 306 | let changeRateInvoke = match newRate { | |
304 | 307 | case rate: Int => | |
305 | 308 | invoke(emissionContract, "changeRatePerBlock", [rate], nil) | |
306 | 309 | case _ => | |
307 | 310 | unit | |
308 | 311 | } | |
309 | 312 | if ((changeRateInvoke == changeRateInvoke)) | |
310 | 313 | then [IntegerEntry(keyStartHeight(), height), StringEntry(keyVotingResult(), totalVotes("0", "0", "0"))] | |
311 | 314 | else throw("Strict value is not equal to itself.") | |
312 | 315 | } | |
313 | 316 | else throw("Strict value is not equal to itself.") | |
314 | 317 | } | |
315 | 318 | ||
316 | 319 |
github/deemru/w8io/026f985 44.85 ms ◑