tx · 3q7jAsWuBsuUJzicmoA7KZcxoK8HcXggrcpTnDppYZQt 3N6oQmUanp4TWuHnv5rma4WveVub63JRFB2: -0.01100000 Waves 2024.08.31 12:34 [3262878] smart account 3N6oQmUanp4TWuHnv5rma4WveVub63JRFB2 > SELF 0.00000000 Waves
{ "type": 13, "id": "3q7jAsWuBsuUJzicmoA7KZcxoK8HcXggrcpTnDppYZQt", "fee": 1100000, "feeAssetId": null, "timestamp": 1725096906874, "version": 2, "chainId": 84, "sender": "3N6oQmUanp4TWuHnv5rma4WveVub63JRFB2", "senderPublicKey": "EM2pooK6eEzhzFXZFGd2phMRus6f1M5GxBsawNk9oi37", "proofs": [ "5G2L2UwQfp8dGFFRfujJEa17Wrv5C3hygSuGsALzwTsQAX9bzskmWG5jxPyXhr8wkj6orwr28SQoFEhAoTdCTTRm" ], "script": "base64:BgIbCAISBAoCCAESBAoCAQESBgoECAEBGBIDCgEBMwAFY2hhaW4JAMkBAgkAygECCAUEdGhpcwVieXRlcwABAAEAFWRlZmF1bHRSZXN0QWRkcmVzc1N0cgQHJG1hdGNoMAUFY2hhaW4DCQAAAgEBVwUHJG1hdGNoMAIjM1BRQ3V2RmJ2aDRMa1BVbnJuVTF6M2puYkExcDltM1dOaHYDCQAAAgEBVAUHJG1hdGNoMAIjM011bWtHR3p0Q0tBWHBXRHF4a2Rkb2ZxWFNVYnFRa3ZTSnkJAAIBAg1Vbmtub3duIGNoYWluAANTRVACAl9fAAVNVUxUNgDAhD0ABU1VTFQ4AIDC1y8BD2dldFN0cmluZ09yRmFpbAIHYWRkcmVzcwNrZXkJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCBQdhZGRyZXNzBQNrZXkJALkJAgkAzAgCAgptYW5kYXRvcnkgCQDMCAIJAKUIAQUHYWRkcmVzcwkAzAgCAgEuCQDMCAIFA2tleQkAzAgCAg8gaXMgbm90IGRlZmluZWQFA25pbAIAAQxnZXRJbnRPckVsc2UCA2tleQpkZWZhdWx0VmFs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xUeElkCQDcBAEJAJsDAQUFdGl0bGUFDHByb3Bvc2FsVGltZQUPdm90aW5nU3RhcnRUaW1lBQ12b3RpbmdFbmRUaW1lBQ5xdW9ydW1JbkdhY3JlcwUKb3B0aW9uc1N0cgUDbmlsBQxwcm9wb3NhbFR4SWQBaQEMY2FuY2VsVm90aW5nAQpwcm9wb3NhbElkAwkBAiE9AggFAWkGY2FsbGVyBQR0aGlzCQACAQIObm90IGF1dGhvcml6ZWQEC2N1cnJlbnREYXRhCQEPZ2V0U3RyaW5nT3JGYWlsAgUEdGhpcwkBGWtleVByb3Bvc2FsU3RhdHVzRGF0YUJ5SWQBBQpwcm9wb3NhbElkBAt1cGRhdGVkRGF0YQkArAICCQCsAgIJAK8CAgULY3VycmVudERhdGEJAQV2YWx1ZQEJALcJAgULY3VycmVudERhdGEFA1NFUAUDU0VQAgR0cnVlCQCUCgIJAMwIAgkBC1N0cmluZ0VudHJ5AgkBGWtleVByb3Bvc2FsU3RhdHVzRGF0YUJ5SWQBBQpwcm9wb3NhbElkBQt1cGRhdGVkRGF0YQUDbmlsBQR1bml0ALZzKtk=", "height": 3262878, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: H9FyRuu64kqrFWz1Dqp5a8g6tSUQPF8W3FG7nHi51rsn Next: HdrudhNgHpFRYXSbMwKgoapzBm9o99PjSeQZb4QChkVS Diff:
Old | New | Differences | |
---|---|---|---|
60 | 60 | ||
61 | 61 | ||
62 | 62 | func keyStakedPiecesByOwner (ownerAddr) = ("stakedPiecesByOwner_" + ownerAddr) | |
63 | - | ||
64 | - | ||
65 | - | func getVotingPower (userAddrStrOrEmpty) = { | |
66 | - | let props = split(valueOrElse(getString(stakingContract, keyResProportions()), "0_0_0_0_0_0"), "_") | |
67 | - | func adder (acc,item) = (acc + parseIntValue(item)) | |
68 | - | ||
69 | - | let totalPower = { | |
70 | - | let $l = props | |
71 | - | let $s = size($l) | |
72 | - | let $acc0 = 0 | |
73 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
74 | - | then $a | |
75 | - | else adder($a, $l[$i]) | |
76 | - | ||
77 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
78 | - | then $a | |
79 | - | else throw("List size exceeds 6") | |
80 | - | ||
81 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
82 | - | } | |
83 | - | let usersPower = valueOrElse(getInteger(stakingContract, keyStakedPiecesByOwner(userAddrStrOrEmpty)), 0) | |
84 | - | [totalPower, usersPower] | |
85 | - | } | |
86 | 63 | ||
87 | 64 | ||
88 | 65 | func getVerboseVotingPower (userAddrStrOrEmpty) = { | |
313 | 290 | else if ((1 >= size(optionsList))) | |
314 | 291 | then throw("Too few choices to vote") | |
315 | 292 | else { | |
316 | - | let eff = | |
293 | + | let eff = getVerboseVotingPower("") | |
317 | 294 | let gAcresTotal = ((eff[IdxEffTotal] * MULT8) + eff[idxEffAcresTotal]) | |
318 | 295 | let quorum = getIntOrElse(keyQuorumRequiredPercent(), DEFAULTQUORUM) | |
319 | 296 | let quorumInGacres = fraction(quorum, gAcresTotal, MULT6) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let chain = take(drop(this.bytes, 1), 1) | |
5 | 5 | ||
6 | 6 | let defaultRestAddressStr = match chain { | |
7 | 7 | case _ => | |
8 | 8 | if ((base58'2W' == $match0)) | |
9 | 9 | then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv" | |
10 | 10 | else if ((base58'2T' == $match0)) | |
11 | 11 | then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy" | |
12 | 12 | else throw("Unknown chain") | |
13 | 13 | } | |
14 | 14 | ||
15 | 15 | let SEP = "__" | |
16 | 16 | ||
17 | 17 | let MULT6 = 1000000 | |
18 | 18 | ||
19 | 19 | let MULT8 = 100000000 | |
20 | 20 | ||
21 | 21 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func getIntOrElse (key,defaultVal) = valueOrElse(getInteger(this, key), defaultVal) | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | let IdxCfgStakingDapp = 1 | |
28 | 28 | ||
29 | 29 | let IdxCfgAcresDapp = 8 | |
30 | 30 | ||
31 | 31 | func keyRestCfg () = "%s__restConfig" | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func keyRestAddress () = "%s__restAddr" | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP) | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx))) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr)) | |
44 | 44 | ||
45 | 45 | let restCfg = readRestCfgOrFail(restContract) | |
46 | 46 | ||
47 | 47 | let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp) | |
48 | 48 | ||
49 | 49 | let acresContract = getContractAddressOrFail(restCfg, IdxCfgAcresDapp) | |
50 | 50 | ||
51 | 51 | let IdxEffTotal = 0 | |
52 | 52 | ||
53 | 53 | let IdxEffUser = 1 | |
54 | 54 | ||
55 | 55 | let idxEffAcresTotal = 2 | |
56 | 56 | ||
57 | 57 | let idxEffAcresUser = 3 | |
58 | 58 | ||
59 | 59 | func keyResProportions () = "resTypesProportions" | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func keyStakedPiecesByOwner (ownerAddr) = ("stakedPiecesByOwner_" + ownerAddr) | |
63 | - | ||
64 | - | ||
65 | - | func getVotingPower (userAddrStrOrEmpty) = { | |
66 | - | let props = split(valueOrElse(getString(stakingContract, keyResProportions()), "0_0_0_0_0_0"), "_") | |
67 | - | func adder (acc,item) = (acc + parseIntValue(item)) | |
68 | - | ||
69 | - | let totalPower = { | |
70 | - | let $l = props | |
71 | - | let $s = size($l) | |
72 | - | let $acc0 = 0 | |
73 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
74 | - | then $a | |
75 | - | else adder($a, $l[$i]) | |
76 | - | ||
77 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
78 | - | then $a | |
79 | - | else throw("List size exceeds 6") | |
80 | - | ||
81 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
82 | - | } | |
83 | - | let usersPower = valueOrElse(getInteger(stakingContract, keyStakedPiecesByOwner(userAddrStrOrEmpty)), 0) | |
84 | - | [totalPower, usersPower] | |
85 | - | } | |
86 | 63 | ||
87 | 64 | ||
88 | 65 | func getVerboseVotingPower (userAddrStrOrEmpty) = { | |
89 | 66 | let props = split(valueOrElse(getString(stakingContract, keyResProportions()), "0_0_0_0_0_0"), "_") | |
90 | 67 | func adder (acc,item) = (acc + parseIntValue(item)) | |
91 | 68 | ||
92 | 69 | let totalPieces = { | |
93 | 70 | let $l = props | |
94 | 71 | let $s = size($l) | |
95 | 72 | let $acc0 = 0 | |
96 | 73 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
97 | 74 | then $a | |
98 | 75 | else adder($a, $l[$i]) | |
99 | 76 | ||
100 | 77 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
101 | 78 | then $a | |
102 | 79 | else throw("List size exceeds 6") | |
103 | 80 | ||
104 | 81 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
105 | 82 | } | |
106 | 83 | let userPieces = valueOrElse(getInteger(stakingContract, keyStakedPiecesByOwner(userAddrStrOrEmpty)), 0) | |
107 | 84 | let totalAcres = valueOrElse(getInteger(acresContract, "acresStakedAmountTotal"), 0) | |
108 | 85 | let userAcres = valueOrElse(getInteger(acresContract, ("acresStakedAmountByUser_" + userAddrStrOrEmpty)), 0) | |
109 | 86 | [totalPieces, userPieces, totalAcres, userAcres] | |
110 | 87 | } | |
111 | 88 | ||
112 | 89 | ||
113 | 90 | func keyUserGwlReleaseTime (userAddr) = ("%s%s__userGwlReleaseTime__" + userAddr) | |
114 | 91 | ||
115 | 92 | ||
116 | 93 | let LISTSEP = ":" | |
117 | 94 | ||
118 | 95 | let DEFAULTQUORUM = 500000 | |
119 | 96 | ||
120 | 97 | let MAXTITLE = 250 | |
121 | 98 | ||
122 | 99 | let MAXVOTINGTIME = 1209600000 | |
123 | 100 | ||
124 | 101 | let DEFAULTFIRSTPROPOSAL = 1 | |
125 | 102 | ||
126 | 103 | let govIdxStart = 4 | |
127 | 104 | ||
128 | 105 | let govIdxEnd = 5 | |
129 | 106 | ||
130 | 107 | let govIdxQuorum = 6 | |
131 | 108 | ||
132 | 109 | let govIdxOptions = 7 | |
133 | 110 | ||
134 | 111 | let govStatusIdxTotalVotes = 4 | |
135 | 112 | ||
136 | 113 | let govStatusIdxIsCanceled = 5 | |
137 | 114 | ||
138 | 115 | func keyQuorumRequiredPercent () = "%s__quorumRequired" | |
139 | 116 | ||
140 | 117 | ||
141 | 118 | func keyLastProposalId () = "%s__proposalId" | |
142 | 119 | ||
143 | 120 | ||
144 | 121 | func keyFirstProposalId () = "%s__firstProposalId" | |
145 | 122 | ||
146 | 123 | ||
147 | 124 | func keyProposalStatusDataById (proposalId) = ("%s%d__proposalStatusData__" + toString(proposalId)) | |
148 | 125 | ||
149 | 126 | ||
150 | 127 | func keyProposalDataById (proposalId) = ("%s%d__proposalData__" + toString(proposalId)) | |
151 | 128 | ||
152 | 129 | ||
153 | 130 | func keyProposalVotesByIdAndOption (proposalId,opt) = makeString(["%s%d%d", "votesByOpt", toString(proposalId), toString(opt)], SEP) | |
154 | 131 | ||
155 | 132 | ||
156 | 133 | func keyProposalVotesByIdAndUser (proposalId,userAddr) = makeString(["%s%d%s", "votesByUser", toString(proposalId), userAddr], SEP) | |
157 | 134 | ||
158 | 135 | ||
159 | 136 | func keyProposalChoiceByIdAndUser (proposalId,userAddr) = makeString(["%s%d%s", "optionByUser", toString(proposalId), userAddr], SEP) | |
160 | 137 | ||
161 | 138 | ||
162 | 139 | func keyNumUniqueVotersByProposalId (proposalId) = ("%s%d__numVoters__" + toString(proposalId)) | |
163 | 140 | ||
164 | 141 | ||
165 | 142 | func keyStatsAverUniqueVoters () = "%s%s%s__stats__avg__uniqueVoters" | |
166 | 143 | ||
167 | 144 | ||
168 | 145 | func keyStatsAverGwlVoted () = "%s%s%s__stats__avg__gwlVoted" | |
169 | 146 | ||
170 | 147 | ||
171 | 148 | func statusData (isVotingValid,winOption,winOptionVotes,totalVotes,canceledByTeam) = makeString(["%b%d%d%d%b", toString(isVotingValid), toString(winOption), toString(winOptionVotes), toString(totalVotes), toString(canceledByTeam)], SEP) | |
172 | 149 | ||
173 | 150 | ||
174 | 151 | func proposalData (proposalTxId,title,proposalTime,votingStartTime,votingEndTime,quorumInGwl,options) = makeString_2C(["%s%s%d%d%d%d%s", proposalTxId, title, toString(proposalTime), toString(votingStartTime), toString(votingEndTime), toString(quorumInGwl), options], SEP) | |
175 | 152 | ||
176 | 153 | ||
177 | 154 | func calcWinOption (proposalId,optionsList,isPrevOptional,oldChoice,optionalTotalOld,newChoice,newTotalByNewChoice) = { | |
178 | 155 | func findBest (acc,elem) = { | |
179 | 156 | let idx = value(indexOf(optionsList, elem)) | |
180 | 157 | let val = if (isPrevOptional) | |
181 | 158 | then if ((idx == newChoice)) | |
182 | 159 | then newTotalByNewChoice | |
183 | 160 | else getIntOrElse(keyProposalVotesByIdAndOption(proposalId, idx), 0) | |
184 | 161 | else if ((idx == value(oldChoice))) | |
185 | 162 | then optionalTotalOld | |
186 | 163 | else if ((idx == newChoice)) | |
187 | 164 | then newTotalByNewChoice | |
188 | 165 | else getIntOrElse(keyProposalVotesByIdAndOption(proposalId, idx), 0) | |
189 | 166 | if ((acc._2 > val)) | |
190 | 167 | then acc | |
191 | 168 | else $Tuple2(idx, val) | |
192 | 169 | } | |
193 | 170 | ||
194 | 171 | let $l = optionsList | |
195 | 172 | let $s = size($l) | |
196 | 173 | let $acc0 = $Tuple2(0, 0) | |
197 | 174 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
198 | 175 | then $a | |
199 | 176 | else findBest($a, $l[$i]) | |
200 | 177 | ||
201 | 178 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
202 | 179 | then $a | |
203 | 180 | else throw("List size exceeds 10") | |
204 | 181 | ||
205 | 182 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
206 | 183 | } | |
207 | 184 | ||
208 | 185 | ||
209 | 186 | func updateStatusData (isCanceledStr,isValid,newWinOpt,newTotalVotes) = makeString(["%b%d%d%d%b", toString(isValid), toString(newWinOpt._1), toString(newWinOpt._2), toString(newTotalVotes), isCanceledStr], SEP) | |
210 | 187 | ||
211 | 188 | ||
212 | 189 | @Callable(i) | |
213 | 190 | func constructorV1 (restAddr,quorumReqPerc) = if ((i.caller != this)) | |
214 | 191 | then throw("Permission denied") | |
215 | 192 | else [StringEntry(keyRestAddress(), restAddr), IntegerEntry(keyQuorumRequiredPercent(), quorumReqPerc)] | |
216 | 193 | ||
217 | 194 | ||
218 | 195 | ||
219 | 196 | @Callable(i) | |
220 | 197 | func castVote (proposalId,choice) = { | |
221 | 198 | let userAddressStr = toString(i.caller) | |
222 | 199 | let dynamicData = split(getStringOrFail(this, keyProposalStatusDataById(proposalId)), SEP) | |
223 | 200 | if ((dynamicData[govStatusIdxIsCanceled] == "true")) | |
224 | 201 | then throw("Voting is canceled by team") | |
225 | 202 | else { | |
226 | 203 | let propData = split_4C(getStringOrFail(this, keyProposalDataById(proposalId)), SEP) | |
227 | 204 | let start = parseIntValue(propData[govIdxStart]) | |
228 | 205 | let end = parseIntValue(propData[govIdxEnd]) | |
229 | 206 | let now = lastBlock.timestamp | |
230 | 207 | if ((start > now)) | |
231 | 208 | then throw("Voting not started yet") | |
232 | 209 | else if ((now >= end)) | |
233 | 210 | then throw("Voting already finished") | |
234 | 211 | else { | |
235 | 212 | let availableOptions = split(propData[govIdxOptions], LISTSEP) | |
236 | 213 | let numOptions = size(availableOptions) | |
237 | 214 | if ((1 >= numOptions)) | |
238 | 215 | then throw("Too few choices to vote") | |
239 | 216 | else if ((choice >= numOptions)) | |
240 | 217 | then throw(("Unknown choice! Must be 0.." + toString((numOptions - 1)))) | |
241 | 218 | else { | |
242 | 219 | let eff = getVerboseVotingPower(userAddressStr) | |
243 | 220 | let gwlAmt = ((eff[IdxEffUser] * MULT8) + eff[idxEffAcresUser]) | |
244 | 221 | if ((0 >= gwlAmt)) | |
245 | 222 | then throw("You need staked lands or ACRES to vote") | |
246 | 223 | else { | |
247 | 224 | let oldChoice = getInteger(keyProposalChoiceByIdAndUser(proposalId, userAddressStr)) | |
248 | 225 | let oldUserVotes = if (!(isDefined(oldChoice))) | |
249 | 226 | then 0 | |
250 | 227 | else getIntOrElse(keyProposalVotesByIdAndUser(proposalId, userAddressStr), 0) | |
251 | 228 | let oldTotalByOldChoice = if (isDefined(oldChoice)) | |
252 | 229 | then getIntOrElse(keyProposalVotesByIdAndOption(proposalId, value(oldChoice)), 0) | |
253 | 230 | else 0 | |
254 | 231 | let oldTotalByNewChoice = getIntOrElse(keyProposalVotesByIdAndOption(proposalId, choice), 0) | |
255 | 232 | let oldTotal = parseIntValue(dynamicData[govStatusIdxTotalVotes]) | |
256 | 233 | let newTotalByOldChoice = if (!(isDefined(oldChoice))) | |
257 | 234 | then 0 | |
258 | 235 | else ((oldTotalByOldChoice - oldUserVotes) + (if ((value(oldChoice) == choice)) | |
259 | 236 | then gwlAmt | |
260 | 237 | else 0)) | |
261 | 238 | let newTotalByNewChoice = if (if (isDefined(oldChoice)) | |
262 | 239 | then (value(oldChoice) == choice) | |
263 | 240 | else false) | |
264 | 241 | then newTotalByOldChoice | |
265 | 242 | else (oldTotalByNewChoice + gwlAmt) | |
266 | 243 | let newTotal = ((oldTotal - oldUserVotes) + gwlAmt) | |
267 | 244 | let isQuorumReached = (newTotal >= parseIntValue(propData[govIdxQuorum])) | |
268 | 245 | let numVotersByProposalId = getIntOrElse(keyNumUniqueVotersByProposalId(proposalId), 0) | |
269 | 246 | let oldAverUniqueVoters6 = getIntOrElse(keyStatsAverUniqueVoters(), 0) | |
270 | 247 | let numProposals = ((getIntegerValue(keyLastProposalId()) - valueOrElse(getInteger(keyFirstProposalId()), DEFAULTFIRSTPROPOSAL)) + 1) | |
271 | 248 | let uniqueDiff = if ((oldUserVotes == 0)) | |
272 | 249 | then 1 | |
273 | 250 | else 0 | |
274 | 251 | let newAverUniqueVoters6 = (oldAverUniqueVoters6 + fraction(uniqueDiff, MULT6, numProposals)) | |
275 | 252 | let oldAverGwl = getIntOrElse(keyStatsAverGwlVoted(), 0) | |
276 | 253 | let newAverGwl = (oldAverGwl + ((gwlAmt - oldUserVotes) / numProposals)) | |
277 | 254 | let isPrevOptional = if (!(isDefined(oldChoice))) | |
278 | 255 | then true | |
279 | 256 | else (value(oldChoice) == choice) | |
280 | 257 | let optionalTotalOld = if (isPrevOptional) | |
281 | 258 | then nil | |
282 | 259 | else [IntegerEntry(keyProposalVotesByIdAndOption(proposalId, value(oldChoice)), newTotalByOldChoice)] | |
283 | 260 | let winOpt = calcWinOption(proposalId, availableOptions, isPrevOptional, oldChoice, newTotalByOldChoice, choice, newTotalByNewChoice) | |
284 | 261 | let releaseTime = max([end, getIntOrElse(keyUserGwlReleaseTime(userAddressStr), 0)]) | |
285 | 262 | $Tuple2(([IntegerEntry(keyProposalChoiceByIdAndUser(proposalId, userAddressStr), choice), IntegerEntry(keyProposalVotesByIdAndUser(proposalId, userAddressStr), gwlAmt), IntegerEntry(keyProposalVotesByIdAndOption(proposalId, choice), newTotalByNewChoice), IntegerEntry(keyNumUniqueVotersByProposalId(proposalId), (numVotersByProposalId + uniqueDiff)), IntegerEntry(keyUserGwlReleaseTime(userAddressStr), releaseTime), IntegerEntry(keyStatsAverUniqueVoters(), newAverUniqueVoters6), IntegerEntry(keyStatsAverGwlVoted(), newAverGwl), StringEntry(keyProposalStatusDataById(proposalId), updateStatusData(dynamicData[govStatusIdxIsCanceled], isQuorumReached, winOpt, newTotal))] ++ optionalTotalOld), unit) | |
286 | 263 | } | |
287 | 264 | } | |
288 | 265 | } | |
289 | 266 | } | |
290 | 267 | } | |
291 | 268 | ||
292 | 269 | ||
293 | 270 | ||
294 | 271 | @Callable(i) | |
295 | 272 | func initiateVoting (title,votingStartTime,votingEndTime,optionsList) = if ((i.caller != this)) | |
296 | 273 | then throw("Permission denied") | |
297 | 274 | else if ((size(i.payments) != 0)) | |
298 | 275 | then throw("governance doesn't require any payments") | |
299 | 276 | else { | |
300 | 277 | let proposalTxId = toBase58String(i.transactionId) | |
301 | 278 | if ((title == "")) | |
302 | 279 | then throw("Title is empty") | |
303 | 280 | else if ((size(title) > MAXTITLE)) | |
304 | 281 | then throw("Too long title") | |
305 | 282 | else { | |
306 | 283 | let proposalTime = lastBlock.timestamp | |
307 | 284 | if ((proposalTime > votingStartTime)) | |
308 | 285 | then throw(((("votingStartTime=" + toString(votingStartTime)) + " < proposalTime=") + toString(proposalTime))) | |
309 | 286 | else if ((votingStartTime > votingEndTime)) | |
310 | 287 | then throw(((("votingEndTime=" + toString(votingEndTime)) + " < votingStartTime=") + toString(votingStartTime))) | |
311 | 288 | else if (((votingEndTime - votingStartTime) > MAXVOTINGTIME)) | |
312 | 289 | then throw(((("Voting period exceeds max: " + toString((votingEndTime - votingStartTime))) + " > ") + toString(MAXVOTINGTIME))) | |
313 | 290 | else if ((1 >= size(optionsList))) | |
314 | 291 | then throw("Too few choices to vote") | |
315 | 292 | else { | |
316 | - | let eff = | |
293 | + | let eff = getVerboseVotingPower("") | |
317 | 294 | let gAcresTotal = ((eff[IdxEffTotal] * MULT8) + eff[idxEffAcresTotal]) | |
318 | 295 | let quorum = getIntOrElse(keyQuorumRequiredPercent(), DEFAULTQUORUM) | |
319 | 296 | let quorumInGacres = fraction(quorum, gAcresTotal, MULT6) | |
320 | 297 | let proposalId = (getIntOrElse(keyLastProposalId(), 0) + 1) | |
321 | 298 | let optionsStr = makeString(optionsList, LISTSEP) | |
322 | 299 | $Tuple2([IntegerEntry(keyLastProposalId(), proposalId), StringEntry(keyProposalStatusDataById(proposalId), statusData(false, 0, 0, 0, false)), StringEntry(keyProposalDataById(proposalId), proposalData(proposalTxId, toBase16String(toBytes(title)), proposalTime, votingStartTime, votingEndTime, quorumInGacres, optionsStr))], proposalTxId) | |
323 | 300 | } | |
324 | 301 | } | |
325 | 302 | } | |
326 | 303 | ||
327 | 304 | ||
328 | 305 | ||
329 | 306 | @Callable(i) | |
330 | 307 | func cancelVoting (proposalId) = if ((i.caller != this)) | |
331 | 308 | then throw("not authorized") | |
332 | 309 | else { | |
333 | 310 | let currentData = getStringOrFail(this, keyProposalStatusDataById(proposalId)) | |
334 | 311 | let updatedData = ((take(currentData, value(lastIndexOf(currentData, SEP))) + SEP) + "true") | |
335 | 312 | $Tuple2([StringEntry(keyProposalStatusDataById(proposalId), updatedData)], unit) | |
336 | 313 | } | |
337 | 314 | ||
338 | 315 |
github/deemru/w8io/169f3d6 74.06 ms ◑