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