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