tx · 6mJoi84NMtLPsVKujuiyDpB2TUDHx7qcAZE9KoSqQSZj 3N1Epwa6GQuTQr2K9WzeUcqSFCdERwuvL5T: -0.01500000 Waves 2023.04.24 13:30 [2548511] smart account 3N1Epwa6GQuTQr2K9WzeUcqSFCdERwuvL5T > SELF 0.00000000 Waves
{ "type": 13, "id": "6mJoi84NMtLPsVKujuiyDpB2TUDHx7qcAZE9KoSqQSZj", "fee": 1500000, "feeAssetId": null, "timestamp": 1682332255891, "version": 2, "chainId": 84, "sender": "3N1Epwa6GQuTQr2K9WzeUcqSFCdERwuvL5T", "senderPublicKey": "7iXEgsFNsnbLZ3ca4tmz8jffnyxMu9keuBV6CuQPJLuA", "proofs": [ "4j94exFdT47GUX2w9i15kX8YXPmLnu9nSRbncmLqbs8S92YDaqX9C4UEKKpX2uspiufiQtM6EMGG2ckoT9XGra5h" ], "script": "base64:BgLdDAgCEg0KCwgICAgICAEIAQgBEgMKAQESBAoCCAgSBQoDCAgEEgQKAggIEgMKAQESAwoBARIECgIICBIECgIICBIDCgEIEgAiCXNlcGFyYXRvciIMa2V5RmVlQW1vdW50Ig5rZXlVc2RuQXNzZXRJZCIOa2V5RXBvY2hMZW5ndGgiEWtleUZpbmFsaXplUmV3YXJkIgxrZXlXeEFzc2V0SWQiFmtleUFzc2V0c1N0b3JlQ29udHJhY3QiE2tleVVzZXJQb29sQ29udHJhY3QiE2tleUVtaXNzaW9uQ29udHJhY3QiE2tleUJvb3N0aW5nQ29udHJhY3QiEmtleUZhY3RvcnlDb250cmFjdCIZa2V5Vm90aW5nRW1pc3Npb25Db250cmFjdCIMa2V5VGhyZXNob2xkIg9nZXRTdHJpbmdPckZhaWwiA2tleSIMZ2V0SW50T3JGYWlsIhBrZXlJbkxpc3RBc3NldElkIg1hbW91bnRBc3NldElkIgxwcmljZUFzc2V0SWQiD2tleVN1Z2dlc3RJbmRleCIOa2V5U3RhcnRIZWlnaHQiDHN1Z2dlc3RJbmRleCIPa2V5Vm90aW5nUmVz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QtTdHJpbmdFbnRyeQIJAQFJAAkA2AQBCQEFdmFsdWUBBQJhWQkAzAgCCQELRGVsZXRlRW50cnkBCQEBSgAFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECYmIBAmJjAAQCYmQEAVIJAQFRAAMJAAECBQFSAgpCeXRlVmVjdG9yBAFXBQFSBQFXAwkAAQIFAVICBFVuaXQIBQJiYg9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgkA9AMDCAUCYmIJYm9keUJ5dGVzCQCRAwIIBQJiYgZwcm9vZnMAAAUCYmQ2MC7v", "height": 2548511, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 71Ud8HWFhSJpMryN2zzM7x5MpCJM3L1n2uBZFScoB3wA Next: AbKzGgoyXD78oYVqqA8tzZ8HChnQzyoDg9V168np9vLL Diff:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "__" | |
410 | 410 | ||
411 | 411 | ||
412 | 412 | @Callable(i) | |
413 | + | func approve (amountAssetId,priceAssetId) = { | |
414 | + | let checkCaller = if ((i.caller == userPoolContract)) | |
415 | + | then true | |
416 | + | else mustManager(i) | |
417 | + | if ((checkCaller == checkCaller)) | |
418 | + | then { | |
419 | + | let res = [invoke(factoryContract, "setWxEmissionPoolLabel", [amountAssetId, priceAssetId], nil), invoke(votingEmissionContract, "create", [amountAssetId, priceAssetId], nil)] | |
420 | + | if ((res == res)) | |
421 | + | then $Tuple2(nil, unit) | |
422 | + | else throw("Strict value is not equal to itself.") | |
423 | + | } | |
424 | + | else throw("Strict value is not equal to itself.") | |
425 | + | } | |
426 | + | ||
427 | + | ||
428 | + | ||
429 | + | @Callable(i) | |
413 | 430 | func setManager (pendingManagerPublicKey) = { | |
414 | 431 | let checkCaller = mustManager(i) | |
415 | 432 | if ((checkCaller == checkCaller)) |
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "__" | |
5 | 5 | ||
6 | 6 | let keyFeeAmount = makeString(["%s", "fee"], separator) | |
7 | 7 | ||
8 | 8 | let keyUsdnAssetId = makeString(["%s", "usdnAssetId"], separator) | |
9 | 9 | ||
10 | 10 | let keyEpochLength = makeString(["%s", "epochLength"], separator) | |
11 | 11 | ||
12 | 12 | let keyFinalizeReward = makeString(["%s", "finalizeReward"], separator) | |
13 | 13 | ||
14 | 14 | let keyWxAssetId = makeString(["%s", "wxAssetId"], separator) | |
15 | 15 | ||
16 | 16 | let keyAssetsStoreContract = makeString(["%s", "assetsStoreContract"], separator) | |
17 | 17 | ||
18 | 18 | let keyUserPoolContract = makeString(["%s", "userPoolContract"], separator) | |
19 | 19 | ||
20 | 20 | let keyEmissionContract = makeString(["%s", "emissionContract"], separator) | |
21 | 21 | ||
22 | 22 | let keyBoostingContract = makeString(["%s", "boostingContract"], separator) | |
23 | 23 | ||
24 | 24 | let keyFactoryContract = makeString(["%s", "factoryContract"], separator) | |
25 | 25 | ||
26 | 26 | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], separator) | |
27 | 27 | ||
28 | 28 | let keyThreshold = makeString(["%s", "votingThreshold"], separator) | |
29 | 29 | ||
30 | 30 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " is not defined")) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func getIntOrFail (key) = valueOrErrorMessage(getInteger(this, key), (key + " is not defined")) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func keyInListAssetId (amountAssetId,priceAssetId) = makeString(["%s%s%s", "inList", amountAssetId, priceAssetId], separator) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func keySuggestIndex (amountAssetId,priceAssetId) = makeString(["%s%s%s", "suggestIndex", amountAssetId, priceAssetId], separator) | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func keyStartHeight (amountAssetId,priceAssetId,suggestIndex) = makeString(["%s%s%s%d", "startHeight", amountAssetId, priceAssetId, toString(suggestIndex)], separator) | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func keyVotingResult (amountAssetId,priceAssetId,suggestIndex) = makeString(["%s%s%s%d", "votingResult", amountAssetId, priceAssetId, toString(suggestIndex)], separator) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func totalVotes (totalYes,totalNo) = makeString(["%d%d", totalYes, totalNo], separator) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func keyVote (amountAssetId,priceAssetId,suggestIndex,voterAddress) = makeString(["%s%s%s%d%s", "vote", amountAssetId, priceAssetId, toString(suggestIndex), voterAddress], separator) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func keyVoteValue (gwxAmount,vote) = { | |
55 | 55 | let key = if (vote) | |
56 | 56 | then makeString(["%d%s", gwxAmount, "yes"], separator) | |
57 | 57 | else makeString(["%d%s", gwxAmount, "no"], separator) | |
58 | 58 | key | |
59 | 59 | } | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func keyInList (pool) = { | |
63 | 63 | let $t024632503 = pool | |
64 | 64 | let amountAssetId = $t024632503._1 | |
65 | 65 | let priceAssetId = $t024632503._2 | |
66 | 66 | makeString(["%s%s%s", "inList", amountAssetId, priceAssetId], separator) | |
67 | 67 | } | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | let assetsStoreContract = addressFromStringValue(getStringOrFail(keyAssetsStoreContract)) | |
77 | 77 | ||
78 | 78 | let boostingContract = addressFromStringValue(getStringOrFail(keyBoostingContract)) | |
79 | 79 | ||
80 | 80 | let emissionContract = addressFromStringValue(getStringOrFail(keyEmissionContract)) | |
81 | 81 | ||
82 | 82 | let factoryContract = addressFromStringValue(getStringOrFail(keyFactoryContract)) | |
83 | 83 | ||
84 | 84 | let userPoolContract = addressFromStringValue(getStringOrFail(keyUserPoolContract)) | |
85 | 85 | ||
86 | 86 | let votingEmissionContract = addressFromStringValue(getStringOrFail(keyVotingEmissionContract)) | |
87 | 87 | ||
88 | 88 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
89 | 89 | case s: String => | |
90 | 90 | fromBase58String(s) | |
91 | 91 | case _: Unit => | |
92 | 92 | unit | |
93 | 93 | case _ => | |
94 | 94 | throw("Match error") | |
95 | 95 | } | |
96 | 96 | ||
97 | 97 | ||
98 | 98 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
99 | 99 | case s: String => | |
100 | 100 | fromBase58String(s) | |
101 | 101 | case _: Unit => | |
102 | 102 | unit | |
103 | 103 | case _ => | |
104 | 104 | throw("Match error") | |
105 | 105 | } | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func isManager (i) = match managerPublicKeyOrUnit() { | |
109 | 109 | case pk: ByteVector => | |
110 | 110 | (i.callerPublicKey == pk) | |
111 | 111 | case _: Unit => | |
112 | 112 | (i.caller == this) | |
113 | 113 | case _ => | |
114 | 114 | throw("Match error") | |
115 | 115 | } | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func mustManager (i) = if (isManager(i)) | |
119 | 119 | then true | |
120 | 120 | else throw("permission denied") | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func asInt (val) = match val { | |
124 | 124 | case valInt: Int => | |
125 | 125 | valInt | |
126 | 126 | case _ => | |
127 | 127 | throw("failed to cast into Integer") | |
128 | 128 | } | |
129 | 129 | ||
130 | 130 | ||
131 | 131 | @Callable(i) | |
132 | 132 | func constructor (assetsStoreContractPrm,boostingContractPrm,emissionContractPrm,factoryContractPrm,userPoolContractPrm,votingEmissionContractPrm,feeAmountPrm,wxAssetIdPrm,votingDurationPrm,usdnAssetIdPrm,finalizeRewardPrm) = { | |
133 | 133 | let checks = [mustManager(i), if (isDefined(addressFromString(assetsStoreContractPrm))) | |
134 | 134 | then true | |
135 | 135 | else throw("Invalid asset_store contract address"), if (isDefined(addressFromString(boostingContractPrm))) | |
136 | 136 | then true | |
137 | 137 | else throw("Invalid boosting contract address"), if (isDefined(addressFromString(userPoolContractPrm))) | |
138 | 138 | then true | |
139 | 139 | else throw("Invalid user_pools contract address"), if (isDefined(addressFromString(emissionContractPrm))) | |
140 | 140 | then true | |
141 | 141 | else throw("Invalid emission contract address"), if (isDefined(addressFromString(factoryContractPrm))) | |
142 | 142 | then true | |
143 | 143 | else throw("Invalid factory contract address"), if ((feeAmountPrm >= 0)) | |
144 | 144 | then true | |
145 | 145 | else throw("Invalid fee amount"), if ((votingDurationPrm > 0)) | |
146 | 146 | then true | |
147 | 147 | else throw("Invalid voting duration"), if ((finalizeRewardPrm >= 0)) | |
148 | 148 | then true | |
149 | 149 | else throw("Invalid finalize reward"), if (isDefined(assetInfo(fromBase58String(wxAssetIdPrm)))) | |
150 | 150 | then true | |
151 | 151 | else throw("Invalid WX asset ID"), if (isDefined(assetInfo(fromBase58String(usdnAssetIdPrm)))) | |
152 | 152 | then true | |
153 | 153 | else throw("Invalid USDN asset ID")] | |
154 | 154 | if ((checks == checks)) | |
155 | 155 | then $Tuple2([StringEntry(keyAssetsStoreContract, assetsStoreContractPrm), StringEntry(keyBoostingContract, boostingContractPrm), StringEntry(keyEmissionContract, emissionContractPrm), StringEntry(keyFactoryContract, factoryContractPrm), StringEntry(keyUserPoolContract, userPoolContractPrm), StringEntry(keyVotingEmissionContract, votingEmissionContractPrm), IntegerEntry(keyFeeAmount, feeAmountPrm), IntegerEntry(keyEpochLength, votingDurationPrm), IntegerEntry(keyFinalizeReward, finalizeRewardPrm), StringEntry(keyWxAssetId, wxAssetIdPrm), StringEntry(keyUsdnAssetId, usdnAssetIdPrm)], unit) | |
156 | 156 | else throw("Strict value is not equal to itself.") | |
157 | 157 | } | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | ||
161 | 161 | @Callable(i) | |
162 | 162 | func constructorV2 (threshold) = { | |
163 | 163 | let checks = [mustManager(i), if ((threshold > 0)) | |
164 | 164 | then true | |
165 | 165 | else throw("invalid threshold")] | |
166 | 166 | if ((checks == checks)) | |
167 | 167 | then $Tuple2([IntegerEntry(keyThreshold, threshold)], unit) | |
168 | 168 | else throw("Strict value is not equal to itself.") | |
169 | 169 | } | |
170 | 170 | ||
171 | 171 | ||
172 | 172 | ||
173 | 173 | @Callable(i) | |
174 | 174 | func suggest (amountAssetId,priceAssetId) = { | |
175 | 175 | let pool = $Tuple2(amountAssetId, priceAssetId) | |
176 | 176 | let payment = value(i.payments[0]) | |
177 | 177 | let checkAmountAsset = if ((amountAssetId == "WAVES")) | |
178 | 178 | then unit | |
179 | 179 | else { | |
180 | 180 | let info = valueOrErrorMessage(assetInfo(fromBase58String(amountAssetId)), "invalid amountAssetId ID") | |
181 | 181 | if ((info.scripted == false)) | |
182 | 182 | then true | |
183 | 183 | else throw("asset is smart") | |
184 | 184 | } | |
185 | 185 | if ((checkAmountAsset == checkAmountAsset)) | |
186 | 186 | then { | |
187 | 187 | let checks = [if ((toBase58String(value(payment.assetId)) == value(getString(keyWxAssetId)))) | |
188 | 188 | then true | |
189 | 189 | else throw("invalid fee asset"), if ((payment.amount == value(getInteger(keyFeeAmount)))) | |
190 | 190 | then true | |
191 | 191 | else throw("invalid fee amount"), if ((getInteger(keyInListAssetId(amountAssetId, priceAssetId)) == unit)) | |
192 | 192 | then true | |
193 | 193 | else throw("already in voting list"), if (!(valueOrElse(getBoolean(votingEmissionContract, keyInList(pool)), false))) | |
194 | 194 | then true | |
195 | 195 | else throw("pool is in emission voting list")] | |
196 | 196 | if ((checks == checks)) | |
197 | 197 | then { | |
198 | 198 | let ensureActive = match invoke(userPoolContract, "statusREADONLY", [amountAssetId, priceAssetId], nil) { | |
199 | 199 | case s: String => | |
200 | 200 | if ((s == "active")) | |
201 | 201 | then true | |
202 | 202 | else throw("user pool is not active") | |
203 | 203 | case _ => | |
204 | 204 | throw("user pool is not active") | |
205 | 205 | } | |
206 | 206 | if ((ensureActive == ensureActive)) | |
207 | 207 | then { | |
208 | 208 | let ensureAmountAssetVerified = if (isManager(i)) | |
209 | 209 | then unit | |
210 | 210 | else { | |
211 | 211 | let inv = match invoke(assetsStoreContract, "isVerifiedREADONLY", [amountAssetId], nil) { | |
212 | 212 | case b: Boolean => | |
213 | 213 | if (b) | |
214 | 214 | then true | |
215 | 215 | else throw("asset is not verified") | |
216 | 216 | case _ => | |
217 | 217 | throw("asset is not verified") | |
218 | 218 | } | |
219 | 219 | if ((inv == inv)) | |
220 | 220 | then unit | |
221 | 221 | else throw("Strict value is not equal to itself.") | |
222 | 222 | } | |
223 | 223 | if ((ensureAmountAssetVerified == ensureAmountAssetVerified)) | |
224 | 224 | then { | |
225 | 225 | let burnFeeInv = invoke(emissionContract, "burn", nil, [AttachedPayment(payment.assetId, payment.amount)]) | |
226 | 226 | if ((burnFeeInv == burnFeeInv)) | |
227 | 227 | then { | |
228 | 228 | let newSuggestIndex = match getInteger(keySuggestIndex(amountAssetId, priceAssetId)) { | |
229 | 229 | case int: Int => | |
230 | 230 | (int + 1) | |
231 | 231 | case _ => | |
232 | 232 | 0 | |
233 | 233 | } | |
234 | 234 | $Tuple2([IntegerEntry(keyInListAssetId(amountAssetId, priceAssetId), newSuggestIndex), IntegerEntry(keyStartHeight(amountAssetId, priceAssetId, newSuggestIndex), height), StringEntry(keyVotingResult(amountAssetId, priceAssetId, newSuggestIndex), totalVotes("0", "0")), IntegerEntry(keySuggestIndex(amountAssetId, priceAssetId), newSuggestIndex)], unit) | |
235 | 235 | } | |
236 | 236 | else throw("Strict value is not equal to itself.") | |
237 | 237 | } | |
238 | 238 | else throw("Strict value is not equal to itself.") | |
239 | 239 | } | |
240 | 240 | else throw("Strict value is not equal to itself.") | |
241 | 241 | } | |
242 | 242 | else throw("Strict value is not equal to itself.") | |
243 | 243 | } | |
244 | 244 | else throw("Strict value is not equal to itself.") | |
245 | 245 | } | |
246 | 246 | ||
247 | 247 | ||
248 | 248 | ||
249 | 249 | @Callable(i) | |
250 | 250 | func vote (amountAssetId,priceAssetId,inFavor) = { | |
251 | 251 | let suggestIndex = value(getInteger(keyInListAssetId(amountAssetId, priceAssetId))) | |
252 | 252 | let votingFinishHeight = (value(getInteger(keyStartHeight(amountAssetId, priceAssetId, suggestIndex))) + value(getInteger(keyEpochLength))) | |
253 | 253 | let checks = [if (isDefined(getInteger(keyInListAssetId(amountAssetId, priceAssetId)))) | |
254 | 254 | then true | |
255 | 255 | else throw("the token isn't on the voting list"), if ((votingFinishHeight > height)) | |
256 | 256 | then true | |
257 | 257 | else throw("too late to vote")] | |
258 | 258 | if ((checks == checks)) | |
259 | 259 | then { | |
260 | 260 | let gwxAmount = invoke(boostingContract, "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), votingFinishHeight], nil) | |
261 | 261 | let notZero = if ((asInt(gwxAmount) > 0)) | |
262 | 262 | then true | |
263 | 263 | else throw("you don't have gwx") | |
264 | 264 | if ((notZero == notZero)) | |
265 | 265 | then { | |
266 | 266 | let vote = match getString(keyVote(amountAssetId, priceAssetId, suggestIndex, toString(i.caller))) { | |
267 | 267 | case s: String => | |
268 | 268 | let vote = split(s, separator) | |
269 | 269 | let voteValue = vote[1] | |
270 | 270 | let voteType = vote[2] | |
271 | 271 | let isVoteTypeSimilar = if (if ((voteType == "yes")) | |
272 | 272 | then (inFavor == true) | |
273 | 273 | else false) | |
274 | 274 | then true | |
275 | 275 | else if ((voteType == "no")) | |
276 | 276 | then (inFavor == false) | |
277 | 277 | else false | |
278 | 278 | let isVoteValueSimilar = if (isVoteTypeSimilar) | |
279 | 279 | then (asInt(gwxAmount) == parseIntValue(voteValue)) | |
280 | 280 | else false | |
281 | 281 | let isNewVoteSimilar = if (if (isVoteTypeSimilar) | |
282 | 282 | then isVoteValueSimilar | |
283 | 283 | else false) | |
284 | 284 | then throw("you already voted") | |
285 | 285 | else invoke(this, "cancelVote", [amountAssetId, priceAssetId], nil) | |
286 | 286 | isNewVoteSimilar | |
287 | 287 | case u: Unit => | |
288 | 288 | u | |
289 | 289 | case _ => | |
290 | 290 | throw("Match error") | |
291 | 291 | } | |
292 | 292 | if ((vote == vote)) | |
293 | 293 | then { | |
294 | 294 | let votingResult = split(value(getString(keyVotingResult(amountAssetId, priceAssetId, suggestIndex))), separator) | |
295 | 295 | let positiveVotes = votingResult[1] | |
296 | 296 | let negativeVotes = votingResult[2] | |
297 | 297 | let newPositiveAndNegativeVotes = if (inFavor) | |
298 | 298 | then { | |
299 | 299 | let newPositiveVotes = (parseIntValue(positiveVotes) + asInt(gwxAmount)) | |
300 | 300 | [toString(newPositiveVotes), negativeVotes] | |
301 | 301 | } | |
302 | 302 | else { | |
303 | 303 | let newNegativeVotes = (parseIntValue(negativeVotes) + asInt(gwxAmount)) | |
304 | 304 | [positiveVotes, toString(newNegativeVotes)] | |
305 | 305 | } | |
306 | 306 | let voteKey = keyVote(amountAssetId, priceAssetId, suggestIndex, toString(i.caller)) | |
307 | 307 | let voteValue = keyVoteValue(toString(asInt(gwxAmount)), inFavor) | |
308 | 308 | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId, suggestIndex), totalVotes(newPositiveAndNegativeVotes[0], newPositiveAndNegativeVotes[1])), StringEntry(voteKey, voteValue)], unit) | |
309 | 309 | } | |
310 | 310 | else throw("Strict value is not equal to itself.") | |
311 | 311 | } | |
312 | 312 | else throw("Strict value is not equal to itself.") | |
313 | 313 | } | |
314 | 314 | else throw("Strict value is not equal to itself.") | |
315 | 315 | } | |
316 | 316 | ||
317 | 317 | ||
318 | 318 | ||
319 | 319 | @Callable(i) | |
320 | 320 | func cancelVote (amountAssetId,priceAssetId) = { | |
321 | 321 | let userAddress = if ((i.caller == this)) | |
322 | 322 | then toString(i.originCaller) | |
323 | 323 | else toString(i.caller) | |
324 | 324 | let suggestIndex = value(getInteger(keyInListAssetId(amountAssetId, priceAssetId))) | |
325 | 325 | let checks = [if (isDefined(getString(keyVotingResult(amountAssetId, priceAssetId, suggestIndex)))) | |
326 | 326 | then true | |
327 | 327 | else throw("no vote for assets pair")] | |
328 | 328 | if ((checks == checks)) | |
329 | 329 | then { | |
330 | 330 | let vote = split(value(getString(keyVote(amountAssetId, priceAssetId, suggestIndex, userAddress))), separator) | |
331 | 331 | let voteValue = vote[1] | |
332 | 332 | let voteType = vote[2] | |
333 | 333 | let votingResult = split(value(getString(keyVotingResult(amountAssetId, priceAssetId, suggestIndex))), separator) | |
334 | 334 | let positiveVotes = votingResult[1] | |
335 | 335 | let negativeVotes = votingResult[2] | |
336 | 336 | let actions = if ((voteType == "yes")) | |
337 | 337 | then { | |
338 | 338 | let newPositiveVotes = (parseIntValue(positiveVotes) - parseIntValue(voteValue)) | |
339 | 339 | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId, suggestIndex), totalVotes(toString(newPositiveVotes), negativeVotes)), DeleteEntry(keyVote(amountAssetId, priceAssetId, suggestIndex, userAddress))], unit) | |
340 | 340 | } | |
341 | 341 | else { | |
342 | 342 | let newNegativeVotes = (parseIntValue(negativeVotes) - parseIntValue(voteValue)) | |
343 | 343 | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId, suggestIndex), totalVotes(positiveVotes, toString(newNegativeVotes))), DeleteEntry(keyVote(amountAssetId, priceAssetId, suggestIndex, userAddress))], unit) | |
344 | 344 | } | |
345 | 345 | actions | |
346 | 346 | } | |
347 | 347 | else throw("Strict value is not equal to itself.") | |
348 | 348 | } | |
349 | 349 | ||
350 | 350 | ||
351 | 351 | ||
352 | 352 | @Callable(i) | |
353 | 353 | func setFee (newFee) = { | |
354 | 354 | let checks = [mustManager(i)] | |
355 | 355 | if ((checks == checks)) | |
356 | 356 | then [IntegerEntry(keyFeeAmount, newFee)] | |
357 | 357 | else throw("Strict value is not equal to itself.") | |
358 | 358 | } | |
359 | 359 | ||
360 | 360 | ||
361 | 361 | ||
362 | 362 | @Callable(i) | |
363 | 363 | func setThreshold (newThreshold) = { | |
364 | 364 | let checks = [mustManager(i), if ((newThreshold > 0)) | |
365 | 365 | then true | |
366 | 366 | else throw("invalid threshold")] | |
367 | 367 | if ((checks == checks)) | |
368 | 368 | then $Tuple2([IntegerEntry(keyThreshold, newThreshold)], unit) | |
369 | 369 | else throw("Strict value is not equal to itself.") | |
370 | 370 | } | |
371 | 371 | ||
372 | 372 | ||
373 | 373 | ||
374 | 374 | @Callable(i) | |
375 | 375 | func finalize (amountAssetId,priceAssetId) = { | |
376 | 376 | let suggestIndex = value(getInteger(keyInListAssetId(amountAssetId, priceAssetId))) | |
377 | 377 | let votingFinishHeight = (value(getInteger(keyStartHeight(amountAssetId, priceAssetId, suggestIndex))) + value(getInteger(keyEpochLength))) | |
378 | 378 | let checks = [if (isDefined(getInteger(keyInListAssetId(amountAssetId, priceAssetId)))) | |
379 | 379 | then true | |
380 | 380 | else throw("no assets pair"), if ((height >= votingFinishHeight)) | |
381 | 381 | then true | |
382 | 382 | else throw("insufficient height for completion")] | |
383 | 383 | if ((checks == checks)) | |
384 | 384 | then { | |
385 | 385 | let votingResult = split(value(getString(keyVotingResult(amountAssetId, priceAssetId, suggestIndex))), separator) | |
386 | 386 | let positiveVotes = parseIntValue(votingResult[1]) | |
387 | 387 | let negativeVotes = parseIntValue(votingResult[2]) | |
388 | 388 | let allVotes = (positiveVotes + negativeVotes) | |
389 | 389 | let threshold = getIntOrFail(keyThreshold) | |
390 | 390 | let actions = if (if ((allVotes >= threshold)) | |
391 | 391 | then (positiveVotes > negativeVotes) | |
392 | 392 | else false) | |
393 | 393 | then { | |
394 | 394 | let res = invoke(factoryContract, "setWxEmissionPoolLabel", [amountAssetId, priceAssetId], nil) | |
395 | 395 | if ((res == res)) | |
396 | 396 | then { | |
397 | 397 | let votingEmissionInv = invoke(votingEmissionContract, "create", [amountAssetId, priceAssetId], nil) | |
398 | 398 | if ((votingEmissionInv == votingEmissionInv)) | |
399 | 399 | then $Tuple2([DeleteEntry(keyInListAssetId(amountAssetId, priceAssetId))], unit) | |
400 | 400 | else throw("Strict value is not equal to itself.") | |
401 | 401 | } | |
402 | 402 | else throw("Strict value is not equal to itself.") | |
403 | 403 | } | |
404 | 404 | else $Tuple2([DeleteEntry(keyInListAssetId(amountAssetId, priceAssetId))], unit) | |
405 | 405 | actions | |
406 | 406 | } | |
407 | 407 | else throw("Strict value is not equal to itself.") | |
408 | 408 | } | |
409 | 409 | ||
410 | 410 | ||
411 | 411 | ||
412 | 412 | @Callable(i) | |
413 | + | func approve (amountAssetId,priceAssetId) = { | |
414 | + | let checkCaller = if ((i.caller == userPoolContract)) | |
415 | + | then true | |
416 | + | else mustManager(i) | |
417 | + | if ((checkCaller == checkCaller)) | |
418 | + | then { | |
419 | + | let res = [invoke(factoryContract, "setWxEmissionPoolLabel", [amountAssetId, priceAssetId], nil), invoke(votingEmissionContract, "create", [amountAssetId, priceAssetId], nil)] | |
420 | + | if ((res == res)) | |
421 | + | then $Tuple2(nil, unit) | |
422 | + | else throw("Strict value is not equal to itself.") | |
423 | + | } | |
424 | + | else throw("Strict value is not equal to itself.") | |
425 | + | } | |
426 | + | ||
427 | + | ||
428 | + | ||
429 | + | @Callable(i) | |
413 | 430 | func setManager (pendingManagerPublicKey) = { | |
414 | 431 | let checkCaller = mustManager(i) | |
415 | 432 | if ((checkCaller == checkCaller)) | |
416 | 433 | then { | |
417 | 434 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
418 | 435 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
419 | 436 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
420 | 437 | else throw("Strict value is not equal to itself.") | |
421 | 438 | } | |
422 | 439 | else throw("Strict value is not equal to itself.") | |
423 | 440 | } | |
424 | 441 | ||
425 | 442 | ||
426 | 443 | ||
427 | 444 | @Callable(i) | |
428 | 445 | func confirmManager () = { | |
429 | 446 | let pm = pendingManagerPublicKeyOrUnit() | |
430 | 447 | let hasPM = if (isDefined(pm)) | |
431 | 448 | then true | |
432 | 449 | else throw("no pending manager") | |
433 | 450 | if ((hasPM == hasPM)) | |
434 | 451 | then { | |
435 | 452 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
436 | 453 | then true | |
437 | 454 | else throw("you are not pending manager") | |
438 | 455 | if ((checkPM == checkPM)) | |
439 | 456 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
440 | 457 | else throw("Strict value is not equal to itself.") | |
441 | 458 | } | |
442 | 459 | else throw("Strict value is not equal to itself.") | |
443 | 460 | } | |
444 | 461 | ||
445 | 462 | ||
446 | 463 | @Verifier(tx) | |
447 | 464 | func verify () = { | |
448 | 465 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
449 | 466 | case pk: ByteVector => | |
450 | 467 | pk | |
451 | 468 | case _: Unit => | |
452 | 469 | tx.senderPublicKey | |
453 | 470 | case _ => | |
454 | 471 | throw("Match error") | |
455 | 472 | } | |
456 | 473 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
457 | 474 | } | |
458 | 475 |
github/deemru/w8io/169f3d6 53.32 ms ◑