tx · 8AtD5nsuAbCJCbKAhFYgjg7L745nZUCZqinHD4dNhKiJ 3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy: -0.01300000 Waves 2022.10.17 18:58 [2276587] smart account 3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy > SELF 0.00000000 Waves
{ "type": 13, "id": "8AtD5nsuAbCJCbKAhFYgjg7L745nZUCZqinHD4dNhKiJ", "fee": 1300000, "feeAssetId": null, "timestamp": 1666022334510, "version": 2, "chainId": 84, "sender": "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy", "senderPublicKey": "C3PaRKeL8AUKbwUqdniMQtThgcTh5DYHV1777Hkxy7rp", "proofs": [ "2ZWV25opzNb53Mvv75vy1ytSz3eBmPg1ZZtdLkcB2BXcHJbjUCca6FtVSXD2nhfNwWK4dHohjpCQyXoF6L2YqG5z" ], "script": "base64:BgIkCAISBAoCAQESBwoFCAgBARgSBwoFCAgBARgSAwoBARIDCgEBSgALcmV2aXNpb25OdW0CAAADU0VQAgJfXwAHTElTVFNFUAIBOgANREVGQVVMVFFVT1JVTQCgwh4AClVSTFBBVFRFUk4CGmh0dHBzOi8vZm9ydW0ubmV1dHJpbm8uYXQvAAhNQVhUSVRMRQCgAQAGTUFYVVJMAPoBAA1NQVhWT1RJTkdUSU1FAICQ5MAEAAVNVUxUNgDAhD0ADkRFRkFVTFRQQVlNRU5UAICU69wDABRERUZBVUxUQ1JFQVRJT05HTlNCVACAlOvcAwASZ292SWR4UHJvcG9zYWxUeElkAAEACmdvdklkeFR5cGUAAgAMZ292SWR4QXV0aG9yAAMACWdvdklkeFVybAAEAAtnb3ZJZHhUaXRsZQAFABJnb3ZJZHhDcmVhdGlvblRpbWUABgALZ292SWR4U3RhcnQABwAJZ292SWR4RW5kAAgAC2dvdklkeFR4SWRzAAkADGdvdklkeFF1b3J1bQAKAA1nb3ZJZHhPcHRpb25zAAsAE2dvdlN0YXR1c0lkeElzVmFsaWQAAQASZ292U3RhdHVzSWR4V2luT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1bml0AWkBC2FwcGx5Vm90aW5nAQpwcm9wb3NhbElkCQCUCgIFA25pbAUEdW5pdACii+yR", "height": 2276587, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9na4igWLsU8QpAT9zkgStt7kN8SX12sMtJ6eUxbedrAA Next: pswkQmDndHZJ2EJS2CxeD2gfG66M2qpa4eW8g3hDqcJ Diff:
Old | New | Differences | |
---|---|---|---|
259 | 259 | func calcWinOption (proposalId,optionsList,isPrevOptional,oldChoice,optionalTotalOld,newChoice,newTotalByNewChoice) = { | |
260 | 260 | func findBest (acc,elem) = { | |
261 | 261 | let idx = value(indexOf(optionsList, elem)) | |
262 | - | let val = getIntOrElse(keyProposalVotesByIdAndOption(proposalId, idx), 0) | |
262 | + | let val = if (isPrevOptional) | |
263 | + | then if ((idx == newChoice)) | |
264 | + | then newTotalByNewChoice | |
265 | + | else getIntOrElse(keyProposalVotesByIdAndOption(proposalId, idx), 0) | |
266 | + | else if ((idx == value(oldChoice))) | |
267 | + | then optionalTotalOld | |
268 | + | else if ((idx == newChoice)) | |
269 | + | then newTotalByNewChoice | |
270 | + | else getIntOrElse(keyProposalVotesByIdAndOption(proposalId, idx), 0) | |
263 | 271 | if ((acc._2 > val)) | |
264 | 272 | then acc | |
265 | 273 | else $Tuple2(idx, val) | |
266 | 274 | } | |
267 | 275 | ||
268 | - | let choiceAndVal = if (if (isPrevOptional) | |
269 | - | then true | |
270 | - | else (newTotalByNewChoice > optionalTotalOld)) | |
271 | - | then $Tuple2(newChoice, newTotalByNewChoice) | |
272 | - | else $Tuple2(value(oldChoice), optionalTotalOld) | |
273 | 276 | let $l = optionsList | |
274 | 277 | let $s = size($l) | |
275 | - | let $acc0 = | |
278 | + | let $acc0 = $Tuple2(0, 0) | |
276 | 279 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
277 | 280 | then $a | |
278 | 281 | else findBest($a, $l[$i]) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let revisionNum = "" | |
5 | 5 | ||
6 | 6 | let SEP = "__" | |
7 | 7 | ||
8 | 8 | let LISTSEP = ":" | |
9 | 9 | ||
10 | 10 | let DEFAULTQUORUM = 500000 | |
11 | 11 | ||
12 | 12 | let URLPATTERN = "https://forum.neutrino.at/" | |
13 | 13 | ||
14 | 14 | let MAXTITLE = 160 | |
15 | 15 | ||
16 | 16 | let MAXURL = 250 | |
17 | 17 | ||
18 | 18 | let MAXVOTINGTIME = 1209600000 | |
19 | 19 | ||
20 | 20 | let MULT6 = 1000000 | |
21 | 21 | ||
22 | 22 | let DEFAULTPAYMENT = 1000000000 | |
23 | 23 | ||
24 | 24 | let DEFAULTCREATIONGNSBT = 1000000000 | |
25 | 25 | ||
26 | 26 | let govIdxProposalTxId = 1 | |
27 | 27 | ||
28 | 28 | let govIdxType = 2 | |
29 | 29 | ||
30 | 30 | let govIdxAuthor = 3 | |
31 | 31 | ||
32 | 32 | let govIdxUrl = 4 | |
33 | 33 | ||
34 | 34 | let govIdxTitle = 5 | |
35 | 35 | ||
36 | 36 | let govIdxCreationTime = 6 | |
37 | 37 | ||
38 | 38 | let govIdxStart = 7 | |
39 | 39 | ||
40 | 40 | let govIdxEnd = 8 | |
41 | 41 | ||
42 | 42 | let govIdxTxIds = 9 | |
43 | 43 | ||
44 | 44 | let govIdxQuorum = 10 | |
45 | 45 | ||
46 | 46 | let govIdxOptions = 11 | |
47 | 47 | ||
48 | 48 | let govStatusIdxIsValid = 1 | |
49 | 49 | ||
50 | 50 | let govStatusIdxWinOpt = 2 | |
51 | 51 | ||
52 | 52 | let govStatusIdxWinVotes = 3 | |
53 | 53 | ||
54 | 54 | let govStatusIdxTotalVotes = 4 | |
55 | 55 | ||
56 | 56 | let govStatusIdxScApplied = 5 | |
57 | 57 | ||
58 | 58 | let govStatusIdxScTime = 6 | |
59 | 59 | ||
60 | 60 | let govStatusIdxIsCanceled = 7 | |
61 | 61 | ||
62 | 62 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func getIntOrElse (key,defaultVal) = valueOrElse(getInteger(this, key), defaultVal) | |
66 | 66 | ||
67 | 67 | ||
68 | 68 | let IdxControlCfgNeutrinoDapp = 1 | |
69 | 69 | ||
70 | 70 | let IdxControlCfgAuctionDapp = 2 | |
71 | 71 | ||
72 | 72 | let IdxControlCfgRpdDapp = 3 | |
73 | 73 | ||
74 | 74 | let IdxControlCfgMathDapp = 4 | |
75 | 75 | ||
76 | 76 | let IdxControlCfgLiquidationDapp = 5 | |
77 | 77 | ||
78 | 78 | let IdxControlCfgRestDapp = 6 | |
79 | 79 | ||
80 | 80 | let IdxControlCfgNodeRegistryDapp = 7 | |
81 | 81 | ||
82 | 82 | let IdxControlCfgNsbtStakingDapp = 8 | |
83 | 83 | ||
84 | 84 | let IdxControlCfgMediatorDapp = 9 | |
85 | 85 | ||
86 | 86 | let IdxControlCfgSurfStakingDapp = 10 | |
87 | 87 | ||
88 | 88 | let IdxControlCfgGnsbtControllerDapp = 11 | |
89 | 89 | ||
90 | 90 | let IdxControlCfgRestV2Dapp = 12 | |
91 | 91 | ||
92 | 92 | let IdxControlCfgGovernanceDapp = 13 | |
93 | 93 | ||
94 | 94 | func keyControlAddress () = "%s%s__config__controlAddress" | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func keyControlCfg () = "%s__controlConfig" | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func readControlCfgOrFail (control) = split_4C(getStringOrFail(control, keyControlCfg()), SEP) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func getContractAddressOrFail (controlCfg,idx) = valueOrErrorMessage(addressFromString(controlCfg[idx]), ("Control cfg doesn't contain address at index " + toString(idx))) | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | let controlContract = addressFromStringValue(valueOrElse(getString(this, keyControlAddress()), "3P5Bfd58PPfNvBM2Hy8QfbcDqMeNtzg7KfP")) | |
107 | 107 | ||
108 | 108 | let controlCfg = readControlCfgOrFail(controlContract) | |
109 | 109 | ||
110 | 110 | let neutrinoContract = getContractAddressOrFail(controlCfg, IdxControlCfgNeutrinoDapp) | |
111 | 111 | ||
112 | 112 | let gnsbtControllerContract = getContractAddressOrFail(controlCfg, IdxControlCfgGnsbtControllerDapp) | |
113 | 113 | ||
114 | 114 | func keyQuorumRequiredPercent () = "%s__quorumRequired" | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func keyPaymentRequired () = "%s__paymentRequired" | |
118 | 118 | ||
119 | 119 | ||
120 | 120 | func keyGnsbtRequired () = "%s__gNsbtRequired" | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func keyLastProposalId () = "%s__proposalId" | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | func keyProposalStatusDataById (proposalId) = ("%s%d__proposalStatusData__" + toString(proposalId)) | |
127 | 127 | ||
128 | 128 | ||
129 | 129 | func keyProposalDataById (proposalId) = ("%s%d__proposalData__" + toString(proposalId)) | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | func keyProposalVotesByIdAndOption (proposalId,opt) = makeString(["%s%d%d", "votesByOpt", toString(proposalId), toString(opt)], SEP) | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | func keyProposalVotesByIdAndUser (proposalId,userAddr) = makeString(["%s%d%s", "votesByUser", toString(proposalId), userAddr], SEP) | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | func keyProposalChoiceByIdAndUser (proposalId,userAddr) = makeString(["%s%d%s", "optionByUser", toString(proposalId), userAddr], SEP) | |
139 | 139 | ||
140 | 140 | ||
141 | 141 | func keyNumUniqueVotersByProposalId (proposalId) = ("%s%d__numVoters__" + toString(proposalId)) | |
142 | 142 | ||
143 | 143 | ||
144 | 144 | func keyStatsAverUniqueVoters () = "%s%s%s__stats__avg__uniqueVoters" | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | func keyStatsAverGnsbtVoted () = "%s%s%s__stats__avg__gnsbtVoted" | |
148 | 148 | ||
149 | 149 | ||
150 | 150 | func keyStatsUniqueAuthors () = "%s%s__stats__uniqueAuthors" | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | func keyNumProposalsByAuthor (addressStr) = ("%s%s__numProposalsByAuthor__" + addressStr) | |
154 | 154 | ||
155 | 155 | ||
156 | 156 | func asAnyList (v) = match v { | |
157 | 157 | case l: List[Any] => | |
158 | 158 | l | |
159 | 159 | case _ => | |
160 | 160 | throw("fail to cast into List[Any]") | |
161 | 161 | } | |
162 | 162 | ||
163 | 163 | ||
164 | 164 | func asInt (v) = match v { | |
165 | 165 | case i: Int => | |
166 | 166 | i | |
167 | 167 | case _ => | |
168 | 168 | throw("fail to cast into Int") | |
169 | 169 | } | |
170 | 170 | ||
171 | 171 | ||
172 | 172 | func statusData (isVotingValid,winOption,winOptionVotes,totalVotes,areScriptsApplied,scriptsTimestamp,canceledByTeam) = makeString(["%b%d%d%d%b%d%b", toString(isVotingValid), toString(winOption), toString(winOptionVotes), toString(totalVotes), toString(areScriptsApplied), toString(scriptsTimestamp), toString(canceledByTeam)], SEP) | |
173 | 173 | ||
174 | 174 | ||
175 | 175 | func proposalData (proposalTxId,type,author,forumLink,title,proposalTime,votingStartTime,votingEndTime,txIds,quorumInGnsbt,options) = makeString(["%s%s%s%s%s%d%d%d%s%d%s", proposalTxId, type, author, forumLink, title, toString(proposalTime), toString(votingStartTime), toString(votingEndTime), txIds, toString(quorumInGnsbt), options], SEP) | |
176 | 176 | ||
177 | 177 | ||
178 | 178 | func checkTxList (txList) = if ((size(txList) > 20)) | |
179 | 179 | then throw(("Too many transactions: " + toString(size(txList)))) | |
180 | 180 | else { | |
181 | 181 | func combiner (acc,tx) = if (!(isDefined(transactionHeightById(fromBase58String(tx))))) | |
182 | 182 | then throw(("Wrong txId:" + tx)) | |
183 | 183 | else if ((acc == "")) | |
184 | 184 | then tx | |
185 | 185 | else ((acc + LISTSEP) + tx) | |
186 | 186 | ||
187 | 187 | let $l = txList | |
188 | 188 | let $s = size($l) | |
189 | 189 | let $acc0 = "" | |
190 | 190 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
191 | 191 | then $a | |
192 | 192 | else combiner($a, $l[$i]) | |
193 | 193 | ||
194 | 194 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
195 | 195 | then $a | |
196 | 196 | else throw("List size exceeds 20") | |
197 | 197 | ||
198 | 198 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($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), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20) | |
199 | 199 | } | |
200 | 200 | ||
201 | 201 | ||
202 | 202 | func initiateVoting (payment,proposalTxId,type,author,forumLink,title,votingStartTime,votingEndTime,status,txList,optionsList) = if ((payment.assetId != unit)) | |
203 | 203 | then throw("Allowed WAVES payment only!") | |
204 | 204 | else { | |
205 | 205 | let pmtReq = getIntOrElse(keyPaymentRequired(), DEFAULTPAYMENT) | |
206 | 206 | if ((pmtReq > payment.amount)) | |
207 | 207 | then throw(("Payment attached should be at least " + toString(pmtReq))) | |
208 | 208 | else if ((value(indexOf(forumLink, URLPATTERN)) != 0)) | |
209 | 209 | then throw("Invalid url") | |
210 | 210 | else if ((size(forumLink) > MAXURL)) | |
211 | 211 | then throw("Url too long!") | |
212 | 212 | else if ((title == "")) | |
213 | 213 | then throw("Title is empty") | |
214 | 214 | else if ((size(title) > MAXTITLE)) | |
215 | 215 | then throw("Too long title") | |
216 | 216 | else { | |
217 | 217 | let proposalTime = lastBlock.timestamp | |
218 | 218 | if ((proposalTime > votingStartTime)) | |
219 | 219 | then throw(((("votingStartTime=" + toString(votingStartTime)) + " < proposalTime=") + toString(proposalTime))) | |
220 | 220 | else if ((votingStartTime > votingEndTime)) | |
221 | 221 | then throw(((("votingEndTime=" + toString(votingEndTime)) + " < votingStartTime=") + toString(votingStartTime))) | |
222 | 222 | else if (((votingEndTime - votingStartTime) > MAXVOTINGTIME)) | |
223 | 223 | then throw(((("Voting period exceeds max: " + toString((votingEndTime - votingStartTime))) + " > ") + toString(MAXVOTINGTIME))) | |
224 | 224 | else { | |
225 | 225 | let txIds = if ((type == "IDEA")) | |
226 | 226 | then "" | |
227 | 227 | else checkTxList(txList) | |
228 | 228 | if ((1 >= size(optionsList))) | |
229 | 229 | then throw("Too few choices to vote") | |
230 | 230 | else { | |
231 | 231 | let gnsbtInfo = asAnyList(invoke(gnsbtControllerContract, "gnsbtInfoSYSREADONLY", [author, 0, 0], nil)) | |
232 | 232 | let gnsbtTotal = asInt(gnsbtInfo[1]) | |
233 | 233 | let gNsbtUser = asInt(gnsbtInfo[0]) | |
234 | 234 | let gnsbtReq = getIntOrElse(keyGnsbtRequired(), DEFAULTCREATIONGNSBT) | |
235 | 235 | if ((gnsbtReq > gNsbtUser)) | |
236 | 236 | then throw((("You need at least " + toString(gnsbtReq)) + " to create voting")) | |
237 | 237 | else { | |
238 | 238 | let amountLeased = invoke(neutrinoContract, "acceptWaves", nil, [payment]) | |
239 | 239 | if ((amountLeased == amountLeased)) | |
240 | 240 | then { | |
241 | 241 | let quorum = getIntOrElse(keyQuorumRequiredPercent(), DEFAULTQUORUM) | |
242 | 242 | let quorumInGnsbt = fraction(quorum, gnsbtTotal, MULT6) | |
243 | 243 | let proposalId = (getIntOrElse(keyLastProposalId(), 0) + 1) | |
244 | 244 | let numProposalsByAuthor = (getIntOrElse(keyNumProposalsByAuthor(author), 0) + 1) | |
245 | 245 | let uniqAuthors = (getIntOrElse(keyStatsUniqueAuthors(), 0) + (if ((numProposalsByAuthor == 1)) | |
246 | 246 | then 1 | |
247 | 247 | else 0)) | |
248 | 248 | let optionsStr = makeString(optionsList, LISTSEP) | |
249 | 249 | $Tuple2([IntegerEntry(keyLastProposalId(), proposalId), StringEntry(keyProposalStatusDataById(proposalId), statusData(false, 0, 0, 0, false, 0, false)), StringEntry(keyProposalDataById(proposalId), proposalData(proposalTxId, type, author, forumLink, title, proposalTime, votingStartTime, votingEndTime, txIds, quorumInGnsbt, optionsStr)), IntegerEntry(keyNumProposalsByAuthor(author), numProposalsByAuthor), IntegerEntry(keyStatsUniqueAuthors(), uniqAuthors)], proposalTxId) | |
250 | 250 | } | |
251 | 251 | else throw("Strict value is not equal to itself.") | |
252 | 252 | } | |
253 | 253 | } | |
254 | 254 | } | |
255 | 255 | } | |
256 | 256 | } | |
257 | 257 | ||
258 | 258 | ||
259 | 259 | func calcWinOption (proposalId,optionsList,isPrevOptional,oldChoice,optionalTotalOld,newChoice,newTotalByNewChoice) = { | |
260 | 260 | func findBest (acc,elem) = { | |
261 | 261 | let idx = value(indexOf(optionsList, elem)) | |
262 | - | let val = getIntOrElse(keyProposalVotesByIdAndOption(proposalId, idx), 0) | |
262 | + | let val = if (isPrevOptional) | |
263 | + | then if ((idx == newChoice)) | |
264 | + | then newTotalByNewChoice | |
265 | + | else getIntOrElse(keyProposalVotesByIdAndOption(proposalId, idx), 0) | |
266 | + | else if ((idx == value(oldChoice))) | |
267 | + | then optionalTotalOld | |
268 | + | else if ((idx == newChoice)) | |
269 | + | then newTotalByNewChoice | |
270 | + | else getIntOrElse(keyProposalVotesByIdAndOption(proposalId, idx), 0) | |
263 | 271 | if ((acc._2 > val)) | |
264 | 272 | then acc | |
265 | 273 | else $Tuple2(idx, val) | |
266 | 274 | } | |
267 | 275 | ||
268 | - | let choiceAndVal = if (if (isPrevOptional) | |
269 | - | then true | |
270 | - | else (newTotalByNewChoice > optionalTotalOld)) | |
271 | - | then $Tuple2(newChoice, newTotalByNewChoice) | |
272 | - | else $Tuple2(value(oldChoice), optionalTotalOld) | |
273 | 276 | let $l = optionsList | |
274 | 277 | let $s = size($l) | |
275 | - | let $acc0 = | |
278 | + | let $acc0 = $Tuple2(0, 0) | |
276 | 279 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
277 | 280 | then $a | |
278 | 281 | else findBest($a, $l[$i]) | |
279 | 282 | ||
280 | 283 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
281 | 284 | then $a | |
282 | 285 | else throw("List size exceeds 10") | |
283 | 286 | ||
284 | 287 | $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) | |
285 | 288 | } | |
286 | 289 | ||
287 | 290 | ||
288 | 291 | func updateStatusData (oldData,isValid,newWinOpt,newTotalVotes) = makeString(["%b%d%d%d%b%d%b", toString(isValid), toString(newWinOpt._1), toString(newWinOpt._2), toString(newTotalVotes), oldData[govStatusIdxScApplied], oldData[govStatusIdxScTime], oldData[govStatusIdxIsCanceled]], SEP) | |
289 | 292 | ||
290 | 293 | ||
291 | 294 | @Callable(i) | |
292 | 295 | func castVote (proposalId,choice) = { | |
293 | 296 | let userAddressStr = toString(i.caller) | |
294 | 297 | let dynamicData = split(getStringOrFail(this, keyProposalStatusDataById(proposalId)), SEP) | |
295 | 298 | let propData = split(getStringOrFail(this, keyProposalDataById(proposalId)), SEP) | |
296 | 299 | let start = parseIntValue(propData[govIdxStart]) | |
297 | 300 | let end = parseIntValue(propData[govIdxEnd]) | |
298 | 301 | let now = lastBlock.timestamp | |
299 | 302 | if ((start > now)) | |
300 | 303 | then throw("Voting not started yet") | |
301 | 304 | else if ((now >= end)) | |
302 | 305 | then throw("Voting already finished") | |
303 | 306 | else if ((dynamicData[govStatusIdxIsCanceled] == "true")) | |
304 | 307 | then throw("Voting is canceled by team") | |
305 | 308 | else { | |
306 | 309 | let availableOptions = split(propData[govIdxOptions], LISTSEP) | |
307 | 310 | let numOptions = size(availableOptions) | |
308 | 311 | if ((1 >= numOptions)) | |
309 | 312 | then throw("Too few choices to vote") | |
310 | 313 | else if ((choice >= numOptions)) | |
311 | 314 | then throw(("Unknown choice! Must be 0.." + toString((numOptions - 1)))) | |
312 | 315 | else { | |
313 | 316 | let gnsbtData = asAnyList(invoke(gnsbtControllerContract, "gnsbtInfoSYSREADONLY", [userAddressStr, 0, 0], nil)) | |
314 | 317 | let gnsbtAmt = asInt(gnsbtData[0]) | |
315 | 318 | if ((0 >= gnsbtAmt)) | |
316 | 319 | then throw("no gnsbt to vote") | |
317 | 320 | else { | |
318 | 321 | let gnsbtTotal = asInt(gnsbtData[1]) | |
319 | 322 | let oldChoice = getInteger(keyProposalChoiceByIdAndUser(proposalId, userAddressStr)) | |
320 | 323 | let oldUserVotes = if (!(isDefined(oldChoice))) | |
321 | 324 | then 0 | |
322 | 325 | else getIntOrElse(keyProposalVotesByIdAndUser(proposalId, userAddressStr), 0) | |
323 | 326 | let oldTotalByOldChoice = if (isDefined(oldChoice)) | |
324 | 327 | then getIntOrElse(keyProposalVotesByIdAndOption(proposalId, value(oldChoice)), 0) | |
325 | 328 | else 0 | |
326 | 329 | let oldTotalByNewChoice = getIntOrElse(keyProposalVotesByIdAndOption(proposalId, choice), 0) | |
327 | 330 | let oldTotal = parseIntValue(dynamicData[govStatusIdxTotalVotes]) | |
328 | 331 | let newTotalByOldChoice = if (!(isDefined(oldChoice))) | |
329 | 332 | then 0 | |
330 | 333 | else ((oldTotalByOldChoice - oldUserVotes) + (if ((value(oldChoice) == choice)) | |
331 | 334 | then gnsbtAmt | |
332 | 335 | else 0)) | |
333 | 336 | let newTotalByNewChoice = if (if (isDefined(oldChoice)) | |
334 | 337 | then (value(oldChoice) == choice) | |
335 | 338 | else false) | |
336 | 339 | then newTotalByOldChoice | |
337 | 340 | else (oldTotalByNewChoice + gnsbtAmt) | |
338 | 341 | let newTotal = ((oldTotal - oldUserVotes) + gnsbtAmt) | |
339 | 342 | let isQuorumReached = (newTotal > parseIntValue(propData[govIdxQuorum])) | |
340 | 343 | let numVotersByProposalId = getIntOrElse(keyNumUniqueVotersByProposalId(proposalId), 0) | |
341 | 344 | let oldAverUniqueVoters6 = getIntOrElse(keyStatsAverUniqueVoters(), 0) | |
342 | 345 | let numProposals = getIntegerValue(keyLastProposalId()) | |
343 | 346 | let uniqueDiff = if ((oldUserVotes == 0)) | |
344 | 347 | then 1 | |
345 | 348 | else 0 | |
346 | 349 | let newAverUniqueVoters6 = (oldAverUniqueVoters6 + fraction(uniqueDiff, MULT6, numProposals)) | |
347 | 350 | let oldAverGnsbt = getIntOrElse(keyStatsAverGnsbtVoted(), 0) | |
348 | 351 | let newAverGnsbt = (oldAverGnsbt + ((gnsbtAmt - oldUserVotes) / numProposals)) | |
349 | 352 | let isPrevOptional = if (!(isDefined(oldChoice))) | |
350 | 353 | then true | |
351 | 354 | else (value(oldChoice) == choice) | |
352 | 355 | let optionalTotalOld = if (isPrevOptional) | |
353 | 356 | then nil | |
354 | 357 | else [IntegerEntry(keyProposalVotesByIdAndOption(proposalId, value(oldChoice)), newTotalByOldChoice)] | |
355 | 358 | let winOpt = calcWinOption(proposalId, availableOptions, isPrevOptional, oldChoice, newTotalByOldChoice, choice, newTotalByNewChoice) | |
356 | 359 | $Tuple2(([IntegerEntry(keyProposalChoiceByIdAndUser(proposalId, userAddressStr), choice), IntegerEntry(keyProposalVotesByIdAndUser(proposalId, userAddressStr), gnsbtAmt), IntegerEntry(keyProposalVotesByIdAndOption(proposalId, choice), newTotalByNewChoice), IntegerEntry(keyNumUniqueVotersByProposalId(proposalId), (numVotersByProposalId + uniqueDiff)), IntegerEntry(keyStatsAverUniqueVoters(), newAverUniqueVoters6), IntegerEntry(keyStatsAverGnsbtVoted(), newAverGnsbt), StringEntry(keyProposalStatusDataById(proposalId), updateStatusData(dynamicData, isQuorumReached, winOpt, newTotal))] ++ optionalTotalOld), unit) | |
357 | 360 | } | |
358 | 361 | } | |
359 | 362 | } | |
360 | 363 | } | |
361 | 364 | ||
362 | 365 | ||
363 | 366 | ||
364 | 367 | @Callable(i) | |
365 | 368 | func initiateIdeaVoting (forumLink,title,votingStartTime,votingEndTime,optionsList) = if ((size(i.payments) != 1)) | |
366 | 369 | then throw("Exactly one payment required") | |
367 | 370 | else initiateVoting(value(i.payments[0]), toBase58String(i.transactionId), "IDEA", toString(i.caller), forumLink, title, votingStartTime, votingEndTime, "PENDING", nil, optionsList) | |
368 | 371 | ||
369 | 372 | ||
370 | 373 | ||
371 | 374 | @Callable(i) | |
372 | 375 | func initiateUpdateVoting (forumLink,title,votingStartTime,votingEndTime,txList) = if ((size(i.payments) != 1)) | |
373 | 376 | then throw("Exactly one payment required") | |
374 | 377 | else if ((1 > size(txList))) | |
375 | 378 | then throw("Transactions list is empty") | |
376 | 379 | else initiateVoting(value(i.payments[0]), toBase58String(i.transactionId), "UPDATE", toString(i.caller), forumLink, title, votingStartTime, votingEndTime, "PENDING", txList, ["NO", "YES"]) | |
377 | 380 | ||
378 | 381 | ||
379 | 382 | ||
380 | 383 | @Callable(i) | |
381 | 384 | func cancelVoting (proposalId) = if ((i.caller != this)) | |
382 | 385 | then throw("not authorized") | |
383 | 386 | else { | |
384 | 387 | let currentData = getStringOrFail(this, keyProposalStatusDataById(proposalId)) | |
385 | 388 | let updatedData = ((take(currentData, value(lastIndexOf(currentData, SEP))) + SEP) + "true") | |
386 | 389 | $Tuple2([StringEntry(keyProposalStatusDataById(proposalId), updatedData)], unit) | |
387 | 390 | } | |
388 | 391 | ||
389 | 392 | ||
390 | 393 | ||
391 | 394 | @Callable(i) | |
392 | 395 | func applyVoting (proposalId) = $Tuple2(nil, unit) | |
393 | 396 | ||
394 | 397 |
github/deemru/w8io/169f3d6 72.01 ms ◑