tx · AQEwDpn5YGc5fFoHfHvh4XkZH7KpfdVBuQorjYBgesv2 3N6CYoCsxrcXKe75pQvvV3JqJrwJjm1t4QN: -0.01400000 Waves 2021.04.15 17:00 [1483651] smart account 3N6CYoCsxrcXKe75pQvvV3JqJrwJjm1t4QN > SELF 0.00000000 Waves
{ "type": 13, "id": "AQEwDpn5YGc5fFoHfHvh4XkZH7KpfdVBuQorjYBgesv2", "fee": 1400000, "feeAssetId": null, "timestamp": 1618495313032, "version": 2, "chainId": 84, "sender": "3N6CYoCsxrcXKe75pQvvV3JqJrwJjm1t4QN", "senderPublicKey": "9NDcimsSfq5LxxqoVoq2nbMd1zPqZhFvr6mVUiXWwtM1", "proofs": [ "2XXLEAUeFAnAxv2Wjrun8ZqF9LUrVnQyKmusNL9qFvsS8YjreydHLY3MnEmvNviBvtoC4ocud6gVsXBVQPUHHYrx" ], "script": "base64:AAIEAAAAAAAAAAgIAhIECgIYEQAAABwAAAAADGFkbWluUHViS2V5MQEAAAAgBM915WTQwQ9OZ7kfE2TEGg3qhCRCMX0zkF1AWAqdk0oAAAAADGFkbWluUHViS2V5MgEAAAAgBM915WTQwQ9OZ7kfE2TEGg3qhCRCMX0zkF1AWAqdk0oAAAAADGFkbWluUHViS2V5MwEAAAAgBM915WTQwQ9OZ7kfE2TEGg3qhCRCMX0zkF1AWAqdk0oAAAAAEWtVc2VyUG9vbFZvdGVTV09QAgAAAAVfdm90ZQAAAAAOa1VzZXJQb29sU3RydWMCAAAAEF91c2VyX3Bvb2xfc3RydWMAAAAAEmtVc2VyVG90YWxWb3RlU1dPUAIAAAAVX3VzZXJfdG90YWxfU1dPUF92b3RlAAAAAA9rVXNlclRvdGFsU3RydWMCAAAAEV91c2VyX3RvdGFsX3N0cnVjAAAAAA1rUG9vbFZvdGVTV09QAgAAAApfdm90ZV9TV09QAAAAAAprUG9vbFN0cnVjAgAAAAtfcG9vbF9zdHJ1YwAAAAAOa1RvdGFsVm90ZVNXT1ACAAAAD3RvdGFsX3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lRW50cnkAAAADCQAEJQAAAAEIBQAAAAFpAAAABmNhbGxlcgUAAAALcG9vbEFkZHJlc3MFAAAAE3VzZXJQb29sVm90ZVNXT1BuZXcAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tlebyxQlQ=", "height": 1483651, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9itJY4aRJM9V8ev9adGwnQH5PVGb2G7yw4Jk3vFk6QEd Next: HJ6hBzhyoMfDoWDHjvt4EXj2AnfnGFeYYvdEReK5kAn7 Diff:
Old | New | Differences | |
---|---|---|---|
9 | 9 | ||
10 | 10 | let kUserPoolVoteSWOP = "_vote" | |
11 | 11 | ||
12 | + | let kUserPoolStruc = "_user_pool_struc" | |
13 | + | ||
12 | 14 | let kUserTotalVoteSWOP = "_user_total_SWOP_vote" | |
15 | + | ||
16 | + | let kUserTotalStruc = "_user_total_struc" | |
13 | 17 | ||
14 | 18 | let kPoolVoteSWOP = "_vote_SWOP" | |
15 | 19 | ||
20 | + | let kPoolStruc = "_pool_struc" | |
21 | + | ||
16 | 22 | let kTotalVoteSWOP = "total_vote_SWOP" | |
23 | + | ||
24 | + | let kTotalStruc = "total_struc" | |
25 | + | ||
26 | + | let kStartHeight = "start_height" | |
27 | + | ||
28 | + | let kBasePeriod = "base_period" | |
29 | + | ||
30 | + | let kPeriodLength = "period_length" | |
31 | + | ||
32 | + | let kDurationFullVotePower = "duration_full_vote_power" | |
33 | + | ||
34 | + | let kMinVotePower = "min_vote_power" | |
35 | + | ||
36 | + | let scale8 = 100000000 | |
37 | + | ||
38 | + | let basePeriod = valueOrErrorMessage(getInteger(this, kBasePeriod), "Empty kBasePeriod") | |
39 | + | ||
40 | + | let startHeight = valueOrErrorMessage(getInteger(this, kStartHeight), "Empty kStartHeight") | |
41 | + | ||
42 | + | let periodLength = valueOrErrorMessage(getInteger(this, kPeriodLength), "Empty kPeriodLength") | |
43 | + | ||
44 | + | let durationFullVotePower = valueOrErrorMessage(getInteger(this, kDurationFullVotePower), "Empty kDurationFullVotePower") | |
45 | + | ||
46 | + | let minVotePower = valueOrErrorMessage(getInteger(this, kMinVotePower), "Empty kMinVotePower") | |
17 | 47 | ||
18 | 48 | let govAddr = Address(base58'3MzJZEn6jzxCPaHEfkrXd7FhbjTyVjdRPLS') | |
19 | 49 | ||
20 | - | ||
21 | - | ||
22 | - | ||
50 | + | let currPeriod = (basePeriod + ((height - startHeight) / periodLength)) | |
51 | + | ||
52 | + | func isCallerInGovernance (user) = if ((valueOrElse(getInteger(govAddr, (toString(user) + "_SWOP_amount")), 0) > 0)) | |
23 | 53 | then true | |
24 | 54 | else false | |
25 | 55 | ||
27 | 57 | func isPoolInGovernance (poolAddress) = isDefined(getInteger(govAddr, (poolAddress + "_current_pool_fraction_reward"))) | |
28 | 58 | ||
29 | 59 | ||
30 | - | ||
31 | - | ||
32 | - | ||
33 | - | then | |
60 | + | func votingCoef () = { | |
61 | + | let votingDuration = (height - (startHeight + (currPeriod * periodLength))) | |
62 | + | if ((durationFullVotePower > votingDuration)) | |
63 | + | then scale8 | |
34 | 64 | else { | |
35 | - | let poolIndex = value(indexOf(poolAddresses, poolAddress)) | |
36 | - | let userPoolVoteSWOPNew = poolsVoteSWOPNew[poolIndex] | |
37 | - | if ((0 > userPoolVoteSWOPNew)) | |
38 | - | then throw("userPoolVoteSWOPNew < 0") | |
39 | - | else { | |
40 | - | let userPoolVoteSWOP = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + poolAddress) + kUserPoolVoteSWOP)), 0) | |
41 | - | let poolVoteDiffSWOP = (userPoolVoteSWOPNew - userPoolVoteSWOP) | |
42 | - | (accumulated + poolVoteDiffSWOP) | |
43 | - | } | |
44 | - | } | |
45 | - | ||
46 | - | func userVoteEntry (accumulated,poolAddress) = { | |
47 | - | let poolIndex = value(indexOf(poolAddresses, poolAddress)) | |
48 | - | let userPoolVoteSWOPNew = poolsVoteSWOPNew[poolIndex] | |
49 | - | IntegerEntry((((toString(i.caller) + "_") + poolAddress) + kUserPoolVoteSWOP), userPoolVoteSWOPNew) :: accumulated | |
50 | - | } | |
51 | - | ||
52 | - | func poolVoteEntry (accumulated,poolAddress) = { | |
53 | - | let poolIndex = value(indexOf(poolAddresses, poolAddress)) | |
54 | - | let userPoolVoteSWOP = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + poolAddress) + kUserPoolVoteSWOP)), 0) | |
55 | - | let userPoolVoteSWOPNew = poolsVoteSWOPNew[poolIndex] | |
56 | - | let poolVoteDiffSWOP = (userPoolVoteSWOPNew - userPoolVoteSWOP) | |
57 | - | let poolVoteSWOP = valueOrElse(getInteger(this, (poolAddress + kPoolVoteSWOP)), 0) | |
58 | - | let poolVoteSWOPnew = (poolVoteSWOP + poolVoteDiffSWOP) | |
59 | - | IntegerEntry((poolAddress + kPoolVoteSWOP), poolVoteSWOPnew) :: accumulated | |
60 | - | } | |
61 | - | ||
62 | - | if (!(isCallerInGovernance(i.caller))) | |
63 | - | then throw("This address has 0 SWOP in Governance dApp") | |
64 | - | else { | |
65 | - | let totalVoteSWOP = valueOrElse(getInteger(this, kTotalVoteSWOP), 0) | |
66 | - | let userTotalVoteSWOP = valueOrElse(getInteger(this, (toString(i.caller) + kUserTotalVoteSWOP)), 0) | |
67 | - | let userSWOPinGovernance = getIntegerValue(govAddr, (toString(i.caller) + "_SWOP_amount")) | |
68 | - | let userVoteDiffSWOP = { | |
69 | - | let $list30173060 = poolAddresses | |
70 | - | let $size30173060 = size($list30173060) | |
71 | - | let $acc030173060 = 0 | |
72 | - | if (($size30173060 == 0)) | |
73 | - | then $acc030173060 | |
74 | - | else { | |
75 | - | let $acc130173060 = calcVoteDiffSWOP($acc030173060, $list30173060[0]) | |
76 | - | if (($size30173060 == 1)) | |
77 | - | then $acc130173060 | |
78 | - | else { | |
79 | - | let $acc230173060 = calcVoteDiffSWOP($acc130173060, $list30173060[1]) | |
80 | - | if (($size30173060 == 2)) | |
81 | - | then $acc230173060 | |
82 | - | else { | |
83 | - | let $acc330173060 = calcVoteDiffSWOP($acc230173060, $list30173060[2]) | |
84 | - | if (($size30173060 == 3)) | |
85 | - | then $acc330173060 | |
86 | - | else { | |
87 | - | let $acc430173060 = calcVoteDiffSWOP($acc330173060, $list30173060[3]) | |
88 | - | if (($size30173060 == 4)) | |
89 | - | then $acc430173060 | |
90 | - | else { | |
91 | - | let $acc530173060 = calcVoteDiffSWOP($acc430173060, $list30173060[4]) | |
92 | - | if (($size30173060 == 5)) | |
93 | - | then $acc530173060 | |
94 | - | else { | |
95 | - | let $acc630173060 = calcVoteDiffSWOP($acc530173060, $list30173060[5]) | |
96 | - | if (($size30173060 == 6)) | |
97 | - | then $acc630173060 | |
98 | - | else { | |
99 | - | let $acc730173060 = calcVoteDiffSWOP($acc630173060, $list30173060[6]) | |
100 | - | if (($size30173060 == 7)) | |
101 | - | then $acc730173060 | |
102 | - | else { | |
103 | - | let $acc830173060 = calcVoteDiffSWOP($acc730173060, $list30173060[7]) | |
104 | - | if (($size30173060 == 8)) | |
105 | - | then $acc830173060 | |
106 | - | else { | |
107 | - | let $acc930173060 = calcVoteDiffSWOP($acc830173060, $list30173060[8]) | |
108 | - | throw("List size exceed 8") | |
109 | - | } | |
110 | - | } | |
111 | - | } | |
112 | - | } | |
113 | - | } | |
114 | - | } | |
115 | - | } | |
116 | - | } | |
117 | - | } | |
118 | - | } | |
119 | - | let userTotalVoteSWOPNew = (userTotalVoteSWOP + userVoteDiffSWOP) | |
120 | - | let totalVoteSWOPnew = (totalVoteSWOP + userVoteDiffSWOP) | |
121 | - | let userDataEntry = { | |
122 | - | let $list32143255 = poolAddresses | |
123 | - | let $size32143255 = size($list32143255) | |
124 | - | let $acc032143255 = nil | |
125 | - | if (($size32143255 == 0)) | |
126 | - | then $acc032143255 | |
127 | - | else { | |
128 | - | let $acc132143255 = userVoteEntry($acc032143255, $list32143255[0]) | |
129 | - | if (($size32143255 == 1)) | |
130 | - | then $acc132143255 | |
131 | - | else { | |
132 | - | let $acc232143255 = userVoteEntry($acc132143255, $list32143255[1]) | |
133 | - | if (($size32143255 == 2)) | |
134 | - | then $acc232143255 | |
135 | - | else { | |
136 | - | let $acc332143255 = userVoteEntry($acc232143255, $list32143255[2]) | |
137 | - | if (($size32143255 == 3)) | |
138 | - | then $acc332143255 | |
139 | - | else { | |
140 | - | let $acc432143255 = userVoteEntry($acc332143255, $list32143255[3]) | |
141 | - | if (($size32143255 == 4)) | |
142 | - | then $acc432143255 | |
143 | - | else { | |
144 | - | let $acc532143255 = userVoteEntry($acc432143255, $list32143255[4]) | |
145 | - | if (($size32143255 == 5)) | |
146 | - | then $acc532143255 | |
147 | - | else { | |
148 | - | let $acc632143255 = userVoteEntry($acc532143255, $list32143255[5]) | |
149 | - | if (($size32143255 == 6)) | |
150 | - | then $acc632143255 | |
151 | - | else { | |
152 | - | let $acc732143255 = userVoteEntry($acc632143255, $list32143255[6]) | |
153 | - | if (($size32143255 == 7)) | |
154 | - | then $acc732143255 | |
155 | - | else { | |
156 | - | let $acc832143255 = userVoteEntry($acc732143255, $list32143255[7]) | |
157 | - | if (($size32143255 == 8)) | |
158 | - | then $acc832143255 | |
159 | - | else { | |
160 | - | let $acc932143255 = userVoteEntry($acc832143255, $list32143255[8]) | |
161 | - | throw("List size exceed 8") | |
162 | - | } | |
163 | - | } | |
164 | - | } | |
165 | - | } | |
166 | - | } | |
167 | - | } | |
168 | - | } | |
169 | - | } | |
170 | - | } | |
171 | - | } | |
172 | - | let poolDataEntry = { | |
173 | - | let $list32803321 = poolAddresses | |
174 | - | let $size32803321 = size($list32803321) | |
175 | - | let $acc032803321 = nil | |
176 | - | if (($size32803321 == 0)) | |
177 | - | then $acc032803321 | |
178 | - | else { | |
179 | - | let $acc132803321 = poolVoteEntry($acc032803321, $list32803321[0]) | |
180 | - | if (($size32803321 == 1)) | |
181 | - | then $acc132803321 | |
182 | - | else { | |
183 | - | let $acc232803321 = poolVoteEntry($acc132803321, $list32803321[1]) | |
184 | - | if (($size32803321 == 2)) | |
185 | - | then $acc232803321 | |
186 | - | else { | |
187 | - | let $acc332803321 = poolVoteEntry($acc232803321, $list32803321[2]) | |
188 | - | if (($size32803321 == 3)) | |
189 | - | then $acc332803321 | |
190 | - | else { | |
191 | - | let $acc432803321 = poolVoteEntry($acc332803321, $list32803321[3]) | |
192 | - | if (($size32803321 == 4)) | |
193 | - | then $acc432803321 | |
194 | - | else { | |
195 | - | let $acc532803321 = poolVoteEntry($acc432803321, $list32803321[4]) | |
196 | - | if (($size32803321 == 5)) | |
197 | - | then $acc532803321 | |
198 | - | else { | |
199 | - | let $acc632803321 = poolVoteEntry($acc532803321, $list32803321[5]) | |
200 | - | if (($size32803321 == 6)) | |
201 | - | then $acc632803321 | |
202 | - | else { | |
203 | - | let $acc732803321 = poolVoteEntry($acc632803321, $list32803321[6]) | |
204 | - | if (($size32803321 == 7)) | |
205 | - | then $acc732803321 | |
206 | - | else { | |
207 | - | let $acc832803321 = poolVoteEntry($acc732803321, $list32803321[7]) | |
208 | - | if (($size32803321 == 8)) | |
209 | - | then $acc832803321 | |
210 | - | else { | |
211 | - | let $acc932803321 = poolVoteEntry($acc832803321, $list32803321[8]) | |
212 | - | throw("List size exceed 8") | |
213 | - | } | |
214 | - | } | |
215 | - | } | |
216 | - | } | |
217 | - | } | |
218 | - | } | |
219 | - | } | |
220 | - | } | |
221 | - | } | |
222 | - | } | |
223 | - | if ((userTotalVoteSWOPNew > userSWOPinGovernance)) | |
224 | - | then throw(((((toString(this) + " has ") + toString(userSWOPinGovernance)) + " SWOP in governance. New SWOP in voting ") + toString(userTotalVoteSWOPNew))) | |
225 | - | else ((userDataEntry ++ poolDataEntry) ++ [IntegerEntry((toString(i.caller) + kUserTotalVoteSWOP), userTotalVoteSWOPNew), IntegerEntry(kTotalVoteSWOP, totalVoteSWOPnew)]) | |
65 | + | let x1 = durationFullVotePower | |
66 | + | let y1 = scale8 | |
67 | + | let x2 = periodLength | |
68 | + | let y2 = minVotePower | |
69 | + | let k = (((y2 - y1) * scale8) / (x2 - x1)) | |
70 | + | let b = ((y1 * scale8) - (k * x1)) | |
71 | + | (((votingDuration * k) / scale8) + (b / scale8)) | |
226 | 72 | } | |
227 | 73 | } | |
74 | + | ||
75 | + | ||
76 | + | func calcDeleteEntry (caller,poolAddress,userPoolVoteSWOPnew) = { | |
77 | + | let deleteKeyUserPoolVoteSWOP = if (isDefined(getInteger(this, (((caller + "_") + poolAddress) + kUserPoolVoteSWOP)))) | |
78 | + | then DeleteEntry((((caller + "_") + poolAddress) + kUserPoolVoteSWOP)) | |
79 | + | else DeleteEntry(".") | |
80 | + | let deleteKeyUserTotalVoteSWOP = if (isDefined(getInteger(this, (caller + kUserTotalVoteSWOP)))) | |
81 | + | then DeleteEntry((caller + kUserTotalVoteSWOP)) | |
82 | + | else DeleteEntry(".") | |
83 | + | let deleteKeyPoolVoteSWOP = if (isDefined(getInteger(this, (poolAddress + kPoolVoteSWOP)))) | |
84 | + | then DeleteEntry((poolAddress + kPoolVoteSWOP)) | |
85 | + | else DeleteEntry(".") | |
86 | + | let deleteKeyTotalVoteSWOP = if (isDefined(getInteger(this, kTotalVoteSWOP))) | |
87 | + | then DeleteEntry(kTotalVoteSWOP) | |
88 | + | else DeleteEntry(".") | |
89 | + | [deleteKeyUserPoolVoteSWOP, deleteKeyUserTotalVoteSWOP, deleteKeyPoolVoteSWOP, deleteKeyTotalVoteSWOP] | |
90 | + | } | |
91 | + | ||
92 | + | ||
93 | + | @Callable(i) | |
94 | + | func votePoolWeight (poolAddressesL,poolsVoteSWOPNewL) = if (if ((size(poolAddressesL) > 1)) | |
95 | + | then true | |
96 | + | else (size(poolsVoteSWOPNewL) > 1)) | |
97 | + | then throw(" poolAddressesL.size > 1 or poolsVoteSWOPNewL.size >") | |
98 | + | else { | |
99 | + | let poolAddress = poolAddressesL[0] | |
100 | + | let userPoolVoteSWOPnew = poolsVoteSWOPNewL[0] | |
101 | + | let userSWOPinGovernance = valueOrErrorMessage(getInteger(govAddr, (toString(i.caller) + "_SWOP_amount")), "Empty _SWOP_amount at gov. address") | |
102 | + | let $t038104443 = if (isDefined(getString(this, (((toString(i.caller) + "_") + poolAddress) + kUserPoolStruc)))) | |
103 | + | then { | |
104 | + | let data = split(valueOrErrorMessage(getString(this, (((toString(i.caller) + "_") + poolAddress) + kUserPoolStruc)), "Empty kUserPoolStruc"), "_") | |
105 | + | $Tuple4(parseIntValue(data[0]), parseIntValue(data[1]), parseIntValue(data[2]), parseIntValue(data[3])) | |
106 | + | } | |
107 | + | else { | |
108 | + | let uPoolVoteSWOP = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + poolAddress) + kUserPoolVoteSWOP)), 0) | |
109 | + | $Tuple4(uPoolVoteSWOP, uPoolVoteSWOP, 0, 0) | |
110 | + | } | |
111 | + | let userPoolVoteSWOP = $t038104443._1 | |
112 | + | let userPoolActiveVoteSWOP = $t038104443._2 | |
113 | + | let userPoolVotePeriod = $t038104443._3 | |
114 | + | let userPoolFreezeSWOP = $t038104443._4 | |
115 | + | let $t044494957 = if (isDefined(getString(this, (toString(i.caller) + kUserTotalStruc)))) | |
116 | + | then { | |
117 | + | let data = split(valueOrErrorMessage(getString(this, (toString(i.caller) + kUserTotalStruc)), "Empty kUserTotalStruc"), "_") | |
118 | + | $Tuple3(parseIntValue(data[0]), parseIntValue(data[1]), parseIntValue(data[2])) | |
119 | + | } | |
120 | + | else { | |
121 | + | let uPoolTotalSWOP = valueOrElse(getInteger(this, (toString(i.caller) + kUserTotalVoteSWOP)), 0) | |
122 | + | $Tuple3(uPoolTotalSWOP, 0, 0) | |
123 | + | } | |
124 | + | let userTotalVoteSWOP = $t044494957._1 | |
125 | + | let userUnvoted = $t044494957._2 | |
126 | + | let userUnvotedPeriod = $t044494957._3 | |
127 | + | let $t049625469 = if (isDefined(getString(this, (poolAddress + kPoolStruc)))) | |
128 | + | then { | |
129 | + | let data = split(valueOrErrorMessage(getString(this, (poolAddress + kPoolStruc)), "Empty kPoolStruc"), "_") | |
130 | + | $Tuple4(parseIntValue(data[0]), parseIntValue(data[1]), parseIntValue(data[2]), parseIntValue(data[3])) | |
131 | + | } | |
132 | + | else { | |
133 | + | let uPoolVoteSWOP = valueOrElse(getInteger(this, (poolAddress + kPoolVoteSWOP)), 0) | |
134 | + | $Tuple4(uPoolVoteSWOP, uPoolVoteSWOP, 0, 0) | |
135 | + | } | |
136 | + | let poolVoteSWOP = $t049625469._1 | |
137 | + | let poolActiveSWOP = $t049625469._2 | |
138 | + | let poolPeriod = $t049625469._3 | |
139 | + | let poolFreezeSWOP = $t049625469._4 | |
140 | + | let $t054755951 = if (isDefined(getString(this, kTotalStruc))) | |
141 | + | then { | |
142 | + | let data = split(valueOrErrorMessage(getString(this, kTotalStruc), "Empty kTotalStruc"), "_") | |
143 | + | $Tuple4(parseIntValue(data[0]), parseIntValue(data[1]), parseIntValue(data[2]), parseIntValue(data[3])) | |
144 | + | } | |
145 | + | else { | |
146 | + | let uTotalVoteSWOP = valueOrElse(getInteger(this, kTotalVoteSWOP), 0) | |
147 | + | $Tuple4(uTotalVoteSWOP, uTotalVoteSWOP, 0, 0) | |
148 | + | } | |
149 | + | let totalVoteSWOP = $t054755951._1 | |
150 | + | let totalActiveSWOP = $t054755951._2 | |
151 | + | let totalPeriod = $t054755951._3 | |
152 | + | let totalFreezeSWOP = $t054755951._4 | |
153 | + | let poolVoteDiffSWOP = (userPoolVoteSWOPnew - userPoolVoteSWOP) | |
154 | + | let userTotalVoteSWOPnew = (userTotalVoteSWOP + poolVoteDiffSWOP) | |
155 | + | if (!(isCallerInGovernance(i.caller))) | |
156 | + | then throw("This address has 0 SWOP in Governance dApp") | |
157 | + | else if ((userTotalVoteSWOPnew > userSWOPinGovernance)) | |
158 | + | then throw(((((toString(this) + " has ") + toString(userSWOPinGovernance)) + " SWOP in governance. New SWOP in voting ") + toString(userTotalVoteSWOPnew))) | |
159 | + | else if ((0 > userTotalVoteSWOPnew)) | |
160 | + | then throw("New userTotalVoteSWOPnew < 0") | |
161 | + | else if ((0 > userPoolVoteSWOPnew)) | |
162 | + | then throw("New userPoolVoteSWOPnew < 0") | |
163 | + | else if ((userPoolVoteSWOPnew >= userPoolVoteSWOP)) | |
164 | + | then { | |
165 | + | let coef = votingCoef() | |
166 | + | let userPoolActiveVoteSWOPnew = if ((userPoolVotePeriod == currPeriod)) | |
167 | + | then (userPoolActiveVoteSWOP + ((poolVoteDiffSWOP * coef) / scale8)) | |
168 | + | else (userPoolVoteSWOP + ((poolVoteDiffSWOP * coef) / scale8)) | |
169 | + | let userPoolFreezeSWOPnew = if ((userPoolVotePeriod == currPeriod)) | |
170 | + | then userPoolFreezeSWOP | |
171 | + | else userPoolVoteSWOP | |
172 | + | let userUnvotedNew = if ((userUnvoted == currPeriod)) | |
173 | + | then userUnvoted | |
174 | + | else max([0, (userUnvoted - poolVoteDiffSWOP)]) | |
175 | + | let userPoolStrucNew = ((((((toString(userPoolVoteSWOPnew) + "_") + toString(userPoolActiveVoteSWOPnew)) + "_") + toString(currPeriod)) + "_") + toString(userPoolFreezeSWOPnew)) | |
176 | + | let userPoolEntry = [StringEntry((((toString(i.caller) + "_") + poolAddress) + kUserPoolStruc), userPoolStrucNew)] | |
177 | + | let userTotalStrucNew = ((((toString(userTotalVoteSWOPnew) + "_") + toString(userUnvotedNew)) + "_") + toString(currPeriod)) | |
178 | + | let userTotalEntry = [StringEntry((toString(i.caller) + kUserTotalStruc), userTotalStrucNew)] | |
179 | + | let poolVoteSWOPnew = (poolVoteSWOP + poolVoteDiffSWOP) | |
180 | + | let poolActiveSWOPnew = if ((poolPeriod == currPeriod)) | |
181 | + | then (poolActiveSWOP + ((poolVoteDiffSWOP * coef) / scale8)) | |
182 | + | else (poolVoteSWOP + ((poolVoteDiffSWOP * coef) / scale8)) | |
183 | + | let poolFreezeSWOPnew = if ((poolPeriod == currPeriod)) | |
184 | + | then poolFreezeSWOP | |
185 | + | else poolVoteSWOP | |
186 | + | let poolStrucNew = ((((((toString(poolVoteSWOPnew) + "_") + toString(poolActiveSWOPnew)) + "_") + toString(currPeriod)) + "_") + toString(poolFreezeSWOPnew)) | |
187 | + | let poolEntry = [StringEntry((poolAddress + kPoolStruc), poolStrucNew)] | |
188 | + | let totalVoteSWOPnew = (totalVoteSWOP + poolVoteDiffSWOP) | |
189 | + | let totalActiveSWOPnew = if ((totalPeriod == currPeriod)) | |
190 | + | then (totalActiveSWOP + ((poolVoteDiffSWOP * coef) / scale8)) | |
191 | + | else (totalVoteSWOP + ((poolVoteDiffSWOP * coef) / scale8)) | |
192 | + | let totalFreezeSWOPnew = if ((poolPeriod == currPeriod)) | |
193 | + | then totalFreezeSWOP | |
194 | + | else totalVoteSWOP | |
195 | + | let totalStrucNew = ((((((toString(totalVoteSWOPnew) + "_") + toString(totalActiveSWOPnew)) + "_") + toString(totalPeriod)) + "_") + toString(totalFreezeSWOPnew)) | |
196 | + | let totalEntry = [StringEntry(kTotalStruc, totalStrucNew)] | |
197 | + | ((((userPoolEntry ++ userTotalEntry) ++ poolEntry) ++ totalEntry) ++ calcDeleteEntry(toString(i.caller), poolAddress, userPoolVoteSWOPnew)) | |
198 | + | } | |
199 | + | else { | |
200 | + | let removePoolVote = -(poolVoteDiffSWOP) | |
201 | + | let userPoolFreezeSWOPnew = if ((userPoolVotePeriod == currPeriod)) | |
202 | + | then min([userPoolFreezeSWOP, userPoolVoteSWOPnew]) | |
203 | + | else userPoolVoteSWOPnew | |
204 | + | let userPoolActiveVoteSWOPnew = if (((userPoolVoteSWOP - userPoolFreezeSWOP) == 0)) | |
205 | + | then 0 | |
206 | + | else (userPoolFreezeSWOPnew + (((userPoolActiveVoteSWOP - userPoolFreezeSWOP) * (userPoolVoteSWOPnew - userPoolFreezeSWOPnew)) / (userPoolVoteSWOP - userPoolFreezeSWOP))) | |
207 | + | let newUnvoted = max([0, (removePoolVote - (if ((userUnvotedPeriod == currPeriod)) | |
208 | + | then (userPoolVoteSWOP - userPoolFreezeSWOP) | |
209 | + | else 0))]) | |
210 | + | let userUnvotedNew = if ((userUnvotedPeriod == currPeriod)) | |
211 | + | then userUnvoted | |
212 | + | else (0 + newUnvoted) | |
213 | + | let userUnvotedPeriodNew = if ((newUnvoted > 0)) | |
214 | + | then currPeriod | |
215 | + | else userUnvotedPeriod | |
216 | + | let userPoolStrucNew = ((((((toString(userPoolVoteSWOPnew) + "_") + toString(userPoolActiveVoteSWOPnew)) + "_") + toString(currPeriod)) + "_") + toString(userPoolFreezeSWOPnew)) | |
217 | + | let userPoolEntry = [StringEntry((((toString(i.caller) + "_") + poolAddress) + kUserPoolStruc), userPoolStrucNew)] | |
218 | + | let userTotalStrucNew = ((((toString(userTotalVoteSWOPnew) + "_") + toString(userUnvotedNew)) + "_") + toString(currPeriod)) | |
219 | + | let userTotalEntry = [StringEntry((toString(i.caller) + kUserTotalStruc), userTotalStrucNew)] | |
220 | + | let poolVoteSWOPnew = (poolVoteSWOP - removePoolVote) | |
221 | + | let poolFreezeSWOPnew = if ((poolPeriod == currPeriod)) | |
222 | + | then min([poolFreezeSWOP, poolVoteSWOPnew]) | |
223 | + | else poolVoteSWOPnew | |
224 | + | let poolActiveSWOPnew = if (((poolVoteSWOP - poolFreezeSWOP) == 0)) | |
225 | + | then 0 | |
226 | + | else (poolFreezeSWOPnew + (((poolActiveSWOP - poolFreezeSWOP) * (poolVoteSWOPnew - poolFreezeSWOPnew)) / (poolVoteSWOP - poolFreezeSWOP))) | |
227 | + | let poolStrucNew = ((((((toString(poolVoteSWOPnew) + "_") + toString(poolActiveSWOPnew)) + "_") + toString(currPeriod)) + "_") + toString(poolFreezeSWOPnew)) | |
228 | + | let poolEntry = [StringEntry((poolAddress + kPoolStruc), poolStrucNew)] | |
229 | + | let totalVoteSWOPnew = (totalVoteSWOP - removePoolVote) | |
230 | + | let totalFreezeSWOPnew = if ((totalPeriod == currPeriod)) | |
231 | + | then min([totalFreezeSWOP, totalVoteSWOPnew]) | |
232 | + | else totalVoteSWOPnew | |
233 | + | let totalActiveSWOPnew = if (((totalVoteSWOP - totalFreezeSWOP) == 0)) | |
234 | + | then 0 | |
235 | + | else (totalFreezeSWOPnew + (((totalActiveSWOP - totalFreezeSWOP) * (totalVoteSWOPnew - totalFreezeSWOPnew)) / (totalVoteSWOP - totalFreezeSWOP))) | |
236 | + | let totalStrucNew = ((((((toString(totalVoteSWOPnew) + "_") + toString(totalActiveSWOPnew)) + "_") + toString(totalPeriod)) + "_") + toString(totalFreezeSWOPnew)) | |
237 | + | let totalEntry = [StringEntry(kTotalStruc, totalStrucNew)] | |
238 | + | let allNewValues = [currPeriod, userPoolFreezeSWOPnew, userPoolActiveVoteSWOPnew, userPoolFreezeSWOPnew, userUnvotedNew, userUnvotedPeriodNew, poolVoteSWOPnew, poolFreezeSWOPnew, poolActiveSWOPnew, totalVoteSWOPnew, totalFreezeSWOPnew, totalActiveSWOPnew] | |
239 | + | if ((0 > min(allNewValues))) | |
240 | + | then throw("One or more values are negative") | |
241 | + | else ((((userPoolEntry ++ userTotalEntry) ++ poolEntry) ++ totalEntry) ++ calcDeleteEntry(toString(i.caller), poolAddress, userPoolVoteSWOPnew)) | |
242 | + | } | |
243 | + | } | |
228 | 244 | ||
229 | 245 | ||
230 | 246 | @Verifier(tx) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let adminPubKey1 = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
5 | 5 | ||
6 | 6 | let adminPubKey2 = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
7 | 7 | ||
8 | 8 | let adminPubKey3 = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
9 | 9 | ||
10 | 10 | let kUserPoolVoteSWOP = "_vote" | |
11 | 11 | ||
12 | + | let kUserPoolStruc = "_user_pool_struc" | |
13 | + | ||
12 | 14 | let kUserTotalVoteSWOP = "_user_total_SWOP_vote" | |
15 | + | ||
16 | + | let kUserTotalStruc = "_user_total_struc" | |
13 | 17 | ||
14 | 18 | let kPoolVoteSWOP = "_vote_SWOP" | |
15 | 19 | ||
20 | + | let kPoolStruc = "_pool_struc" | |
21 | + | ||
16 | 22 | let kTotalVoteSWOP = "total_vote_SWOP" | |
23 | + | ||
24 | + | let kTotalStruc = "total_struc" | |
25 | + | ||
26 | + | let kStartHeight = "start_height" | |
27 | + | ||
28 | + | let kBasePeriod = "base_period" | |
29 | + | ||
30 | + | let kPeriodLength = "period_length" | |
31 | + | ||
32 | + | let kDurationFullVotePower = "duration_full_vote_power" | |
33 | + | ||
34 | + | let kMinVotePower = "min_vote_power" | |
35 | + | ||
36 | + | let scale8 = 100000000 | |
37 | + | ||
38 | + | let basePeriod = valueOrErrorMessage(getInteger(this, kBasePeriod), "Empty kBasePeriod") | |
39 | + | ||
40 | + | let startHeight = valueOrErrorMessage(getInteger(this, kStartHeight), "Empty kStartHeight") | |
41 | + | ||
42 | + | let periodLength = valueOrErrorMessage(getInteger(this, kPeriodLength), "Empty kPeriodLength") | |
43 | + | ||
44 | + | let durationFullVotePower = valueOrErrorMessage(getInteger(this, kDurationFullVotePower), "Empty kDurationFullVotePower") | |
45 | + | ||
46 | + | let minVotePower = valueOrErrorMessage(getInteger(this, kMinVotePower), "Empty kMinVotePower") | |
17 | 47 | ||
18 | 48 | let govAddr = Address(base58'3MzJZEn6jzxCPaHEfkrXd7FhbjTyVjdRPLS') | |
19 | 49 | ||
20 | - | ||
21 | - | ||
22 | - | ||
50 | + | let currPeriod = (basePeriod + ((height - startHeight) / periodLength)) | |
51 | + | ||
52 | + | func isCallerInGovernance (user) = if ((valueOrElse(getInteger(govAddr, (toString(user) + "_SWOP_amount")), 0) > 0)) | |
23 | 53 | then true | |
24 | 54 | else false | |
25 | 55 | ||
26 | 56 | ||
27 | 57 | func isPoolInGovernance (poolAddress) = isDefined(getInteger(govAddr, (poolAddress + "_current_pool_fraction_reward"))) | |
28 | 58 | ||
29 | 59 | ||
30 | - | ||
31 | - | ||
32 | - | ||
33 | - | then | |
60 | + | func votingCoef () = { | |
61 | + | let votingDuration = (height - (startHeight + (currPeriod * periodLength))) | |
62 | + | if ((durationFullVotePower > votingDuration)) | |
63 | + | then scale8 | |
34 | 64 | else { | |
35 | - | let poolIndex = value(indexOf(poolAddresses, poolAddress)) | |
36 | - | let userPoolVoteSWOPNew = poolsVoteSWOPNew[poolIndex] | |
37 | - | if ((0 > userPoolVoteSWOPNew)) | |
38 | - | then throw("userPoolVoteSWOPNew < 0") | |
39 | - | else { | |
40 | - | let userPoolVoteSWOP = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + poolAddress) + kUserPoolVoteSWOP)), 0) | |
41 | - | let poolVoteDiffSWOP = (userPoolVoteSWOPNew - userPoolVoteSWOP) | |
42 | - | (accumulated + poolVoteDiffSWOP) | |
43 | - | } | |
44 | - | } | |
45 | - | ||
46 | - | func userVoteEntry (accumulated,poolAddress) = { | |
47 | - | let poolIndex = value(indexOf(poolAddresses, poolAddress)) | |
48 | - | let userPoolVoteSWOPNew = poolsVoteSWOPNew[poolIndex] | |
49 | - | IntegerEntry((((toString(i.caller) + "_") + poolAddress) + kUserPoolVoteSWOP), userPoolVoteSWOPNew) :: accumulated | |
50 | - | } | |
51 | - | ||
52 | - | func poolVoteEntry (accumulated,poolAddress) = { | |
53 | - | let poolIndex = value(indexOf(poolAddresses, poolAddress)) | |
54 | - | let userPoolVoteSWOP = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + poolAddress) + kUserPoolVoteSWOP)), 0) | |
55 | - | let userPoolVoteSWOPNew = poolsVoteSWOPNew[poolIndex] | |
56 | - | let poolVoteDiffSWOP = (userPoolVoteSWOPNew - userPoolVoteSWOP) | |
57 | - | let poolVoteSWOP = valueOrElse(getInteger(this, (poolAddress + kPoolVoteSWOP)), 0) | |
58 | - | let poolVoteSWOPnew = (poolVoteSWOP + poolVoteDiffSWOP) | |
59 | - | IntegerEntry((poolAddress + kPoolVoteSWOP), poolVoteSWOPnew) :: accumulated | |
60 | - | } | |
61 | - | ||
62 | - | if (!(isCallerInGovernance(i.caller))) | |
63 | - | then throw("This address has 0 SWOP in Governance dApp") | |
64 | - | else { | |
65 | - | let totalVoteSWOP = valueOrElse(getInteger(this, kTotalVoteSWOP), 0) | |
66 | - | let userTotalVoteSWOP = valueOrElse(getInteger(this, (toString(i.caller) + kUserTotalVoteSWOP)), 0) | |
67 | - | let userSWOPinGovernance = getIntegerValue(govAddr, (toString(i.caller) + "_SWOP_amount")) | |
68 | - | let userVoteDiffSWOP = { | |
69 | - | let $list30173060 = poolAddresses | |
70 | - | let $size30173060 = size($list30173060) | |
71 | - | let $acc030173060 = 0 | |
72 | - | if (($size30173060 == 0)) | |
73 | - | then $acc030173060 | |
74 | - | else { | |
75 | - | let $acc130173060 = calcVoteDiffSWOP($acc030173060, $list30173060[0]) | |
76 | - | if (($size30173060 == 1)) | |
77 | - | then $acc130173060 | |
78 | - | else { | |
79 | - | let $acc230173060 = calcVoteDiffSWOP($acc130173060, $list30173060[1]) | |
80 | - | if (($size30173060 == 2)) | |
81 | - | then $acc230173060 | |
82 | - | else { | |
83 | - | let $acc330173060 = calcVoteDiffSWOP($acc230173060, $list30173060[2]) | |
84 | - | if (($size30173060 == 3)) | |
85 | - | then $acc330173060 | |
86 | - | else { | |
87 | - | let $acc430173060 = calcVoteDiffSWOP($acc330173060, $list30173060[3]) | |
88 | - | if (($size30173060 == 4)) | |
89 | - | then $acc430173060 | |
90 | - | else { | |
91 | - | let $acc530173060 = calcVoteDiffSWOP($acc430173060, $list30173060[4]) | |
92 | - | if (($size30173060 == 5)) | |
93 | - | then $acc530173060 | |
94 | - | else { | |
95 | - | let $acc630173060 = calcVoteDiffSWOP($acc530173060, $list30173060[5]) | |
96 | - | if (($size30173060 == 6)) | |
97 | - | then $acc630173060 | |
98 | - | else { | |
99 | - | let $acc730173060 = calcVoteDiffSWOP($acc630173060, $list30173060[6]) | |
100 | - | if (($size30173060 == 7)) | |
101 | - | then $acc730173060 | |
102 | - | else { | |
103 | - | let $acc830173060 = calcVoteDiffSWOP($acc730173060, $list30173060[7]) | |
104 | - | if (($size30173060 == 8)) | |
105 | - | then $acc830173060 | |
106 | - | else { | |
107 | - | let $acc930173060 = calcVoteDiffSWOP($acc830173060, $list30173060[8]) | |
108 | - | throw("List size exceed 8") | |
109 | - | } | |
110 | - | } | |
111 | - | } | |
112 | - | } | |
113 | - | } | |
114 | - | } | |
115 | - | } | |
116 | - | } | |
117 | - | } | |
118 | - | } | |
119 | - | let userTotalVoteSWOPNew = (userTotalVoteSWOP + userVoteDiffSWOP) | |
120 | - | let totalVoteSWOPnew = (totalVoteSWOP + userVoteDiffSWOP) | |
121 | - | let userDataEntry = { | |
122 | - | let $list32143255 = poolAddresses | |
123 | - | let $size32143255 = size($list32143255) | |
124 | - | let $acc032143255 = nil | |
125 | - | if (($size32143255 == 0)) | |
126 | - | then $acc032143255 | |
127 | - | else { | |
128 | - | let $acc132143255 = userVoteEntry($acc032143255, $list32143255[0]) | |
129 | - | if (($size32143255 == 1)) | |
130 | - | then $acc132143255 | |
131 | - | else { | |
132 | - | let $acc232143255 = userVoteEntry($acc132143255, $list32143255[1]) | |
133 | - | if (($size32143255 == 2)) | |
134 | - | then $acc232143255 | |
135 | - | else { | |
136 | - | let $acc332143255 = userVoteEntry($acc232143255, $list32143255[2]) | |
137 | - | if (($size32143255 == 3)) | |
138 | - | then $acc332143255 | |
139 | - | else { | |
140 | - | let $acc432143255 = userVoteEntry($acc332143255, $list32143255[3]) | |
141 | - | if (($size32143255 == 4)) | |
142 | - | then $acc432143255 | |
143 | - | else { | |
144 | - | let $acc532143255 = userVoteEntry($acc432143255, $list32143255[4]) | |
145 | - | if (($size32143255 == 5)) | |
146 | - | then $acc532143255 | |
147 | - | else { | |
148 | - | let $acc632143255 = userVoteEntry($acc532143255, $list32143255[5]) | |
149 | - | if (($size32143255 == 6)) | |
150 | - | then $acc632143255 | |
151 | - | else { | |
152 | - | let $acc732143255 = userVoteEntry($acc632143255, $list32143255[6]) | |
153 | - | if (($size32143255 == 7)) | |
154 | - | then $acc732143255 | |
155 | - | else { | |
156 | - | let $acc832143255 = userVoteEntry($acc732143255, $list32143255[7]) | |
157 | - | if (($size32143255 == 8)) | |
158 | - | then $acc832143255 | |
159 | - | else { | |
160 | - | let $acc932143255 = userVoteEntry($acc832143255, $list32143255[8]) | |
161 | - | throw("List size exceed 8") | |
162 | - | } | |
163 | - | } | |
164 | - | } | |
165 | - | } | |
166 | - | } | |
167 | - | } | |
168 | - | } | |
169 | - | } | |
170 | - | } | |
171 | - | } | |
172 | - | let poolDataEntry = { | |
173 | - | let $list32803321 = poolAddresses | |
174 | - | let $size32803321 = size($list32803321) | |
175 | - | let $acc032803321 = nil | |
176 | - | if (($size32803321 == 0)) | |
177 | - | then $acc032803321 | |
178 | - | else { | |
179 | - | let $acc132803321 = poolVoteEntry($acc032803321, $list32803321[0]) | |
180 | - | if (($size32803321 == 1)) | |
181 | - | then $acc132803321 | |
182 | - | else { | |
183 | - | let $acc232803321 = poolVoteEntry($acc132803321, $list32803321[1]) | |
184 | - | if (($size32803321 == 2)) | |
185 | - | then $acc232803321 | |
186 | - | else { | |
187 | - | let $acc332803321 = poolVoteEntry($acc232803321, $list32803321[2]) | |
188 | - | if (($size32803321 == 3)) | |
189 | - | then $acc332803321 | |
190 | - | else { | |
191 | - | let $acc432803321 = poolVoteEntry($acc332803321, $list32803321[3]) | |
192 | - | if (($size32803321 == 4)) | |
193 | - | then $acc432803321 | |
194 | - | else { | |
195 | - | let $acc532803321 = poolVoteEntry($acc432803321, $list32803321[4]) | |
196 | - | if (($size32803321 == 5)) | |
197 | - | then $acc532803321 | |
198 | - | else { | |
199 | - | let $acc632803321 = poolVoteEntry($acc532803321, $list32803321[5]) | |
200 | - | if (($size32803321 == 6)) | |
201 | - | then $acc632803321 | |
202 | - | else { | |
203 | - | let $acc732803321 = poolVoteEntry($acc632803321, $list32803321[6]) | |
204 | - | if (($size32803321 == 7)) | |
205 | - | then $acc732803321 | |
206 | - | else { | |
207 | - | let $acc832803321 = poolVoteEntry($acc732803321, $list32803321[7]) | |
208 | - | if (($size32803321 == 8)) | |
209 | - | then $acc832803321 | |
210 | - | else { | |
211 | - | let $acc932803321 = poolVoteEntry($acc832803321, $list32803321[8]) | |
212 | - | throw("List size exceed 8") | |
213 | - | } | |
214 | - | } | |
215 | - | } | |
216 | - | } | |
217 | - | } | |
218 | - | } | |
219 | - | } | |
220 | - | } | |
221 | - | } | |
222 | - | } | |
223 | - | if ((userTotalVoteSWOPNew > userSWOPinGovernance)) | |
224 | - | then throw(((((toString(this) + " has ") + toString(userSWOPinGovernance)) + " SWOP in governance. New SWOP in voting ") + toString(userTotalVoteSWOPNew))) | |
225 | - | else ((userDataEntry ++ poolDataEntry) ++ [IntegerEntry((toString(i.caller) + kUserTotalVoteSWOP), userTotalVoteSWOPNew), IntegerEntry(kTotalVoteSWOP, totalVoteSWOPnew)]) | |
65 | + | let x1 = durationFullVotePower | |
66 | + | let y1 = scale8 | |
67 | + | let x2 = periodLength | |
68 | + | let y2 = minVotePower | |
69 | + | let k = (((y2 - y1) * scale8) / (x2 - x1)) | |
70 | + | let b = ((y1 * scale8) - (k * x1)) | |
71 | + | (((votingDuration * k) / scale8) + (b / scale8)) | |
226 | 72 | } | |
227 | 73 | } | |
74 | + | ||
75 | + | ||
76 | + | func calcDeleteEntry (caller,poolAddress,userPoolVoteSWOPnew) = { | |
77 | + | let deleteKeyUserPoolVoteSWOP = if (isDefined(getInteger(this, (((caller + "_") + poolAddress) + kUserPoolVoteSWOP)))) | |
78 | + | then DeleteEntry((((caller + "_") + poolAddress) + kUserPoolVoteSWOP)) | |
79 | + | else DeleteEntry(".") | |
80 | + | let deleteKeyUserTotalVoteSWOP = if (isDefined(getInteger(this, (caller + kUserTotalVoteSWOP)))) | |
81 | + | then DeleteEntry((caller + kUserTotalVoteSWOP)) | |
82 | + | else DeleteEntry(".") | |
83 | + | let deleteKeyPoolVoteSWOP = if (isDefined(getInteger(this, (poolAddress + kPoolVoteSWOP)))) | |
84 | + | then DeleteEntry((poolAddress + kPoolVoteSWOP)) | |
85 | + | else DeleteEntry(".") | |
86 | + | let deleteKeyTotalVoteSWOP = if (isDefined(getInteger(this, kTotalVoteSWOP))) | |
87 | + | then DeleteEntry(kTotalVoteSWOP) | |
88 | + | else DeleteEntry(".") | |
89 | + | [deleteKeyUserPoolVoteSWOP, deleteKeyUserTotalVoteSWOP, deleteKeyPoolVoteSWOP, deleteKeyTotalVoteSWOP] | |
90 | + | } | |
91 | + | ||
92 | + | ||
93 | + | @Callable(i) | |
94 | + | func votePoolWeight (poolAddressesL,poolsVoteSWOPNewL) = if (if ((size(poolAddressesL) > 1)) | |
95 | + | then true | |
96 | + | else (size(poolsVoteSWOPNewL) > 1)) | |
97 | + | then throw(" poolAddressesL.size > 1 or poolsVoteSWOPNewL.size >") | |
98 | + | else { | |
99 | + | let poolAddress = poolAddressesL[0] | |
100 | + | let userPoolVoteSWOPnew = poolsVoteSWOPNewL[0] | |
101 | + | let userSWOPinGovernance = valueOrErrorMessage(getInteger(govAddr, (toString(i.caller) + "_SWOP_amount")), "Empty _SWOP_amount at gov. address") | |
102 | + | let $t038104443 = if (isDefined(getString(this, (((toString(i.caller) + "_") + poolAddress) + kUserPoolStruc)))) | |
103 | + | then { | |
104 | + | let data = split(valueOrErrorMessage(getString(this, (((toString(i.caller) + "_") + poolAddress) + kUserPoolStruc)), "Empty kUserPoolStruc"), "_") | |
105 | + | $Tuple4(parseIntValue(data[0]), parseIntValue(data[1]), parseIntValue(data[2]), parseIntValue(data[3])) | |
106 | + | } | |
107 | + | else { | |
108 | + | let uPoolVoteSWOP = valueOrElse(getInteger(this, (((toString(i.caller) + "_") + poolAddress) + kUserPoolVoteSWOP)), 0) | |
109 | + | $Tuple4(uPoolVoteSWOP, uPoolVoteSWOP, 0, 0) | |
110 | + | } | |
111 | + | let userPoolVoteSWOP = $t038104443._1 | |
112 | + | let userPoolActiveVoteSWOP = $t038104443._2 | |
113 | + | let userPoolVotePeriod = $t038104443._3 | |
114 | + | let userPoolFreezeSWOP = $t038104443._4 | |
115 | + | let $t044494957 = if (isDefined(getString(this, (toString(i.caller) + kUserTotalStruc)))) | |
116 | + | then { | |
117 | + | let data = split(valueOrErrorMessage(getString(this, (toString(i.caller) + kUserTotalStruc)), "Empty kUserTotalStruc"), "_") | |
118 | + | $Tuple3(parseIntValue(data[0]), parseIntValue(data[1]), parseIntValue(data[2])) | |
119 | + | } | |
120 | + | else { | |
121 | + | let uPoolTotalSWOP = valueOrElse(getInteger(this, (toString(i.caller) + kUserTotalVoteSWOP)), 0) | |
122 | + | $Tuple3(uPoolTotalSWOP, 0, 0) | |
123 | + | } | |
124 | + | let userTotalVoteSWOP = $t044494957._1 | |
125 | + | let userUnvoted = $t044494957._2 | |
126 | + | let userUnvotedPeriod = $t044494957._3 | |
127 | + | let $t049625469 = if (isDefined(getString(this, (poolAddress + kPoolStruc)))) | |
128 | + | then { | |
129 | + | let data = split(valueOrErrorMessage(getString(this, (poolAddress + kPoolStruc)), "Empty kPoolStruc"), "_") | |
130 | + | $Tuple4(parseIntValue(data[0]), parseIntValue(data[1]), parseIntValue(data[2]), parseIntValue(data[3])) | |
131 | + | } | |
132 | + | else { | |
133 | + | let uPoolVoteSWOP = valueOrElse(getInteger(this, (poolAddress + kPoolVoteSWOP)), 0) | |
134 | + | $Tuple4(uPoolVoteSWOP, uPoolVoteSWOP, 0, 0) | |
135 | + | } | |
136 | + | let poolVoteSWOP = $t049625469._1 | |
137 | + | let poolActiveSWOP = $t049625469._2 | |
138 | + | let poolPeriod = $t049625469._3 | |
139 | + | let poolFreezeSWOP = $t049625469._4 | |
140 | + | let $t054755951 = if (isDefined(getString(this, kTotalStruc))) | |
141 | + | then { | |
142 | + | let data = split(valueOrErrorMessage(getString(this, kTotalStruc), "Empty kTotalStruc"), "_") | |
143 | + | $Tuple4(parseIntValue(data[0]), parseIntValue(data[1]), parseIntValue(data[2]), parseIntValue(data[3])) | |
144 | + | } | |
145 | + | else { | |
146 | + | let uTotalVoteSWOP = valueOrElse(getInteger(this, kTotalVoteSWOP), 0) | |
147 | + | $Tuple4(uTotalVoteSWOP, uTotalVoteSWOP, 0, 0) | |
148 | + | } | |
149 | + | let totalVoteSWOP = $t054755951._1 | |
150 | + | let totalActiveSWOP = $t054755951._2 | |
151 | + | let totalPeriod = $t054755951._3 | |
152 | + | let totalFreezeSWOP = $t054755951._4 | |
153 | + | let poolVoteDiffSWOP = (userPoolVoteSWOPnew - userPoolVoteSWOP) | |
154 | + | let userTotalVoteSWOPnew = (userTotalVoteSWOP + poolVoteDiffSWOP) | |
155 | + | if (!(isCallerInGovernance(i.caller))) | |
156 | + | then throw("This address has 0 SWOP in Governance dApp") | |
157 | + | else if ((userTotalVoteSWOPnew > userSWOPinGovernance)) | |
158 | + | then throw(((((toString(this) + " has ") + toString(userSWOPinGovernance)) + " SWOP in governance. New SWOP in voting ") + toString(userTotalVoteSWOPnew))) | |
159 | + | else if ((0 > userTotalVoteSWOPnew)) | |
160 | + | then throw("New userTotalVoteSWOPnew < 0") | |
161 | + | else if ((0 > userPoolVoteSWOPnew)) | |
162 | + | then throw("New userPoolVoteSWOPnew < 0") | |
163 | + | else if ((userPoolVoteSWOPnew >= userPoolVoteSWOP)) | |
164 | + | then { | |
165 | + | let coef = votingCoef() | |
166 | + | let userPoolActiveVoteSWOPnew = if ((userPoolVotePeriod == currPeriod)) | |
167 | + | then (userPoolActiveVoteSWOP + ((poolVoteDiffSWOP * coef) / scale8)) | |
168 | + | else (userPoolVoteSWOP + ((poolVoteDiffSWOP * coef) / scale8)) | |
169 | + | let userPoolFreezeSWOPnew = if ((userPoolVotePeriod == currPeriod)) | |
170 | + | then userPoolFreezeSWOP | |
171 | + | else userPoolVoteSWOP | |
172 | + | let userUnvotedNew = if ((userUnvoted == currPeriod)) | |
173 | + | then userUnvoted | |
174 | + | else max([0, (userUnvoted - poolVoteDiffSWOP)]) | |
175 | + | let userPoolStrucNew = ((((((toString(userPoolVoteSWOPnew) + "_") + toString(userPoolActiveVoteSWOPnew)) + "_") + toString(currPeriod)) + "_") + toString(userPoolFreezeSWOPnew)) | |
176 | + | let userPoolEntry = [StringEntry((((toString(i.caller) + "_") + poolAddress) + kUserPoolStruc), userPoolStrucNew)] | |
177 | + | let userTotalStrucNew = ((((toString(userTotalVoteSWOPnew) + "_") + toString(userUnvotedNew)) + "_") + toString(currPeriod)) | |
178 | + | let userTotalEntry = [StringEntry((toString(i.caller) + kUserTotalStruc), userTotalStrucNew)] | |
179 | + | let poolVoteSWOPnew = (poolVoteSWOP + poolVoteDiffSWOP) | |
180 | + | let poolActiveSWOPnew = if ((poolPeriod == currPeriod)) | |
181 | + | then (poolActiveSWOP + ((poolVoteDiffSWOP * coef) / scale8)) | |
182 | + | else (poolVoteSWOP + ((poolVoteDiffSWOP * coef) / scale8)) | |
183 | + | let poolFreezeSWOPnew = if ((poolPeriod == currPeriod)) | |
184 | + | then poolFreezeSWOP | |
185 | + | else poolVoteSWOP | |
186 | + | let poolStrucNew = ((((((toString(poolVoteSWOPnew) + "_") + toString(poolActiveSWOPnew)) + "_") + toString(currPeriod)) + "_") + toString(poolFreezeSWOPnew)) | |
187 | + | let poolEntry = [StringEntry((poolAddress + kPoolStruc), poolStrucNew)] | |
188 | + | let totalVoteSWOPnew = (totalVoteSWOP + poolVoteDiffSWOP) | |
189 | + | let totalActiveSWOPnew = if ((totalPeriod == currPeriod)) | |
190 | + | then (totalActiveSWOP + ((poolVoteDiffSWOP * coef) / scale8)) | |
191 | + | else (totalVoteSWOP + ((poolVoteDiffSWOP * coef) / scale8)) | |
192 | + | let totalFreezeSWOPnew = if ((poolPeriod == currPeriod)) | |
193 | + | then totalFreezeSWOP | |
194 | + | else totalVoteSWOP | |
195 | + | let totalStrucNew = ((((((toString(totalVoteSWOPnew) + "_") + toString(totalActiveSWOPnew)) + "_") + toString(totalPeriod)) + "_") + toString(totalFreezeSWOPnew)) | |
196 | + | let totalEntry = [StringEntry(kTotalStruc, totalStrucNew)] | |
197 | + | ((((userPoolEntry ++ userTotalEntry) ++ poolEntry) ++ totalEntry) ++ calcDeleteEntry(toString(i.caller), poolAddress, userPoolVoteSWOPnew)) | |
198 | + | } | |
199 | + | else { | |
200 | + | let removePoolVote = -(poolVoteDiffSWOP) | |
201 | + | let userPoolFreezeSWOPnew = if ((userPoolVotePeriod == currPeriod)) | |
202 | + | then min([userPoolFreezeSWOP, userPoolVoteSWOPnew]) | |
203 | + | else userPoolVoteSWOPnew | |
204 | + | let userPoolActiveVoteSWOPnew = if (((userPoolVoteSWOP - userPoolFreezeSWOP) == 0)) | |
205 | + | then 0 | |
206 | + | else (userPoolFreezeSWOPnew + (((userPoolActiveVoteSWOP - userPoolFreezeSWOP) * (userPoolVoteSWOPnew - userPoolFreezeSWOPnew)) / (userPoolVoteSWOP - userPoolFreezeSWOP))) | |
207 | + | let newUnvoted = max([0, (removePoolVote - (if ((userUnvotedPeriod == currPeriod)) | |
208 | + | then (userPoolVoteSWOP - userPoolFreezeSWOP) | |
209 | + | else 0))]) | |
210 | + | let userUnvotedNew = if ((userUnvotedPeriod == currPeriod)) | |
211 | + | then userUnvoted | |
212 | + | else (0 + newUnvoted) | |
213 | + | let userUnvotedPeriodNew = if ((newUnvoted > 0)) | |
214 | + | then currPeriod | |
215 | + | else userUnvotedPeriod | |
216 | + | let userPoolStrucNew = ((((((toString(userPoolVoteSWOPnew) + "_") + toString(userPoolActiveVoteSWOPnew)) + "_") + toString(currPeriod)) + "_") + toString(userPoolFreezeSWOPnew)) | |
217 | + | let userPoolEntry = [StringEntry((((toString(i.caller) + "_") + poolAddress) + kUserPoolStruc), userPoolStrucNew)] | |
218 | + | let userTotalStrucNew = ((((toString(userTotalVoteSWOPnew) + "_") + toString(userUnvotedNew)) + "_") + toString(currPeriod)) | |
219 | + | let userTotalEntry = [StringEntry((toString(i.caller) + kUserTotalStruc), userTotalStrucNew)] | |
220 | + | let poolVoteSWOPnew = (poolVoteSWOP - removePoolVote) | |
221 | + | let poolFreezeSWOPnew = if ((poolPeriod == currPeriod)) | |
222 | + | then min([poolFreezeSWOP, poolVoteSWOPnew]) | |
223 | + | else poolVoteSWOPnew | |
224 | + | let poolActiveSWOPnew = if (((poolVoteSWOP - poolFreezeSWOP) == 0)) | |
225 | + | then 0 | |
226 | + | else (poolFreezeSWOPnew + (((poolActiveSWOP - poolFreezeSWOP) * (poolVoteSWOPnew - poolFreezeSWOPnew)) / (poolVoteSWOP - poolFreezeSWOP))) | |
227 | + | let poolStrucNew = ((((((toString(poolVoteSWOPnew) + "_") + toString(poolActiveSWOPnew)) + "_") + toString(currPeriod)) + "_") + toString(poolFreezeSWOPnew)) | |
228 | + | let poolEntry = [StringEntry((poolAddress + kPoolStruc), poolStrucNew)] | |
229 | + | let totalVoteSWOPnew = (totalVoteSWOP - removePoolVote) | |
230 | + | let totalFreezeSWOPnew = if ((totalPeriod == currPeriod)) | |
231 | + | then min([totalFreezeSWOP, totalVoteSWOPnew]) | |
232 | + | else totalVoteSWOPnew | |
233 | + | let totalActiveSWOPnew = if (((totalVoteSWOP - totalFreezeSWOP) == 0)) | |
234 | + | then 0 | |
235 | + | else (totalFreezeSWOPnew + (((totalActiveSWOP - totalFreezeSWOP) * (totalVoteSWOPnew - totalFreezeSWOPnew)) / (totalVoteSWOP - totalFreezeSWOP))) | |
236 | + | let totalStrucNew = ((((((toString(totalVoteSWOPnew) + "_") + toString(totalActiveSWOPnew)) + "_") + toString(totalPeriod)) + "_") + toString(totalFreezeSWOPnew)) | |
237 | + | let totalEntry = [StringEntry(kTotalStruc, totalStrucNew)] | |
238 | + | let allNewValues = [currPeriod, userPoolFreezeSWOPnew, userPoolActiveVoteSWOPnew, userPoolFreezeSWOPnew, userUnvotedNew, userUnvotedPeriodNew, poolVoteSWOPnew, poolFreezeSWOPnew, poolActiveSWOPnew, totalVoteSWOPnew, totalFreezeSWOPnew, totalActiveSWOPnew] | |
239 | + | if ((0 > min(allNewValues))) | |
240 | + | then throw("One or more values are negative") | |
241 | + | else ((((userPoolEntry ++ userTotalEntry) ++ poolEntry) ++ totalEntry) ++ calcDeleteEntry(toString(i.caller), poolAddress, userPoolVoteSWOPnew)) | |
242 | + | } | |
243 | + | } | |
228 | 244 | ||
229 | 245 | ||
230 | 246 | @Verifier(tx) | |
231 | 247 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
232 | 248 |
github/deemru/w8io/169f3d6 65.83 ms ◑