tx · Ea32eC29rPLKgGsdNAzU1pGQqq6z88yrJ6Sj8AMF8mYZ 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh: -0.01400000 Waves 2023.05.02 09:54 [2559810] smart account 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh > SELF 0.00000000 Waves
{ "type": 13, "id": "Ea32eC29rPLKgGsdNAzU1pGQqq6z88yrJ6Sj8AMF8mYZ", "fee": 1400000, "feeAssetId": null, "timestamp": 1683010501243, "version": 2, "chainId": 84, "sender": "3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh", "senderPublicKey": "Ap7CkWd6fzBU34kGo4GJJzC5q4qWXuLVunzE25PchdGS", "proofs": [ "555ogRiZZrAULPg4v6zSJTDUVy1aod3VnqcXYFV67EFoDojS8tcZJ7wCrdtbfMzBNAysfRLmd7cHSYx7mfGNQBDX" ], "script": "base64:BgKdEAgCEgkKBwgICBgBCAESABIICgYICAgICAgSAwoBGBIDCgEIEgASABIECgIICCIQY29udHJhY3RGaWxlbmFtZSIDU0VQIgx3YXZlc0Fzc2V0SWQiEWludmFsaWRQcmljZUFzc2V0Igd3cmFwRXJyIgNtc2ciCHRocm93RXJyIgd0aHJvd1BEIhR0aHJvd0NyZWF0ZU5vdENhbGxlZCIRdGhyb3dZb3VOb3RJc3N1ZXIiD3Rocm93UG9vbEV4aXN0cyIVdGhyb3dBc3NldE5vdFZlcmlmaWVkIhZ0aHJvd0ludmFsaWRQcmljZUFzc2V0IhR0aHJvd0ludmFsaWRGZWVBc3NldCIXdGhyb3dJbnZhbGlkQW1vdW50QXNzZXQiEnRocm93SW52YWxpZFN0YXR1cyIfdGhyb3dDYW5BY3RpdmF0ZU9ubHlQZW5kaW5nUG9vbCIddGhyb3dGYWN0b3J5UmV0dXJuZWROb3RTdHJpbmciHHRocm93SW52YWxpZFByaWNlQXNzZXRBbW91bnQiD3Rocm93SW52YWxpZEZlZSIVdGhyb3dJbnZhbGlkQXNzZXRQYWlyIh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"succeeded", "spentComplexity": 0 } View: original | compacted Prev: GkjZUyBJNWL3LJGd6TD1hgVXrQVg28kkgqhX5TA2c9g Next: 5LWRgKxspmWRZ5VApBsmk7A3vWPYYNiVPVnfrbFocqcg Diff:
Old | New | Differences | |
---|---|---|---|
247 | 247 | else throwInvalidAssetPair() | |
248 | 248 | if ((checkAssetsNotEqual == checkAssetsNotEqual)) | |
249 | 249 | then { | |
250 | - | let $t078218263 = if (if (containsElement(priceAssetsList, asset2Id)) | |
251 | - | then isVerified(asset1Id) | |
252 | - | else false) | |
250 | + | let $t078218282 = if (if (isManager(i)) | |
251 | + | then true | |
252 | + | else if (containsElement(priceAssetsList, asset2Id)) | |
253 | + | then isVerified(asset1Id) | |
254 | + | else false) | |
253 | 255 | then $Tuple4(asset1Id, asset1Payment.amount, asset2Id, asset2Payment.amount) | |
254 | 256 | else if (if (containsElement(priceAssetsList, asset1Id)) | |
255 | 257 | then isVerified(asset2Id) | |
256 | 258 | else false) | |
257 | 259 | then $Tuple4(asset2Id, asset2Payment.amount, asset1Id, asset1Payment.amount) | |
258 | 260 | else throwInvalidAssetPair() | |
259 | - | let amountAssetId = $ | |
260 | - | let amountAssetAmount = $ | |
261 | - | let priceAssetId = $ | |
262 | - | let priceAssetAmount = $ | |
261 | + | let amountAssetId = $t078218282._1 | |
262 | + | let amountAssetAmount = $t078218282._2 | |
263 | + | let priceAssetId = $t078218282._3 | |
264 | + | let priceAssetAmount = $t078218282._4 | |
263 | 265 | let managerPriceAssetMinAmount = 1 | |
264 | 266 | let priceAssetMinAmount = if (isManager(i)) | |
265 | 267 | then managerPriceAssetMinAmount | |
280 | 282 | then true | |
281 | 283 | else throwPoolExists(), if (!(poolExists)) | |
282 | 284 | then true | |
283 | - | else throwPoolExists(), if ((getString(keyFeeAssetId()) == feeAssetId)) | |
285 | + | else throwPoolExists(), if (if (isManager(i)) | |
286 | + | then true | |
287 | + | else (getString(keyFeeAssetId()) == feeAssetId)) | |
284 | 288 | then true | |
285 | 289 | else throwInvalidFeeAsset(), if (if (isManager(i)) | |
286 | 290 | then true | |
290 | 294 | then true | |
291 | 295 | else (priceAssetAmount >= priceAssetMinAmount)) | |
292 | 296 | then true | |
293 | - | else throwInvalidPriceAssetAmount(), if ((feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
297 | + | else throwInvalidPriceAssetAmount(), if (if (isManager(i)) | |
298 | + | then true | |
299 | + | else (feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
294 | 300 | then true | |
295 | 301 | else throwInvalidFee()] | |
296 | 302 | if ((checks == checks)) | |
297 | 303 | then { | |
298 | - | let burnEmissionInv = invoke(emissionContract, "burn", nil, [AttachedPayment(fromBase58String(feeAssetId), feeAssetPayment.amount)]) | |
304 | + | let paymentsWithFeeSize = 3 | |
305 | + | let burnEmissionInv = if ((size(i.payments) >= paymentsWithFeeSize)) | |
306 | + | then invoke(emissionContract, "burn", nil, [AttachedPayment(fromBase58String(feeAssetId), feeAssetPayment.amount)]) | |
307 | + | else unit | |
299 | 308 | if ((burnEmissionInv == burnEmissionInv)) | |
300 | 309 | then [BooleanEntry(keyCreateCalled(amountAssetId, priceAssetId), true), StringEntry(keyCreateCaller(amountAssetId, priceAssetId), toString(i.caller)), IntegerEntry(keyLastIndex(), curIndex), StringEntry(keySuffix(amountAssetId, priceAssetId), (toString(curIndex) + indexSuffix)), IntegerEntry(keyHeight(amountAssetId, priceAssetId), height), StringEntry(keyStatus(amountAssetId, priceAssetId), statusPending), IntegerEntry(keyAmountAssetAmount(amountAssetId, priceAssetId), amountAssetAmount), IntegerEntry(keyPriceAssetAmount(amountAssetId, priceAssetId), priceAssetAmount)] | |
301 | 310 | else throw("Strict value is not equal to itself.") |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let contractFilename = "user_pools.ride" | |
5 | 5 | ||
6 | 6 | let SEP = "__" | |
7 | 7 | ||
8 | 8 | let wavesAssetId = "WAVES" | |
9 | 9 | ||
10 | 10 | let invalidPriceAsset = "Invalid price asset" | |
11 | 11 | ||
12 | 12 | func wrapErr (msg) = makeString([contractFilename, ": ", msg], "") | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func throwErr (msg) = throw(wrapErr(msg)) | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func throwPD () = throwErr("Permission denied") | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func throwCreateNotCalled () = throwErr("Create is not called for assets pair") | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func throwYouNotIssuer () = throwErr("You are not amountAsset issuer") | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func throwPoolExists () = throwErr("Pool with such assets already exists") | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func throwAssetNotVerified () = throwErr("Asset is not verified") | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func throwInvalidPriceAsset () = throwErr(invalidPriceAsset) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func throwInvalidFeeAsset () = throwErr("Invalid fee asset") | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func throwInvalidAmountAsset () = throwErr("Invalid amount asset attached") | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func throwInvalidStatus () = throwErr("Invalid status") | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func throwCanActivateOnlyPendingPool () = throwErr("Can activate pool only in 'pending' status") | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func throwFactoryReturnedNotString () = throwErr("FactoryV2 returned not string") | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func throwInvalidPriceAssetAmount () = throwErr("invalid price asset amount") | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func throwInvalidFee () = throwErr("invalid fee") | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func throwInvalidAssetPair () = throwErr("invalid asset pair") | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func keyManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func keyPendingManagerPublicKey () = makeString(["%s", "pendingManagerPublicKey"], SEP) | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func keyAdminPubKeys () = makeString(["%s", "adminPubKeys"], SEP) | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func keyStatus (amountAssetId,priceAssetId) = makeString(["%s%s%s", "status", amountAssetId, priceAssetId], SEP) | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func keyFactoryContract () = makeString(["%s", "factoryContract"], SEP) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func keyAssetsStoreContract () = makeString(["%s", "assetsStoreContract"], SEP) | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func keyEmissionContract () = makeString(["%s", "emissionContract"], SEP) | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func keySuffix (amountAssetId,priceAssetId) = makeString(["%s%s%s", "suffix", amountAssetId, priceAssetId], SEP) | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func keyLastIndex () = makeString(["%s", "lastIndex"], SEP) | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | let indexSuffix = "u" | |
88 | 88 | ||
89 | 89 | let statusPending = "pending" | |
90 | 90 | ||
91 | 91 | let statusDeclined = "declined" | |
92 | 92 | ||
93 | 93 | let statusActive = "active" | |
94 | 94 | ||
95 | 95 | let statuses = [statusPending, statusDeclined, statusActive] | |
96 | 96 | ||
97 | 97 | func keyCreateCalled (amountAssetId,priceAssetId) = makeString(["%s%s%s", "createCalled", amountAssetId, priceAssetId], SEP) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func keyCreateCaller (amountAssetId,priceAssetId) = makeString(["%s%s%s", "createCaller", amountAssetId, priceAssetId], SEP) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func keyAmountAssetAmount (amountAssetId,priceAssetId) = makeString(["%s%s%s", "amountAssetAmount", amountAssetId, priceAssetId], SEP) | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func keyPriceAssetAmount (amountAssetId,priceAssetId) = makeString(["%s%s%s", "priceAssetAmount", amountAssetId, priceAssetId], SEP) | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | func keyHeight (amountAssetId,priceAssetId) = makeString(["%s%s%s", "height", amountAssetId, priceAssetId], SEP) | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func keyFeeAssetId () = makeString(["%s", "feeAssetId"], SEP) | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func keyFeeAmount () = makeString(["%s", "feeAmount"], SEP) | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func keyAmountAssetMinAmount () = makeString(["%s", "amountAssetMinAmount"], SEP) | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func keyPriceAssetsMinAmount () = makeString(["%s", "priceAssetsMinAmount"], SEP) | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func keyPriceAssets () = makeString(["%s", "priceAssets"], SEP) | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " is not defined")) | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func stringOptionToList (stringOrUnit) = match stringOrUnit { | |
131 | 131 | case s: String => | |
132 | 132 | if ((size(s) == 0)) | |
133 | 133 | then nil | |
134 | 134 | else split(s, SEP) | |
135 | 135 | case _: Unit => | |
136 | 136 | nil | |
137 | 137 | case _ => | |
138 | 138 | throw("Match error") | |
139 | 139 | } | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | let factoryContract = addressFromStringValue(getStringOrFail(keyFactoryContract())) | |
143 | 143 | ||
144 | 144 | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP) | |
145 | 145 | ||
146 | 146 | let votingEmissionContract = addressFromStringValue(valueOrErrorMessage(getString(factoryContract, keyVotingEmissionContract), wrapErr("voting emission contract address is required"))) | |
147 | 147 | ||
148 | 148 | let keyVotingEmissionCandidateContract = makeString(["%s", "votingEmissionCandidateContract"], SEP) | |
149 | 149 | ||
150 | 150 | let votingEmissionCandidateContract = addressFromStringValue(valueOrErrorMessage(getString(votingEmissionContract, keyVotingEmissionCandidateContract), wrapErr("voting emission candidate contract address is required"))) | |
151 | 151 | ||
152 | 152 | func isCreateCalled (amountAssetId,priceAssetId) = valueOrElse(getBoolean(keyCreateCalled(amountAssetId, priceAssetId)), false) | |
153 | 153 | ||
154 | 154 | ||
155 | 155 | func mustCreateCalled (amountAssetId,priceAssetId) = if (isCreateCalled(amountAssetId, priceAssetId)) | |
156 | 156 | then true | |
157 | 157 | else throwCreateNotCalled() | |
158 | 158 | ||
159 | 159 | ||
160 | 160 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
161 | 161 | case s: String => | |
162 | 162 | fromBase58String(s) | |
163 | 163 | case _: Unit => | |
164 | 164 | unit | |
165 | 165 | case _ => | |
166 | 166 | throw("Match error") | |
167 | 167 | } | |
168 | 168 | ||
169 | 169 | ||
170 | 170 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
171 | 171 | case s: String => | |
172 | 172 | fromBase58String(s) | |
173 | 173 | case _: Unit => | |
174 | 174 | unit | |
175 | 175 | case _ => | |
176 | 176 | throw("Match error") | |
177 | 177 | } | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | func isManager (i) = match managerPublicKeyOrUnit() { | |
181 | 181 | case pk: ByteVector => | |
182 | 182 | (i.callerPublicKey == pk) | |
183 | 183 | case _: Unit => | |
184 | 184 | (i.caller == this) | |
185 | 185 | case _ => | |
186 | 186 | throw("Match error") | |
187 | 187 | } | |
188 | 188 | ||
189 | 189 | ||
190 | 190 | func mustManager (i) = if (isManager(i)) | |
191 | 191 | then true | |
192 | 192 | else throwPD() | |
193 | 193 | ||
194 | 194 | ||
195 | 195 | func mustAdmin (i) = { | |
196 | 196 | let adminPKs = stringOptionToList(getString(keyAdminPubKeys())) | |
197 | 197 | if (containsElement(adminPKs, toBase58String(i.callerPublicKey))) | |
198 | 198 | then true | |
199 | 199 | else mustManager(i) | |
200 | 200 | } | |
201 | 201 | ||
202 | 202 | ||
203 | 203 | func isVerified (assetId) = (valueOrElse(getInteger(addressFromStringValue(getStringOrFail(keyAssetsStoreContract())), (("status_<" + assetId) + ">")), 0) == 2) | |
204 | 204 | ||
205 | 205 | ||
206 | 206 | func getIdAndInfo (payment) = match payment.assetId { | |
207 | 207 | case id: ByteVector => | |
208 | 208 | let info = value(assetInfo(id)) | |
209 | 209 | $Tuple2(toBase58String(id), info) | |
210 | 210 | case _: Unit => | |
211 | 211 | $Tuple2(wavesAssetId, unit) | |
212 | 212 | case _ => | |
213 | 213 | throw("Match error") | |
214 | 214 | } | |
215 | 215 | ||
216 | 216 | ||
217 | 217 | func validStatus (status) = containsElement(statuses, status) | |
218 | 218 | ||
219 | 219 | ||
220 | 220 | @Callable(i) | |
221 | 221 | func constructor (factoryV2Address,assetsStoreAddress,emissionAddress,priceAssetsMinAmount,amountAssetMinAmount,feeAssetId,feeAmount) = { | |
222 | 222 | let checkCaller = mustManager(i) | |
223 | 223 | if ((checkCaller == checkCaller)) | |
224 | 224 | then [StringEntry(keyFactoryContract(), factoryV2Address), StringEntry(keyAssetsStoreContract(), assetsStoreAddress), StringEntry(keyEmissionContract(), emissionAddress), StringEntry(keyPriceAssetsMinAmount(), makeString(priceAssetsMinAmount, SEP)), IntegerEntry(keyAmountAssetMinAmount(), amountAssetMinAmount), StringEntry(keyFeeAssetId(), feeAssetId), IntegerEntry(keyFeeAmount(), feeAmount)] | |
225 | 225 | else throw("Strict value is not equal to itself.") | |
226 | 226 | } | |
227 | 227 | ||
228 | 228 | ||
229 | 229 | ||
230 | 230 | @Callable(i) | |
231 | 231 | func create () = { | |
232 | 232 | let asset1Payment = value(i.payments[0]) | |
233 | 233 | let asset2Payment = value(i.payments[1]) | |
234 | 234 | let feeAssetPayment = value(i.payments[2]) | |
235 | 235 | let $t074647521 = getIdAndInfo(asset1Payment) | |
236 | 236 | let asset1Id = $t074647521._1 | |
237 | 237 | let asset1Info = $t074647521._2 | |
238 | 238 | let $t075247581 = getIdAndInfo(asset2Payment) | |
239 | 239 | let asset2Id = $t075247581._1 | |
240 | 240 | let asset2Info = $t075247581._2 | |
241 | 241 | let $t075847647 = getIdAndInfo(feeAssetPayment) | |
242 | 242 | let feeAssetId = $t075847647._1 | |
243 | 243 | let feeAssetInfo = $t075847647._2 | |
244 | 244 | let priceAssetsList = stringOptionToList(getString(factoryContract, keyPriceAssets())) | |
245 | 245 | let checkAssetsNotEqual = if ((asset1Id != asset2Id)) | |
246 | 246 | then true | |
247 | 247 | else throwInvalidAssetPair() | |
248 | 248 | if ((checkAssetsNotEqual == checkAssetsNotEqual)) | |
249 | 249 | then { | |
250 | - | let $t078218263 = if (if (containsElement(priceAssetsList, asset2Id)) | |
251 | - | then isVerified(asset1Id) | |
252 | - | else false) | |
250 | + | let $t078218282 = if (if (isManager(i)) | |
251 | + | then true | |
252 | + | else if (containsElement(priceAssetsList, asset2Id)) | |
253 | + | then isVerified(asset1Id) | |
254 | + | else false) | |
253 | 255 | then $Tuple4(asset1Id, asset1Payment.amount, asset2Id, asset2Payment.amount) | |
254 | 256 | else if (if (containsElement(priceAssetsList, asset1Id)) | |
255 | 257 | then isVerified(asset2Id) | |
256 | 258 | else false) | |
257 | 259 | then $Tuple4(asset2Id, asset2Payment.amount, asset1Id, asset1Payment.amount) | |
258 | 260 | else throwInvalidAssetPair() | |
259 | - | let amountAssetId = $ | |
260 | - | let amountAssetAmount = $ | |
261 | - | let priceAssetId = $ | |
262 | - | let priceAssetAmount = $ | |
261 | + | let amountAssetId = $t078218282._1 | |
262 | + | let amountAssetAmount = $t078218282._2 | |
263 | + | let priceAssetId = $t078218282._3 | |
264 | + | let priceAssetAmount = $t078218282._4 | |
263 | 265 | let managerPriceAssetMinAmount = 1 | |
264 | 266 | let priceAssetMinAmount = if (isManager(i)) | |
265 | 267 | then managerPriceAssetMinAmount | |
266 | 268 | else { | |
267 | 269 | let priceAssetsIndex = valueOrErrorMessage(indexOf(priceAssetsList, priceAssetId), invalidPriceAsset) | |
268 | 270 | value(parseInt(stringOptionToList(getString(keyPriceAssetsMinAmount()))[priceAssetsIndex])) | |
269 | 271 | } | |
270 | 272 | let lastIndex = valueOrElse(getInteger(keyLastIndex()), 0) | |
271 | 273 | let curIndex = (lastIndex + 1) | |
272 | 274 | let emissionContract = addressFromStringValue(getStringOrFail(keyEmissionContract())) | |
273 | 275 | let poolExists = { | |
274 | 276 | let @ = invoke(factoryContract, "poolExistsREADONLY", [amountAssetId, priceAssetId], nil) | |
275 | 277 | if ($isInstanceOf(@, "Boolean")) | |
276 | 278 | then @ | |
277 | 279 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
278 | 280 | } | |
279 | 281 | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
280 | 282 | then true | |
281 | 283 | else throwPoolExists(), if (!(poolExists)) | |
282 | 284 | then true | |
283 | - | else throwPoolExists(), if ((getString(keyFeeAssetId()) == feeAssetId)) | |
285 | + | else throwPoolExists(), if (if (isManager(i)) | |
286 | + | then true | |
287 | + | else (getString(keyFeeAssetId()) == feeAssetId)) | |
284 | 288 | then true | |
285 | 289 | else throwInvalidFeeAsset(), if (if (isManager(i)) | |
286 | 290 | then true | |
287 | 291 | else (amountAssetAmount >= getIntegerValue(keyAmountAssetMinAmount()))) | |
288 | 292 | then true | |
289 | 293 | else throwInvalidAmountAsset(), if (if (isManager(i)) | |
290 | 294 | then true | |
291 | 295 | else (priceAssetAmount >= priceAssetMinAmount)) | |
292 | 296 | then true | |
293 | - | else throwInvalidPriceAssetAmount(), if ((feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
297 | + | else throwInvalidPriceAssetAmount(), if (if (isManager(i)) | |
298 | + | then true | |
299 | + | else (feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
294 | 300 | then true | |
295 | 301 | else throwInvalidFee()] | |
296 | 302 | if ((checks == checks)) | |
297 | 303 | then { | |
298 | - | let burnEmissionInv = invoke(emissionContract, "burn", nil, [AttachedPayment(fromBase58String(feeAssetId), feeAssetPayment.amount)]) | |
304 | + | let paymentsWithFeeSize = 3 | |
305 | + | let burnEmissionInv = if ((size(i.payments) >= paymentsWithFeeSize)) | |
306 | + | then invoke(emissionContract, "burn", nil, [AttachedPayment(fromBase58String(feeAssetId), feeAssetPayment.amount)]) | |
307 | + | else unit | |
299 | 308 | if ((burnEmissionInv == burnEmissionInv)) | |
300 | 309 | then [BooleanEntry(keyCreateCalled(amountAssetId, priceAssetId), true), StringEntry(keyCreateCaller(amountAssetId, priceAssetId), toString(i.caller)), IntegerEntry(keyLastIndex(), curIndex), StringEntry(keySuffix(amountAssetId, priceAssetId), (toString(curIndex) + indexSuffix)), IntegerEntry(keyHeight(amountAssetId, priceAssetId), height), StringEntry(keyStatus(amountAssetId, priceAssetId), statusPending), IntegerEntry(keyAmountAssetAmount(amountAssetId, priceAssetId), amountAssetAmount), IntegerEntry(keyPriceAssetAmount(amountAssetId, priceAssetId), priceAssetAmount)] | |
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 activate (poolAddress,amountAssetId,amountAssetTicker,priceAssetId,priceAssetTicker,logo) = { | |
312 | 321 | let checks = [mustAdmin(i), if (isCreateCalled(amountAssetId, priceAssetId)) | |
313 | 322 | then true | |
314 | 323 | else throwCreateNotCalled(), if ((value(getString(keyStatus(amountAssetId, priceAssetId))) == statusPending)) | |
315 | 324 | then true | |
316 | 325 | else throwCanActivateOnlyPendingPool()] | |
317 | 326 | if ((checks == checks)) | |
318 | 327 | then { | |
319 | 328 | let activateNewPoolInv = invoke(factoryContract, "activateNewPool", [poolAddress, amountAssetId, priceAssetId, ((amountAssetTicker + priceAssetTicker) + "LP"), (((amountAssetTicker + "/") + priceAssetTicker) + " pool liquidity provider token"), 0, "VLTPOOL", logo], nil) | |
320 | 329 | if ((activateNewPoolInv == activateNewPoolInv)) | |
321 | 330 | then { | |
322 | 331 | let lpAssetId = match activateNewPoolInv { | |
323 | 332 | case id: String => | |
324 | 333 | id | |
325 | 334 | case _ => | |
326 | 335 | throwFactoryReturnedNotString() | |
327 | 336 | } | |
328 | 337 | if ((lpAssetId == lpAssetId)) | |
329 | 338 | then { | |
330 | 339 | let beforePut = assetBalance(this, fromBase58String(lpAssetId)) | |
331 | 340 | if ((beforePut == beforePut)) | |
332 | 341 | then { | |
333 | 342 | let put = invoke(addressFromStringValue(poolAddress), "put", [0, false], [AttachedPayment(if ((amountAssetId == "WAVES")) | |
334 | 343 | then unit | |
335 | 344 | else fromBase58String(amountAssetId), value(getInteger(keyAmountAssetAmount(amountAssetId, priceAssetId)))), AttachedPayment(if ((priceAssetId == "WAVES")) | |
336 | 345 | then unit | |
337 | 346 | else fromBase58String(priceAssetId), value(getInteger(keyPriceAssetAmount(amountAssetId, priceAssetId))))]) | |
338 | 347 | if ((put == put)) | |
339 | 348 | then { | |
340 | 349 | let afterPut = assetBalance(this, fromBase58String(lpAssetId)) | |
341 | 350 | if ((afterPut == afterPut)) | |
342 | 351 | then { | |
343 | 352 | let user = value(addressFromString(value(getString(keyCreateCaller(amountAssetId, priceAssetId))))) | |
344 | 353 | let res = invoke(votingEmissionCandidateContract, "approve", [amountAssetId, priceAssetId], nil) | |
345 | 354 | if ((res == res)) | |
346 | 355 | then [StringEntry(keyStatus(amountAssetId, priceAssetId), statusActive), ScriptTransfer(user, (afterPut - beforePut), fromBase58String(lpAssetId))] | |
347 | 356 | else throw("Strict value is not equal to itself.") | |
348 | 357 | } | |
349 | 358 | else throw("Strict value is not equal to itself.") | |
350 | 359 | } | |
351 | 360 | else throw("Strict value is not equal to itself.") | |
352 | 361 | } | |
353 | 362 | else throw("Strict value is not equal to itself.") | |
354 | 363 | } | |
355 | 364 | else throw("Strict value is not equal to itself.") | |
356 | 365 | } | |
357 | 366 | else throw("Strict value is not equal to itself.") | |
358 | 367 | } | |
359 | 368 | else throw("Strict value is not equal to itself.") | |
360 | 369 | } | |
361 | 370 | ||
362 | 371 | ||
363 | 372 | ||
364 | 373 | @Callable(i) | |
365 | 374 | func setAdmins (adminPubKeys) = { | |
366 | 375 | let checkCaller = mustManager(i) | |
367 | 376 | if ((checkCaller == checkCaller)) | |
368 | 377 | then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))] | |
369 | 378 | else throw("Strict value is not equal to itself.") | |
370 | 379 | } | |
371 | 380 | ||
372 | 381 | ||
373 | 382 | ||
374 | 383 | @Callable(i) | |
375 | 384 | func setManager (pendingManagerPublicKey) = { | |
376 | 385 | let checkCaller = mustManager(i) | |
377 | 386 | if ((checkCaller == checkCaller)) | |
378 | 387 | then { | |
379 | 388 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
380 | 389 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
381 | 390 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
382 | 391 | else throw("Strict value is not equal to itself.") | |
383 | 392 | } | |
384 | 393 | else throw("Strict value is not equal to itself.") | |
385 | 394 | } | |
386 | 395 | ||
387 | 396 | ||
388 | 397 | ||
389 | 398 | @Callable(i) | |
390 | 399 | func confirmManager () = { | |
391 | 400 | let pm = pendingManagerPublicKeyOrUnit() | |
392 | 401 | let hasPM = if (isDefined(pm)) | |
393 | 402 | then true | |
394 | 403 | else throw("No pending manager") | |
395 | 404 | if ((hasPM == hasPM)) | |
396 | 405 | then { | |
397 | 406 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
398 | 407 | then true | |
399 | 408 | else throw("You are not pending manager") | |
400 | 409 | if ((checkPM == checkPM)) | |
401 | 410 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
402 | 411 | else throw("Strict value is not equal to itself.") | |
403 | 412 | } | |
404 | 413 | else throw("Strict value is not equal to itself.") | |
405 | 414 | } | |
406 | 415 | ||
407 | 416 | ||
408 | 417 | ||
409 | 418 | @Callable(i) | |
410 | 419 | func priceAssetsREADONLY () = $Tuple2(nil, stringOptionToList(getString(keyPriceAssets()))) | |
411 | 420 | ||
412 | 421 | ||
413 | 422 | ||
414 | 423 | @Callable(i) | |
415 | 424 | func statusREADONLY (amountAssetId,priceAssetId) = { | |
416 | 425 | let status = match getString(keyStatus(amountAssetId, priceAssetId)) { | |
417 | 426 | case s: String => | |
418 | 427 | s | |
419 | 428 | case _ => | |
420 | 429 | unit | |
421 | 430 | } | |
422 | 431 | $Tuple2(nil, status) | |
423 | 432 | } | |
424 | 433 | ||
425 | 434 | ||
426 | 435 | @Verifier(tx) | |
427 | 436 | func verify () = { | |
428 | 437 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
429 | 438 | case pk: ByteVector => | |
430 | 439 | pk | |
431 | 440 | case _: Unit => | |
432 | 441 | tx.senderPublicKey | |
433 | 442 | case _ => | |
434 | 443 | throw("Match error") | |
435 | 444 | } | |
436 | 445 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
437 | 446 | } | |
438 | 447 |
github/deemru/w8io/026f985 81.41 ms ◑