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:BgIbCAISBwoFCAgBAQESABIDCgEBEgASAwoBARIAHAAJc2VwYXJhdG9yAgJfXwAQY29udHJhY3RGaWxlbmFtZQIZdm90aW5nX2VtaXNzaW9uX3JhdGUucmlkZQAOa2V5RXBvY2hMZW5ndGgJALkJAgkAzAgCAgIlcwkAzAgCAgtlcG9jaExlbmd0aAUDbmlsBQlzZXBhcmF0b3IAE2tleUVtaXNzaW9uQ29udHJhY3QJALkJAgkAzAgCAgIlcwkAzAgCAhBlbWlzc2lvbkNvbnRyYWN0BQNuaWwFCXNlcGFyYXRvcgATa2V5Qm9vc3RpbmdDb250cmFjdAkAuQkCCQDMCAICAiVzCQDMCAICEGJvb3N0aW5nQ29udHJhY3QFA25pbAUJc2VwYXJhdG9yAAxrZXlUaHJlc2hvbGQJALkJAgkAzAgCAgIlcwkAzAgCAg92b3RpbmdUaHJlc2hvbGQFA25pbAUJc2VwYXJhdG9yAA9rZXlSYXRlUGVyQmxvY2sJALkJAgkAzAgCAgQlcyVzCQDMCAICDHJhdGVQZXJCbG9jawkAzAgCAgdjdXJyZW50BQNuaWwFCXNlcGFyYX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xWb3RlcwMCATACATACATAFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgDT7wz0", "height": 2583437, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 75H7XxBiqjXVS1RAzut7RK42aV16oZ1xhQGzPfdHXfD9 Next: 5DHqA3M2YdRrmdfsQpq33J9SEPAjaTbp5wQLUFoUQrem Diff:
Old | New | Differences | |
---|---|---|---|
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 | - | else makeString(["%d%s", gwxAmount, " | |
48 | + | else makeString(["%d%s", gwxAmount, "current"], separator) | |
49 | 49 | key | |
50 | 50 | } | |
51 | 51 | ||
174 | 174 | then (inFavor == -1) | |
175 | 175 | else false) | |
176 | 176 | then true | |
177 | - | else if ((voteType == " | |
177 | + | else if ((voteType == "current")) | |
178 | 178 | then (inFavor == 0) | |
179 | 179 | else false | |
180 | 180 | let isVoteValueSimilar = if (isVoteTypeSimilar) | |
194 | 194 | if ((vote == vote)) | |
195 | 195 | then { | |
196 | 196 | let votingResult = split(value(getString(keyVotingResult())), separator) | |
197 | - | let | |
198 | - | let | |
199 | - | let | |
197 | + | let votesForIncrease = votingResult[1] | |
198 | + | let votesForCurrent = votingResult[2] | |
199 | + | let votesForDecrease = votingResult[3] | |
200 | 200 | let newPositiveAndNegativeVotes = if ((inFavor == 1)) | |
201 | 201 | then { | |
202 | - | let newPositiveVotes = (parseIntValue( | |
203 | - | [toString(newPositiveVotes), | |
202 | + | let newPositiveVotes = (parseIntValue(votesForIncrease) + asInt(gwxAmount)) | |
203 | + | [toString(newPositiveVotes), votesForCurrent, votesForDecrease] | |
204 | 204 | } | |
205 | 205 | else if ((inFavor == -1)) | |
206 | 206 | then { | |
207 | - | let newNegativeVotes = (parseIntValue( | |
208 | - | [ | |
207 | + | let newNegativeVotes = (parseIntValue(votesForCurrent) + asInt(gwxAmount)) | |
208 | + | [votesForIncrease, votesForCurrent, toString(newNegativeVotes)] | |
209 | 209 | } | |
210 | 210 | else { | |
211 | - | let newNoneVotes = (parseIntValue( | |
212 | - | [ | |
211 | + | let newNoneVotes = (parseIntValue(votesForCurrent) + asInt(gwxAmount)) | |
212 | + | [votesForIncrease, toString(newNoneVotes), votesForDecrease] | |
213 | 213 | } | |
214 | 214 | let voteKey = keyVote(toString(i.caller)) | |
215 | 215 | let voteValue = keyVoteValue(toString(asInt(gwxAmount)), inFavor) | |
238 | 238 | let voteValue = vote[1] | |
239 | 239 | let voteType = vote[2] | |
240 | 240 | let votingResult = split(value(getString(keyVotingResult())), separator) | |
241 | - | let | |
242 | - | let | |
243 | - | let | |
241 | + | let votesForIncrease = votingResult[1] | |
242 | + | let votesForCurrent = votingResult[2] | |
243 | + | let votesForDecrease = votingResult[3] | |
244 | 244 | let actions = if ((voteType == "increase")) | |
245 | 245 | then { | |
246 | - | let newIncreaseVotes = (parseIntValue( | |
247 | - | $Tuple2([StringEntry(keyVotingResult(), totalVotes(toString(newIncreaseVotes), | |
246 | + | let newIncreaseVotes = (parseIntValue(votesForIncrease) - parseIntValue(voteValue)) | |
247 | + | $Tuple2([StringEntry(keyVotingResult(), totalVotes(toString(newIncreaseVotes), votesForCurrent, votesForDecrease)), DeleteEntry(keyVote(userAddress))], unit) | |
248 | 248 | } | |
249 | 249 | else if ((voteType == "decrease")) | |
250 | 250 | then { | |
251 | - | let newDecreaseVotes = (parseIntValue( | |
252 | - | $Tuple2([StringEntry(keyVotingResult(), totalVotes( | |
251 | + | let newDecreaseVotes = (parseIntValue(votesForDecrease) - parseIntValue(voteValue)) | |
252 | + | $Tuple2([StringEntry(keyVotingResult(), totalVotes(votesForIncrease, votesForCurrent, toString(newDecreaseVotes))), DeleteEntry(keyVote(userAddress))], unit) | |
253 | 253 | } | |
254 | 254 | else { | |
255 | - | let | |
256 | - | $Tuple2([StringEntry(keyVotingResult(), totalVotes( | |
255 | + | let newCurrentVotes = (parseIntValue(votesForCurrent) - parseIntValue(voteValue)) | |
256 | + | $Tuple2([StringEntry(keyVotingResult(), totalVotes(votesForIncrease, toString(newCurrentVotes), votesForDecrease)), DeleteEntry(keyVote(userAddress))], unit) | |
257 | 257 | } | |
258 | 258 | actions | |
259 | 259 | } | |
283 | 283 | if ((checks == checks)) | |
284 | 284 | then { | |
285 | 285 | let votingResult = split(value(getString(keyVotingResult())), separator) | |
286 | - | let | |
287 | - | let | |
288 | - | let | |
289 | - | let allVotes = (( | |
286 | + | let votesForIncrease = parseIntValue(votingResult[1]) | |
287 | + | let votesForCurrent = parseIntValue(votingResult[2]) | |
288 | + | let votesForDecrease = parseIntValue(votingResult[3]) | |
289 | + | let allVotes = ((votesForIncrease + votesForCurrent) + votesForDecrease) | |
290 | 290 | 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.") | |
304 | 312 | } | |
305 | 313 | else throw("Strict value is not equal to itself.") | |
306 | 314 | } |
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 | 40 | func keyVote (voterAddress) = makeString(["%s%s", "vote", voterAddress], 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 | - | else makeString(["%d%s", gwxAmount, " | |
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 | 150 | let votingFinishHeight = (value(getInteger(keyStartHeight())) + value(getInteger(keyEpochLength))) | |
151 | 151 | let checks = [if ((votingFinishHeight > height)) | |
152 | 152 | then true | |
153 | 153 | else throwErr("too late to vote"), if (containsElement([1, 0, -1], inFavor)) | |
154 | 154 | then true | |
155 | 155 | else throwErr("not valid argument")] | |
156 | 156 | if ((checks == checks)) | |
157 | 157 | then { | |
158 | 158 | let gwxAmount = invoke(boostingContract, "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), votingFinishHeight], nil) | |
159 | 159 | let notZero = if ((asInt(gwxAmount) > 0)) | |
160 | 160 | then true | |
161 | 161 | else throwErr("you don't have gwx") | |
162 | 162 | if ((notZero == notZero)) | |
163 | 163 | then { | |
164 | 164 | let vote = match getString(keyVote(toString(i.caller))) { | |
165 | 165 | case s: String => | |
166 | 166 | let vote = split(s, separator) | |
167 | 167 | let voteValue = vote[1] | |
168 | 168 | let voteType = vote[2] | |
169 | 169 | let isVoteTypeSimilar = if (if (if ((voteType == "increase")) | |
170 | 170 | then (inFavor == 1) | |
171 | 171 | else false) | |
172 | 172 | then true | |
173 | 173 | else if ((voteType == "decrease")) | |
174 | 174 | then (inFavor == -1) | |
175 | 175 | else false) | |
176 | 176 | then true | |
177 | - | else if ((voteType == " | |
177 | + | else if ((voteType == "current")) | |
178 | 178 | then (inFavor == 0) | |
179 | 179 | else false | |
180 | 180 | let isVoteValueSimilar = if (isVoteTypeSimilar) | |
181 | 181 | then (asInt(gwxAmount) == parseIntValue(voteValue)) | |
182 | 182 | else false | |
183 | 183 | let isNewVoteSimilar = if (if (isVoteTypeSimilar) | |
184 | 184 | then isVoteValueSimilar | |
185 | 185 | else false) | |
186 | 186 | then throwErr("you already voted") | |
187 | 187 | else invoke(this, "cancelVote", nil, nil) | |
188 | 188 | isNewVoteSimilar | |
189 | 189 | case u: Unit => | |
190 | 190 | u | |
191 | 191 | case _ => | |
192 | 192 | throw("Match error") | |
193 | 193 | } | |
194 | 194 | if ((vote == vote)) | |
195 | 195 | then { | |
196 | 196 | let votingResult = split(value(getString(keyVotingResult())), separator) | |
197 | - | let | |
198 | - | let | |
199 | - | let | |
197 | + | let votesForIncrease = votingResult[1] | |
198 | + | let votesForCurrent = votingResult[2] | |
199 | + | let votesForDecrease = votingResult[3] | |
200 | 200 | let newPositiveAndNegativeVotes = if ((inFavor == 1)) | |
201 | 201 | then { | |
202 | - | let newPositiveVotes = (parseIntValue( | |
203 | - | [toString(newPositiveVotes), | |
202 | + | let newPositiveVotes = (parseIntValue(votesForIncrease) + asInt(gwxAmount)) | |
203 | + | [toString(newPositiveVotes), votesForCurrent, votesForDecrease] | |
204 | 204 | } | |
205 | 205 | else if ((inFavor == -1)) | |
206 | 206 | then { | |
207 | - | let newNegativeVotes = (parseIntValue( | |
208 | - | [ | |
207 | + | let newNegativeVotes = (parseIntValue(votesForCurrent) + asInt(gwxAmount)) | |
208 | + | [votesForIncrease, votesForCurrent, toString(newNegativeVotes)] | |
209 | 209 | } | |
210 | 210 | else { | |
211 | - | let newNoneVotes = (parseIntValue( | |
212 | - | [ | |
211 | + | let newNoneVotes = (parseIntValue(votesForCurrent) + asInt(gwxAmount)) | |
212 | + | [votesForIncrease, toString(newNoneVotes), votesForDecrease] | |
213 | 213 | } | |
214 | 214 | let voteKey = keyVote(toString(i.caller)) | |
215 | 215 | let voteValue = keyVoteValue(toString(asInt(gwxAmount)), inFavor) | |
216 | 216 | $Tuple2([StringEntry(keyVotingResult(), totalVotes(newPositiveAndNegativeVotes[0], newPositiveAndNegativeVotes[1], newPositiveAndNegativeVotes[2])), StringEntry(voteKey, voteValue)], unit) | |
217 | 217 | } | |
218 | 218 | else throw("Strict value is not equal to itself.") | |
219 | 219 | } | |
220 | 220 | else throw("Strict value is not equal to itself.") | |
221 | 221 | } | |
222 | 222 | else throw("Strict value is not equal to itself.") | |
223 | 223 | } | |
224 | 224 | ||
225 | 225 | ||
226 | 226 | ||
227 | 227 | @Callable(i) | |
228 | 228 | func cancelVote () = { | |
229 | 229 | let userAddress = if ((i.caller == this)) | |
230 | 230 | then toString(i.originCaller) | |
231 | 231 | else toString(i.caller) | |
232 | 232 | let checks = [if (isDefined(getString(keyVotingResult()))) | |
233 | 233 | then true | |
234 | 234 | else throwErr("no vote")] | |
235 | 235 | if ((checks == checks)) | |
236 | 236 | then { | |
237 | 237 | let vote = split(value(getString(keyVote(userAddress))), separator) | |
238 | 238 | let voteValue = vote[1] | |
239 | 239 | let voteType = vote[2] | |
240 | 240 | let votingResult = split(value(getString(keyVotingResult())), separator) | |
241 | - | let | |
242 | - | let | |
243 | - | let | |
241 | + | let votesForIncrease = votingResult[1] | |
242 | + | let votesForCurrent = votingResult[2] | |
243 | + | let votesForDecrease = votingResult[3] | |
244 | 244 | let actions = if ((voteType == "increase")) | |
245 | 245 | then { | |
246 | - | let newIncreaseVotes = (parseIntValue( | |
247 | - | $Tuple2([StringEntry(keyVotingResult(), totalVotes(toString(newIncreaseVotes), | |
246 | + | let newIncreaseVotes = (parseIntValue(votesForIncrease) - parseIntValue(voteValue)) | |
247 | + | $Tuple2([StringEntry(keyVotingResult(), totalVotes(toString(newIncreaseVotes), votesForCurrent, votesForDecrease)), DeleteEntry(keyVote(userAddress))], unit) | |
248 | 248 | } | |
249 | 249 | else if ((voteType == "decrease")) | |
250 | 250 | then { | |
251 | - | let newDecreaseVotes = (parseIntValue( | |
252 | - | $Tuple2([StringEntry(keyVotingResult(), totalVotes( | |
251 | + | let newDecreaseVotes = (parseIntValue(votesForDecrease) - parseIntValue(voteValue)) | |
252 | + | $Tuple2([StringEntry(keyVotingResult(), totalVotes(votesForIncrease, votesForCurrent, toString(newDecreaseVotes))), DeleteEntry(keyVote(userAddress))], unit) | |
253 | 253 | } | |
254 | 254 | else { | |
255 | - | let | |
256 | - | $Tuple2([StringEntry(keyVotingResult(), totalVotes( | |
255 | + | let newCurrentVotes = (parseIntValue(votesForCurrent) - parseIntValue(voteValue)) | |
256 | + | $Tuple2([StringEntry(keyVotingResult(), totalVotes(votesForIncrease, toString(newCurrentVotes), votesForDecrease)), DeleteEntry(keyVote(userAddress))], unit) | |
257 | 257 | } | |
258 | 258 | actions | |
259 | 259 | } | |
260 | 260 | else throw("Strict value is not equal to itself.") | |
261 | 261 | } | |
262 | 262 | ||
263 | 263 | ||
264 | 264 | ||
265 | 265 | @Callable(i) | |
266 | 266 | func setThreshold (newThreshold) = { | |
267 | 267 | let checks = [mustManager(i), if ((newThreshold > 0)) | |
268 | 268 | then true | |
269 | 269 | else throwErr("invalid threshold")] | |
270 | 270 | if ((checks == checks)) | |
271 | 271 | then $Tuple2([IntegerEntry(keyThreshold, newThreshold)], unit) | |
272 | 272 | else throw("Strict value is not equal to itself.") | |
273 | 273 | } | |
274 | 274 | ||
275 | 275 | ||
276 | 276 | ||
277 | 277 | @Callable(i) | |
278 | 278 | func finalize () = { | |
279 | 279 | let votingFinishHeight = (value(getInteger(keyStartHeight())) + value(getInteger(keyEpochLength))) | |
280 | 280 | let checks = [if ((height >= votingFinishHeight)) | |
281 | 281 | then true | |
282 | 282 | else throwErr("insufficient height for completion")] | |
283 | 283 | if ((checks == checks)) | |
284 | 284 | then { | |
285 | 285 | let votingResult = split(value(getString(keyVotingResult())), separator) | |
286 | - | let | |
287 | - | let | |
288 | - | let | |
289 | - | let allVotes = (( | |
286 | + | let votesForIncrease = parseIntValue(votingResult[1]) | |
287 | + | let votesForCurrent = parseIntValue(votingResult[2]) | |
288 | + | let votesForDecrease = parseIntValue(votingResult[3]) | |
289 | + | let allVotes = ((votesForIncrease + votesForCurrent) + votesForDecrease) | |
290 | 290 | 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.") | |
304 | 312 | } | |
305 | 313 | else throw("Strict value is not equal to itself.") | |
306 | 314 | } | |
307 | 315 | ||
308 | 316 |
github/deemru/w8io/026f985 53.80 ms ◑