tx · AWxxyUq7pUj4mnKd4kcbfxbchATDWQyUX2v4sLVLxhSJ 3N1ytAUyhtig9X6F2hHHs1jbzYxr47Yp8Fr: -0.01600000 Waves 2024.12.19 10:48 [3421139] smart account 3N1ytAUyhtig9X6F2hHHs1jbzYxr47Yp8Fr > SELF 0.00000000 Waves
{ "type": 13, "id": "AWxxyUq7pUj4mnKd4kcbfxbchATDWQyUX2v4sLVLxhSJ", "fee": 1600000, "feeAssetId": null, "timestamp": 1734594512574, "version": 2, "chainId": 84, "sender": "3N1ytAUyhtig9X6F2hHHs1jbzYxr47Yp8Fr", "senderPublicKey": "jXCTQV8PjX2uC9UHBFveupYy9cjhY7stHbzE9cptymw", "proofs": [ "hHqEuyoCDLQCrUvZpWrUqeTz6ERqYt1AzwJdyXkgAEQ8sSorkxXgjpes9HXXtZUMd1aVRBJWFtqADX4mkEsUHaU" ], "script": "base64:BwIrCAISAwoBCBIECgICGBIECgICGBIECgICGBIECgICGBIECgICGBIECgICGDUACXNlcGFyYXRvcgICX18AC3dhdmVzU3RyaW5nAgVXQVZFUwAQY29udHJhY3RGaWxlbmFtZQIXbWVtZV9pbV9jYWxjdWxhdG9yLnJpZGUABW11bHQ4AIDC1y8BB3dyYXBFcnIBAXMJAKwCAgkArAICBRBjb250cmFjdEZpbGVuYW1lAgI6IAUBcwEIdGhyb3dFcnIBAXMJAAIBCQEHd3JhcEVycgEFAXMBD3ZhbGlkYXRlQWRkcmVzcwEHYWRkcmVzcwkBCWlzRGVmaW5lZAEJAKYIAQUHYWRkcmVzcwAMU1RBVFVTX0VNUFRZAAAADFNUQVRVU19SRUFEWQABABVTVEFUVVNfVEFSR0VUX1JFQUNIRUQAAgASU1RBVFVTX1RSQU5TRkVSUkVEAAMACWtTaHV0ZG93bgIOc2h1dGRvd25fX2ZsYWcAC2tQcmljZUFzc2V0AgxwcmljZV9fYXNzZXQADmtMaXN0aW5nVm9sdW1lAg9saXN0aW5nX192b2x1bWUADGtDcmVhdGlvbkZlZQISc2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NzBQ5rZXlBbGxvd2VkVHhJZAIAAwUIYnlBZG1pbnMGBQdieU93bmVyrFyiRQ==", "height": 3421139, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: J5xwGBvQVTeMK2r5PCA6FjjETuBQavKiuMkpZLwwUexm Next: 8iJxrm1J7TrHqGtMqTx6KVxQei3cz27NSjEGmNQ7dk86 Diff:
Old | New | Differences | |
---|---|---|---|
345 | 345 | let wavesAssetBalanceBefore = getBalance(factoryAddress, wavesAsset) | |
346 | 346 | if ((wavesAssetBalanceBefore == wavesAssetBalanceBefore)) | |
347 | 347 | then { | |
348 | - | let withdrawInvoke = invoke(factoryAddress, "withdrawLiquidityFromPool", | |
348 | + | let withdrawInvoke = invoke(factoryAddress, "withdrawLiquidityFromPool", [poolAddress.bytes], nil) | |
349 | 349 | if ((withdrawInvoke == withdrawInvoke)) | |
350 | 350 | then { | |
351 | 351 | let poolAssetBalanceAfter = getBalance(factoryAddress, poolAsset) | |
365 | 365 | if ((burnAction == burnAction)) | |
366 | 366 | then { | |
367 | 367 | let feeWavesAmount = fraction(wavesAmount, 20, 100) | |
368 | - | let feeAction = invoke(factoryAddress, "transferWaves", [feeCollectorAddress, feeWavesAmount], nil) | |
368 | + | let feeAction = invoke(factoryAddress, "transferWaves", [feeCollectorAddress.bytes, feeWavesAmount], nil) | |
369 | 369 | if ((feeAction == feeAction)) | |
370 | 370 | then { | |
371 | 371 | let createWxPoolAction = invoke(factoryAddress, "createWxPool", [userPoolsAddress, assetIdToString(poolAsset), (poolAssetAmount - burnAmount), assetIdToString(wavesAsset), (wavesAmount - feeWavesAmount)], nil) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 7 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "__" | |
5 | 5 | ||
6 | 6 | let wavesString = "WAVES" | |
7 | 7 | ||
8 | 8 | let contractFilename = "meme_im_calculator.ride" | |
9 | 9 | ||
10 | 10 | let mult8 = 100000000 | |
11 | 11 | ||
12 | 12 | func wrapErr (s) = ((contractFilename + ": ") + s) | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func throwErr (s) = throw(wrapErr(s)) | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func validateAddress (address) = isDefined(addressFromString(address)) | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | let STATUS_EMPTY = 0 | |
22 | 22 | ||
23 | 23 | let STATUS_READY = 1 | |
24 | 24 | ||
25 | 25 | let STATUS_TARGET_REACHED = 2 | |
26 | 26 | ||
27 | 27 | let STATUS_TRANSFERRED = 3 | |
28 | 28 | ||
29 | 29 | let kShutdown = "shutdown__flag" | |
30 | 30 | ||
31 | 31 | let kPriceAsset = "price__asset" | |
32 | 32 | ||
33 | 33 | let kListingVolume = "listing__volume" | |
34 | 34 | ||
35 | 35 | let kCreationFee = "setup__creationFee" | |
36 | 36 | ||
37 | 37 | let kCurveTarget = "setup__curveTarget" | |
38 | 38 | ||
39 | 39 | let kVirtualLiquidity = "setup__virtualLiquidity" | |
40 | 40 | ||
41 | 41 | let kPoolTokensList = "static_tokenIds" | |
42 | 42 | ||
43 | 43 | let kPoolContractHash = "pool__contract__hash" | |
44 | 44 | ||
45 | 45 | let kLastEmptyPoolIndex = "last__empty_pool__index" | |
46 | 46 | ||
47 | 47 | let kFirstEmptyPoolIndex = "first__empty__pool__index" | |
48 | 48 | ||
49 | 49 | func kPoolAddressFromIndex (index) = makeString(["pool", toString(index)], separator) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func kPoolIndexFromAddress (address) = makeString(["pool", toString(address)], separator) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func kPoolAsset (address) = makeString(["asset", toString(address)], separator) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func kPoolStatus (index) = makeString(["pool", "status", toString(index)], separator) | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | let kFactoryAddress = "factory__address" | |
62 | 62 | ||
63 | 63 | let factoryAddressOption = match getString(this, kFactoryAddress) { | |
64 | 64 | case s: String => | |
65 | 65 | addressFromString(s) | |
66 | 66 | case _: Unit => | |
67 | 67 | unit | |
68 | 68 | case _ => | |
69 | 69 | throw("Match error") | |
70 | 70 | } | |
71 | 71 | ||
72 | 72 | let factoryAddress = valueOrErrorMessage(factoryAddressOption, wrapErr("invalid factory address")) | |
73 | 73 | ||
74 | 74 | let kWxSwapAddress = "wxswap__address" | |
75 | 75 | ||
76 | 76 | let wxSwapAddressOption = match getString(factoryAddress, kWxSwapAddress) { | |
77 | 77 | case s: String => | |
78 | 78 | addressFromString(s) | |
79 | 79 | case _ => | |
80 | 80 | unit | |
81 | 81 | } | |
82 | 82 | ||
83 | 83 | let wxSwapAddress = valueOrErrorMessage(wxSwapAddressOption, wrapErr("invalid wx swap address")) | |
84 | 84 | ||
85 | 85 | let kFeeCollectorAddress = "wxfee_address" | |
86 | 86 | ||
87 | 87 | let feeCollectorAddressOption = match getString(factoryAddress, kFeeCollectorAddress) { | |
88 | 88 | case s: String => | |
89 | 89 | addressFromString(s) | |
90 | 90 | case _ => | |
91 | 91 | unit | |
92 | 92 | } | |
93 | 93 | ||
94 | 94 | let feeCollectorAddress = valueOrErrorMessage(feeCollectorAddressOption, wrapErr("invalid fee collector address")) | |
95 | 95 | ||
96 | 96 | let kUserPoolsAddress = "userpools_address" | |
97 | 97 | ||
98 | 98 | let userPoolsAddressOption = match getString(factoryAddress, kUserPoolsAddress) { | |
99 | 99 | case s: String => | |
100 | 100 | addressFromString(s) | |
101 | 101 | case _ => | |
102 | 102 | unit | |
103 | 103 | } | |
104 | 104 | ||
105 | 105 | let userPoolsAddress = valueOrErrorMessage(userPoolsAddressOption, wrapErr("invalid user_pools dapp address")) | |
106 | 106 | ||
107 | 107 | let shutdown = valueOrElse(getBoolean(factoryAddress, kShutdown), false) | |
108 | 108 | ||
109 | 109 | let lastEmptyIndex = valueOrElse(getInteger(factoryAddress, kLastEmptyPoolIndex), 0) | |
110 | 110 | ||
111 | 111 | let firstEmptyIndex = valueOrElse(getInteger(factoryAddress, kFirstEmptyPoolIndex), 0) | |
112 | 112 | ||
113 | 113 | let listingVolume = valueOrElse(getInteger(factoryAddress, kListingVolume), 0) | |
114 | 114 | ||
115 | 115 | let creationFee = valueOrElse(getInteger(factoryAddress, kCreationFee), 0) | |
116 | 116 | ||
117 | 117 | let poolContractHash = getBinary(factoryAddress, kPoolContractHash) | |
118 | 118 | ||
119 | 119 | func parseAssetId (input) = if ((input == wavesString)) | |
120 | 120 | then unit | |
121 | 121 | else fromBase58String(input) | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func assetIdToString (input) = if ((input == unit)) | |
125 | 125 | then wavesString | |
126 | 126 | else toBase58String(value(input)) | |
127 | 127 | ||
128 | 128 | ||
129 | 129 | func mustAddress (caller,address) = if ((caller == address)) | |
130 | 130 | then true | |
131 | 131 | else throwErr("permission denied") | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | func mustThis (caller) = mustAddress(caller, this) | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func mustFactory (caller) = mustAddress(caller, factoryAddress) | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | func checkContractScript (address) = match poolContractHash { | |
141 | 141 | case hash: ByteVector => | |
142 | 142 | (scriptHash(address) == hash) | |
143 | 143 | case _ => | |
144 | 144 | true | |
145 | 145 | } | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | func isPoolExists (poolAddress) = isDefined(getInteger(factoryAddress, kPoolIndexFromAddress(poolAddress))) | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | func getPoolId (poolAddress) = valueOrErrorMessage(getInteger(factoryAddress, kPoolIndexFromAddress(poolAddress)), "pool doesn't exists") | |
152 | 152 | ||
153 | 153 | ||
154 | 154 | func isPoolTargetReached (poolAddress) = (valueOrElse(getInteger(factoryAddress, kPoolStatus(getPoolId(poolAddress))), -1) == STATUS_TARGET_REACHED) | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | func getBalance (address,assetId) = match assetId { | |
158 | 158 | case id: ByteVector => | |
159 | 159 | assetBalance(address, id) | |
160 | 160 | case _ => | |
161 | 161 | wavesBalance(address).available | |
162 | 162 | } | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | @Callable(i) | |
166 | 166 | func init (factoryAddressStr) = { | |
167 | 167 | let checkCaller = mustThis(i.caller) | |
168 | 168 | if ((checkCaller == checkCaller)) | |
169 | 169 | then [StringEntry(kFactoryAddress, factoryAddressStr)] | |
170 | 170 | else throw("Strict value is not equal to itself.") | |
171 | 171 | } | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | ||
175 | 175 | @Callable(i) | |
176 | 176 | func addEmptyPool (callerPublicKey,args) = { | |
177 | 177 | let newPoolAddress = addressFromPublicKey(callerPublicKey) | |
178 | 178 | let newPoolIndex = (lastEmptyIndex + 1) | |
179 | 179 | let checks = [if (!(shutdown)) | |
180 | 180 | then true | |
181 | 181 | else throwErr("not allowed (shutdown)"), if (checkContractScript(newPoolAddress)) | |
182 | 182 | then true | |
183 | 183 | else throwErr("pool script is not allowed"), if (!(isPoolExists(newPoolAddress))) | |
184 | 184 | then true | |
185 | 185 | else throwErr("pool address is already registered")] | |
186 | 186 | if ((checks == checks)) | |
187 | 187 | then { | |
188 | 188 | let factoryActions = [invoke(factoryAddress, "integerEntry", [kLastEmptyPoolIndex, newPoolIndex], nil), invoke(factoryAddress, "stringEntry", [kPoolAddressFromIndex(newPoolIndex), toString(newPoolAddress)], nil), invoke(factoryAddress, "integerEntry", [kPoolIndexFromAddress(newPoolAddress), newPoolIndex], nil), invoke(factoryAddress, "integerEntry", [kPoolStatus(newPoolIndex), STATUS_EMPTY], nil)] | |
189 | 189 | $Tuple2(nil, factoryActions) | |
190 | 190 | } | |
191 | 191 | else throw("Strict value is not equal to itself.") | |
192 | 192 | } | |
193 | 193 | ||
194 | 194 | ||
195 | 195 | ||
196 | 196 | @Callable(i) | |
197 | 197 | func createPool (callerPublicKey,args) = { | |
198 | 198 | let minPayment = (listingVolume + creationFee) | |
199 | 199 | let checks = [if (!(shutdown)) | |
200 | 200 | then true | |
201 | 201 | else throwErr("Temporary shutdown"), mustFactory(i.caller), if (((lastEmptyIndex - firstEmptyIndex) > 0)) | |
202 | 202 | then true | |
203 | 203 | else throwErr("No empty pool available"), if ((i.payments[0].assetId == unit)) | |
204 | 204 | then true | |
205 | 205 | else throwErr("Payment should be in WAVES"), if ((i.payments[0].amount >= minPayment)) | |
206 | 206 | then true | |
207 | 207 | else throwErr((("Payment should be greater or equal " + toString(minPayment)) + " WAVELET")), if (isDefined(args[0])) | |
208 | 208 | then true | |
209 | 209 | else throwErr("Token name is not provided"), if (isDefined(args[1])) | |
210 | 210 | then true | |
211 | 211 | else throwErr("Token description is not provided"), if (isDefined(args[2])) | |
212 | 212 | then true | |
213 | 213 | else throwErr("Token quantity is not provided"), if ((parseInt(args[2]) != unit)) | |
214 | 214 | then true | |
215 | 215 | else throwErr("Token quantity should be a number")] | |
216 | 216 | if ((checks == checks)) | |
217 | 217 | then { | |
218 | 218 | let poolIndex = (firstEmptyIndex + 1) | |
219 | 219 | let poolAddressString = getStringValue(factoryAddress, kPoolAddressFromIndex(poolIndex)) | |
220 | 220 | let poolAddress = addressFromStringValue(poolAddressString) | |
221 | 221 | let callerAddress = addressFromPublicKey(callerPublicKey) | |
222 | 222 | let poolDomain = take(poolAddressString, 8) | |
223 | 223 | let poolOwner = toString(callerAddress) | |
224 | 224 | let tokenName = args[0] | |
225 | 225 | let tokenDesc = args[1] | |
226 | 226 | let tokenQuantity = args[2] | |
227 | 227 | let initPoolInvoke = invoke(factoryAddress, "initPoolInvoke", [poolAddressString, [poolDomain, poolOwner, tokenName, tokenDesc, tokenQuantity]], [AttachedPayment(i.payments[0].assetId, i.payments[0].amount)]) | |
228 | 228 | if ((initPoolInvoke == initPoolInvoke)) | |
229 | 229 | then { | |
230 | 230 | let factoryActions = [invoke(factoryAddress, "integerEntry", [kFirstEmptyPoolIndex, poolIndex], nil), invoke(factoryAddress, "integerEntry", [kPoolStatus(poolIndex), STATUS_READY], nil)] | |
231 | 231 | $Tuple2(nil, factoryActions) | |
232 | 232 | } | |
233 | 233 | else throw("Strict value is not equal to itself.") | |
234 | 234 | } | |
235 | 235 | else throw("Strict value is not equal to itself.") | |
236 | 236 | } | |
237 | 237 | ||
238 | 238 | ||
239 | 239 | ||
240 | 240 | @Callable(i) | |
241 | 241 | func notifyStatusUpdate (callerPublicKey,args) = { | |
242 | 242 | let poolAddress = addressFromPublicKey(callerPublicKey) | |
243 | 243 | let checks = [if (isPoolExists(poolAddress)) | |
244 | 244 | then true | |
245 | 245 | else throwErr("pool not found"), mustFactory(i.caller)] | |
246 | 246 | if ((checks == checks)) | |
247 | 247 | then { | |
248 | 248 | let poolIndex = getIntegerValue(factoryAddress, kPoolIndexFromAddress(poolAddress)) | |
249 | 249 | let newStatus = parseIntValue(args[0]) | |
250 | 250 | let factoryActions = [invoke(factoryAddress, "integerEntry", [kPoolStatus(poolIndex), newStatus], nil)] | |
251 | 251 | $Tuple2(nil, factoryActions) | |
252 | 252 | } | |
253 | 253 | else throw("Strict value is not equal to itself.") | |
254 | 254 | } | |
255 | 255 | ||
256 | 256 | ||
257 | 257 | ||
258 | 258 | @Callable(i) | |
259 | 259 | func swapREADONLY (callerPublicKey,args) = { | |
260 | 260 | let poolAddress = addressFromStringValue(args[0]) | |
261 | 261 | let amountAssetIdString = args[1] | |
262 | 262 | let priceAssetIdString = args[2] | |
263 | 263 | let amount = parseIntValue(args[3]) | |
264 | 264 | let checks = [if (!(shutdown)) | |
265 | 265 | then true | |
266 | 266 | else throwErr("Temporary shutdown"), mustFactory(i.caller)] | |
267 | 267 | if ((checks == checks)) | |
268 | 268 | then if (isPoolTargetReached(poolAddress)) | |
269 | 269 | then { | |
270 | 270 | let wxSwapResult = { | |
271 | 271 | let @ = invoke(wxSwapAddress, "swapCalculateREADONLY", [amount, amountAssetIdString, priceAssetIdString], nil) | |
272 | 272 | if ($isInstanceOf(@, "Int")) | |
273 | 273 | then @ | |
274 | 274 | else throw(($getType(@) + " couldn't be cast to Int")) | |
275 | 275 | } | |
276 | 276 | $Tuple2(nil, $Tuple2(wxSwapResult, "WxSwap")) | |
277 | 277 | } | |
278 | 278 | else { | |
279 | 279 | let poolSwapResult = { | |
280 | 280 | let @ = invoke(poolAddress, "swapReadOnly", [amountAssetIdString, priceAssetIdString, amount], nil) | |
281 | 281 | if ($isInstanceOf(@, "Int")) | |
282 | 282 | then @ | |
283 | 283 | else throw(($getType(@) + " couldn't be cast to Int")) | |
284 | 284 | } | |
285 | 285 | $Tuple2(nil, $Tuple2(poolSwapResult, "iMemePool")) | |
286 | 286 | } | |
287 | 287 | else throw("Strict value is not equal to itself.") | |
288 | 288 | } | |
289 | 289 | ||
290 | 290 | ||
291 | 291 | ||
292 | 292 | @Callable(i) | |
293 | 293 | func swap (callerPublicKey,args) = { | |
294 | 294 | let callerAddress = addressFromPublicKey(callerPublicKey) | |
295 | 295 | let poolAddress = addressFromStringValue(args[0]) | |
296 | 296 | let priceAssetIdString = args[1] | |
297 | 297 | let priceAssetId = parseAssetId(priceAssetIdString) | |
298 | 298 | let minimumAmount = parseIntValue(args[2]) | |
299 | 299 | let assetInAmount = i.payments[0].amount | |
300 | 300 | let assetInAssetId = i.payments[0].assetId | |
301 | 301 | let checks = [if (!(shutdown)) | |
302 | 302 | then true | |
303 | 303 | else throwErr("Temporary shutdown"), mustFactory(i.caller), if ((size(i.payments) == 1)) | |
304 | 304 | then true | |
305 | 305 | else throwErr("exactly one payment is expected")] | |
306 | 306 | if ((checks == checks)) | |
307 | 307 | then { | |
308 | 308 | let outAssetBalanceBefore = getBalance(this, priceAssetId) | |
309 | 309 | if ((outAssetBalanceBefore == outAssetBalanceBefore)) | |
310 | 310 | then { | |
311 | 311 | let swapAction = if (isPoolTargetReached(poolAddress)) | |
312 | 312 | then invoke(wxSwapAddress, "swap", [minimumAmount, priceAssetIdString, toString(this)], i.payments) | |
313 | 313 | else invoke(poolAddress, "swap", [priceAssetIdString, minimumAmount], i.payments) | |
314 | 314 | if ((swapAction == swapAction)) | |
315 | 315 | then { | |
316 | 316 | let outAssetBalanceAfter = getBalance(this, priceAssetId) | |
317 | 317 | if ((outAssetBalanceAfter == outAssetBalanceAfter)) | |
318 | 318 | then [ScriptTransfer(callerAddress, (outAssetBalanceAfter - outAssetBalanceBefore), priceAssetId)] | |
319 | 319 | else throw("Strict value is not equal to itself.") | |
320 | 320 | } | |
321 | 321 | else throw("Strict value is not equal to itself.") | |
322 | 322 | } | |
323 | 323 | else throw("Strict value is not equal to itself.") | |
324 | 324 | } | |
325 | 325 | else throw("Strict value is not equal to itself.") | |
326 | 326 | } | |
327 | 327 | ||
328 | 328 | ||
329 | 329 | ||
330 | 330 | @Callable(i) | |
331 | 331 | func transferPool (callerPublicKey,args) = { | |
332 | 332 | let callerAddress = addressFromPublicKey(callerPublicKey) | |
333 | 333 | let poolAddress = addressFromStringValue(args[0]) | |
334 | 334 | let poolTokensStringList = split(getStringValue(poolAddress, kPoolTokensList), ",") | |
335 | 335 | let asset1 = parseAssetId(poolTokensStringList[0]) | |
336 | 336 | let asset2 = parseAssetId(poolTokensStringList[1]) | |
337 | 337 | let $t01059110683 = if ((asset1 == unit)) | |
338 | 338 | then $Tuple2(asset2, asset1) | |
339 | 339 | else $Tuple2(asset1, asset2) | |
340 | 340 | let poolAsset = $t01059110683._1 | |
341 | 341 | let wavesAsset = $t01059110683._2 | |
342 | 342 | let poolAssetBalanceBefore = getBalance(factoryAddress, poolAsset) | |
343 | 343 | if ((poolAssetBalanceBefore == poolAssetBalanceBefore)) | |
344 | 344 | then { | |
345 | 345 | let wavesAssetBalanceBefore = getBalance(factoryAddress, wavesAsset) | |
346 | 346 | if ((wavesAssetBalanceBefore == wavesAssetBalanceBefore)) | |
347 | 347 | then { | |
348 | - | let withdrawInvoke = invoke(factoryAddress, "withdrawLiquidityFromPool", | |
348 | + | let withdrawInvoke = invoke(factoryAddress, "withdrawLiquidityFromPool", [poolAddress.bytes], nil) | |
349 | 349 | if ((withdrawInvoke == withdrawInvoke)) | |
350 | 350 | then { | |
351 | 351 | let poolAssetBalanceAfter = getBalance(factoryAddress, poolAsset) | |
352 | 352 | if ((poolAssetBalanceAfter == poolAssetBalanceAfter)) | |
353 | 353 | then { | |
354 | 354 | let wavesAssetBalanceAfter = getBalance(factoryAddress, wavesAsset) | |
355 | 355 | if ((wavesAssetBalanceAfter == wavesAssetBalanceAfter)) | |
356 | 356 | then { | |
357 | 357 | let poolAssetAmount = (poolAssetBalanceAfter - poolAssetBalanceBefore) | |
358 | 358 | let wavesAmount = (wavesAssetBalanceAfter - wavesAssetBalanceBefore) | |
359 | 359 | if (if ((poolAssetAmount > 0)) | |
360 | 360 | then (wavesAmount > 0) | |
361 | 361 | else false) | |
362 | 362 | then { | |
363 | 363 | let burnAmount = fraction(poolAssetAmount, 20, 100) | |
364 | 364 | let burnAction = invoke(factoryAddress, "burn", [poolAsset, burnAmount], nil) | |
365 | 365 | if ((burnAction == burnAction)) | |
366 | 366 | then { | |
367 | 367 | let feeWavesAmount = fraction(wavesAmount, 20, 100) | |
368 | - | let feeAction = invoke(factoryAddress, "transferWaves", [feeCollectorAddress, feeWavesAmount], nil) | |
368 | + | let feeAction = invoke(factoryAddress, "transferWaves", [feeCollectorAddress.bytes, feeWavesAmount], nil) | |
369 | 369 | if ((feeAction == feeAction)) | |
370 | 370 | then { | |
371 | 371 | let createWxPoolAction = invoke(factoryAddress, "createWxPool", [userPoolsAddress, assetIdToString(poolAsset), (poolAssetAmount - burnAmount), assetIdToString(wavesAsset), (wavesAmount - feeWavesAmount)], nil) | |
372 | 372 | if ((createWxPoolAction == createWxPoolAction)) | |
373 | 373 | then nil | |
374 | 374 | else throw("Strict value is not equal to itself.") | |
375 | 375 | } | |
376 | 376 | else throw("Strict value is not equal to itself.") | |
377 | 377 | } | |
378 | 378 | else throw("Strict value is not equal to itself.") | |
379 | 379 | } | |
380 | 380 | else throwErr("withdrawn amount from pool is too low") | |
381 | 381 | } | |
382 | 382 | else throw("Strict value is not equal to itself.") | |
383 | 383 | } | |
384 | 384 | else throw("Strict value is not equal to itself.") | |
385 | 385 | } | |
386 | 386 | else throw("Strict value is not equal to itself.") | |
387 | 387 | } | |
388 | 388 | else throw("Strict value is not equal to itself.") | |
389 | 389 | } | |
390 | 390 | else throw("Strict value is not equal to itself.") | |
391 | 391 | } | |
392 | 392 | ||
393 | 393 | ||
394 | 394 | @Verifier(tx) | |
395 | 395 | func verify () = { | |
396 | 396 | let keyAdminAddressList = "%s__adminAddressList" | |
397 | 397 | let keyAllowedTxId = "%s__txId" | |
398 | 398 | let adminList = split(valueOrElse(getString(factoryAddress, keyAdminAddressList), ""), "__") | |
399 | 399 | let byOwner = if ((size(adminList) >= 3)) | |
400 | 400 | then false | |
401 | 401 | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
402 | 402 | let byAdmins = (tx.id == fromBase58String(valueOrElse(getString(factoryAddress, keyAllowedTxId), ""))) | |
403 | 403 | if (byAdmins) | |
404 | 404 | then true | |
405 | 405 | else byOwner | |
406 | 406 | } | |
407 | 407 |
github/deemru/w8io/169f3d6 44.13 ms ◑