tx · yyaXcB1XHk2swAX1QzUfRGaA8d58qSffdFTNaxHFrW3 3N9Zi6AcWcGbM23jQJ4fnzFsoHoTsxYDznr: -0.02300000 Waves 2023.12.26 15:49 [2903735] smart account 3N9Zi6AcWcGbM23jQJ4fnzFsoHoTsxYDznr > SELF 0.00000000 Waves
{ "type": 13, "id": "yyaXcB1XHk2swAX1QzUfRGaA8d58qSffdFTNaxHFrW3", "fee": 2300000, "feeAssetId": null, "timestamp": 1703594979068, "version": 2, "chainId": 84, "sender": "3N9Zi6AcWcGbM23jQJ4fnzFsoHoTsxYDznr", "senderPublicKey": "GFbasS3jufhZkK4xR7tdTjjnP8K33KvJFEDHRtxXDkaJ", "proofs": [ "4i3N3Asv49vwQ4wibJHnYwCToYizjXrxRz9LRUwyRVLLJf3FPUvtXjfHncZEBDJr6PiruHy52rLwQeLzNEVk8kTP" ], "script": "base64:BgKRFwgCEgQKAggBEgcKBQgICAgBEgQKAggIEgUKAwgIARIECgIICBIDCgEBEgMKAQESBAoCCAgSBAoCCAQSABIDCgEBEgASBAoCCAgSBAoCCAgSBAoCCAgSABIECgIICCIJc2VwYXJhdG9yIg5wb29sV2VpZ2h0TXVsdCIPbWF4RGVwdGhEZWZhdWx0IhZmaW5hbGl6YXRpb25TdGFnZVRvdGFsIhdmaW5hbGl6YXRpb25TdGFnZVNoYXJlcyIOa2V5RXBvY2hMZW5ndGgiEWtleUVwb2NoTGVuZ3RoTmV3IhVrZXlFcG9jaExlbmd0aEJ5RXBvY2giBWVwb2NoIg9rZXlDdXJyZW50RXBvY2giC2tleU1heERlcHRoIiJrZXlWb3RpbmdFbWlzc2lvbkNhbmRpZGF0ZUNvbnRyYWN0Ih1rZXlWb3RpbmdFbWlzc2lvblJhdGVDb250cmFjdCISa2V5RmFjdG9yeUNvbnRyYWN0IhNrZXlCb29zdGluZ0NvbnRyYWN0IhJrZXlTdGFraW5nQ29udHJhY3QiFGtleUZpbmFsaXphdGlvblN0YWdlIgtrZXlOZXh0UG9vbC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BpdHNlbGYuAQJjQwECY0QABAJjRQQBWQkBAmFaAAMJAAECBQFZAgpCeXRlVmVjdG9yBAJiZAUBWQUCYmQDCQABAgUBWQIEVW5pdAgFAmNDD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJjQwlib2R5Qnl0ZXMJAJEDAggFAmNDBnByb29mcwAABQJjRdXyxME=", "height": 2903735, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 27C2p9L9QGMuft3Yw1rY3vLzoadRPNPSzUKx7tpPqv61 Next: AV9cwwPTu77YCvGsy8F1tpDhsgUJqzGJ7YTdqUT21x2M Diff:
Old | New | Differences | |
---|---|---|---|
531 | 531 | let votingResultStakedActions = if ((stakedByUser == 0)) | |
532 | 532 | then nil | |
533 | 533 | else [IntegerEntry(keyVotingResultStaked(lpAssetIdStr, epochPrevious), (votingResultStakedPrevious + votePrevious))] | |
534 | + | let lpAssetId = getLpAssetByPoolAssets(amountAssetId, priceAssetId) | |
535 | + | let balanceIsOk = { | |
536 | + | let @ = invoke(factoryContract, "checkBalance", [lpAssetId], nil) | |
537 | + | if ($isInstanceOf(@, "Boolean")) | |
538 | + | then @ | |
539 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
540 | + | } | |
534 | 541 | let newVote = if ((gwxAmountAtEndTotalPrevious > 0)) | |
535 | 542 | then fraction(votePrevious, gwxAmountAtEndTotal, gwxAmountAtEndTotalPrevious) | |
536 | 543 | else 0 | |
537 | - | let actions = if (if ((newVote > 0)) | |
544 | + | let actions = if (if (if ((newVote > 0)) | |
538 | 545 | then wxEmission | |
546 | + | else false) | |
547 | + | then balanceIsOk | |
539 | 548 | else false) | |
540 | 549 | then [IntegerEntry(keyVote(pool, userAddress, epoch), newVote), IntegerEntry(keyTotalVotes(epoch), (totalVotes + newVote)), IntegerEntry(keyVotingResult(pool, epoch), (votingResult + newVote)), IntegerEntry(keyUsed(userAddress, epoch), (used + newVote))] | |
541 | 550 | else deleteNodeActions(getVotesListName(pool), userAddressStr) | |
565 | 574 | if ((checkTargetEpoch == checkTargetEpoch)) | |
566 | 575 | then { | |
567 | 576 | let pool = stringToPool(poolStr) | |
568 | - | let $ | |
569 | - | let amountAssetId = $ | |
570 | - | let priceAssetId = $ | |
577 | + | let $t02064120681 = pool | |
578 | + | let amountAssetId = $t02064120681._1 | |
579 | + | let priceAssetId = $t02064120681._2 | |
571 | 580 | let stakingContract = addressFromStringValue(getStrOrFail(this, keyStakingContract)) | |
572 | 581 | let lpAssetId = getLpAssetByPoolAssets(amountAssetId, priceAssetId) | |
573 | 582 | let r = { | |
581 | 590 | then $Tuple2(nil, true) | |
582 | 591 | else { | |
583 | 592 | let wxEmission = checkWxEmissionPoolLabel(pool) | |
593 | + | let balanceIsOk = { | |
594 | + | let @ = invoke(factoryContract, "checkBalance", [lpAssetId], nil) | |
595 | + | if ($isInstanceOf(@, "Boolean")) | |
596 | + | then @ | |
597 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
598 | + | } | |
584 | 599 | let totalVotes = valueOrElse(getInteger(this, keyTotalVotes(targetEpoch)), 0) | |
585 | 600 | let votingResult = valueOrElse(getInteger(this, keyVotingResult(pool, targetEpoch)), 0) | |
586 | - | let share = if (if ((totalVotes == 0)) | |
601 | + | let share = if (if (if ((totalVotes == 0)) | |
587 | 602 | then true | |
588 | 603 | else !(wxEmission)) | |
604 | + | then true | |
605 | + | else !(balanceIsOk)) | |
589 | 606 | then 0 | |
590 | 607 | else fraction(votingResult, poolWeightMult, totalVotes) | |
591 | 608 | let modifyWeightInv = invoke(factoryContract, "modifyWeight", [lpAssetId, share], nil) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "__" | |
5 | 5 | ||
6 | 6 | let poolWeightMult = 100000000 | |
7 | 7 | ||
8 | 8 | let maxDepthDefault = 10 | |
9 | 9 | ||
10 | 10 | let finalizationStageTotal = 0 | |
11 | 11 | ||
12 | 12 | let finalizationStageShares = 1 | |
13 | 13 | ||
14 | 14 | let keyEpochLength = makeString(["%s", "epochLength"], separator) | |
15 | 15 | ||
16 | 16 | let keyEpochLengthNew = makeString(["%s%s", "epochLength__new"], separator) | |
17 | 17 | ||
18 | 18 | func keyEpochLengthByEpoch (epoch) = makeString(["%s%d", "epochLength", toString(epoch)], separator) | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | let keyCurrentEpoch = makeString(["%s", "currentEpoch"], separator) | |
22 | 22 | ||
23 | 23 | let keyMaxDepth = makeString(["%s", "maxDepth"], separator) | |
24 | 24 | ||
25 | 25 | let keyVotingEmissionCandidateContract = makeString(["%s", "votingEmissionCandidateContract"], separator) | |
26 | 26 | ||
27 | 27 | let keyVotingEmissionRateContract = makeString(["%s", "votingEmissionRateContract"], separator) | |
28 | 28 | ||
29 | 29 | let keyFactoryContract = makeString(["%s", "factoryContract"], separator) | |
30 | 30 | ||
31 | 31 | let keyBoostingContract = makeString(["%s", "boostingContract"], separator) | |
32 | 32 | ||
33 | 33 | let keyStakingContract = makeString(["%s", "stakingContract"], separator) | |
34 | 34 | ||
35 | 35 | let keyFinalizationStage = makeString(["%s", "finalizationStage"], separator) | |
36 | 36 | ||
37 | 37 | let keyNextPool = makeString(["%s", "nextPool"], separator) | |
38 | 38 | ||
39 | 39 | let keyNextUser = makeString(["%s", "nextUser"], separator) | |
40 | 40 | ||
41 | 41 | let keyStartHeight = makeString(["%s", "startHeight"], separator) | |
42 | 42 | ||
43 | 43 | let keyCurrentEpochUi = makeString(["%s", "currentEpochUi"], separator) | |
44 | 44 | ||
45 | 45 | let keyStartHeightUi = makeString(["%s", "startHeightUi"], separator) | |
46 | 46 | ||
47 | 47 | let keyFinalizationShouldBeForced = makeString(["%s", "force"], separator) | |
48 | 48 | ||
49 | 49 | func keyStartHeightByEpoch (epoch) = makeString(["%s%d", "startHeight", toString(epoch)], separator) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func keyFinalized (epoch) = makeString(["%s%d", "finalized", toString(epoch)], separator) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func keyInList (pool) = { | |
56 | 56 | let $t017881828 = pool | |
57 | 57 | let amountAssetId = $t017881828._1 | |
58 | 58 | let priceAssetId = $t017881828._2 | |
59 | 59 | makeString(["%s%s%s", "inList", amountAssetId, priceAssetId], separator) | |
60 | 60 | } | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func keyUsed (address,epoch) = makeString(["%s%s%d", "used", toString(address), toString(epoch)], separator) | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func keyVote (pool,address,epoch) = { | |
67 | 67 | let $t021022142 = pool | |
68 | 68 | let amountAssetId = $t021022142._1 | |
69 | 69 | let priceAssetId = $t021022142._2 | |
70 | 70 | makeString(["%s%s%s%s%d", "vote", amountAssetId, priceAssetId, toString(address), toString(epoch)], separator) | |
71 | 71 | } | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func keyVotingResult (pool,epoch) = { | |
75 | 75 | let $t023242364 = pool | |
76 | 76 | let amountAssetId = $t023242364._1 | |
77 | 77 | let priceAssetId = $t023242364._2 | |
78 | 78 | makeString(["%s%s%s%d", "votingResult", amountAssetId, priceAssetId, toString(epoch)], separator) | |
79 | 79 | } | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func keyVotingResultStaked (lpAssetIdStr,epoch) = makeString(["%s%s%d", "votingResultStaked", lpAssetIdStr, toString(epoch)], separator) | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func keyPoolShare (pool,epoch) = { | |
86 | 86 | let $t026852725 = pool | |
87 | 87 | let amountAssetId = $t026852725._1 | |
88 | 88 | let priceAssetId = $t026852725._2 | |
89 | 89 | makeString(["%s%s%s%d", "poolShare", amountAssetId, priceAssetId, toString(epoch)], separator) | |
90 | 90 | } | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func keyTotalVotes (epoch) = makeString(["%s%d", "totalVotes", toString(epoch)], separator) | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func keyStakedByUser (lpAssetIdStr,userAddressStr) = makeString(["%s%s%s", "staked", userAddressStr, lpAssetIdStr], separator) | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func wrapErr (msg) = makeString(["voting_emission.ride:", msg], " ") | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func throwErr (msg) = throw(wrapErr(msg)) | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func getValueOrFail (address,key,type) = { | |
106 | 106 | let error = wrapErr(makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
107 | 107 | valueOrErrorMessage( match type { | |
108 | 108 | case str: String => | |
109 | 109 | getString(address, key) | |
110 | 110 | case int: Int => | |
111 | 111 | getInteger(address, key) | |
112 | 112 | case _ => | |
113 | 113 | throwErr("invalid entry type") | |
114 | 114 | }, error) | |
115 | 115 | } | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func getStrOrFail (address,key) = { | |
119 | 119 | let @ = getValueOrFail(address, key, "") | |
120 | 120 | if ($isInstanceOf(@, "String")) | |
121 | 121 | then @ | |
122 | 122 | else throw(($getType(@) + " couldn't be cast to String")) | |
123 | 123 | } | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | func getIntOrFail (address,key) = { | |
127 | 127 | let @ = getValueOrFail(address, key, 0) | |
128 | 128 | if ($isInstanceOf(@, "Int")) | |
129 | 129 | then @ | |
130 | 130 | else throw(($getType(@) + " couldn't be cast to Int")) | |
131 | 131 | } | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | func poolToString (pool) = ((pool._1 + separator) + pool._2) | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func stringToPool (str) = { | |
138 | 138 | let parts = split(str, separator) | |
139 | 139 | if ((size(parts) == 2)) | |
140 | 140 | then $Tuple2(parts[0], parts[1]) | |
141 | 141 | else throwErr("invalid pool string") | |
142 | 142 | } | |
143 | 143 | ||
144 | 144 | ||
145 | 145 | let factoryContract = addressFromStringValue(getStrOrFail(this, keyFactoryContract)) | |
146 | 146 | ||
147 | 147 | let IdxFactoryCfgGwxRewardDapp = 10 | |
148 | 148 | ||
149 | 149 | func keyFactoryCfg () = "%s__factoryConfig" | |
150 | 150 | ||
151 | 151 | ||
152 | 152 | func readFactoryCfgOrFail (factory) = split(getStrOrFail(factory, keyFactoryCfg()), separator) | |
153 | 153 | ||
154 | 154 | ||
155 | 155 | func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp]) | |
156 | 156 | ||
157 | 157 | ||
158 | 158 | func getLpAssetByPoolAssets (amountAssetId,priceAssetId) = { | |
159 | 159 | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
160 | 160 | ||
161 | 161 | func keyMappingPoolAssetsToPoolContractAddress (internalAmountAssetIdStr,internalPriceAssetIdStr) = (((("%d%d%s%s__" + toString(internalAmountAssetIdStr)) + "__") + toString(internalPriceAssetIdStr)) + "__mappings__poolAssets2PoolContract") | |
162 | 162 | ||
163 | 163 | func keyMappingPoolContractToLPAsset (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset") | |
164 | 164 | ||
165 | 165 | let amountAssetInternalId = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amountAssetId)) | |
166 | 166 | let priceAssetInternalId = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAssetId)) | |
167 | 167 | let poolContractAddress = getStrOrFail(factoryContract, keyMappingPoolAssetsToPoolContractAddress(amountAssetInternalId, priceAssetInternalId)) | |
168 | 168 | let lpAssetId = getStrOrFail(factoryContract, keyMappingPoolContractToLPAsset(poolContractAddress)) | |
169 | 169 | lpAssetId | |
170 | 170 | } | |
171 | 171 | ||
172 | 172 | ||
173 | 173 | func checkWxEmissionPoolLabel (pool) = { | |
174 | 174 | let $t055655605 = pool | |
175 | 175 | let amountAssetId = $t055655605._1 | |
176 | 176 | let priceAssetId = $t055655605._2 | |
177 | 177 | let @ = invoke(factoryContract, "checkWxEmissionPoolLabel", [amountAssetId, priceAssetId], nil) | |
178 | 178 | if ($isInstanceOf(@, "Boolean")) | |
179 | 179 | then @ | |
180 | 180 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
181 | 181 | } | |
182 | 182 | ||
183 | 183 | ||
184 | 184 | func gwxRewardDeposit () = { | |
185 | 185 | let factoryCfg = readFactoryCfgOrFail(factoryContract) | |
186 | 186 | let gwxRewardsContract = getGwxRewardAddressOrFail(factoryCfg) | |
187 | 187 | invoke(gwxRewardsContract, "deposit", nil, nil) | |
188 | 188 | } | |
189 | 189 | ||
190 | 190 | ||
191 | 191 | let poolsListName = "pools" | |
192 | 192 | ||
193 | 193 | func getVotesListName (pool) = { | |
194 | 194 | let $t060226062 = pool | |
195 | 195 | let amountAssetId = $t060226062._1 | |
196 | 196 | let priceAssetId = $t060226062._2 | |
197 | 197 | makeString(["votes", amountAssetId, priceAssetId], separator) | |
198 | 198 | } | |
199 | 199 | ||
200 | 200 | ||
201 | 201 | func keyListHead (listName) = { | |
202 | 202 | let meta = if ((listName == poolsListName)) | |
203 | 203 | then "%s%s" | |
204 | 204 | else "%s%s%s%s" | |
205 | 205 | makeString([meta, listName, "head"], separator) | |
206 | 206 | } | |
207 | 207 | ||
208 | 208 | ||
209 | 209 | func keyListSize (listName) = { | |
210 | 210 | let meta = if ((listName == poolsListName)) | |
211 | 211 | then "%s%s" | |
212 | 212 | else "%s%s%s%s" | |
213 | 213 | makeString([meta, listName, "size"], separator) | |
214 | 214 | } | |
215 | 215 | ||
216 | 216 | ||
217 | 217 | func keyListPrev (listName,id) = { | |
218 | 218 | let meta = if ((listName == poolsListName)) | |
219 | 219 | then "%s%s%s%s" | |
220 | 220 | else "%s%s%s%s%s" | |
221 | 221 | makeString([meta, listName, id, "prev"], separator) | |
222 | 222 | } | |
223 | 223 | ||
224 | 224 | ||
225 | 225 | func keyListNext (listName,id) = { | |
226 | 226 | let meta = if ((listName == poolsListName)) | |
227 | 227 | then "%s%s%s%s" | |
228 | 228 | else "%s%s%s%s%s" | |
229 | 229 | makeString([meta, listName, id, "next"], separator) | |
230 | 230 | } | |
231 | 231 | ||
232 | 232 | ||
233 | 233 | func containsNode (listName,id) = { | |
234 | 234 | let headOrUnit = getString(this, keyListHead(listName)) | |
235 | 235 | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
236 | 236 | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
237 | 237 | if (if ((id == valueOrElse(headOrUnit, ""))) | |
238 | 238 | then true | |
239 | 239 | else (prevOrUnit != unit)) | |
240 | 240 | then true | |
241 | 241 | else (nextOrUnit != unit) | |
242 | 242 | } | |
243 | 243 | ||
244 | 244 | ||
245 | 245 | func insertNodeActions (listName,id) = { | |
246 | 246 | let headOrUnit = getString(this, keyListHead(listName)) | |
247 | 247 | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
248 | 248 | let checkNode = if (!(containsNode(listName, id))) | |
249 | 249 | then true | |
250 | 250 | else throwErr("Node exists") | |
251 | 251 | if ((checkNode == checkNode)) | |
252 | 252 | then (([IntegerEntry(keyListSize(listName), (listSize + 1))] ++ (if ((headOrUnit != unit)) | |
253 | 253 | then [StringEntry(keyListNext(listName, id), value(headOrUnit)), StringEntry(keyListPrev(listName, value(headOrUnit)), id)] | |
254 | 254 | else nil)) ++ [StringEntry(keyListHead(listName), id)]) | |
255 | 255 | else throw("Strict value is not equal to itself.") | |
256 | 256 | } | |
257 | 257 | ||
258 | 258 | ||
259 | 259 | func deleteNodeActions (listName,id) = { | |
260 | 260 | let headOrUnit = getString(this, keyListHead(listName)) | |
261 | 261 | let listSize = valueOrElse(getInteger(this, keyListSize(listName)), 0) | |
262 | 262 | let prevOrUnit = getString(this, keyListPrev(listName, id)) | |
263 | 263 | let nextOrUnit = getString(this, keyListNext(listName, id)) | |
264 | 264 | ([IntegerEntry(keyListSize(listName), (listSize - 1))] ++ (if (if ((prevOrUnit != unit)) | |
265 | 265 | then (nextOrUnit != unit) | |
266 | 266 | else false) | |
267 | 267 | then [StringEntry(keyListNext(listName, value(prevOrUnit)), value(nextOrUnit)), StringEntry(keyListPrev(listName, value(nextOrUnit)), value(prevOrUnit)), DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, id))] | |
268 | 268 | else if ((nextOrUnit != unit)) | |
269 | 269 | then [StringEntry(keyListHead(listName), value(nextOrUnit)), DeleteEntry(keyListNext(listName, id)), DeleteEntry(keyListPrev(listName, value(nextOrUnit)))] | |
270 | 270 | else if ((prevOrUnit != unit)) | |
271 | 271 | then [DeleteEntry(keyListPrev(listName, id)), DeleteEntry(keyListNext(listName, value(prevOrUnit)))] | |
272 | 272 | else if ((id == valueOrElse(headOrUnit, ""))) | |
273 | 273 | then [DeleteEntry(keyListHead(listName))] | |
274 | 274 | else throwErr(((("invalid node: " + listName) + ".") + id)))) | |
275 | 275 | } | |
276 | 276 | ||
277 | 277 | ||
278 | 278 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
279 | 279 | ||
280 | 280 | ||
281 | 281 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
282 | 282 | ||
283 | 283 | ||
284 | 284 | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
285 | 285 | case s: String => | |
286 | 286 | addressFromStringValue(s) | |
287 | 287 | case _ => | |
288 | 288 | this | |
289 | 289 | } | |
290 | 290 | ||
291 | 291 | ||
292 | 292 | func managerPublicKeyOrUnit () = { | |
293 | 293 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
294 | 294 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
295 | 295 | case s: String => | |
296 | 296 | fromBase58String(s) | |
297 | 297 | case _: Unit => | |
298 | 298 | unit | |
299 | 299 | case _ => | |
300 | 300 | throw("Match error") | |
301 | 301 | } | |
302 | 302 | } | |
303 | 303 | ||
304 | 304 | ||
305 | 305 | func isManager (i) = match managerPublicKeyOrUnit() { | |
306 | 306 | case pk: ByteVector => | |
307 | 307 | (i.callerPublicKey == pk) | |
308 | 308 | case _: Unit => | |
309 | 309 | (i.caller == this) | |
310 | 310 | case _ => | |
311 | 311 | throw("Match error") | |
312 | 312 | } | |
313 | 313 | ||
314 | 314 | ||
315 | 315 | func mustManager (i) = if (isManager(i)) | |
316 | 316 | then true | |
317 | 317 | else throw("permission denied") | |
318 | 318 | ||
319 | 319 | ||
320 | 320 | func mustThis (i) = if ((i.caller == this)) | |
321 | 321 | then true | |
322 | 322 | else throw("permission denied") | |
323 | 323 | ||
324 | 324 | ||
325 | 325 | @Callable(i) | |
326 | 326 | func getUserGwxAmountAtHeight (userAddress,targetHeight) = { | |
327 | 327 | let boostingContractAddress = valueOrErrorMessage(addressFromString(getStrOrFail(this, keyBoostingContract)), wrapErr("invalid boosting contract address")) | |
328 | 328 | $Tuple2(nil, { | |
329 | 329 | let @ = invoke(boostingContractAddress, "getUserGwxAmountAtHeightREADONLY", [userAddress, targetHeight], nil) | |
330 | 330 | if ($isInstanceOf(@, "Int")) | |
331 | 331 | then @ | |
332 | 332 | else throw(($getType(@) + " couldn't be cast to Int")) | |
333 | 333 | }) | |
334 | 334 | } | |
335 | 335 | ||
336 | 336 | ||
337 | 337 | ||
338 | 338 | @Callable(i) | |
339 | 339 | func constructor (factoryContract,votingEmissionCandidateContract,boostingContract,stakingContract,epochLength) = { | |
340 | 340 | let checks = [mustManager(i), if ((addressFromString(factoryContract) != unit)) | |
341 | 341 | then true | |
342 | 342 | else "invalid factory contract address", if ((addressFromString(votingEmissionCandidateContract) != unit)) | |
343 | 343 | then true | |
344 | 344 | else "invalid voting emission candidate contract address", if ((addressFromString(boostingContract) != unit)) | |
345 | 345 | then true | |
346 | 346 | else "invalid boosting contract address", if ((addressFromString(stakingContract) != unit)) | |
347 | 347 | then true | |
348 | 348 | else "invalid staking contract address", if ((epochLength > 0)) | |
349 | 349 | then true | |
350 | 350 | else throwErr("invalid epoch length")] | |
351 | 351 | if ((checks == checks)) | |
352 | 352 | then $Tuple2([StringEntry(keyFactoryContract, factoryContract), StringEntry(keyVotingEmissionCandidateContract, votingEmissionCandidateContract), StringEntry(keyBoostingContract, boostingContract), StringEntry(keyStakingContract, stakingContract), IntegerEntry(keyEpochLength, epochLength)], unit) | |
353 | 353 | else throw("Strict value is not equal to itself.") | |
354 | 354 | } | |
355 | 355 | ||
356 | 356 | ||
357 | 357 | ||
358 | 358 | @Callable(i) | |
359 | 359 | func create (amountAssetId,priceAssetId) = { | |
360 | 360 | let checks = [if ((toBase58String(i.caller.bytes) == valueOrElse(getString(this, keyVotingEmissionCandidateContract), ""))) | |
361 | 361 | then true | |
362 | 362 | else mustManager(i)] | |
363 | 363 | if ((checks == checks)) | |
364 | 364 | then { | |
365 | 365 | let pool = $Tuple2(amountAssetId, priceAssetId) | |
366 | 366 | let inListActions = ([BooleanEntry(keyInList(pool), true)] ++ insertNodeActions(poolsListName, poolToString(pool))) | |
367 | 367 | let currentEpochIsNotDefined = (getInteger(this, keyCurrentEpoch) == unit) | |
368 | 368 | let startHeightActions = if (currentEpochIsNotDefined) | |
369 | 369 | then { | |
370 | 370 | let epoch = 0 | |
371 | 371 | [IntegerEntry(keyCurrentEpoch, epoch), IntegerEntry(keyStartHeightByEpoch(epoch), height), IntegerEntry(keyStartHeight, height), IntegerEntry(keyCurrentEpochUi, epoch), IntegerEntry(keyStartHeightUi, height)] | |
372 | 372 | } | |
373 | 373 | else nil | |
374 | 374 | $Tuple2((inListActions ++ startHeightActions), unit) | |
375 | 375 | } | |
376 | 376 | else throw("Strict value is not equal to itself.") | |
377 | 377 | } | |
378 | 378 | ||
379 | 379 | ||
380 | 380 | ||
381 | 381 | @Callable(i) | |
382 | 382 | func vote (amountAssetId,priceAssetId,amount) = { | |
383 | 383 | let pool = $Tuple2(amountAssetId, priceAssetId) | |
384 | 384 | let epoch = valueOrElse(getInteger(this, keyCurrentEpoch), 0) | |
385 | 385 | let startHeight = getIntOrFail(this, keyStartHeightByEpoch(epoch)) | |
386 | 386 | let epochLength = getIntOrFail(this, keyEpochLength) | |
387 | 387 | let endHeight = (startHeight + epochLength) | |
388 | 388 | let finalizationStageOrUnit = getInteger(this, keyFinalizationStage) | |
389 | 389 | let used = valueOrElse(getInteger(this, keyUsed(i.caller, epoch)), 0) | |
390 | 390 | let vote = valueOrElse(getInteger(this, keyVote(pool, i.caller, epoch)), 0) | |
391 | 391 | let poolResult = valueOrElse(getInteger(this, keyVotingResult(pool, epoch)), 0) | |
392 | 392 | let totalVotes = valueOrElse(getInteger(this, keyTotalVotes(epoch)), 0) | |
393 | 393 | let gwxAmountAtEndTotal = { | |
394 | 394 | let @ = invoke(this, "getUserGwxAmountAtHeight", [toBase58String(i.caller.bytes), endHeight], nil) | |
395 | 395 | if ($isInstanceOf(@, "Int")) | |
396 | 396 | then @ | |
397 | 397 | else throw(($getType(@) + " couldn't be cast to Int")) | |
398 | 398 | } | |
399 | 399 | let available = (gwxAmountAtEndTotal - used) | |
400 | 400 | let newVote = (vote + amount) | |
401 | 401 | let wxEmission = checkWxEmissionPoolLabel(pool) | |
402 | 402 | let checks = [if ((getBoolean(keyInList(pool)) != unit)) | |
403 | 403 | then true | |
404 | 404 | else throwErr("invalid assets"), if ((endHeight > height)) | |
405 | 405 | then true | |
406 | 406 | else throwErr("invalid height"), if ((finalizationStageOrUnit == unit)) | |
407 | 407 | then true | |
408 | 408 | else throwErr("finalization in progress"), if ((gwxAmountAtEndTotal > 0)) | |
409 | 409 | then true | |
410 | 410 | else throwErr("you do not have gWX"), if (if ((amount > 0)) | |
411 | 411 | then (available >= amount) | |
412 | 412 | else false) | |
413 | 413 | then true | |
414 | 414 | else throwErr("invalid amount"), if (wxEmission) | |
415 | 415 | then true | |
416 | 416 | else throwErr("pool hasn't WX_EMISSION label")] | |
417 | 417 | if ((checks == checks)) | |
418 | 418 | then { | |
419 | 419 | let votesListName = getVotesListName(pool) | |
420 | 420 | let userAddressStr = toString(i.caller) | |
421 | 421 | let votesListActions = if (containsNode(votesListName, userAddressStr)) | |
422 | 422 | then nil | |
423 | 423 | else insertNodeActions(votesListName, userAddressStr) | |
424 | 424 | $Tuple2(([IntegerEntry(keyUsed(i.caller, epoch), (used + amount)), IntegerEntry(keyVote(pool, i.caller, epoch), newVote), IntegerEntry(keyVotingResult(pool, epoch), (poolResult + amount)), IntegerEntry(keyTotalVotes(epoch), (totalVotes + amount))] ++ votesListActions), unit) | |
425 | 425 | } | |
426 | 426 | else throw("Strict value is not equal to itself.") | |
427 | 427 | } | |
428 | 428 | ||
429 | 429 | ||
430 | 430 | ||
431 | 431 | @Callable(i) | |
432 | 432 | func cancelVote (amountAssetId,priceAssetId) = { | |
433 | 433 | let pool = $Tuple2(amountAssetId, priceAssetId) | |
434 | 434 | let epoch = valueOrElse(getInteger(this, keyCurrentEpoch), 0) | |
435 | 435 | let startHeight = getIntOrFail(this, keyStartHeightByEpoch(epoch)) | |
436 | 436 | let epochLength = getIntOrFail(this, keyEpochLength) | |
437 | 437 | let endHeight = (startHeight + epochLength) | |
438 | 438 | let finalizationStageOrUnit = getInteger(this, keyFinalizationStage) | |
439 | 439 | let used = valueOrElse(getInteger(this, keyUsed(i.caller, epoch)), 0) | |
440 | 440 | let vote = valueOrElse(getInteger(this, keyVote(pool, i.caller, epoch)), 0) | |
441 | 441 | let poolResult = valueOrElse(getInteger(this, keyVotingResult(pool, epoch)), 0) | |
442 | 442 | let totalVotes = valueOrElse(getInteger(this, keyTotalVotes(epoch)), 0) | |
443 | 443 | let checks = [if ((getBoolean(keyInList(pool)) != unit)) | |
444 | 444 | then true | |
445 | 445 | else throwErr("invalid assets"), if ((endHeight > height)) | |
446 | 446 | then true | |
447 | 447 | else throwErr("invalid height"), if ((finalizationStageOrUnit == unit)) | |
448 | 448 | then true | |
449 | 449 | else throwErr("finalization in progress"), if ((vote > 0)) | |
450 | 450 | then true | |
451 | 451 | else throwErr("no vote")] | |
452 | 452 | if ((checks == checks)) | |
453 | 453 | then { | |
454 | 454 | let votesListName = getVotesListName(pool) | |
455 | 455 | let userAddressStr = toString(i.caller) | |
456 | 456 | $Tuple2(([IntegerEntry(keyUsed(i.caller, epoch), max([(used - vote), 0])), DeleteEntry(keyVote(pool, i.caller, epoch)), IntegerEntry(keyVotingResult(pool, epoch), (poolResult - vote)), IntegerEntry(keyTotalVotes(epoch), (totalVotes - vote))] ++ deleteNodeActions(votesListName, userAddressStr)), unit) | |
457 | 457 | } | |
458 | 458 | else throw("Strict value is not equal to itself.") | |
459 | 459 | } | |
460 | 460 | ||
461 | 461 | ||
462 | 462 | ||
463 | 463 | @Callable(i) | |
464 | 464 | func setEpochLength (newEpochLength) = { | |
465 | 465 | let checks = [mustManager(i), if ((newEpochLength > 0)) | |
466 | 466 | then true | |
467 | 467 | else throwErr("invalid epoch length")] | |
468 | 468 | if ((checks == checks)) | |
469 | 469 | then $Tuple2([IntegerEntry(keyEpochLengthNew, newEpochLength)], unit) | |
470 | 470 | else throw("Strict value is not equal to itself.") | |
471 | 471 | } | |
472 | 472 | ||
473 | 473 | ||
474 | 474 | ||
475 | 475 | @Callable(i) | |
476 | 476 | func setMaxDepth (newMaxDepth) = { | |
477 | 477 | let checks = [mustManager(i), if ((newMaxDepth > 0)) | |
478 | 478 | then true | |
479 | 479 | else throwErr("invalid max depth")] | |
480 | 480 | if ((checks == checks)) | |
481 | 481 | then $Tuple2([IntegerEntry(keyMaxDepth, newMaxDepth)], unit) | |
482 | 482 | else throw("Strict value is not equal to itself.") | |
483 | 483 | } | |
484 | 484 | ||
485 | 485 | ||
486 | 486 | ||
487 | 487 | @Callable(i) | |
488 | 488 | func processVoteINTERNAL (poolStr,userAddressStr) = { | |
489 | 489 | let checkCaller = mustThis(i) | |
490 | 490 | if ((checkCaller == checkCaller)) | |
491 | 491 | then { | |
492 | 492 | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr(("processVoteINTERNAL: invalid user address " + userAddressStr))) | |
493 | 493 | let epoch = getIntOrFail(this, keyCurrentEpoch) | |
494 | 494 | let epochPrevious = (epoch - 1) | |
495 | 495 | let epochLength = getIntOrFail(this, keyEpochLength) | |
496 | 496 | let startHeight = getIntOrFail(this, keyStartHeightByEpoch(epoch)) | |
497 | 497 | let endHeight = (startHeight + epochLength) | |
498 | 498 | let startHeightPrevious = getIntOrFail(this, keyStartHeightByEpoch(epochPrevious)) | |
499 | 499 | let epochLengthPrevious = getIntOrFail(this, keyEpochLengthByEpoch(epochPrevious)) | |
500 | 500 | let endHeightPrevious = (startHeightPrevious + epochLengthPrevious) | |
501 | 501 | let checkTargetEpoch = if ((epochPrevious >= 0)) | |
502 | 502 | then true | |
503 | 503 | else throwErr("processVoteINTERNAL: invalid previous epoch") | |
504 | 504 | if ((checkTargetEpoch == checkTargetEpoch)) | |
505 | 505 | then { | |
506 | 506 | let pool = stringToPool(poolStr) | |
507 | 507 | let $t01806518105 = pool | |
508 | 508 | let amountAssetId = $t01806518105._1 | |
509 | 509 | let priceAssetId = $t01806518105._2 | |
510 | 510 | let wxEmission = checkWxEmissionPoolLabel(pool) | |
511 | 511 | let gwxAmountAtEndTotal = { | |
512 | 512 | let @ = invoke(this, "getUserGwxAmountAtHeight", [userAddressStr, endHeight], nil) | |
513 | 513 | if ($isInstanceOf(@, "Int")) | |
514 | 514 | then @ | |
515 | 515 | else throw(($getType(@) + " couldn't be cast to Int")) | |
516 | 516 | } | |
517 | 517 | let gwxAmountAtEndTotalPrevious = { | |
518 | 518 | let @ = invoke(this, "getUserGwxAmountAtHeight", [userAddressStr, endHeightPrevious], nil) | |
519 | 519 | if ($isInstanceOf(@, "Int")) | |
520 | 520 | then @ | |
521 | 521 | else throw(($getType(@) + " couldn't be cast to Int")) | |
522 | 522 | } | |
523 | 523 | let totalVotes = valueOrElse(getInteger(keyTotalVotes(epoch)), 0) | |
524 | 524 | let votingResult = valueOrElse(getInteger(keyVotingResult(pool, epoch)), 0) | |
525 | 525 | let votePrevious = valueOrErrorMessage(getInteger(keyVote(pool, userAddress, epochPrevious)), wrapErr((((("processVoteINTERNAL " + poolStr) + " ") + userAddressStr) + ": no previous vote"))) | |
526 | 526 | let used = valueOrElse(getInteger(this, keyUsed(userAddress, epoch)), 0) | |
527 | 527 | let lpAssetIdStr = getLpAssetByPoolAssets(amountAssetId, priceAssetId) | |
528 | 528 | let votingResultStakedPrevious = valueOrElse(getInteger(keyVotingResultStaked(lpAssetIdStr, epochPrevious)), 0) | |
529 | 529 | let stakingContract = addressFromStringValue(getStrOrFail(this, keyStakingContract)) | |
530 | 530 | let stakedByUser = valueOrElse(getInteger(stakingContract, keyStakedByUser(lpAssetIdStr, userAddressStr)), 0) | |
531 | 531 | let votingResultStakedActions = if ((stakedByUser == 0)) | |
532 | 532 | then nil | |
533 | 533 | else [IntegerEntry(keyVotingResultStaked(lpAssetIdStr, epochPrevious), (votingResultStakedPrevious + votePrevious))] | |
534 | + | let lpAssetId = getLpAssetByPoolAssets(amountAssetId, priceAssetId) | |
535 | + | let balanceIsOk = { | |
536 | + | let @ = invoke(factoryContract, "checkBalance", [lpAssetId], nil) | |
537 | + | if ($isInstanceOf(@, "Boolean")) | |
538 | + | then @ | |
539 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
540 | + | } | |
534 | 541 | let newVote = if ((gwxAmountAtEndTotalPrevious > 0)) | |
535 | 542 | then fraction(votePrevious, gwxAmountAtEndTotal, gwxAmountAtEndTotalPrevious) | |
536 | 543 | else 0 | |
537 | - | let actions = if (if ((newVote > 0)) | |
544 | + | let actions = if (if (if ((newVote > 0)) | |
538 | 545 | then wxEmission | |
546 | + | else false) | |
547 | + | then balanceIsOk | |
539 | 548 | else false) | |
540 | 549 | then [IntegerEntry(keyVote(pool, userAddress, epoch), newVote), IntegerEntry(keyTotalVotes(epoch), (totalVotes + newVote)), IntegerEntry(keyVotingResult(pool, epoch), (votingResult + newVote)), IntegerEntry(keyUsed(userAddress, epoch), (used + newVote))] | |
541 | 550 | else deleteNodeActions(getVotesListName(pool), userAddressStr) | |
542 | 551 | $Tuple2((actions ++ votingResultStakedActions), unit) | |
543 | 552 | } | |
544 | 553 | else throw("Strict value is not equal to itself.") | |
545 | 554 | } | |
546 | 555 | else throw("Strict value is not equal to itself.") | |
547 | 556 | } | |
548 | 557 | ||
549 | 558 | ||
550 | 559 | ||
551 | 560 | @Callable(i) | |
552 | 561 | func processPoolINTERNAL (poolStr,force) = { | |
553 | 562 | let checkCaller = mustThis(i) | |
554 | 563 | if ((checkCaller == checkCaller)) | |
555 | 564 | then { | |
556 | 565 | let targetEpoch = { | |
557 | 566 | let currentEpoch = getIntOrFail(this, keyCurrentEpoch) | |
558 | 567 | if (force) | |
559 | 568 | then currentEpoch | |
560 | 569 | else (currentEpoch - 1) | |
561 | 570 | } | |
562 | 571 | let checkTargetEpoch = if ((targetEpoch >= 0)) | |
563 | 572 | then true | |
564 | 573 | else throwErr("processPoolINTERNAL: invalid target epoch") | |
565 | 574 | if ((checkTargetEpoch == checkTargetEpoch)) | |
566 | 575 | then { | |
567 | 576 | let pool = stringToPool(poolStr) | |
568 | - | let $ | |
569 | - | let amountAssetId = $ | |
570 | - | let priceAssetId = $ | |
577 | + | let $t02064120681 = pool | |
578 | + | let amountAssetId = $t02064120681._1 | |
579 | + | let priceAssetId = $t02064120681._2 | |
571 | 580 | let stakingContract = addressFromStringValue(getStrOrFail(this, keyStakingContract)) | |
572 | 581 | let lpAssetId = getLpAssetByPoolAssets(amountAssetId, priceAssetId) | |
573 | 582 | let r = { | |
574 | 583 | let @ = invoke(stakingContract, "usersListTraversal", [lpAssetId], nil) | |
575 | 584 | if ($isInstanceOf(@, "Boolean")) | |
576 | 585 | then @ | |
577 | 586 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
578 | 587 | } | |
579 | 588 | if ((r == r)) | |
580 | 589 | then if (r) | |
581 | 590 | then $Tuple2(nil, true) | |
582 | 591 | else { | |
583 | 592 | let wxEmission = checkWxEmissionPoolLabel(pool) | |
593 | + | let balanceIsOk = { | |
594 | + | let @ = invoke(factoryContract, "checkBalance", [lpAssetId], nil) | |
595 | + | if ($isInstanceOf(@, "Boolean")) | |
596 | + | then @ | |
597 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
598 | + | } | |
584 | 599 | let totalVotes = valueOrElse(getInteger(this, keyTotalVotes(targetEpoch)), 0) | |
585 | 600 | let votingResult = valueOrElse(getInteger(this, keyVotingResult(pool, targetEpoch)), 0) | |
586 | - | let share = if (if ((totalVotes == 0)) | |
601 | + | let share = if (if (if ((totalVotes == 0)) | |
587 | 602 | then true | |
588 | 603 | else !(wxEmission)) | |
604 | + | then true | |
605 | + | else !(balanceIsOk)) | |
589 | 606 | then 0 | |
590 | 607 | else fraction(votingResult, poolWeightMult, totalVotes) | |
591 | 608 | let modifyWeightInv = invoke(factoryContract, "modifyWeight", [lpAssetId, share], nil) | |
592 | 609 | if ((modifyWeightInv == modifyWeightInv)) | |
593 | 610 | then { | |
594 | 611 | let poolsListActions = if (if (wxEmission) | |
595 | 612 | then true | |
596 | 613 | else force) | |
597 | 614 | then nil | |
598 | 615 | else ([DeleteEntry(keyInList(pool))] ++ deleteNodeActions(poolsListName, poolStr)) | |
599 | 616 | $Tuple2(([IntegerEntry(keyPoolShare(pool, targetEpoch), share)] ++ poolsListActions), false) | |
600 | 617 | } | |
601 | 618 | else throw("Strict value is not equal to itself.") | |
602 | 619 | } | |
603 | 620 | else throw("Strict value is not equal to itself.") | |
604 | 621 | } | |
605 | 622 | else throw("Strict value is not equal to itself.") | |
606 | 623 | } | |
607 | 624 | else throw("Strict value is not equal to itself.") | |
608 | 625 | } | |
609 | 626 | ||
610 | 627 | ||
611 | 628 | ||
612 | 629 | @Callable(i) | |
613 | 630 | func finalizeHelper () = { | |
614 | 631 | let force = valueOrElse(getBoolean(keyFinalizationShouldBeForced), false) | |
615 | 632 | let epoch = valueOrElse(getInteger(this, keyCurrentEpoch), 0) | |
616 | 633 | let previousEpoch = (epoch - 1) | |
617 | 634 | let startHeight = getIntOrFail(this, keyStartHeightByEpoch(epoch)) | |
618 | 635 | let epochLength = getIntOrFail(this, keyEpochLength) | |
619 | 636 | let endHeight = (startHeight + epochLength) | |
620 | 637 | let finalizationStageOrUnit = getInteger(this, keyFinalizationStage) | |
621 | 638 | if (if (if ((height >= endHeight)) | |
622 | 639 | then (finalizationStageOrUnit == unit) | |
623 | 640 | else false) | |
624 | 641 | then !(force) | |
625 | 642 | else false) | |
626 | 643 | then { | |
627 | 644 | let newEpoch = (epoch + 1) | |
628 | 645 | let newEpochLengthOption = getInteger(this, keyEpochLengthNew) | |
629 | 646 | let newEpochLengthActions = match newEpochLengthOption { | |
630 | 647 | case newEpochLength: Int => | |
631 | 648 | [IntegerEntry(keyEpochLength, newEpochLength), DeleteEntry(keyEpochLengthNew)] | |
632 | 649 | case _: Unit => | |
633 | 650 | nil | |
634 | 651 | case _ => | |
635 | 652 | throw("Match error") | |
636 | 653 | } | |
637 | 654 | $Tuple2(([IntegerEntry(keyStartHeightByEpoch(newEpoch), height), IntegerEntry(keyStartHeight, height), IntegerEntry(keyCurrentEpoch, newEpoch), IntegerEntry(keyFinalizationStage, finalizationStageTotal), IntegerEntry(keyEpochLengthByEpoch(epoch), epochLength)] ++ newEpochLengthActions), true) | |
638 | 655 | } | |
639 | 656 | else if (if (force) | |
640 | 657 | then (finalizationStageOrUnit == unit) | |
641 | 658 | else false) | |
642 | 659 | then $Tuple2([IntegerEntry(keyFinalizationStage, finalizationStageShares)], true) | |
643 | 660 | else if ((finalizationStageOrUnit == unit)) | |
644 | 661 | then $Tuple2(nil, false) | |
645 | 662 | else if ((finalizationStageOrUnit == finalizationStageTotal)) | |
646 | 663 | then { | |
647 | 664 | let poolOrUnit = getString(keyNextPool) | |
648 | 665 | let userOrUnit = getString(keyNextUser) | |
649 | 666 | match poolOrUnit { | |
650 | 667 | case _: Unit => | |
651 | 668 | match getString(keyListHead(poolsListName)) { | |
652 | 669 | case _: Unit => | |
653 | 670 | $Tuple2([IntegerEntry(keyFinalizationStage, finalizationStageShares), DeleteEntry(keyNextPool), DeleteEntry(keyNextUser)], true) | |
654 | 671 | case poolsHeadStr: String => | |
655 | 672 | $Tuple2([StringEntry(keyNextPool, poolsHeadStr)], true) | |
656 | 673 | case _ => | |
657 | 674 | throw("Match error") | |
658 | 675 | } | |
659 | 676 | case poolStr: String => | |
660 | 677 | let pool = stringToPool(poolStr) | |
661 | 678 | let nextUserOrUnit = match userOrUnit { | |
662 | 679 | case _: Unit => | |
663 | 680 | getString(keyListHead(getVotesListName(pool))) | |
664 | 681 | case user: String => | |
665 | 682 | let next = getString(keyListNext(getVotesListName(pool), user)) | |
666 | 683 | if ((next == next)) | |
667 | 684 | then { | |
668 | 685 | let processVoteInv = invoke(this, "processVoteINTERNAL", [poolStr, user], nil) | |
669 | 686 | if ((processVoteInv == processVoteInv)) | |
670 | 687 | then next | |
671 | 688 | else throw("Strict value is not equal to itself.") | |
672 | 689 | } | |
673 | 690 | else throw("Strict value is not equal to itself.") | |
674 | 691 | case _ => | |
675 | 692 | throw("Match error") | |
676 | 693 | } | |
677 | 694 | match nextUserOrUnit { | |
678 | 695 | case _: Unit => | |
679 | 696 | let nextPoolOrUnit = getString(keyListNext(poolsListName, poolStr)) | |
680 | 697 | match nextPoolOrUnit { | |
681 | 698 | case _: Unit => | |
682 | 699 | $Tuple2([IntegerEntry(keyFinalizationStage, finalizationStageShares), DeleteEntry(keyNextPool), DeleteEntry(keyNextUser)], true) | |
683 | 700 | case s: String => | |
684 | 701 | $Tuple2([StringEntry(keyNextPool, s), DeleteEntry(keyNextUser)], true) | |
685 | 702 | case _ => | |
686 | 703 | throw("Match error") | |
687 | 704 | } | |
688 | 705 | case nextUser: String => | |
689 | 706 | $Tuple2([StringEntry(keyNextUser, nextUser)], true) | |
690 | 707 | case _ => | |
691 | 708 | throw("Match error") | |
692 | 709 | } | |
693 | 710 | case _ => | |
694 | 711 | throw("Match error") | |
695 | 712 | } | |
696 | 713 | } | |
697 | 714 | else if ((finalizationStageOrUnit == finalizationStageShares)) | |
698 | 715 | then { | |
699 | 716 | let poolOrUnit = getString(keyNextPool) | |
700 | 717 | match poolOrUnit { | |
701 | 718 | case _: Unit => | |
702 | 719 | match getString(keyListHead(poolsListName)) { | |
703 | 720 | case _: Unit => | |
704 | 721 | let actions = if (force) | |
705 | 722 | then [DeleteEntry(keyFinalizationStage), DeleteEntry(keyFinalizationShouldBeForced)] | |
706 | 723 | else [DeleteEntry(keyFinalizationStage), BooleanEntry(keyFinalized(previousEpoch), true), IntegerEntry(keyCurrentEpochUi, epoch), IntegerEntry(keyStartHeightUi, startHeight)] | |
707 | 724 | let gwxRewardDepositInv = gwxRewardDeposit() | |
708 | 725 | if ((gwxRewardDepositInv == gwxRewardDepositInv)) | |
709 | 726 | then $Tuple2(actions, true) | |
710 | 727 | else throw("Strict value is not equal to itself.") | |
711 | 728 | case nextPoolStr: String => | |
712 | 729 | $Tuple2([StringEntry(keyNextPool, nextPoolStr)], true) | |
713 | 730 | case _ => | |
714 | 731 | throw("Match error") | |
715 | 732 | } | |
716 | 733 | case poolStr: String => | |
717 | 734 | let nextPoolOrUnit = getString(keyListNext(poolsListName, poolStr)) | |
718 | 735 | if ((nextPoolOrUnit == nextPoolOrUnit)) | |
719 | 736 | then { | |
720 | 737 | let r = { | |
721 | 738 | let @ = invoke(this, "processPoolINTERNAL", [poolStr, force], nil) | |
722 | 739 | if ($isInstanceOf(@, "Boolean")) | |
723 | 740 | then @ | |
724 | 741 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
725 | 742 | } | |
726 | 743 | if ((r == r)) | |
727 | 744 | then if (r) | |
728 | 745 | then $Tuple2(nil, true) | |
729 | 746 | else match nextPoolOrUnit { | |
730 | 747 | case _: Unit => | |
731 | 748 | let actions = if (force) | |
732 | 749 | then [DeleteEntry(keyFinalizationStage), DeleteEntry(keyFinalizationShouldBeForced), DeleteEntry(keyNextPool)] | |
733 | 750 | else [DeleteEntry(keyFinalizationStage), BooleanEntry(keyFinalized(previousEpoch), true), IntegerEntry(keyCurrentEpochUi, epoch), IntegerEntry(keyStartHeightUi, startHeight), DeleteEntry(keyNextPool)] | |
734 | 751 | let gwxRewardDepositInv = gwxRewardDeposit() | |
735 | 752 | if ((gwxRewardDepositInv == gwxRewardDepositInv)) | |
736 | 753 | then $Tuple2(actions, true) | |
737 | 754 | else throw("Strict value is not equal to itself.") | |
738 | 755 | case nextPoolStr: String => | |
739 | 756 | $Tuple2([StringEntry(keyNextPool, nextPoolStr)], true) | |
740 | 757 | case _ => | |
741 | 758 | throw("Match error") | |
742 | 759 | } | |
743 | 760 | else throw("Strict value is not equal to itself.") | |
744 | 761 | } | |
745 | 762 | else throw("Strict value is not equal to itself.") | |
746 | 763 | case _ => | |
747 | 764 | throw("Match error") | |
748 | 765 | } | |
749 | 766 | } | |
750 | 767 | else throwErr("finalization is broken") | |
751 | 768 | } | |
752 | 769 | ||
753 | 770 | ||
754 | 771 | ||
755 | 772 | @Callable(i) | |
756 | 773 | func finalizeWrapper (counter) = { | |
757 | 774 | let votingEmissionRateContract = addressFromStringValue(getStringValue(this, keyVotingEmissionRateContract)) | |
758 | 775 | let result = { | |
759 | 776 | let @ = invoke(this, "finalizeHelper", nil, nil) | |
760 | 777 | if ($isInstanceOf(@, "Boolean")) | |
761 | 778 | then @ | |
762 | 779 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
763 | 780 | } | |
764 | 781 | if ((result == result)) | |
765 | 782 | then if (!(result)) | |
766 | 783 | then if ((counter == 0)) | |
767 | 784 | then throwErr("Current voting is not over yet") | |
768 | 785 | else { | |
769 | 786 | let inv = invoke(votingEmissionRateContract, "finalize", nil, nil) | |
770 | 787 | if ((inv == inv)) | |
771 | 788 | then $Tuple2(nil, unit) | |
772 | 789 | else throw("Strict value is not equal to itself.") | |
773 | 790 | } | |
774 | 791 | else { | |
775 | 792 | let maxDepth = valueOrElse(getInteger(this, keyMaxDepth), maxDepthDefault) | |
776 | 793 | if ((maxDepth > counter)) | |
777 | 794 | then { | |
778 | 795 | let inv = invoke(this, "finalizeWrapper", [(counter + 1)], nil) | |
779 | 796 | if ((inv == inv)) | |
780 | 797 | then $Tuple2(nil, unit) | |
781 | 798 | else throw("Strict value is not equal to itself.") | |
782 | 799 | } | |
783 | 800 | else $Tuple2(nil, unit) | |
784 | 801 | } | |
785 | 802 | else throw("Strict value is not equal to itself.") | |
786 | 803 | } | |
787 | 804 | ||
788 | 805 | ||
789 | 806 | ||
790 | 807 | @Callable(i) | |
791 | 808 | func finalize () = { | |
792 | 809 | let inv = invoke(this, "finalizeWrapper", [0], nil) | |
793 | 810 | if ((inv == inv)) | |
794 | 811 | then $Tuple2(nil, unit) | |
795 | 812 | else throw("Strict value is not equal to itself.") | |
796 | 813 | } | |
797 | 814 | ||
798 | 815 | ||
799 | 816 | ||
800 | 817 | @Callable(i) | |
801 | 818 | func containsNodeREADONLY (listName,id) = $Tuple2(nil, containsNode(listName, id)) | |
802 | 819 | ||
803 | 820 | ||
804 | 821 | ||
805 | 822 | @Callable(i) | |
806 | 823 | func insertNode (listName,id) = { | |
807 | 824 | let checkCaller = mustManager(i) | |
808 | 825 | if ((checkCaller == checkCaller)) | |
809 | 826 | then $Tuple2(insertNodeActions(listName, id), unit) | |
810 | 827 | else throw("Strict value is not equal to itself.") | |
811 | 828 | } | |
812 | 829 | ||
813 | 830 | ||
814 | 831 | ||
815 | 832 | @Callable(i) | |
816 | 833 | func deleteNode (listName,id) = { | |
817 | 834 | let checkCaller = mustManager(i) | |
818 | 835 | if ((checkCaller == checkCaller)) | |
819 | 836 | then $Tuple2(deleteNodeActions(listName, id), unit) | |
820 | 837 | else throw("Strict value is not equal to itself.") | |
821 | 838 | } | |
822 | 839 | ||
823 | 840 | ||
824 | 841 | ||
825 | 842 | @Callable(i) | |
826 | 843 | func isFinalizationInProgress () = { | |
827 | 844 | let finalizationStageOrUnit = getInteger(this, keyFinalizationStage) | |
828 | 845 | let finalizationInProgress = (finalizationStageOrUnit != unit) | |
829 | 846 | $Tuple2(nil, finalizationInProgress) | |
830 | 847 | } | |
831 | 848 | ||
832 | 849 | ||
833 | 850 | ||
834 | 851 | @Callable(i) | |
835 | 852 | func deletePool (amountAssetId,priceAssetId) = { | |
836 | 853 | let checkCaller = if (if ((i.caller == factoryContract)) | |
837 | 854 | then true | |
838 | 855 | else mustManager(i)) | |
839 | 856 | then true | |
840 | 857 | else throwErr("Permission denied") | |
841 | 858 | if ((checkCaller == checkCaller)) | |
842 | 859 | then { | |
843 | 860 | let listName = "pools" | |
844 | 861 | let pool = $Tuple2(amountAssetId, priceAssetId) | |
845 | 862 | let id = makeString([amountAssetId, priceAssetId], separator) | |
846 | 863 | let actions = if (containsNode(listName, id)) | |
847 | 864 | then deleteNodeActions(listName, id) | |
848 | 865 | else nil | |
849 | 866 | ([DeleteEntry(keyInList(pool))] ++ actions) | |
850 | 867 | } | |
851 | 868 | else throw("Strict value is not equal to itself.") | |
852 | 869 | } | |
853 | 870 | ||
854 | 871 | ||
855 | 872 | @Verifier(tx) | |
856 | 873 | func verify () = { | |
857 | 874 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
858 | 875 | case pk: ByteVector => | |
859 | 876 | pk | |
860 | 877 | case _: Unit => | |
861 | 878 | tx.senderPublicKey | |
862 | 879 | case _ => | |
863 | 880 | throw("Match error") | |
864 | 881 | } | |
865 | 882 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
866 | 883 | } | |
867 | 884 |
github/deemru/w8io/169f3d6 112.59 ms ◑