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