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