tx · CUqJU9AeeQBkd7QRf35k2gP43aGZx4FVx8YyX6uJ2oeA 3N1ytAUyhtig9X6F2hHHs1jbzYxr47Yp8Fr: -0.01200000 Waves 2024.12.16 10:59 [3416857] smart account 3N1ytAUyhtig9X6F2hHHs1jbzYxr47Yp8Fr > SELF 0.00000000 Waves
{ "type": 13, "id": "CUqJU9AeeQBkd7QRf35k2gP43aGZx4FVx8YyX6uJ2oeA", "fee": 1200000, "feeAssetId": null, "timestamp": 1734336003100, "version": 2, "chainId": 84, "sender": "3N1ytAUyhtig9X6F2hHHs1jbzYxr47Yp8Fr", "senderPublicKey": "jXCTQV8PjX2uC9UHBFveupYy9cjhY7stHbzE9cptymw", "proofs": [ "2uDGLLFVRJqhLLk1URAvaaNwQwXfrMV6gZxtvYizdraJSGEWKmAoFnMLKaNXLhUyLamhnz9oYgjxT1WcUzBnUYxr" ], "script": "base64:BwIfCAISAwoBCBIECgICGBIECgICGBIECgICGBIECgICGCwACXNlcGFyYXRvcgICX18AC3dhdmVzU3RyaW5nAgVXQVZFUwAQY29udHJhY3RGaWxlbmFtZQIXbWVtZV9pbV9jYWxjdWxhdG9yLnJpZGUABW11bHQ4AIDC1y8BB3dyYXBFcnIBAXMJAKwCAgkArAICBRBjb250cmFjdEZpbGVuYW1lAgI6IAUBcwEIdGhyb3dFcnIBAXMJAAIBCQEHd3JhcEVycgEFAXMBD3ZhbGlkYXRlQWRkcmVzcwEHYWRkcmVzcwkBCWlzRGVmaW5lZAEJAKYIAQUHYWRkcmVzcwAMU1RBVFVTX0VNUFRZAAAADFNUQVRVU19SRUFEWQABABVTVEFUVVNfVEFSR0VUX1JFQUNIRUQAAgAJa1NodXRkb3duAg5zaHV0ZG93bl9fZmxhZwALa1ByaWNlQXNzZXQCDHByaWNlX19hc3NldAAOa0xpc3RpbmdWb2x1bWUCD2xpc3RpbmdfX3ZvbHVtZQAMa0NyZWF0aW9uRmVlAhJzZXR1cF9fY3JlYXRpb25GZWUADGtDdXJ2ZVRhcm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Bc3NldElkU3RyaW5nCQDMCAIFEnByaWNlQXNzZXRJZFN0cmluZwkAzAgCBQZhbW91bnQFA25pbAUDbmlsAwkAAQIFAUACA0ludAUBQAkAAgEJAKwCAgkAAwEFAUACGCBjb3VsZG4ndCBiZSBjYXN0IHRvIEludAkAlAoCBQNuaWwFDnBvb2xTd2FwUmVzdWx0CQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJ0eAEGdmVyaWZ5AAQTa2V5QWRtaW5BZGRyZXNzTGlzdAIUJXNfX2FkbWluQWRkcmVzc0xpc3QEDmtleUFsbG93ZWRUeElkAgglc19fdHhJZAQJYWRtaW5MaXN0CQC1CQIJAQt2YWx1ZU9yRWxzZQIJAJ0IAgUOZmFjdG9yeUFkZHJlc3MFE2tleUFkbWluQWRkcmVzc0xpc3QCAAICX18EB2J5T3duZXIDCQBnAgkAkAMBBQlhZG1pbkxpc3QAAwcJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkECGJ5QWRtaW5zCQAAAggFAnR4AmlkCQDZBAEJAQt2YWx1ZU9yRWxzZQIJAJ0IAgUOZmFjdG9yeUFkZHJlc3MFDmtleUFsbG93ZWRUeElkAgADBQhieUFkbWlucwYFB2J5T3duZXL5dXcm", "height": 3416857, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 26xPixHk9PYVNDH6fJGuZHHpRCfKuUBGZA9WLwtSpHWX Next: FW4ZLacr9kopQfi3kMg33eHdeiBUkYphzmTEDq5SyXMQ Diff:
Old | New | Differences | |
---|---|---|---|
69 | 69 | ||
70 | 70 | let kWxSwapAddress = "wxswap__address" | |
71 | 71 | ||
72 | - | let wxSwapAddressOption = match getString( | |
72 | + | let wxSwapAddressOption = match getString(factoryAddress, kWxSwapAddress) { | |
73 | 73 | case s: String => | |
74 | 74 | addressFromString(s) | |
75 | 75 | case _: Unit => |
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 kShutdown = "shutdown__flag" | |
28 | 28 | ||
29 | 29 | let kPriceAsset = "price__asset" | |
30 | 30 | ||
31 | 31 | let kListingVolume = "listing__volume" | |
32 | 32 | ||
33 | 33 | let kCreationFee = "setup__creationFee" | |
34 | 34 | ||
35 | 35 | let kCurveTarget = "setup__curveTarget" | |
36 | 36 | ||
37 | 37 | let kVirtualLiquidity = "setup__virtualLiquidity" | |
38 | 38 | ||
39 | 39 | let kPoolContractHash = "pool__contract__hash" | |
40 | 40 | ||
41 | 41 | let kLastEmptyPoolIndex = "last__empty_pool__index" | |
42 | 42 | ||
43 | 43 | let kFirstEmptyPoolIndex = "first__empty__pool__index" | |
44 | 44 | ||
45 | 45 | func kPoolAddressFromIndex (index) = makeString(["pool", toString(index)], separator) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func kPoolIndexFromAddress (address) = makeString(["pool", toString(address)], separator) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func kPoolAsset (address) = makeString(["asset", toString(address)], separator) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func kPoolStatus (index) = makeString(["pool", "status", toString(index)], separator) | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | let kFactoryAddress = "factory__address" | |
58 | 58 | ||
59 | 59 | let factoryAddressOption = match getString(this, kFactoryAddress) { | |
60 | 60 | case s: String => | |
61 | 61 | addressFromString(s) | |
62 | 62 | case _: Unit => | |
63 | 63 | unit | |
64 | 64 | case _ => | |
65 | 65 | throw("Match error") | |
66 | 66 | } | |
67 | 67 | ||
68 | 68 | let factoryAddress = valueOrErrorMessage(factoryAddressOption, wrapErr("invalid factory address")) | |
69 | 69 | ||
70 | 70 | let kWxSwapAddress = "wxswap__address" | |
71 | 71 | ||
72 | - | let wxSwapAddressOption = match getString( | |
72 | + | let wxSwapAddressOption = match getString(factoryAddress, kWxSwapAddress) { | |
73 | 73 | case s: String => | |
74 | 74 | addressFromString(s) | |
75 | 75 | case _: Unit => | |
76 | 76 | unit | |
77 | 77 | case _ => | |
78 | 78 | throw("Match error") | |
79 | 79 | } | |
80 | 80 | ||
81 | 81 | let wxSwapAddress = valueOrErrorMessage(wxSwapAddressOption, wrapErr("invalid wx swap address")) | |
82 | 82 | ||
83 | 83 | let shutdown = valueOrElse(getBoolean(factoryAddress, kShutdown), false) | |
84 | 84 | ||
85 | 85 | let lastEmptyIndex = valueOrElse(getInteger(factoryAddress, kLastEmptyPoolIndex), 0) | |
86 | 86 | ||
87 | 87 | let firstEmptyIndex = valueOrElse(getInteger(factoryAddress, kFirstEmptyPoolIndex), 0) | |
88 | 88 | ||
89 | 89 | let listingVolume = valueOrElse(getInteger(factoryAddress, kListingVolume), 0) | |
90 | 90 | ||
91 | 91 | let creationFee = valueOrElse(getInteger(factoryAddress, kCreationFee), 0) | |
92 | 92 | ||
93 | 93 | let poolContractHash = getBinary(factoryAddress, kPoolContractHash) | |
94 | 94 | ||
95 | 95 | func parseAssetId (input) = if ((input == wavesString)) | |
96 | 96 | then unit | |
97 | 97 | else fromBase58String(input) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func assetIdToString (input) = if ((input == unit)) | |
101 | 101 | then wavesString | |
102 | 102 | else toBase58String(value(input)) | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func mustAddress (caller,address) = if ((caller == address)) | |
106 | 106 | then true | |
107 | 107 | else throwErr("permission denied") | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func mustThis (caller) = mustAddress(caller, this) | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | func mustFactory (caller) = mustAddress(caller, factoryAddress) | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func checkContractScript (address) = match poolContractHash { | |
117 | 117 | case hash: ByteVector => | |
118 | 118 | (scriptHash(address) == hash) | |
119 | 119 | case _ => | |
120 | 120 | true | |
121 | 121 | } | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func isPoolExists (poolAddress) = isDefined(getInteger(factoryAddress, kPoolIndexFromAddress(poolAddress))) | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func getPoolId (poolAddress) = valueOrErrorMessage(getInteger(factoryAddress, kPoolIndexFromAddress(poolAddress)), "pool doesn't exists") | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func isPoolTargetReached (poolAddress) = (valueOrElse(getInteger(factoryAddress, kPoolStatus(getPoolId(poolAddress))), -1) == STATUS_TARGET_REACHED) | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | @Callable(i) | |
134 | 134 | func init (factoryAddressStr) = { | |
135 | 135 | let checkCaller = mustThis(i.caller) | |
136 | 136 | if ((checkCaller == checkCaller)) | |
137 | 137 | then [StringEntry(kFactoryAddress, factoryAddressStr)] | |
138 | 138 | else throw("Strict value is not equal to itself.") | |
139 | 139 | } | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | ||
143 | 143 | @Callable(i) | |
144 | 144 | func addEmptyPool (callerPublicKey,args) = { | |
145 | 145 | let newPoolAddress = addressFromPublicKey(callerPublicKey) | |
146 | 146 | let newPoolIndex = (lastEmptyIndex + 1) | |
147 | 147 | let checks = [if (!(shutdown)) | |
148 | 148 | then true | |
149 | 149 | else throwErr("not allowed (shutdown)"), if (checkContractScript(newPoolAddress)) | |
150 | 150 | then true | |
151 | 151 | else throwErr("pool script is not allowed"), if (!(isPoolExists(newPoolAddress))) | |
152 | 152 | then true | |
153 | 153 | else throwErr("pool address is already registered")] | |
154 | 154 | if ((checks == checks)) | |
155 | 155 | then { | |
156 | 156 | 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)] | |
157 | 157 | $Tuple2(nil, factoryActions) | |
158 | 158 | } | |
159 | 159 | else throw("Strict value is not equal to itself.") | |
160 | 160 | } | |
161 | 161 | ||
162 | 162 | ||
163 | 163 | ||
164 | 164 | @Callable(i) | |
165 | 165 | func createPool (callerPublicKey,args) = { | |
166 | 166 | let minPayment = (listingVolume + creationFee) | |
167 | 167 | let checks = [if (!(shutdown)) | |
168 | 168 | then true | |
169 | 169 | else throwErr("Temporary shutdown"), mustFactory(i.caller), if (((lastEmptyIndex - firstEmptyIndex) > 0)) | |
170 | 170 | then true | |
171 | 171 | else throwErr("No empty pool available"), if ((i.payments[0].assetId == unit)) | |
172 | 172 | then true | |
173 | 173 | else throwErr("Payment should be in WAVES"), if ((i.payments[0].amount >= minPayment)) | |
174 | 174 | then true | |
175 | 175 | else throwErr((("Payment should be greater or equal " + toString(minPayment)) + " WAVELET")), if (isDefined(args[0])) | |
176 | 176 | then true | |
177 | 177 | else throwErr("Token name is not provided"), if (isDefined(args[1])) | |
178 | 178 | then true | |
179 | 179 | else throwErr("Token description is not provided"), if (isDefined(args[2])) | |
180 | 180 | then true | |
181 | 181 | else throwErr("Token quantity is not provided"), if ((parseInt(args[2]) != unit)) | |
182 | 182 | then true | |
183 | 183 | else throwErr("Token quantity should be a number")] | |
184 | 184 | if ((checks == checks)) | |
185 | 185 | then { | |
186 | 186 | let poolIndex = (firstEmptyIndex + 1) | |
187 | 187 | let poolAddressString = getStringValue(factoryAddress, kPoolAddressFromIndex(poolIndex)) | |
188 | 188 | let poolAddress = addressFromStringValue(poolAddressString) | |
189 | 189 | let callerAddress = addressFromPublicKey(callerPublicKey) | |
190 | 190 | let poolDomain = take(poolAddressString, 8) | |
191 | 191 | let poolOwner = toString(callerAddress) | |
192 | 192 | let tokenName = args[0] | |
193 | 193 | let tokenDesc = args[1] | |
194 | 194 | let tokenQuantity = args[2] | |
195 | 195 | let initPoolInvoke = invoke(factoryAddress, "initPoolInvoke", [poolAddressString, [poolDomain, poolOwner, tokenName, tokenDesc, tokenQuantity]], [AttachedPayment(i.payments[0].assetId, i.payments[0].amount)]) | |
196 | 196 | if ((initPoolInvoke == initPoolInvoke)) | |
197 | 197 | then { | |
198 | 198 | let factoryActions = [invoke(factoryAddress, "integerEntry", [kFirstEmptyPoolIndex, poolIndex], nil), invoke(factoryAddress, "integerEntry", [kPoolStatus(poolIndex), STATUS_READY], nil)] | |
199 | 199 | $Tuple2(nil, factoryActions) | |
200 | 200 | } | |
201 | 201 | else throw("Strict value is not equal to itself.") | |
202 | 202 | } | |
203 | 203 | else throw("Strict value is not equal to itself.") | |
204 | 204 | } | |
205 | 205 | ||
206 | 206 | ||
207 | 207 | ||
208 | 208 | @Callable(i) | |
209 | 209 | func notifyStatusUpdate (callerPublicKey,args) = { | |
210 | 210 | let poolAddress = addressFromPublicKey(callerPublicKey) | |
211 | 211 | let checks = [if (isPoolExists(poolAddress)) | |
212 | 212 | then true | |
213 | 213 | else throwErr("pool not found"), mustFactory(i.caller)] | |
214 | 214 | if ((checks == checks)) | |
215 | 215 | then { | |
216 | 216 | let poolIndex = getIntegerValue(factoryAddress, kPoolIndexFromAddress(poolAddress)) | |
217 | 217 | let newStatus = parseIntValue(args[0]) | |
218 | 218 | let factoryActions = [invoke(factoryAddress, "integerEntry", [kPoolStatus(poolIndex), newStatus], nil)] | |
219 | 219 | $Tuple2(nil, factoryActions) | |
220 | 220 | } | |
221 | 221 | else throw("Strict value is not equal to itself.") | |
222 | 222 | } | |
223 | 223 | ||
224 | 224 | ||
225 | 225 | ||
226 | 226 | @Callable(i) | |
227 | 227 | func swapREADONLY (callerPublicKey,args) = { | |
228 | 228 | let poolAddress = addressFromStringValue(args[0]) | |
229 | 229 | let amountAssetIdString = args[1] | |
230 | 230 | let priceAssetIdString = args[2] | |
231 | 231 | let amount = parseIntValue(args[3]) | |
232 | 232 | let checks = [if (!(shutdown)) | |
233 | 233 | then true | |
234 | 234 | else throwErr("Temporary shutdown"), mustFactory(i.caller)] | |
235 | 235 | if ((checks == checks)) | |
236 | 236 | then if (isPoolTargetReached(poolAddress)) | |
237 | 237 | then { | |
238 | 238 | let wxSwapResult = { | |
239 | 239 | let @ = invoke(wxSwapAddress, "swapCalculateREADONLY", [amount, amountAssetIdString, priceAssetIdString], nil) | |
240 | 240 | if ($isInstanceOf(@, "Int")) | |
241 | 241 | then @ | |
242 | 242 | else throw(($getType(@) + " couldn't be cast to Int")) | |
243 | 243 | } | |
244 | 244 | $Tuple2(nil, wxSwapResult) | |
245 | 245 | } | |
246 | 246 | else { | |
247 | 247 | let poolSwapResult = { | |
248 | 248 | let @ = invoke(poolAddress, "swapReadOnly", [amountAssetIdString, priceAssetIdString, amount], nil) | |
249 | 249 | if ($isInstanceOf(@, "Int")) | |
250 | 250 | then @ | |
251 | 251 | else throw(($getType(@) + " couldn't be cast to Int")) | |
252 | 252 | } | |
253 | 253 | $Tuple2(nil, poolSwapResult) | |
254 | 254 | } | |
255 | 255 | else throw("Strict value is not equal to itself.") | |
256 | 256 | } | |
257 | 257 | ||
258 | 258 | ||
259 | 259 | @Verifier(tx) | |
260 | 260 | func verify () = { | |
261 | 261 | let keyAdminAddressList = "%s__adminAddressList" | |
262 | 262 | let keyAllowedTxId = "%s__txId" | |
263 | 263 | let adminList = split(valueOrElse(getString(factoryAddress, keyAdminAddressList), ""), "__") | |
264 | 264 | let byOwner = if ((size(adminList) >= 3)) | |
265 | 265 | then false | |
266 | 266 | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
267 | 267 | let byAdmins = (tx.id == fromBase58String(valueOrElse(getString(factoryAddress, keyAllowedTxId), ""))) | |
268 | 268 | if (byAdmins) | |
269 | 269 | then true | |
270 | 270 | else byOwner | |
271 | 271 | } | |
272 | 272 |
github/deemru/w8io/169f3d6 66.53 ms ◑