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