tx · HSSgoJad1EMVsHSohxX4DnygKLKyTtTbDVE7L62fGfXh 3N1Epwa6GQuTQr2K9WzeUcqSFCdERwuvL5T: -0.01900000 Waves 2023.01.10 13:35 [2398735] smart account 3N1Epwa6GQuTQr2K9WzeUcqSFCdERwuvL5T > SELF 0.00000000 Waves
{ "type": 13, "id": "HSSgoJad1EMVsHSohxX4DnygKLKyTtTbDVE7L62fGfXh", "fee": 1900000, "feeAssetId": null, "timestamp": 1673346965405, "version": 1, "sender": "3N1Epwa6GQuTQr2K9WzeUcqSFCdERwuvL5T", "senderPublicKey": "7iXEgsFNsnbLZ3ca4tmz8jffnyxMu9keuBV6CuQPJLuA", "proofs": [ "2Piu6TzmBejV5MXMEArjphqUZEACbHbJ5xiMfEKfU4fFwSSoYKRuJXPHt95juQqUjDcbeWNwP6vHfMESAT7J9CiY" ], "script": "base64:AAIFAAAAAAAABkUIAhINCgsICAgICAgBCAEIARIDCgEBEgQKAggIEgUKAwgIBBIECgIICBIDCgEBEgMKAQESBAoCCAgSAwoBCBIAIglzZXBhcmF0b3IiDGtleUZlZUFtb3VudCIOa2V5VXNkbkFzc2V0SWQiDmtleUVwb2NoTGVuZ3RoIhFrZXlGaW5hbGl6ZVJld2FyZCIMa2V5V3hBc3NldElkIhZrZXlBc3NldHNTdG9yZUNvbnRyYWN0IhNrZXlVc2VyUG9vbENvbnRyYWN0IhNrZXlFbWlzc2lvbkNvbnRyYWN0IhNrZXlCb29zdGluZ0NvbnRyYWN0IhJrZXlGYWN0b3J5Q29udHJhY3QiGWtleVZvdGluZ0VtaXNzaW9uQ29udHJhY3QiDGtleVRocmVzaG9sZCIPZ2V0U3RyaW5nT3JGYWlsIgNrZXkiDGdldEludE9yRmFpbCIQa2V5SW5MaXN0QXNzZXRJZCINYW1vdW50QXNzZXRJZCIMcHJpY2VBc3NldElkIg9rZXlTdWdnZXN0SW5kZXgiDmtleVN0YXJ0SGVpZ2h0IgxzdWdnZXN0SW5kZXgiD2tleVZvdGluZ1J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AAAEAAAACYmEBAAAAAmJiAAAAAAQAAAACYmMEAAAAAVIJAQAAAAFRAAAAAAMJAAABAAAAAgUAAAABUgIAAAAKQnl0ZVZlY3RvcgQAAAABVwUAAAABUgUAAAABVwMJAAABAAAAAgUAAAABUgIAAAAEVW5pdAgFAAAAAmJhAAAAD3NlbmRlclB1YmxpY0tleQkAAAIAAAABAgAAAAtNYXRjaCBlcnJvcgkAAfQAAAADCAUAAAACYmEAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJiYQAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAAmJjEOTm9g==", "chainId": 84, "height": 2398735, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4wCuD9oHXA3f2BHoJSx8EK5dbCMhbi36Am9de4WuvX75 Next: 71Ud8HWFhSJpMryN2zzM7x5MpCJM3L1n2uBZFScoB3wA Diff:
Old | New | Differences | |
---|---|---|---|
174 | 174 | func suggest (amountAssetId,priceAssetId) = { | |
175 | 175 | let pool = $Tuple2(amountAssetId, priceAssetId) | |
176 | 176 | let payment = value(i.payments[0]) | |
177 | - | let checkAmountAsset = if ((amountAssetId == "WAVES")) | |
178 | - | then unit | |
179 | - | else { | |
180 | - | let info = valueOrErrorMessage(assetInfo(fromBase58String(amountAssetId)), "invalid amountAssetId ID") | |
181 | - | if ((info.scripted == false)) | |
182 | - | then true | |
183 | - | else throw("asset is smart") | |
177 | + | let info = valueOrErrorMessage(assetInfo(fromBase58String(amountAssetId)), "invalid amountAssetId ID") | |
178 | + | let checks = [if ((info.scripted == false)) | |
179 | + | then true | |
180 | + | else throw("asset is smart"), if ((toBase58String(value(payment.assetId)) == value(getString(keyWxAssetId)))) | |
181 | + | then true | |
182 | + | else throw("invalid fee asset"), if ((payment.amount == value(getInteger(keyFeeAmount)))) | |
183 | + | then true | |
184 | + | else throw("invalid fee amount"), if ((getInteger(keyInListAssetId(amountAssetId, priceAssetId)) == unit)) | |
185 | + | then true | |
186 | + | else throw("already in voting list"), if (!(valueOrElse(getBoolean(votingEmissionContract, keyInList(pool)), false))) | |
187 | + | then true | |
188 | + | else throw("pool is in emission voting list")] | |
189 | + | if ((checks == checks)) | |
190 | + | then { | |
191 | + | let ensureActive = match invoke(userPoolContract, "statusREADONLY", [amountAssetId, priceAssetId], nil) { | |
192 | + | case s: String => | |
193 | + | if ((s == "active")) | |
194 | + | then true | |
195 | + | else throw("user pool is not active") | |
196 | + | case _ => | |
197 | + | throw("user pool is not active") | |
184 | 198 | } | |
185 | - | if ((checkAmountAsset == checkAmountAsset)) | |
186 | - | then { | |
187 | - | let checks = [if ((toBase58String(value(payment.assetId)) == value(getString(keyWxAssetId)))) | |
188 | - | then true | |
189 | - | else throw("invalid fee asset"), if ((payment.amount == value(getInteger(keyFeeAmount)))) | |
190 | - | then true | |
191 | - | else throw("invalid fee amount"), if ((getInteger(keyInListAssetId(amountAssetId, priceAssetId)) == unit)) | |
192 | - | then true | |
193 | - | else throw("already in voting list"), if (!(valueOrElse(getBoolean(votingEmissionContract, keyInList(pool)), false))) | |
194 | - | then true | |
195 | - | else throw("pool is in emission voting list")] | |
196 | - | if ((checks == checks)) | |
199 | + | if ((ensureActive == ensureActive)) | |
197 | 200 | then { | |
198 | - | let ensureActive = match invoke(userPoolContract, "statusREADONLY", [amountAssetId, priceAssetId], nil) { | |
199 | - | case s: String => | |
200 | - | if ((s == "active")) | |
201 | - | then true | |
202 | - | else throw("user pool is not active") | |
203 | - | case _ => | |
204 | - | throw("user pool is not active") | |
205 | - | } | |
206 | - | if ((ensureActive == ensureActive)) | |
201 | + | let ensureAmountAssetVerified = if (isManager(i)) | |
202 | + | then unit | |
203 | + | else { | |
204 | + | let inv = match invoke(assetsStoreContract, "isVerifiedREADONLY", [amountAssetId], nil) { | |
205 | + | case b: Boolean => | |
206 | + | if (b) | |
207 | + | then true | |
208 | + | else throw("asset is not verified") | |
209 | + | case _ => | |
210 | + | throw("asset is not verified") | |
211 | + | } | |
212 | + | if ((inv == inv)) | |
213 | + | then unit | |
214 | + | else throw("Strict value is not equal to itself.") | |
215 | + | } | |
216 | + | if ((ensureAmountAssetVerified == ensureAmountAssetVerified)) | |
207 | 217 | then { | |
208 | - | let ensureAmountAssetVerified = if (isManager(i)) | |
209 | - | then unit | |
210 | - | else { | |
211 | - | let inv = match invoke(assetsStoreContract, "isVerifiedREADONLY", [amountAssetId], nil) { | |
212 | - | case b: Boolean => | |
213 | - | if (b) | |
214 | - | then true | |
215 | - | else throw("asset is not verified") | |
218 | + | let burnFeeInv = invoke(emissionContract, "burn", nil, [AttachedPayment(payment.assetId, payment.amount)]) | |
219 | + | if ((burnFeeInv == burnFeeInv)) | |
220 | + | then { | |
221 | + | let newSuggestIndex = match getInteger(keySuggestIndex(amountAssetId, priceAssetId)) { | |
222 | + | case int: Int => | |
223 | + | (int + 1) | |
216 | 224 | case _ => | |
217 | - | | |
225 | + | 0 | |
218 | 226 | } | |
219 | - | if ((inv == inv)) | |
220 | - | then unit | |
221 | - | else throw("Strict value is not equal to itself.") | |
222 | - | } | |
223 | - | if ((ensureAmountAssetVerified == ensureAmountAssetVerified)) | |
224 | - | then { | |
225 | - | let burnFeeInv = invoke(emissionContract, "burn", nil, [AttachedPayment(payment.assetId, payment.amount)]) | |
226 | - | if ((burnFeeInv == burnFeeInv)) | |
227 | - | then { | |
228 | - | let newSuggestIndex = match getInteger(keySuggestIndex(amountAssetId, priceAssetId)) { | |
229 | - | case int: Int => | |
230 | - | (int + 1) | |
231 | - | case _ => | |
232 | - | 0 | |
233 | - | } | |
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 | - | } | |
236 | - | else throw("Strict value is not equal to itself.") | |
227 | + | $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) | |
237 | 228 | } | |
238 | 229 | else throw("Strict value is not equal to itself.") | |
239 | 230 | } |
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 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 | - | let checkAmountAsset = if ((amountAssetId == "WAVES")) | |
178 | - | then unit | |
179 | - | else { | |
180 | - | let info = valueOrErrorMessage(assetInfo(fromBase58String(amountAssetId)), "invalid amountAssetId ID") | |
181 | - | if ((info.scripted == false)) | |
182 | - | then true | |
183 | - | else throw("asset is smart") | |
177 | + | let info = valueOrErrorMessage(assetInfo(fromBase58String(amountAssetId)), "invalid amountAssetId ID") | |
178 | + | let checks = [if ((info.scripted == false)) | |
179 | + | then true | |
180 | + | else throw("asset is smart"), if ((toBase58String(value(payment.assetId)) == value(getString(keyWxAssetId)))) | |
181 | + | then true | |
182 | + | else throw("invalid fee asset"), if ((payment.amount == value(getInteger(keyFeeAmount)))) | |
183 | + | then true | |
184 | + | else throw("invalid fee amount"), if ((getInteger(keyInListAssetId(amountAssetId, priceAssetId)) == unit)) | |
185 | + | then true | |
186 | + | else throw("already in voting list"), if (!(valueOrElse(getBoolean(votingEmissionContract, keyInList(pool)), false))) | |
187 | + | then true | |
188 | + | else throw("pool is in emission voting list")] | |
189 | + | if ((checks == checks)) | |
190 | + | then { | |
191 | + | let ensureActive = match invoke(userPoolContract, "statusREADONLY", [amountAssetId, priceAssetId], nil) { | |
192 | + | case s: String => | |
193 | + | if ((s == "active")) | |
194 | + | then true | |
195 | + | else throw("user pool is not active") | |
196 | + | case _ => | |
197 | + | throw("user pool is not active") | |
184 | 198 | } | |
185 | - | if ((checkAmountAsset == checkAmountAsset)) | |
186 | - | then { | |
187 | - | let checks = [if ((toBase58String(value(payment.assetId)) == value(getString(keyWxAssetId)))) | |
188 | - | then true | |
189 | - | else throw("invalid fee asset"), if ((payment.amount == value(getInteger(keyFeeAmount)))) | |
190 | - | then true | |
191 | - | else throw("invalid fee amount"), if ((getInteger(keyInListAssetId(amountAssetId, priceAssetId)) == unit)) | |
192 | - | then true | |
193 | - | else throw("already in voting list"), if (!(valueOrElse(getBoolean(votingEmissionContract, keyInList(pool)), false))) | |
194 | - | then true | |
195 | - | else throw("pool is in emission voting list")] | |
196 | - | if ((checks == checks)) | |
199 | + | if ((ensureActive == ensureActive)) | |
197 | 200 | then { | |
198 | - | let ensureActive = match invoke(userPoolContract, "statusREADONLY", [amountAssetId, priceAssetId], nil) { | |
199 | - | case s: String => | |
200 | - | if ((s == "active")) | |
201 | - | then true | |
202 | - | else throw("user pool is not active") | |
203 | - | case _ => | |
204 | - | throw("user pool is not active") | |
205 | - | } | |
206 | - | if ((ensureActive == ensureActive)) | |
201 | + | let ensureAmountAssetVerified = if (isManager(i)) | |
202 | + | then unit | |
203 | + | else { | |
204 | + | let inv = match invoke(assetsStoreContract, "isVerifiedREADONLY", [amountAssetId], nil) { | |
205 | + | case b: Boolean => | |
206 | + | if (b) | |
207 | + | then true | |
208 | + | else throw("asset is not verified") | |
209 | + | case _ => | |
210 | + | throw("asset is not verified") | |
211 | + | } | |
212 | + | if ((inv == inv)) | |
213 | + | then unit | |
214 | + | else throw("Strict value is not equal to itself.") | |
215 | + | } | |
216 | + | if ((ensureAmountAssetVerified == ensureAmountAssetVerified)) | |
207 | 217 | then { | |
208 | - | let ensureAmountAssetVerified = if (isManager(i)) | |
209 | - | then unit | |
210 | - | else { | |
211 | - | let inv = match invoke(assetsStoreContract, "isVerifiedREADONLY", [amountAssetId], nil) { | |
212 | - | case b: Boolean => | |
213 | - | if (b) | |
214 | - | then true | |
215 | - | else throw("asset is not verified") | |
218 | + | let burnFeeInv = invoke(emissionContract, "burn", nil, [AttachedPayment(payment.assetId, payment.amount)]) | |
219 | + | if ((burnFeeInv == burnFeeInv)) | |
220 | + | then { | |
221 | + | let newSuggestIndex = match getInteger(keySuggestIndex(amountAssetId, priceAssetId)) { | |
222 | + | case int: Int => | |
223 | + | (int + 1) | |
216 | 224 | case _ => | |
217 | - | | |
225 | + | 0 | |
218 | 226 | } | |
219 | - | if ((inv == inv)) | |
220 | - | then unit | |
221 | - | else throw("Strict value is not equal to itself.") | |
222 | - | } | |
223 | - | if ((ensureAmountAssetVerified == ensureAmountAssetVerified)) | |
224 | - | then { | |
225 | - | let burnFeeInv = invoke(emissionContract, "burn", nil, [AttachedPayment(payment.assetId, payment.amount)]) | |
226 | - | if ((burnFeeInv == burnFeeInv)) | |
227 | - | then { | |
228 | - | let newSuggestIndex = match getInteger(keySuggestIndex(amountAssetId, priceAssetId)) { | |
229 | - | case int: Int => | |
230 | - | (int + 1) | |
231 | - | case _ => | |
232 | - | 0 | |
233 | - | } | |
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 | - | } | |
236 | - | else throw("Strict value is not equal to itself.") | |
227 | + | $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) | |
237 | 228 | } | |
238 | 229 | else throw("Strict value is not equal to itself.") | |
239 | 230 | } | |
240 | 231 | else throw("Strict value is not equal to itself.") | |
241 | 232 | } | |
242 | 233 | else throw("Strict value is not equal to itself.") | |
243 | 234 | } | |
244 | 235 | else throw("Strict value is not equal to itself.") | |
245 | 236 | } | |
246 | 237 | ||
247 | 238 | ||
248 | 239 | ||
249 | 240 | @Callable(i) | |
250 | 241 | func vote (amountAssetId,priceAssetId,inFavor) = { | |
251 | 242 | let suggestIndex = value(getInteger(keyInListAssetId(amountAssetId, priceAssetId))) | |
252 | 243 | let votingFinishHeight = (value(getInteger(keyStartHeight(amountAssetId, priceAssetId, suggestIndex))) + value(getInteger(keyEpochLength))) | |
253 | 244 | let checks = [if (isDefined(getInteger(keyInListAssetId(amountAssetId, priceAssetId)))) | |
254 | 245 | then true | |
255 | 246 | else throw("the token isn't on the voting list"), if ((votingFinishHeight > height)) | |
256 | 247 | then true | |
257 | 248 | else throw("too late to vote")] | |
258 | 249 | if ((checks == checks)) | |
259 | 250 | then { | |
260 | 251 | let gwxAmount = invoke(boostingContract, "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), votingFinishHeight], nil) | |
261 | 252 | let notZero = if ((asInt(gwxAmount) > 0)) | |
262 | 253 | then true | |
263 | 254 | else throw("you don't have gwx") | |
264 | 255 | if ((notZero == notZero)) | |
265 | 256 | then { | |
266 | 257 | let vote = match getString(keyVote(amountAssetId, priceAssetId, suggestIndex, toString(i.caller))) { | |
267 | 258 | case s: String => | |
268 | 259 | let vote = split(s, separator) | |
269 | 260 | let voteValue = vote[1] | |
270 | 261 | let voteType = vote[2] | |
271 | 262 | let isVoteTypeSimilar = if (if ((voteType == "yes")) | |
272 | 263 | then (inFavor == true) | |
273 | 264 | else false) | |
274 | 265 | then true | |
275 | 266 | else if ((voteType == "no")) | |
276 | 267 | then (inFavor == false) | |
277 | 268 | else false | |
278 | 269 | let isVoteValueSimilar = if (isVoteTypeSimilar) | |
279 | 270 | then (asInt(gwxAmount) == parseIntValue(voteValue)) | |
280 | 271 | else false | |
281 | 272 | let isNewVoteSimilar = if (if (isVoteTypeSimilar) | |
282 | 273 | then isVoteValueSimilar | |
283 | 274 | else false) | |
284 | 275 | then throw("you already voted") | |
285 | 276 | else invoke(this, "cancelVote", [amountAssetId, priceAssetId], nil) | |
286 | 277 | isNewVoteSimilar | |
287 | 278 | case u: Unit => | |
288 | 279 | u | |
289 | 280 | case _ => | |
290 | 281 | throw("Match error") | |
291 | 282 | } | |
292 | 283 | if ((vote == vote)) | |
293 | 284 | then { | |
294 | 285 | let votingResult = split(value(getString(keyVotingResult(amountAssetId, priceAssetId, suggestIndex))), separator) | |
295 | 286 | let positiveVotes = votingResult[1] | |
296 | 287 | let negativeVotes = votingResult[2] | |
297 | 288 | let newPositiveAndNegativeVotes = if (inFavor) | |
298 | 289 | then { | |
299 | 290 | let newPositiveVotes = (parseIntValue(positiveVotes) + asInt(gwxAmount)) | |
300 | 291 | [toString(newPositiveVotes), negativeVotes] | |
301 | 292 | } | |
302 | 293 | else { | |
303 | 294 | let newNegativeVotes = (parseIntValue(negativeVotes) + asInt(gwxAmount)) | |
304 | 295 | [positiveVotes, toString(newNegativeVotes)] | |
305 | 296 | } | |
306 | 297 | let voteKey = keyVote(amountAssetId, priceAssetId, suggestIndex, toString(i.caller)) | |
307 | 298 | let voteValue = keyVoteValue(toString(asInt(gwxAmount)), inFavor) | |
308 | 299 | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId, suggestIndex), totalVotes(newPositiveAndNegativeVotes[0], newPositiveAndNegativeVotes[1])), StringEntry(voteKey, voteValue)], unit) | |
309 | 300 | } | |
310 | 301 | else throw("Strict value is not equal to itself.") | |
311 | 302 | } | |
312 | 303 | else throw("Strict value is not equal to itself.") | |
313 | 304 | } | |
314 | 305 | else throw("Strict value is not equal to itself.") | |
315 | 306 | } | |
316 | 307 | ||
317 | 308 | ||
318 | 309 | ||
319 | 310 | @Callable(i) | |
320 | 311 | func cancelVote (amountAssetId,priceAssetId) = { | |
321 | 312 | let userAddress = if ((i.caller == this)) | |
322 | 313 | then toString(i.originCaller) | |
323 | 314 | else toString(i.caller) | |
324 | 315 | let suggestIndex = value(getInteger(keyInListAssetId(amountAssetId, priceAssetId))) | |
325 | 316 | let checks = [if (isDefined(getString(keyVotingResult(amountAssetId, priceAssetId, suggestIndex)))) | |
326 | 317 | then true | |
327 | 318 | else throw("no vote for assets pair")] | |
328 | 319 | if ((checks == checks)) | |
329 | 320 | then { | |
330 | 321 | let vote = split(value(getString(keyVote(amountAssetId, priceAssetId, suggestIndex, userAddress))), separator) | |
331 | 322 | let voteValue = vote[1] | |
332 | 323 | let voteType = vote[2] | |
333 | 324 | let votingResult = split(value(getString(keyVotingResult(amountAssetId, priceAssetId, suggestIndex))), separator) | |
334 | 325 | let positiveVotes = votingResult[1] | |
335 | 326 | let negativeVotes = votingResult[2] | |
336 | 327 | let actions = if ((voteType == "yes")) | |
337 | 328 | then { | |
338 | 329 | let newPositiveVotes = (parseIntValue(positiveVotes) - parseIntValue(voteValue)) | |
339 | 330 | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId, suggestIndex), totalVotes(toString(newPositiveVotes), negativeVotes)), DeleteEntry(keyVote(amountAssetId, priceAssetId, suggestIndex, userAddress))], unit) | |
340 | 331 | } | |
341 | 332 | else { | |
342 | 333 | let newNegativeVotes = (parseIntValue(negativeVotes) - parseIntValue(voteValue)) | |
343 | 334 | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId, suggestIndex), totalVotes(positiveVotes, toString(newNegativeVotes))), DeleteEntry(keyVote(amountAssetId, priceAssetId, suggestIndex, userAddress))], unit) | |
344 | 335 | } | |
345 | 336 | actions | |
346 | 337 | } | |
347 | 338 | else throw("Strict value is not equal to itself.") | |
348 | 339 | } | |
349 | 340 | ||
350 | 341 | ||
351 | 342 | ||
352 | 343 | @Callable(i) | |
353 | 344 | func setFee (newFee) = { | |
354 | 345 | let checks = [mustManager(i)] | |
355 | 346 | if ((checks == checks)) | |
356 | 347 | then [IntegerEntry(keyFeeAmount, newFee)] | |
357 | 348 | else throw("Strict value is not equal to itself.") | |
358 | 349 | } | |
359 | 350 | ||
360 | 351 | ||
361 | 352 | ||
362 | 353 | @Callable(i) | |
363 | 354 | func setThreshold (newThreshold) = { | |
364 | 355 | let checks = [mustManager(i), if ((newThreshold > 0)) | |
365 | 356 | then true | |
366 | 357 | else throw("invalid threshold")] | |
367 | 358 | if ((checks == checks)) | |
368 | 359 | then $Tuple2([IntegerEntry(keyThreshold, newThreshold)], unit) | |
369 | 360 | else throw("Strict value is not equal to itself.") | |
370 | 361 | } | |
371 | 362 | ||
372 | 363 | ||
373 | 364 | ||
374 | 365 | @Callable(i) | |
375 | 366 | func finalize (amountAssetId,priceAssetId) = { | |
376 | 367 | let suggestIndex = value(getInteger(keyInListAssetId(amountAssetId, priceAssetId))) | |
377 | 368 | let votingFinishHeight = (value(getInteger(keyStartHeight(amountAssetId, priceAssetId, suggestIndex))) + value(getInteger(keyEpochLength))) | |
378 | 369 | let checks = [if (isDefined(getInteger(keyInListAssetId(amountAssetId, priceAssetId)))) | |
379 | 370 | then true | |
380 | 371 | else throw("no assets pair"), if ((height >= votingFinishHeight)) | |
381 | 372 | then true | |
382 | 373 | else throw("insufficient height for completion")] | |
383 | 374 | if ((checks == checks)) | |
384 | 375 | then { | |
385 | 376 | let votingResult = split(value(getString(keyVotingResult(amountAssetId, priceAssetId, suggestIndex))), separator) | |
386 | 377 | let positiveVotes = parseIntValue(votingResult[1]) | |
387 | 378 | let negativeVotes = parseIntValue(votingResult[2]) | |
388 | 379 | let allVotes = (positiveVotes + negativeVotes) | |
389 | 380 | let threshold = getIntOrFail(keyThreshold) | |
390 | 381 | let actions = if (if ((allVotes >= threshold)) | |
391 | 382 | then (positiveVotes > negativeVotes) | |
392 | 383 | else false) | |
393 | 384 | then { | |
394 | 385 | let res = invoke(factoryContract, "setWxEmissionPoolLabel", [amountAssetId, priceAssetId], nil) | |
395 | 386 | if ((res == res)) | |
396 | 387 | then { | |
397 | 388 | let votingEmissionInv = invoke(votingEmissionContract, "create", [amountAssetId, priceAssetId], nil) | |
398 | 389 | if ((votingEmissionInv == votingEmissionInv)) | |
399 | 390 | then $Tuple2([DeleteEntry(keyInListAssetId(amountAssetId, priceAssetId))], unit) | |
400 | 391 | else throw("Strict value is not equal to itself.") | |
401 | 392 | } | |
402 | 393 | else throw("Strict value is not equal to itself.") | |
403 | 394 | } | |
404 | 395 | else $Tuple2([DeleteEntry(keyInListAssetId(amountAssetId, priceAssetId))], unit) | |
405 | 396 | actions | |
406 | 397 | } | |
407 | 398 | else throw("Strict value is not equal to itself.") | |
408 | 399 | } | |
409 | 400 | ||
410 | 401 | ||
411 | 402 | ||
412 | 403 | @Callable(i) | |
413 | 404 | func setManager (pendingManagerPublicKey) = { | |
414 | 405 | let checkCaller = mustManager(i) | |
415 | 406 | if ((checkCaller == checkCaller)) | |
416 | 407 | then { | |
417 | 408 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
418 | 409 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
419 | 410 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
420 | 411 | else throw("Strict value is not equal to itself.") | |
421 | 412 | } | |
422 | 413 | else throw("Strict value is not equal to itself.") | |
423 | 414 | } | |
424 | 415 | ||
425 | 416 | ||
426 | 417 | ||
427 | 418 | @Callable(i) | |
428 | 419 | func confirmManager () = { | |
429 | 420 | let pm = pendingManagerPublicKeyOrUnit() | |
430 | 421 | let hasPM = if (isDefined(pm)) | |
431 | 422 | then true | |
432 | 423 | else throw("no pending manager") | |
433 | 424 | if ((hasPM == hasPM)) | |
434 | 425 | then { | |
435 | 426 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
436 | 427 | then true | |
437 | 428 | else throw("you are not pending manager") | |
438 | 429 | if ((checkPM == checkPM)) | |
439 | 430 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
440 | 431 | else throw("Strict value is not equal to itself.") | |
441 | 432 | } | |
442 | 433 | else throw("Strict value is not equal to itself.") | |
443 | 434 | } | |
444 | 435 | ||
445 | 436 | ||
446 | 437 | @Verifier(tx) | |
447 | 438 | func verify () = { | |
448 | 439 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
449 | 440 | case pk: ByteVector => | |
450 | 441 | pk | |
451 | 442 | case _: Unit => | |
452 | 443 | tx.senderPublicKey | |
453 | 444 | case _ => | |
454 | 445 | throw("Match error") | |
455 | 446 | } | |
456 | 447 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
457 | 448 | } | |
458 | 449 |
github/deemru/w8io/fabc49c 51.20 ms ◑