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