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