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