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