tx · 7ZVgY8jEJDCALb44jGL7Varwv6yL21rwCsaATfF7SH6g

3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh:  -0.01000000 Waves

2023.05.18 16:07 [2583437] smart account 3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh > SELF 0.00000000 Waves

{ "type": 13, "id": "7ZVgY8jEJDCALb44jGL7Varwv6yL21rwCsaATfF7SH6g", "fee": 1000000, "feeAssetId": null, "timestamp": 1684415309570, "version": 2, "chainId": 84, "sender": "3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh", "senderPublicKey": "EU9obW1yVhR8qug3EmXPeew3DMagvJFQzY5Ku8bmcsU7", "proofs": [ "62F3cYFDpF6CKpHLCdPs5YMukhzEmMmUMYi3Uo5vhzCzkLqzeSNUbSEhXQVoExLodiN7pXuGDQAHKtKWgKpU64SK" ], "script": "base64:BgIbCAISBwoFCAgBAQESABIDCgEBEgASAwoBARIAHAAJc2VwYXJhdG9yAgJfXwAQY29udHJhY3RGaWxlbmFtZQIZdm90aW5nX2VtaXNzaW9uX3JhdGUucmlkZQAOa2V5RXBvY2hMZW5ndGgJALkJAgkAzAgCAgIlcwkAzAgCAgtlcG9jaExlbmd0aAUDbmlsBQlzZXBhcmF0b3IAE2tleUVtaXNzaW9uQ29udHJhY3QJALkJAgkAzAgCAgIlcwkAzAgCAhBlbWlzc2lvbkNvbnRyYWN0BQNuaWwFCXNlcGFyYXRvcgATa2V5Qm9vc3RpbmdDb250cmFjdAkAuQkCCQDMCAICAiVzCQDMCAICEGJvb3N0aW5nQ29udHJhY3QFA25pbAUJc2VwYXJhdG9yAAxrZXlUaHJlc2hvbGQJALkJAgkAzAgCAgIlcwkAzAgCAg92b3RpbmdUaHJlc2hvbGQFA25pbAUJc2VwYXJhdG9yAA9rZXlSYXRlUGVyQmxvY2sJALkJAgkAzAgCAgQlcyVzCQDMCAICDHJhdGVQZXJCbG9jawkAzAgCAgdjdXJyZW50BQNuaWwFCXNlcGFyY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WxWb3RlcwMCATACATACATAFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgDT7wz0", "height": 2583437, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 75H7XxBiqjXVS1RAzut7RK42aV16oZ1xhQGzPfdHXfD9 Next: 5DHqA3M2YdRrmdfsQpq33J9SEPAjaTbp5wQLUFoUQrem Diff:
OldNewDifferences
4545 then makeString(["%d%s", gwxAmount, "increase"], separator)
4646 else if ((vote == -1))
4747 then makeString(["%d%s", gwxAmount, "decrease"], separator)
48- else makeString(["%d%s", gwxAmount, "none"], separator)
48+ else makeString(["%d%s", gwxAmount, "current"], separator)
4949 key
5050 }
5151
174174 then (inFavor == -1)
175175 else false)
176176 then true
177- else if ((voteType == "none"))
177+ else if ((voteType == "current"))
178178 then (inFavor == 0)
179179 else false
180180 let isVoteValueSimilar = if (isVoteTypeSimilar)
194194 if ((vote == vote))
195195 then {
196196 let votingResult = split(value(getString(keyVotingResult())), separator)
197- let votesToIncrease = votingResult[1]
198- let votesToNone = votingResult[2]
199- let votesToDecrease = votingResult[3]
197+ let votesForIncrease = votingResult[1]
198+ let votesForCurrent = votingResult[2]
199+ let votesForDecrease = votingResult[3]
200200 let newPositiveAndNegativeVotes = if ((inFavor == 1))
201201 then {
202- let newPositiveVotes = (parseIntValue(votesToIncrease) + asInt(gwxAmount))
203-[toString(newPositiveVotes), votesToNone, votesToDecrease]
202+ let newPositiveVotes = (parseIntValue(votesForIncrease) + asInt(gwxAmount))
203+[toString(newPositiveVotes), votesForCurrent, votesForDecrease]
204204 }
205205 else if ((inFavor == -1))
206206 then {
207- let newNegativeVotes = (parseIntValue(votesToNone) + asInt(gwxAmount))
208-[votesToIncrease, votesToNone, toString(newNegativeVotes)]
207+ let newNegativeVotes = (parseIntValue(votesForCurrent) + asInt(gwxAmount))
208+[votesForIncrease, votesForCurrent, toString(newNegativeVotes)]
209209 }
210210 else {
211- let newNoneVotes = (parseIntValue(votesToNone) + asInt(gwxAmount))
212-[votesToIncrease, toString(newNoneVotes), votesToDecrease]
211+ let newNoneVotes = (parseIntValue(votesForCurrent) + asInt(gwxAmount))
212+[votesForIncrease, toString(newNoneVotes), votesForDecrease]
213213 }
214214 let voteKey = keyVote(toString(i.caller))
215215 let voteValue = keyVoteValue(toString(asInt(gwxAmount)), inFavor)
238238 let voteValue = vote[1]
239239 let voteType = vote[2]
240240 let votingResult = split(value(getString(keyVotingResult())), separator)
241- let votesToIncrease = votingResult[1]
242- let votesToNone = votingResult[2]
243- let votesToDecrease = votingResult[3]
241+ let votesForIncrease = votingResult[1]
242+ let votesForCurrent = votingResult[2]
243+ let votesForDecrease = votingResult[3]
244244 let actions = if ((voteType == "increase"))
245245 then {
246- let newIncreaseVotes = (parseIntValue(votesToIncrease) - parseIntValue(voteValue))
247- $Tuple2([StringEntry(keyVotingResult(), totalVotes(toString(newIncreaseVotes), votesToNone, votesToDecrease)), DeleteEntry(keyVote(userAddress))], unit)
246+ let newIncreaseVotes = (parseIntValue(votesForIncrease) - parseIntValue(voteValue))
247+ $Tuple2([StringEntry(keyVotingResult(), totalVotes(toString(newIncreaseVotes), votesForCurrent, votesForDecrease)), DeleteEntry(keyVote(userAddress))], unit)
248248 }
249249 else if ((voteType == "decrease"))
250250 then {
251- let newDecreaseVotes = (parseIntValue(votesToDecrease) - parseIntValue(voteValue))
252- $Tuple2([StringEntry(keyVotingResult(), totalVotes(votesToIncrease, votesToNone, toString(newDecreaseVotes))), DeleteEntry(keyVote(userAddress))], unit)
251+ let newDecreaseVotes = (parseIntValue(votesForDecrease) - parseIntValue(voteValue))
252+ $Tuple2([StringEntry(keyVotingResult(), totalVotes(votesForIncrease, votesForCurrent, toString(newDecreaseVotes))), DeleteEntry(keyVote(userAddress))], unit)
253253 }
254254 else {
255- let newNoneVotes = (parseIntValue(votesToNone) - parseIntValue(voteValue))
256- $Tuple2([StringEntry(keyVotingResult(), totalVotes(votesToIncrease, toString(newNoneVotes), votesToDecrease)), DeleteEntry(keyVote(userAddress))], unit)
255+ let newCurrentVotes = (parseIntValue(votesForCurrent) - parseIntValue(voteValue))
256+ $Tuple2([StringEntry(keyVotingResult(), totalVotes(votesForIncrease, toString(newCurrentVotes), votesForDecrease)), DeleteEntry(keyVote(userAddress))], unit)
257257 }
258258 actions
259259 }
283283 if ((checks == checks))
284284 then {
285285 let votingResult = split(value(getString(keyVotingResult())), separator)
286- let votesToIncrease = parseIntValue(votingResult[1])
287- let votesToNone = parseIntValue(votingResult[2])
288- let votesToDecrease = parseIntValue(votingResult[3])
289- let allVotes = ((votesToIncrease + votesToNone) + votesToDecrease)
286+ let votesForIncrease = parseIntValue(votingResult[1])
287+ let votesForCurrent = parseIntValue(votingResult[2])
288+ let votesForDecrease = parseIntValue(votingResult[3])
289+ let allVotes = ((votesForIncrease + votesForCurrent) + votesForDecrease)
290290 let threshold = getIntOrFail(keyThreshold)
291- let $t090759155 = getRateChangeAmountsINTERNAL()
292- let increasedRate = $t090759155._1
293- let currentRate = $t090759155._2
294- let decreasedRate = $t090759155._3
295- let votesList = [votesToIncrease, votesToNone, votesToDecrease]
296- let actions = if ((threshold > allVotes))
297- then nil
298- else if ((votesToNone == max(votesList)))
299- then [StringEntry("foo", "NONE"), IntegerEntry("bar", currentRate)]
300- else if ((votesToIncrease == max(votesList)))
301- then [StringEntry("foo", "INC"), IntegerEntry("bar", increasedRate)]
302- else [StringEntry("foo", "DEC"), IntegerEntry("bar", decreasedRate)]
303- (actions ++ [IntegerEntry(keyStartHeight(), height)])
291+ let $t091419221 = getRateChangeAmountsINTERNAL()
292+ let increasedRate = $t091419221._1
293+ let currentRate = $t091419221._2
294+ let decreasedRate = $t091419221._3
295+ let votesList = [votesForIncrease, votesForCurrent, votesForDecrease]
296+ let newRate = if (if ((threshold > allVotes))
297+ then true
298+ else (votesForCurrent == max(votesList)))
299+ then unit
300+ else if ((votesForIncrease == max(votesList)))
301+ then increasedRate
302+ else decreasedRate
303+ let changeRateInvoke = match newRate {
304+ case rate: Int =>
305+ invoke(emissionContract, "changeRatePerBlock", [rate], nil)
306+ case _ =>
307+ unit
308+ }
309+ if ((changeRateInvoke == changeRateInvoke))
310+ then [IntegerEntry(keyStartHeight(), height), StringEntry(keyVotingResult(), totalVotes("0", "0", "0"))]
311+ else throw("Strict value is not equal to itself.")
304312 }
305313 else throw("Strict value is not equal to itself.")
306314 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let separator = "__"
55
66 let contractFilename = "voting_emission_rate.ride"
77
88 let keyEpochLength = makeString(["%s", "epochLength"], separator)
99
1010 let keyEmissionContract = makeString(["%s", "emissionContract"], separator)
1111
1212 let keyBoostingContract = makeString(["%s", "boostingContract"], separator)
1313
1414 let keyThreshold = makeString(["%s", "votingThreshold"], separator)
1515
1616 let keyRatePerBlock = makeString(["%s%s", "ratePerBlock", "current"], separator)
1717
1818 let keyRatePerBlockMax = makeString(["%s%s", "ratePerBlockMax", "current"], separator)
1919
2020 let keyRateChangeStep = makeString(["%s", "rateChangeStep"], separator)
2121
2222 func throwErr (s) = throw(((contractFilename + ": ") + s))
2323
2424
2525 func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " is not defined"))
2626
2727
2828 func getIntOrFail (key) = valueOrErrorMessage(getInteger(this, key), (key + " is not defined"))
2929
3030
3131 func keyStartHeight () = makeString(["%s", "startHeight"], separator)
3232
3333
3434 func keyVotingResult () = makeString(["%s", "votingResult"], separator)
3535
3636
3737 func totalVotes (totalIncrease,totalNone,totalDecrease) = makeString(["%d%d%d", totalIncrease, totalNone, totalDecrease], separator)
3838
3939
4040 func keyVote (voterAddress) = makeString(["%s%s", "vote", voterAddress], separator)
4141
4242
4343 func keyVoteValue (gwxAmount,vote) = {
4444 let key = if ((vote == 1))
4545 then makeString(["%d%s", gwxAmount, "increase"], separator)
4646 else if ((vote == -1))
4747 then makeString(["%d%s", gwxAmount, "decrease"], separator)
48- else makeString(["%d%s", gwxAmount, "none"], separator)
48+ else makeString(["%d%s", gwxAmount, "current"], separator)
4949 key
5050 }
5151
5252
5353 let boostingContract = addressFromStringValue(getStringOrFail(keyBoostingContract))
5454
5555 let emissionContract = addressFromStringValue(getStringOrFail(keyEmissionContract))
5656
5757 func keyManagerPublicKey () = "%s__managerPublicKey"
5858
5959
6060 func keyManagerVaultAddress () = "%s__managerVaultAddress"
6161
6262
6363 func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) {
6464 case s: String =>
6565 addressFromStringValue(s)
6666 case _ =>
6767 this
6868 }
6969
7070
7171 func managerPublicKeyOrUnit () = {
7272 let managerVaultAddress = getManagerVaultAddressOrThis()
7373 match getString(managerVaultAddress, keyManagerPublicKey()) {
7474 case s: String =>
7575 fromBase58String(s)
7676 case _: Unit =>
7777 unit
7878 case _ =>
7979 throw("Match error")
8080 }
8181 }
8282
8383
8484 func isManager (i) = match managerPublicKeyOrUnit() {
8585 case pk: ByteVector =>
8686 (i.callerPublicKey == pk)
8787 case _: Unit =>
8888 (i.caller == this)
8989 case _ =>
9090 throw("Match error")
9191 }
9292
9393
9494 func mustManager (i) = if (isManager(i))
9595 then true
9696 else throwErr("permission denied")
9797
9898
9999 func asInt (val) = match val {
100100 case valInt: Int =>
101101 valInt
102102 case _ =>
103103 throwErr("failed to cast into Integer")
104104 }
105105
106106
107107 func calcNewRate (ratePerBlockMax,ratePerBlock,changeStep) = {
108108 let maxAllowed = fraction(100, ratePerBlockMax, 120)
109109 let increasedRate = min([fraction((100 + changeStep), ratePerBlock, 100), maxAllowed])
110110 let decreasedRate = max([fraction((100 - changeStep), ratePerBlock, 100), 0])
111111 $Tuple3(increasedRate, ratePerBlock, decreasedRate)
112112 }
113113
114114
115115 func getRateChangeAmountsINTERNAL () = {
116116 let ratePerBlockMax = getIntegerValue(emissionContract, keyRatePerBlockMax)
117117 let ratePerBlock = getIntegerValue(emissionContract, keyRatePerBlock)
118118 let rateChangeStep = getIntegerValue(this, keyRateChangeStep)
119119 calcNewRate(ratePerBlockMax, ratePerBlock, rateChangeStep)
120120 }
121121
122122
123123 @Callable(i)
124124 func constructor (boostingContractPrm,emissionContractPrm,votingDurationPrm,threshold,rateChangeStep) = {
125125 let checks = [if (isDefined(addressFromString(boostingContractPrm)))
126126 then true
127127 else throwErr("Invalid boosting contract address"), if (isDefined(addressFromString(emissionContractPrm)))
128128 then true
129129 else throwErr("Invalid emission contract address"), if ((votingDurationPrm > 0))
130130 then true
131131 else throwErr("Invalid voting duration"), if ((threshold > 0))
132132 then true
133133 else throwErr("invalid threshold"), if ((rateChangeStep > 0))
134134 then true
135135 else throwErr("invalid rateChangeStep")]
136136 if ((checks == checks))
137137 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)
138138 else throw("Strict value is not equal to itself.")
139139 }
140140
141141
142142
143143 @Callable(i)
144144 func getRateChangeAmountsREADONLY () = $Tuple2(nil, getRateChangeAmountsINTERNAL())
145145
146146
147147
148148 @Callable(i)
149149 func vote (inFavor) = {
150150 let votingFinishHeight = (value(getInteger(keyStartHeight())) + value(getInteger(keyEpochLength)))
151151 let checks = [if ((votingFinishHeight > height))
152152 then true
153153 else throwErr("too late to vote"), if (containsElement([1, 0, -1], inFavor))
154154 then true
155155 else throwErr("not valid argument")]
156156 if ((checks == checks))
157157 then {
158158 let gwxAmount = invoke(boostingContract, "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), votingFinishHeight], nil)
159159 let notZero = if ((asInt(gwxAmount) > 0))
160160 then true
161161 else throwErr("you don't have gwx")
162162 if ((notZero == notZero))
163163 then {
164164 let vote = match getString(keyVote(toString(i.caller))) {
165165 case s: String =>
166166 let vote = split(s, separator)
167167 let voteValue = vote[1]
168168 let voteType = vote[2]
169169 let isVoteTypeSimilar = if (if (if ((voteType == "increase"))
170170 then (inFavor == 1)
171171 else false)
172172 then true
173173 else if ((voteType == "decrease"))
174174 then (inFavor == -1)
175175 else false)
176176 then true
177- else if ((voteType == "none"))
177+ else if ((voteType == "current"))
178178 then (inFavor == 0)
179179 else false
180180 let isVoteValueSimilar = if (isVoteTypeSimilar)
181181 then (asInt(gwxAmount) == parseIntValue(voteValue))
182182 else false
183183 let isNewVoteSimilar = if (if (isVoteTypeSimilar)
184184 then isVoteValueSimilar
185185 else false)
186186 then throwErr("you already voted")
187187 else invoke(this, "cancelVote", nil, nil)
188188 isNewVoteSimilar
189189 case u: Unit =>
190190 u
191191 case _ =>
192192 throw("Match error")
193193 }
194194 if ((vote == vote))
195195 then {
196196 let votingResult = split(value(getString(keyVotingResult())), separator)
197- let votesToIncrease = votingResult[1]
198- let votesToNone = votingResult[2]
199- let votesToDecrease = votingResult[3]
197+ let votesForIncrease = votingResult[1]
198+ let votesForCurrent = votingResult[2]
199+ let votesForDecrease = votingResult[3]
200200 let newPositiveAndNegativeVotes = if ((inFavor == 1))
201201 then {
202- let newPositiveVotes = (parseIntValue(votesToIncrease) + asInt(gwxAmount))
203-[toString(newPositiveVotes), votesToNone, votesToDecrease]
202+ let newPositiveVotes = (parseIntValue(votesForIncrease) + asInt(gwxAmount))
203+[toString(newPositiveVotes), votesForCurrent, votesForDecrease]
204204 }
205205 else if ((inFavor == -1))
206206 then {
207- let newNegativeVotes = (parseIntValue(votesToNone) + asInt(gwxAmount))
208-[votesToIncrease, votesToNone, toString(newNegativeVotes)]
207+ let newNegativeVotes = (parseIntValue(votesForCurrent) + asInt(gwxAmount))
208+[votesForIncrease, votesForCurrent, toString(newNegativeVotes)]
209209 }
210210 else {
211- let newNoneVotes = (parseIntValue(votesToNone) + asInt(gwxAmount))
212-[votesToIncrease, toString(newNoneVotes), votesToDecrease]
211+ let newNoneVotes = (parseIntValue(votesForCurrent) + asInt(gwxAmount))
212+[votesForIncrease, toString(newNoneVotes), votesForDecrease]
213213 }
214214 let voteKey = keyVote(toString(i.caller))
215215 let voteValue = keyVoteValue(toString(asInt(gwxAmount)), inFavor)
216216 $Tuple2([StringEntry(keyVotingResult(), totalVotes(newPositiveAndNegativeVotes[0], newPositiveAndNegativeVotes[1], newPositiveAndNegativeVotes[2])), StringEntry(voteKey, voteValue)], unit)
217217 }
218218 else throw("Strict value is not equal to itself.")
219219 }
220220 else throw("Strict value is not equal to itself.")
221221 }
222222 else throw("Strict value is not equal to itself.")
223223 }
224224
225225
226226
227227 @Callable(i)
228228 func cancelVote () = {
229229 let userAddress = if ((i.caller == this))
230230 then toString(i.originCaller)
231231 else toString(i.caller)
232232 let checks = [if (isDefined(getString(keyVotingResult())))
233233 then true
234234 else throwErr("no vote")]
235235 if ((checks == checks))
236236 then {
237237 let vote = split(value(getString(keyVote(userAddress))), separator)
238238 let voteValue = vote[1]
239239 let voteType = vote[2]
240240 let votingResult = split(value(getString(keyVotingResult())), separator)
241- let votesToIncrease = votingResult[1]
242- let votesToNone = votingResult[2]
243- let votesToDecrease = votingResult[3]
241+ let votesForIncrease = votingResult[1]
242+ let votesForCurrent = votingResult[2]
243+ let votesForDecrease = votingResult[3]
244244 let actions = if ((voteType == "increase"))
245245 then {
246- let newIncreaseVotes = (parseIntValue(votesToIncrease) - parseIntValue(voteValue))
247- $Tuple2([StringEntry(keyVotingResult(), totalVotes(toString(newIncreaseVotes), votesToNone, votesToDecrease)), DeleteEntry(keyVote(userAddress))], unit)
246+ let newIncreaseVotes = (parseIntValue(votesForIncrease) - parseIntValue(voteValue))
247+ $Tuple2([StringEntry(keyVotingResult(), totalVotes(toString(newIncreaseVotes), votesForCurrent, votesForDecrease)), DeleteEntry(keyVote(userAddress))], unit)
248248 }
249249 else if ((voteType == "decrease"))
250250 then {
251- let newDecreaseVotes = (parseIntValue(votesToDecrease) - parseIntValue(voteValue))
252- $Tuple2([StringEntry(keyVotingResult(), totalVotes(votesToIncrease, votesToNone, toString(newDecreaseVotes))), DeleteEntry(keyVote(userAddress))], unit)
251+ let newDecreaseVotes = (parseIntValue(votesForDecrease) - parseIntValue(voteValue))
252+ $Tuple2([StringEntry(keyVotingResult(), totalVotes(votesForIncrease, votesForCurrent, toString(newDecreaseVotes))), DeleteEntry(keyVote(userAddress))], unit)
253253 }
254254 else {
255- let newNoneVotes = (parseIntValue(votesToNone) - parseIntValue(voteValue))
256- $Tuple2([StringEntry(keyVotingResult(), totalVotes(votesToIncrease, toString(newNoneVotes), votesToDecrease)), DeleteEntry(keyVote(userAddress))], unit)
255+ let newCurrentVotes = (parseIntValue(votesForCurrent) - parseIntValue(voteValue))
256+ $Tuple2([StringEntry(keyVotingResult(), totalVotes(votesForIncrease, toString(newCurrentVotes), votesForDecrease)), DeleteEntry(keyVote(userAddress))], unit)
257257 }
258258 actions
259259 }
260260 else throw("Strict value is not equal to itself.")
261261 }
262262
263263
264264
265265 @Callable(i)
266266 func setThreshold (newThreshold) = {
267267 let checks = [mustManager(i), if ((newThreshold > 0))
268268 then true
269269 else throwErr("invalid threshold")]
270270 if ((checks == checks))
271271 then $Tuple2([IntegerEntry(keyThreshold, newThreshold)], unit)
272272 else throw("Strict value is not equal to itself.")
273273 }
274274
275275
276276
277277 @Callable(i)
278278 func finalize () = {
279279 let votingFinishHeight = (value(getInteger(keyStartHeight())) + value(getInteger(keyEpochLength)))
280280 let checks = [if ((height >= votingFinishHeight))
281281 then true
282282 else throwErr("insufficient height for completion")]
283283 if ((checks == checks))
284284 then {
285285 let votingResult = split(value(getString(keyVotingResult())), separator)
286- let votesToIncrease = parseIntValue(votingResult[1])
287- let votesToNone = parseIntValue(votingResult[2])
288- let votesToDecrease = parseIntValue(votingResult[3])
289- let allVotes = ((votesToIncrease + votesToNone) + votesToDecrease)
286+ let votesForIncrease = parseIntValue(votingResult[1])
287+ let votesForCurrent = parseIntValue(votingResult[2])
288+ let votesForDecrease = parseIntValue(votingResult[3])
289+ let allVotes = ((votesForIncrease + votesForCurrent) + votesForDecrease)
290290 let threshold = getIntOrFail(keyThreshold)
291- let $t090759155 = getRateChangeAmountsINTERNAL()
292- let increasedRate = $t090759155._1
293- let currentRate = $t090759155._2
294- let decreasedRate = $t090759155._3
295- let votesList = [votesToIncrease, votesToNone, votesToDecrease]
296- let actions = if ((threshold > allVotes))
297- then nil
298- else if ((votesToNone == max(votesList)))
299- then [StringEntry("foo", "NONE"), IntegerEntry("bar", currentRate)]
300- else if ((votesToIncrease == max(votesList)))
301- then [StringEntry("foo", "INC"), IntegerEntry("bar", increasedRate)]
302- else [StringEntry("foo", "DEC"), IntegerEntry("bar", decreasedRate)]
303- (actions ++ [IntegerEntry(keyStartHeight(), height)])
291+ let $t091419221 = getRateChangeAmountsINTERNAL()
292+ let increasedRate = $t091419221._1
293+ let currentRate = $t091419221._2
294+ let decreasedRate = $t091419221._3
295+ let votesList = [votesForIncrease, votesForCurrent, votesForDecrease]
296+ let newRate = if (if ((threshold > allVotes))
297+ then true
298+ else (votesForCurrent == max(votesList)))
299+ then unit
300+ else if ((votesForIncrease == max(votesList)))
301+ then increasedRate
302+ else decreasedRate
303+ let changeRateInvoke = match newRate {
304+ case rate: Int =>
305+ invoke(emissionContract, "changeRatePerBlock", [rate], nil)
306+ case _ =>
307+ unit
308+ }
309+ if ((changeRateInvoke == changeRateInvoke))
310+ then [IntegerEntry(keyStartHeight(), height), StringEntry(keyVotingResult(), totalVotes("0", "0", "0"))]
311+ else throw("Strict value is not equal to itself.")
304312 }
305313 else throw("Strict value is not equal to itself.")
306314 }
307315
308316

github/deemru/w8io/026f985 
53.80 ms