tx · 9vHL7r6M9ndfd8VKh1tFWGn3LPm3pCoMpHG6mo8JoZy5 3N1Epwa6GQuTQr2K9WzeUcqSFCdERwuvL5T: -0.01400000 Waves 2022.05.06 11:34 [2039592] smart account 3N1Epwa6GQuTQr2K9WzeUcqSFCdERwuvL5T > SELF 0.00000000 Waves
{ "type": 13, "id": "9vHL7r6M9ndfd8VKh1tFWGn3LPm3pCoMpHG6mo8JoZy5", "fee": 1400000, "feeAssetId": null, "timestamp": 1651826068990, "version": 1, "sender": "3N1Epwa6GQuTQr2K9WzeUcqSFCdERwuvL5T", "senderPublicKey": "7iXEgsFNsnbLZ3ca4tmz8jffnyxMu9keuBV6CuQPJLuA", "proofs": [ "4Yz4brVuqmbxED5nXeAYhBPMfSnzgbAQSjk8xmu24g1joRKoqA41TAE9YspUcnweQMifpMJcUzpqypmxVva6iQU" ], "script": "base64:AAIFAAAAAAAAADoIAhIMCgoICAgIAQgBAQgBEgQKAggIEgUKAwgIBBIECgIICBIDCgEBEgMKAQESBAoCCAgSAwoBCBIAAAAAGwAAAAAJc2VwYXJhdG9yAgAAAAJfXwAAAAAMa2V5RmVlQW1vdW50CQAEuQAAAAIJAARMAAAAAgIAAAACJXMJAARMAAAAAgIAAAADZmVlBQAAAANuaWwFAAAACXNlcGFyYXRvcgAAAAAOa2V5VXNkbkFzc2V0SWQJAAS5AAAAAgkABEwAAAACAgAAAAIlcwkABEwAAAACAgAAAAt1c2RuQXNzZXRJZAUAAAADbmlsBQAAAAlzZXBhcmF0b3IAAAAAEWtleVZvdGluZ0R1cmF0aW9uCQAEuQAAAAIJAARMAAAAAgIAAAACJXMJAARMAAAAAgIAAAALZXBvY2hMZW5ndGgFAAAAA25pbAUAAAAJc2VwYXJhdG9yAAAAABFrZXlGaW5hbGl6ZVJld2FyZAkABLkAAAACCQAETAAAAAICAAAAAiVzCQAETAAAAAICAAAADmZpbmFsaXplUmV3YXJkBQAAAANuaWwFAAAACXNlcGFyYXRvcgAAAAASa2V5Vm90aW5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AAAgkBAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAACQACWAAAAAEJAQAAAAV2YWx1ZQAAAAEFAAAAAnBtCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEJAQAAABprZXlQZW5kaW5nTWFuYWdlclB1YmxpY0tleQAAAAAFAAAAA25pbAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAACAAAAAQIAAAAkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAPdGFyZ2V0UHVibGljS2V5BAAAAAckbWF0Y2gwCQEAAAAWbWFuYWdlclB1YmxpY0tleU9yVW5pdAAAAAADCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5dGVWZWN0b3IEAAAAAnBrBQAAAAckbWF0Y2gwBQAAAAJwawMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQkAAAIAAAABAgAAAAtNYXRjaCBlcnJvcgkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAD3RhcmdldFB1YmxpY0tleS2UJvs=", "chainId": 84, "height": 2039592, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9mtHfAgaGN7N91fkPGmPhsUBTh3D6wTaYQWxY2A7hnSX Next: 66aDmYgExJDGMj1nKA9pEAZrpsf6rqFUCGu9cuCFQdHj Diff:
Old | New | Differences | |
---|---|---|---|
8 | 8 | let keyUsdnAssetId = makeString(["%s", "usdnAssetId"], separator) | |
9 | 9 | ||
10 | 10 | let keyVotingDuration = makeString(["%s", "epochLength"], separator) | |
11 | + | ||
12 | + | let keyFinalizeReward = makeString(["%s", "finalizeReward"], separator) | |
11 | 13 | ||
12 | 14 | let keyVotingThreshold = makeString(["%s", "votingThreshold"], separator) | |
13 | 15 | ||
36 | 38 | func keyVote (amountAssetId,priceAssetId,voterAddress) = makeString(["%s%s%s%s", "vote", amountAssetId, priceAssetId, voterAddress], separator) | |
37 | 39 | ||
38 | 40 | ||
41 | + | func keyVoteValue (gwxAmount,vote) = { | |
42 | + | let key = if (vote) | |
43 | + | then makeString(["%d%s", gwxAmount, "yes"], separator) | |
44 | + | else makeString(["%d%s", gwxAmount, "no"], separator) | |
45 | + | key | |
46 | + | } | |
47 | + | ||
48 | + | ||
39 | 49 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
40 | 50 | ||
41 | 51 | ||
47 | 57 | let userPoolContract = addressFromStringValue(getStringOrFail(keyuserPoolContract)) | |
48 | 58 | ||
49 | 59 | let boostingContract = addressFromStringValue(getStringOrFail(keyBoostingContract)) | |
60 | + | ||
61 | + | let assetStoreContract = addressFromStringValue(getStringOrFail(keyAssetsStoreContract)) | |
50 | 62 | ||
51 | 63 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
52 | 64 | case s: String => | |
94 | 106 | ||
95 | 107 | ||
96 | 108 | @Callable(i) | |
97 | - | func constructor (assetsStoreContractPrm,userPoolContractPrm,boostingContractPrm,emissionContractPrm,feeAmountPrm,wxAssetIdPrm,votingThresholdPrm,votingDurationPrm,usdnAssetIdPrm) = { | |
109 | + | func constructor (assetsStoreContractPrm,userPoolContractPrm,boostingContractPrm,emissionContractPrm,feeAmountPrm,wxAssetIdPrm,votingThresholdPrm,votingDurationPrm,usdnAssetIdPrm,finalizeRewardPrm) = { | |
98 | 110 | let checks = [if (mustManager(i)) | |
99 | 111 | then true | |
100 | 112 | else throw("Must manager"), if (isDefined(addressFromString(assetsStoreContractPrm))) | |
109 | 121 | then true | |
110 | 122 | else throw("Invalid fee amount"), if ((votingDurationPrm > 0)) | |
111 | 123 | then true | |
112 | - | else throw("Invalid voting duration"), if ((votingThresholdPrm >= 0)) | |
124 | + | else throw("Invalid voting duration"), if ((finalizeRewardPrm > 0)) | |
125 | + | then true | |
126 | + | else throw("Invalid finalize reward"), if ((votingThresholdPrm >= 0)) | |
113 | 127 | then true | |
114 | 128 | else throw("Invalid voting threshold"), if (isDefined(assetInfo(fromBase58String(wxAssetIdPrm)))) | |
115 | 129 | then true | |
117 | 131 | then true | |
118 | 132 | else throw("Invalid USDN asset ID")] | |
119 | 133 | if ((checks == checks)) | |
120 | - | then $Tuple2([StringEntry(keyAssetsStoreContract, assetsStoreContractPrm), StringEntry(keyuserPoolContract, userPoolContractPrm), StringEntry(keyEmissionContract, emissionContractPrm), IntegerEntry(keyFeeAmount, feeAmountPrm), IntegerEntry(keyVotingDuration, votingDurationPrm), IntegerEntry(keyVotingThreshold, votingThresholdPrm), StringEntry(keyWxAssetId, wxAssetIdPrm), StringEntry(keyUsdnAssetId, usdnAssetIdPrm)], unit) | |
134 | + | then $Tuple2([StringEntry(keyAssetsStoreContract, assetsStoreContractPrm), StringEntry(keyuserPoolContract, userPoolContractPrm), StringEntry(keyEmissionContract, emissionContractPrm), IntegerEntry(keyFeeAmount, feeAmountPrm), IntegerEntry(keyVotingDuration, votingDurationPrm), IntegerEntry(keyFinalizeReward, finalizeRewardPrm), IntegerEntry(keyVotingThreshold, votingThresholdPrm), StringEntry(keyWxAssetId, wxAssetIdPrm), StringEntry(keyUsdnAssetId, usdnAssetIdPrm)], unit) | |
121 | 135 | else throw("Strict value is not equal to itself.") | |
122 | 136 | } | |
123 | 137 | ||
176 | 190 | ||
177 | 191 | @Callable(i) | |
178 | 192 | func vote (amountAssetId,priceAssetId,inFavor) = { | |
193 | + | let votingFinishHeight = (value(getInteger(keyStartHeight(amountAssetId, priceAssetId))) + value(getInteger(keyVotingDuration))) | |
179 | 194 | let checks = [if (valueOrElse(getBoolean(keyInListAssetId(amountAssetId, priceAssetId)), false)) | |
180 | 195 | then true | |
181 | - | else throw("The token isn't on the voting list"), (height >= (value(getInteger(keyStartHeight(amountAssetId, priceAssetId))) + value(getInteger(keyVotingDuration))))] | |
196 | + | else throw("The token isn't on the voting list"), if ((height >= votingFinishHeight)) | |
197 | + | then true | |
198 | + | else throw("too late to vote")] | |
182 | 199 | if ((checks == checks)) | |
183 | 200 | then { | |
184 | 201 | let votingResult = split(value(getString(keyVotingResult(amountAssetId, priceAssetId))), separator) | |
185 | 202 | let positiveVotes = votingResult[1] | |
186 | 203 | let negativeVotes = votingResult[2] | |
187 | - | let gwxAmount = invoke(boostingContract, "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), | |
204 | + | let gwxAmount = invoke(boostingContract, "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), votingFinishHeight], nil) | |
188 | 205 | let entries = if (inFavor) | |
189 | 206 | then { | |
190 | 207 | let newPositiveVotes = (parseIntValue(positiveVotes) + asInt(gwxAmount)) | |
191 | 208 | let totalVotes = makeString(["%d%d", toString(newPositiveVotes), negativeVotes], separator) | |
192 | 209 | let yesVoteKey = keyVote(amountAssetId, priceAssetId, toString(i.caller)) | |
193 | - | let yesVoteValue = | |
210 | + | let yesVoteValue = keyVoteValue(toString(asInt(gwxAmount)), inFavor) | |
194 | 211 | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId), totalVotes), StringEntry(yesVoteKey, yesVoteValue)], unit) | |
195 | 212 | } | |
196 | 213 | else { | |
197 | 214 | let newNegativeVotes = (parseIntValue(negativeVotes) + asInt(gwxAmount)) | |
198 | 215 | let totalVotes = makeString(["%d%d", positiveVotes, toString(newNegativeVotes)], separator) | |
199 | 216 | let noVoteKey = keyVote(amountAssetId, priceAssetId, toString(i.caller)) | |
200 | - | let noVoteValue = | |
217 | + | let noVoteValue = keyVoteValue(toString(asInt(gwxAmount)), inFavor) | |
201 | 218 | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId), totalVotes), StringEntry(noVoteKey, noVoteValue)], unit) | |
202 | 219 | } | |
203 | 220 | entries | |
221 | + | } | |
222 | + | else throw("Strict value is not equal to itself.") | |
223 | + | } | |
224 | + | ||
225 | + | ||
226 | + | ||
227 | + | @Callable(i) | |
228 | + | func cancelVote (amountAssetId,priceAssetId) = { | |
229 | + | let checks = [if (isDefined(keyVotingResult(amountAssetId, priceAssetId))) | |
230 | + | then true | |
231 | + | else throw("No vote for assets pair")] | |
232 | + | if ((checks == checks)) | |
233 | + | then { | |
234 | + | let vote = split(value(getString(keyVote(amountAssetId, priceAssetId, toString(i.caller)))), separator) | |
235 | + | let voteValue = vote[1] | |
236 | + | let voteType = vote[2] | |
237 | + | let votingResult = split(value(getString(keyVotingResult(amountAssetId, priceAssetId))), separator) | |
238 | + | let positiveVotes = votingResult[1] | |
239 | + | let negativeVotes = votingResult[2] | |
240 | + | let actions = if ((voteType == "yes")) | |
241 | + | then { | |
242 | + | let newPositiveVotes = (parseIntValue(positiveVotes) - parseIntValue(voteValue)) | |
243 | + | let totalVotes = makeString(["%d%d", toString(newPositiveVotes), negativeVotes], separator) | |
244 | + | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId), totalVotes), DeleteEntry(keyVote(amountAssetId, priceAssetId, toString(i.caller)))], unit) | |
245 | + | } | |
246 | + | else { | |
247 | + | let newNegativeVotes = (parseIntValue(negativeVotes) - parseIntValue(voteValue)) | |
248 | + | let totalVotes = makeString(["%d%d", toString(newNegativeVotes), negativeVotes], separator) | |
249 | + | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId), totalVotes), DeleteEntry(keyVote(amountAssetId, priceAssetId, toString(i.caller)))], unit) | |
250 | + | } | |
251 | + | actions | |
252 | + | } | |
253 | + | else throw("Strict value is not equal to itself.") | |
254 | + | } | |
255 | + | ||
256 | + | ||
257 | + | ||
258 | + | @Callable(i) | |
259 | + | func setVotingThreshold (newThreshold) = { | |
260 | + | let checks = [if (mustManager(i)) | |
261 | + | then true | |
262 | + | else throw("Must manager")] | |
263 | + | if ((checks == checks)) | |
264 | + | then [IntegerEntry(keyVotingThreshold, newThreshold)] | |
265 | + | else throw("Strict value is not equal to itself.") | |
266 | + | } | |
267 | + | ||
268 | + | ||
269 | + | ||
270 | + | @Callable(i) | |
271 | + | func setFee (newFee) = { | |
272 | + | let checks = [if (mustManager(i)) | |
273 | + | then true | |
274 | + | else throw("Must manager")] | |
275 | + | if ((checks == checks)) | |
276 | + | then [IntegerEntry(keyFeeAmount, newFee)] | |
277 | + | else throw("Strict value is not equal to itself.") | |
278 | + | } | |
279 | + | ||
280 | + | ||
281 | + | ||
282 | + | @Callable(i) | |
283 | + | func finalize (amountAssetId,priceAssetId) = { | |
284 | + | let votingFinishHeight = (value(getInteger(keyStartHeight(amountAssetId, priceAssetId))) + value(getInteger(keyVotingDuration))) | |
285 | + | let checks = [if (isDefined(keyInListAssetId(amountAssetId, priceAssetId))) | |
286 | + | then true | |
287 | + | else throw("No assets pair"), if ((votingFinishHeight > height)) | |
288 | + | then true | |
289 | + | else throw("insufficient height for completion")] | |
290 | + | if ((checks == checks)) | |
291 | + | then { | |
292 | + | let votingResult = split(value(getString(keyVotingResult(amountAssetId, priceAssetId))), separator) | |
293 | + | let positiveVotes = parseIntValue(votingResult[1]) | |
294 | + | let negativeVotes = parseIntValue(votingResult[2]) | |
295 | + | let actions = if ((positiveVotes > negativeVotes)) | |
296 | + | then { | |
297 | + | let res = invoke(assetStoreContract, "setPoolLabels", [amountAssetId, priceAssetId, "WX_EMISSION"], nil) | |
298 | + | if ((res == res)) | |
299 | + | then $Tuple2([DeleteEntry(keyInListAssetId(amountAssetId, priceAssetId))], unit) | |
300 | + | else throw("Strict value is not equal to itself.") | |
301 | + | } | |
302 | + | else $Tuple2([DeleteEntry(keyInListAssetId(amountAssetId, priceAssetId))], unit) | |
303 | + | actions | |
204 | 304 | } | |
205 | 305 | else throw("Strict value is not equal to itself.") | |
206 | 306 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
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 keyVotingDuration = makeString(["%s", "epochLength"], separator) | |
11 | + | ||
12 | + | let keyFinalizeReward = makeString(["%s", "finalizeReward"], separator) | |
11 | 13 | ||
12 | 14 | let keyVotingThreshold = makeString(["%s", "votingThreshold"], separator) | |
13 | 15 | ||
14 | 16 | let keyWxAssetId = makeString(["%s", "wxAssetId"], separator) | |
15 | 17 | ||
16 | 18 | let keyAssetsStoreContract = makeString(["%s", "assetsStoreContract"], separator) | |
17 | 19 | ||
18 | 20 | let keyuserPoolContract = makeString(["%s", "userPoolContract"], separator) | |
19 | 21 | ||
20 | 22 | let keyEmissionContract = makeString(["%s", "emissionContract"], separator) | |
21 | 23 | ||
22 | 24 | let keyBoostingContract = makeString(["%s", "boostingContract"], separator) | |
23 | 25 | ||
24 | 26 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " is not defined")) | |
25 | 27 | ||
26 | 28 | ||
27 | 29 | func keyInListAssetId (amountAssetId,priceAssetId) = makeString([("%s%s%s" + "inList"), amountAssetId, priceAssetId], separator) | |
28 | 30 | ||
29 | 31 | ||
30 | 32 | func keyStartHeight (amountAssetId,priceAssetId) = makeString([("%s%s%s" + "startHeight"), amountAssetId, priceAssetId], separator) | |
31 | 33 | ||
32 | 34 | ||
33 | 35 | func keyVotingResult (amountAssetId,priceAssetId) = makeString(["%s%s%s", "votingResult", amountAssetId, priceAssetId], separator) | |
34 | 36 | ||
35 | 37 | ||
36 | 38 | func keyVote (amountAssetId,priceAssetId,voterAddress) = makeString(["%s%s%s%s", "vote", amountAssetId, priceAssetId, voterAddress], separator) | |
37 | 39 | ||
38 | 40 | ||
41 | + | func keyVoteValue (gwxAmount,vote) = { | |
42 | + | let key = if (vote) | |
43 | + | then makeString(["%d%s", gwxAmount, "yes"], separator) | |
44 | + | else makeString(["%d%s", gwxAmount, "no"], separator) | |
45 | + | key | |
46 | + | } | |
47 | + | ||
48 | + | ||
39 | 49 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
40 | 50 | ||
41 | 51 | ||
42 | 52 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
43 | 53 | ||
44 | 54 | ||
45 | 55 | let emissionContract = addressFromStringValue(getStringOrFail(keyEmissionContract)) | |
46 | 56 | ||
47 | 57 | let userPoolContract = addressFromStringValue(getStringOrFail(keyuserPoolContract)) | |
48 | 58 | ||
49 | 59 | let boostingContract = addressFromStringValue(getStringOrFail(keyBoostingContract)) | |
60 | + | ||
61 | + | let assetStoreContract = addressFromStringValue(getStringOrFail(keyAssetsStoreContract)) | |
50 | 62 | ||
51 | 63 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
52 | 64 | case s: String => | |
53 | 65 | fromBase58String(s) | |
54 | 66 | case _: Unit => | |
55 | 67 | unit | |
56 | 68 | case _ => | |
57 | 69 | throw("Match error") | |
58 | 70 | } | |
59 | 71 | ||
60 | 72 | ||
61 | 73 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
62 | 74 | case s: String => | |
63 | 75 | fromBase58String(s) | |
64 | 76 | case _: Unit => | |
65 | 77 | unit | |
66 | 78 | case _ => | |
67 | 79 | throw("Match error") | |
68 | 80 | } | |
69 | 81 | ||
70 | 82 | ||
71 | 83 | func mustManager (i) = { | |
72 | 84 | let pd = throw("Permission denied") | |
73 | 85 | match managerPublicKeyOrUnit() { | |
74 | 86 | case pk: ByteVector => | |
75 | 87 | if ((i.callerPublicKey == pk)) | |
76 | 88 | then true | |
77 | 89 | else pd | |
78 | 90 | case _: Unit => | |
79 | 91 | if ((i.caller == this)) | |
80 | 92 | then true | |
81 | 93 | else pd | |
82 | 94 | case _ => | |
83 | 95 | throw("Match error") | |
84 | 96 | } | |
85 | 97 | } | |
86 | 98 | ||
87 | 99 | ||
88 | 100 | func asInt (val) = match val { | |
89 | 101 | case valInt: Int => | |
90 | 102 | valInt | |
91 | 103 | case _ => | |
92 | 104 | throw("Failed to cast into Integer") | |
93 | 105 | } | |
94 | 106 | ||
95 | 107 | ||
96 | 108 | @Callable(i) | |
97 | - | func constructor (assetsStoreContractPrm,userPoolContractPrm,boostingContractPrm,emissionContractPrm,feeAmountPrm,wxAssetIdPrm,votingThresholdPrm,votingDurationPrm,usdnAssetIdPrm) = { | |
109 | + | func constructor (assetsStoreContractPrm,userPoolContractPrm,boostingContractPrm,emissionContractPrm,feeAmountPrm,wxAssetIdPrm,votingThresholdPrm,votingDurationPrm,usdnAssetIdPrm,finalizeRewardPrm) = { | |
98 | 110 | let checks = [if (mustManager(i)) | |
99 | 111 | then true | |
100 | 112 | else throw("Must manager"), if (isDefined(addressFromString(assetsStoreContractPrm))) | |
101 | 113 | then true | |
102 | 114 | else throw("Invalid asset_store contract address"), if (isDefined(addressFromString(boostingContractPrm))) | |
103 | 115 | then true | |
104 | 116 | else throw("Invalid boosting contract address"), if (isDefined(addressFromString(userPoolContractPrm))) | |
105 | 117 | then true | |
106 | 118 | else throw("Invalid user_pools contract address"), if (isDefined(addressFromString(emissionContractPrm))) | |
107 | 119 | then true | |
108 | 120 | else throw("Invalid emission contract address"), if ((feeAmountPrm >= 0)) | |
109 | 121 | then true | |
110 | 122 | else throw("Invalid fee amount"), if ((votingDurationPrm > 0)) | |
111 | 123 | then true | |
112 | - | else throw("Invalid voting duration"), if ((votingThresholdPrm >= 0)) | |
124 | + | else throw("Invalid voting duration"), if ((finalizeRewardPrm > 0)) | |
125 | + | then true | |
126 | + | else throw("Invalid finalize reward"), if ((votingThresholdPrm >= 0)) | |
113 | 127 | then true | |
114 | 128 | else throw("Invalid voting threshold"), if (isDefined(assetInfo(fromBase58String(wxAssetIdPrm)))) | |
115 | 129 | then true | |
116 | 130 | else throw("Invalid WX asset ID"), if (isDefined(assetInfo(fromBase58String(usdnAssetIdPrm)))) | |
117 | 131 | then true | |
118 | 132 | else throw("Invalid USDN asset ID")] | |
119 | 133 | if ((checks == checks)) | |
120 | - | then $Tuple2([StringEntry(keyAssetsStoreContract, assetsStoreContractPrm), StringEntry(keyuserPoolContract, userPoolContractPrm), StringEntry(keyEmissionContract, emissionContractPrm), IntegerEntry(keyFeeAmount, feeAmountPrm), IntegerEntry(keyVotingDuration, votingDurationPrm), IntegerEntry(keyVotingThreshold, votingThresholdPrm), StringEntry(keyWxAssetId, wxAssetIdPrm), StringEntry(keyUsdnAssetId, usdnAssetIdPrm)], unit) | |
134 | + | then $Tuple2([StringEntry(keyAssetsStoreContract, assetsStoreContractPrm), StringEntry(keyuserPoolContract, userPoolContractPrm), StringEntry(keyEmissionContract, emissionContractPrm), IntegerEntry(keyFeeAmount, feeAmountPrm), IntegerEntry(keyVotingDuration, votingDurationPrm), IntegerEntry(keyFinalizeReward, finalizeRewardPrm), IntegerEntry(keyVotingThreshold, votingThresholdPrm), StringEntry(keyWxAssetId, wxAssetIdPrm), StringEntry(keyUsdnAssetId, usdnAssetIdPrm)], unit) | |
121 | 135 | else throw("Strict value is not equal to itself.") | |
122 | 136 | } | |
123 | 137 | ||
124 | 138 | ||
125 | 139 | ||
126 | 140 | @Callable(i) | |
127 | 141 | func suggest (amountAssetId,priceAssetId) = { | |
128 | 142 | let payment = value(i.payments[0]) | |
129 | 143 | let info = valueOrErrorMessage(assetInfo(fromBase58String(amountAssetId)), "Invalid amountAssetId ID") | |
130 | 144 | let checks = [if ((info.issuer == i.caller)) | |
131 | 145 | then true | |
132 | 146 | else throw("Asset can only be suggested by its issuer"), if ((info.scripted == false)) | |
133 | 147 | then true | |
134 | 148 | else throw("Asset is smart"), if ((toBase58String(value(payment.assetId)) == value(getString(keyWxAssetId)))) | |
135 | 149 | then true | |
136 | 150 | else throw("Invalid fee asset"), if ((payment.amount == value(getInteger(keyFeeAmount)))) | |
137 | 151 | then true | |
138 | 152 | else throw("Invalid fee amount"), if ((priceAssetId == value(getString(keyUsdnAssetId)))) | |
139 | 153 | then true | |
140 | 154 | else throw("priceAssetId is not USDN"), if ((getBoolean(keyInListAssetId(amountAssetId, priceAssetId)) == unit)) | |
141 | 155 | then true | |
142 | 156 | else throw("Already in voting list")] | |
143 | 157 | if ((checks == checks)) | |
144 | 158 | then { | |
145 | 159 | let ensureActive = match invoke(userPoolContract, "statusREADONLY", [amountAssetId, priceAssetId], nil) { | |
146 | 160 | case s: String => | |
147 | 161 | if ((s == "active")) | |
148 | 162 | then true | |
149 | 163 | else throw("User pool is not active") | |
150 | 164 | case _ => | |
151 | 165 | throw("User pool is not active") | |
152 | 166 | } | |
153 | 167 | if ((ensureActive == ensureActive)) | |
154 | 168 | then { | |
155 | 169 | let ensureAmountAssetVerified = match invoke(value(addressFromString(keyAssetsStoreContract)), "isVerifiedREADONLY", [amountAssetId], nil) { | |
156 | 170 | case b: Boolean => | |
157 | 171 | b | |
158 | 172 | case _ => | |
159 | 173 | throw("Asset is not verified") | |
160 | 174 | } | |
161 | 175 | if ((ensureAmountAssetVerified == ensureAmountAssetVerified)) | |
162 | 176 | then { | |
163 | 177 | let burnFeeInv = invoke(emissionContract, "burn", nil, [AttachedPayment(payment.assetId, payment.amount)]) | |
164 | 178 | if ((burnFeeInv == burnFeeInv)) | |
165 | 179 | then [BooleanEntry(keyInListAssetId(amountAssetId, priceAssetId), true), IntegerEntry(keyStartHeight(amountAssetId, priceAssetId), height)] | |
166 | 180 | else throw("Strict value is not equal to itself.") | |
167 | 181 | } | |
168 | 182 | else throw("Strict value is not equal to itself.") | |
169 | 183 | } | |
170 | 184 | else throw("Strict value is not equal to itself.") | |
171 | 185 | } | |
172 | 186 | else throw("Strict value is not equal to itself.") | |
173 | 187 | } | |
174 | 188 | ||
175 | 189 | ||
176 | 190 | ||
177 | 191 | @Callable(i) | |
178 | 192 | func vote (amountAssetId,priceAssetId,inFavor) = { | |
193 | + | let votingFinishHeight = (value(getInteger(keyStartHeight(amountAssetId, priceAssetId))) + value(getInteger(keyVotingDuration))) | |
179 | 194 | let checks = [if (valueOrElse(getBoolean(keyInListAssetId(amountAssetId, priceAssetId)), false)) | |
180 | 195 | then true | |
181 | - | else throw("The token isn't on the voting list"), (height >= (value(getInteger(keyStartHeight(amountAssetId, priceAssetId))) + value(getInteger(keyVotingDuration))))] | |
196 | + | else throw("The token isn't on the voting list"), if ((height >= votingFinishHeight)) | |
197 | + | then true | |
198 | + | else throw("too late to vote")] | |
182 | 199 | if ((checks == checks)) | |
183 | 200 | then { | |
184 | 201 | let votingResult = split(value(getString(keyVotingResult(amountAssetId, priceAssetId))), separator) | |
185 | 202 | let positiveVotes = votingResult[1] | |
186 | 203 | let negativeVotes = votingResult[2] | |
187 | - | let gwxAmount = invoke(boostingContract, "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), | |
204 | + | let gwxAmount = invoke(boostingContract, "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), votingFinishHeight], nil) | |
188 | 205 | let entries = if (inFavor) | |
189 | 206 | then { | |
190 | 207 | let newPositiveVotes = (parseIntValue(positiveVotes) + asInt(gwxAmount)) | |
191 | 208 | let totalVotes = makeString(["%d%d", toString(newPositiveVotes), negativeVotes], separator) | |
192 | 209 | let yesVoteKey = keyVote(amountAssetId, priceAssetId, toString(i.caller)) | |
193 | - | let yesVoteValue = | |
210 | + | let yesVoteValue = keyVoteValue(toString(asInt(gwxAmount)), inFavor) | |
194 | 211 | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId), totalVotes), StringEntry(yesVoteKey, yesVoteValue)], unit) | |
195 | 212 | } | |
196 | 213 | else { | |
197 | 214 | let newNegativeVotes = (parseIntValue(negativeVotes) + asInt(gwxAmount)) | |
198 | 215 | let totalVotes = makeString(["%d%d", positiveVotes, toString(newNegativeVotes)], separator) | |
199 | 216 | let noVoteKey = keyVote(amountAssetId, priceAssetId, toString(i.caller)) | |
200 | - | let noVoteValue = | |
217 | + | let noVoteValue = keyVoteValue(toString(asInt(gwxAmount)), inFavor) | |
201 | 218 | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId), totalVotes), StringEntry(noVoteKey, noVoteValue)], unit) | |
202 | 219 | } | |
203 | 220 | entries | |
221 | + | } | |
222 | + | else throw("Strict value is not equal to itself.") | |
223 | + | } | |
224 | + | ||
225 | + | ||
226 | + | ||
227 | + | @Callable(i) | |
228 | + | func cancelVote (amountAssetId,priceAssetId) = { | |
229 | + | let checks = [if (isDefined(keyVotingResult(amountAssetId, priceAssetId))) | |
230 | + | then true | |
231 | + | else throw("No vote for assets pair")] | |
232 | + | if ((checks == checks)) | |
233 | + | then { | |
234 | + | let vote = split(value(getString(keyVote(amountAssetId, priceAssetId, toString(i.caller)))), separator) | |
235 | + | let voteValue = vote[1] | |
236 | + | let voteType = vote[2] | |
237 | + | let votingResult = split(value(getString(keyVotingResult(amountAssetId, priceAssetId))), separator) | |
238 | + | let positiveVotes = votingResult[1] | |
239 | + | let negativeVotes = votingResult[2] | |
240 | + | let actions = if ((voteType == "yes")) | |
241 | + | then { | |
242 | + | let newPositiveVotes = (parseIntValue(positiveVotes) - parseIntValue(voteValue)) | |
243 | + | let totalVotes = makeString(["%d%d", toString(newPositiveVotes), negativeVotes], separator) | |
244 | + | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId), totalVotes), DeleteEntry(keyVote(amountAssetId, priceAssetId, toString(i.caller)))], unit) | |
245 | + | } | |
246 | + | else { | |
247 | + | let newNegativeVotes = (parseIntValue(negativeVotes) - parseIntValue(voteValue)) | |
248 | + | let totalVotes = makeString(["%d%d", toString(newNegativeVotes), negativeVotes], separator) | |
249 | + | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId), totalVotes), DeleteEntry(keyVote(amountAssetId, priceAssetId, toString(i.caller)))], unit) | |
250 | + | } | |
251 | + | actions | |
252 | + | } | |
253 | + | else throw("Strict value is not equal to itself.") | |
254 | + | } | |
255 | + | ||
256 | + | ||
257 | + | ||
258 | + | @Callable(i) | |
259 | + | func setVotingThreshold (newThreshold) = { | |
260 | + | let checks = [if (mustManager(i)) | |
261 | + | then true | |
262 | + | else throw("Must manager")] | |
263 | + | if ((checks == checks)) | |
264 | + | then [IntegerEntry(keyVotingThreshold, newThreshold)] | |
265 | + | else throw("Strict value is not equal to itself.") | |
266 | + | } | |
267 | + | ||
268 | + | ||
269 | + | ||
270 | + | @Callable(i) | |
271 | + | func setFee (newFee) = { | |
272 | + | let checks = [if (mustManager(i)) | |
273 | + | then true | |
274 | + | else throw("Must manager")] | |
275 | + | if ((checks == checks)) | |
276 | + | then [IntegerEntry(keyFeeAmount, newFee)] | |
277 | + | else throw("Strict value is not equal to itself.") | |
278 | + | } | |
279 | + | ||
280 | + | ||
281 | + | ||
282 | + | @Callable(i) | |
283 | + | func finalize (amountAssetId,priceAssetId) = { | |
284 | + | let votingFinishHeight = (value(getInteger(keyStartHeight(amountAssetId, priceAssetId))) + value(getInteger(keyVotingDuration))) | |
285 | + | let checks = [if (isDefined(keyInListAssetId(amountAssetId, priceAssetId))) | |
286 | + | then true | |
287 | + | else throw("No assets pair"), if ((votingFinishHeight > height)) | |
288 | + | then true | |
289 | + | else throw("insufficient height for completion")] | |
290 | + | if ((checks == checks)) | |
291 | + | then { | |
292 | + | let votingResult = split(value(getString(keyVotingResult(amountAssetId, priceAssetId))), separator) | |
293 | + | let positiveVotes = parseIntValue(votingResult[1]) | |
294 | + | let negativeVotes = parseIntValue(votingResult[2]) | |
295 | + | let actions = if ((positiveVotes > negativeVotes)) | |
296 | + | then { | |
297 | + | let res = invoke(assetStoreContract, "setPoolLabels", [amountAssetId, priceAssetId, "WX_EMISSION"], nil) | |
298 | + | if ((res == res)) | |
299 | + | then $Tuple2([DeleteEntry(keyInListAssetId(amountAssetId, priceAssetId))], unit) | |
300 | + | else throw("Strict value is not equal to itself.") | |
301 | + | } | |
302 | + | else $Tuple2([DeleteEntry(keyInListAssetId(amountAssetId, priceAssetId))], unit) | |
303 | + | actions | |
204 | 304 | } | |
205 | 305 | else throw("Strict value is not equal to itself.") | |
206 | 306 | } | |
207 | 307 | ||
208 | 308 | ||
209 | 309 | ||
210 | 310 | @Callable(i) | |
211 | 311 | func setManager (pendingManagerPublicKey) = { | |
212 | 312 | let checkCaller = mustManager(i) | |
213 | 313 | if ((checkCaller == checkCaller)) | |
214 | 314 | then { | |
215 | 315 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
216 | 316 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
217 | 317 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
218 | 318 | else throw("Strict value is not equal to itself.") | |
219 | 319 | } | |
220 | 320 | else throw("Strict value is not equal to itself.") | |
221 | 321 | } | |
222 | 322 | ||
223 | 323 | ||
224 | 324 | ||
225 | 325 | @Callable(i) | |
226 | 326 | func confirmManager () = { | |
227 | 327 | let pm = pendingManagerPublicKeyOrUnit() | |
228 | 328 | let hasPM = if (isDefined(pm)) | |
229 | 329 | then true | |
230 | 330 | else throw("No pending manager") | |
231 | 331 | if ((hasPM == hasPM)) | |
232 | 332 | then { | |
233 | 333 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
234 | 334 | then true | |
235 | 335 | else throw("You are not pending manager") | |
236 | 336 | if ((checkPM == checkPM)) | |
237 | 337 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
238 | 338 | else throw("Strict value is not equal to itself.") | |
239 | 339 | } | |
240 | 340 | else throw("Strict value is not equal to itself.") | |
241 | 341 | } | |
242 | 342 | ||
243 | 343 | ||
244 | 344 | @Verifier(tx) | |
245 | 345 | func verify () = { | |
246 | 346 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
247 | 347 | case pk: ByteVector => | |
248 | 348 | pk | |
249 | 349 | case _: Unit => | |
250 | 350 | tx.senderPublicKey | |
251 | 351 | case _ => | |
252 | 352 | throw("Match error") | |
253 | 353 | } | |
254 | 354 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
255 | 355 | } | |
256 | 356 |
github/deemru/w8io/169f3d6 55.66 ms ◑