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