tx · 5LWRgKxspmWRZ5VApBsmk7A3vWPYYNiVPVnfrbFocqcg 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh: -0.01400000 Waves 2023.05.04 12:23 [2562827] smart account 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh > SELF 0.00000000 Waves
{ "type": 13, "id": "5LWRgKxspmWRZ5VApBsmk7A3vWPYYNiVPVnfrbFocqcg", "fee": 1400000, "feeAssetId": null, "timestamp": 1683192278603, "version": 2, "chainId": 84, "sender": "3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh", "senderPublicKey": "Ap7CkWd6fzBU34kGo4GJJzC5q4qWXuLVunzE25PchdGS", "proofs": [ "667g779y62Cz61LkXWvF2GbYF9t5rmZzCHUokaqiUrwMBTkpzAu9krNM6fsZrzdyz2ctWZb54oF3XhDMyfDbT7Y2" ], "script": "base64:BgLiEAgCEgkKBwgICBgBCAESABIAEggKBggICAgICBIDCgEYEgMKAQgSABIAEgQKAggIIhBjb250cmFjdEZpbGVuYW1lIgNTRVAiDHdhdmVzQXNzZXRJZCIHVkxUUE9PTCIIU1RCTFBPT0wiEWludmFsaWRQcmljZUFzc2V0Igd3cmFwRXJyIgNtc2ciCHRocm93RXJyIgd0aHJvd1BEIhR0aHJvd0NyZWF0ZU5vdENhbGxlZCIRdGhyb3dZb3VOb3RJc3N1ZXIiD3Rocm93UG9vbEV4aXN0cyIVdGhyb3dBc3NldE5vdFZlcmlmaWVkIhZ0aHJvd0ludmFsaWRQcmljZUFzc2V0IhR0aHJvd0ludmFsaWRGZWVBc3NldCIXdGhyb3dJbnZhbGlkQW1vdW50QXNzZXQiEnRocm93SW52YWxpZFN0YXR1cyIfdGhyb3dDYW5BY3RpdmF0ZU9ubHlQZW5kaW5nUG9vbCIddGhyb3dGYWN0b3J5UmV0dXJuZWROb3RTdHJpbmciHHRocm93SW52YWxpZFByaWNlQXNzZXRBbW91bnQiD3Rocm93SW52YWxpZEZlZSIVdGhyb3dJ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aWwJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4CYW8BE3ByaWNlQXNzZXRzUkVBRE9OTFkACQCUCgIFA25pbAkBAmFhAQkAoggBCQEBWAACYW8BDnN0YXR1c1JFQURPTkxZAgFCAUMEAmFBBAJhYwkAoggBCQEBQQIFAUIFAUMDCQABAgUCYWMCBlN0cmluZwQCYWQFAmFjBQJhZAUEdW5pdAkAlAoCBQNuaWwFAmFBAQJiRQECYkYABAJiRwQCYWMJAQJhbAADCQABAgUCYWMCCkJ5dGVWZWN0b3IEAmFwBQJhYwUCYXADCQABAgUCYWMCBFVuaXQIBQJiRQ9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgkA9AMDCAUCYkUJYm9keUJ5dGVzCQCRAwIIBQJiRQZwcm9vZnMAAAUCYkd7GB8p", "height": 2562827, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Ea32eC29rPLKgGsdNAzU1pGQqq6z88yrJ6Sj8AMF8mYZ Next: 5ifMM8dPiZ7dWFGqw4TSnFr2dnkDQrVkRAbNxZVp7YsU Diff:
Old | New | Differences | |
---|---|---|---|
6 | 6 | let SEP = "__" | |
7 | 7 | ||
8 | 8 | let wavesAssetId = "WAVES" | |
9 | + | ||
10 | + | let VLTPOOL = "VLTPOOL" | |
11 | + | ||
12 | + | let STBLPOOL = "STBLPOOL" | |
9 | 13 | ||
10 | 14 | let invalidPriceAsset = "Invalid price asset" | |
11 | 15 | ||
107 | 111 | ||
108 | 112 | ||
109 | 113 | func keyHeight (amountAssetId,priceAssetId) = makeString(["%s%s%s", "height", amountAssetId, priceAssetId], SEP) | |
114 | + | ||
115 | + | ||
116 | + | func keyPoolType (amountAssetId,priceAssetId) = makeString(["%s%s%s", "poolType", amountAssetId, priceAssetId], SEP) | |
110 | 117 | ||
111 | 118 | ||
112 | 119 | func keyFeeAssetId () = makeString(["%s", "feeAssetId"], SEP) | |
217 | 224 | func validStatus (status) = containsElement(statuses, status) | |
218 | 225 | ||
219 | 226 | ||
220 | - | @Callable(i) | |
221 | - | func constructor (factoryV2Address,assetsStoreAddress,emissionAddress,priceAssetsMinAmount,amountAssetMinAmount,feeAssetId,feeAmount) = { | |
222 | - | let checkCaller = mustManager(i) | |
223 | - | if ((checkCaller == checkCaller)) | |
224 | - | then [StringEntry(keyFactoryContract(), factoryV2Address), StringEntry(keyAssetsStoreContract(), assetsStoreAddress), StringEntry(keyEmissionContract(), emissionAddress), StringEntry(keyPriceAssetsMinAmount(), makeString(priceAssetsMinAmount, SEP)), IntegerEntry(keyAmountAssetMinAmount(), amountAssetMinAmount), StringEntry(keyFeeAssetId(), feeAssetId), IntegerEntry(keyFeeAmount(), feeAmount)] | |
225 | - | else throw("Strict value is not equal to itself.") | |
226 | - | } | |
227 | - | ||
228 | - | ||
229 | - | ||
230 | - | @Callable(i) | |
231 | - | func create () = { | |
227 | + | func _create (i,poolType) = { | |
232 | 228 | let asset1Payment = value(i.payments[0]) | |
233 | 229 | let asset2Payment = value(i.payments[1]) | |
234 | 230 | let feeAssetPayment = value(i.payments[2]) | |
235 | - | let $ | |
236 | - | let asset1Id = $ | |
237 | - | let asset1Info = $ | |
238 | - | let $ | |
239 | - | let asset2Id = $ | |
240 | - | let asset2Info = $ | |
241 | - | let $ | |
242 | - | let feeAssetId = $ | |
243 | - | let feeAssetInfo = $ | |
231 | + | let $t064076464 = getIdAndInfo(asset1Payment) | |
232 | + | let asset1Id = $t064076464._1 | |
233 | + | let asset1Info = $t064076464._2 | |
234 | + | let $t064676524 = getIdAndInfo(asset2Payment) | |
235 | + | let asset2Id = $t064676524._1 | |
236 | + | let asset2Info = $t064676524._2 | |
237 | + | let $t065276590 = getIdAndInfo(feeAssetPayment) | |
238 | + | let feeAssetId = $t065276590._1 | |
239 | + | let feeAssetInfo = $t065276590._2 | |
244 | 240 | let priceAssetsList = stringOptionToList(getString(factoryContract, keyPriceAssets())) | |
245 | 241 | let checkAssetsNotEqual = if ((asset1Id != asset2Id)) | |
246 | 242 | then true | |
247 | 243 | else throwInvalidAssetPair() | |
248 | 244 | if ((checkAssetsNotEqual == checkAssetsNotEqual)) | |
249 | 245 | then { | |
250 | - | let $ | |
246 | + | let $t067647225 = if (if (isManager(i)) | |
251 | 247 | then true | |
252 | 248 | else if (containsElement(priceAssetsList, asset2Id)) | |
253 | 249 | then isVerified(asset1Id) | |
258 | 254 | else false) | |
259 | 255 | then $Tuple4(asset2Id, asset2Payment.amount, asset1Id, asset1Payment.amount) | |
260 | 256 | else throwInvalidAssetPair() | |
261 | - | let amountAssetId = $ | |
262 | - | let amountAssetAmount = $ | |
263 | - | let priceAssetId = $ | |
264 | - | let priceAssetAmount = $ | |
257 | + | let amountAssetId = $t067647225._1 | |
258 | + | let amountAssetAmount = $t067647225._2 | |
259 | + | let priceAssetId = $t067647225._3 | |
260 | + | let priceAssetAmount = $t067647225._4 | |
265 | 261 | let managerPriceAssetMinAmount = 1 | |
266 | 262 | let priceAssetMinAmount = if (isManager(i)) | |
267 | 263 | then managerPriceAssetMinAmount | |
306 | 302 | then invoke(emissionContract, "burn", nil, [AttachedPayment(fromBase58String(feeAssetId), feeAssetPayment.amount)]) | |
307 | 303 | else unit | |
308 | 304 | if ((burnEmissionInv == burnEmissionInv)) | |
309 | - | then [BooleanEntry(keyCreateCalled(amountAssetId, priceAssetId), true), StringEntry(keyCreateCaller(amountAssetId, priceAssetId), toString(i.caller)), IntegerEntry(keyLastIndex(), curIndex), StringEntry(keySuffix(amountAssetId, priceAssetId), (toString(curIndex) + indexSuffix)), IntegerEntry(keyHeight(amountAssetId, priceAssetId), height), StringEntry(keyStatus(amountAssetId, priceAssetId), statusPending), IntegerEntry(keyAmountAssetAmount(amountAssetId, priceAssetId), amountAssetAmount), IntegerEntry(keyPriceAssetAmount(amountAssetId, priceAssetId), priceAssetAmount)] | |
305 | + | then [BooleanEntry(keyCreateCalled(amountAssetId, priceAssetId), true), StringEntry(keyCreateCaller(amountAssetId, priceAssetId), toString(i.caller)), IntegerEntry(keyLastIndex(), curIndex), StringEntry(keySuffix(amountAssetId, priceAssetId), (toString(curIndex) + indexSuffix)), IntegerEntry(keyHeight(amountAssetId, priceAssetId), height), StringEntry(keyStatus(amountAssetId, priceAssetId), statusPending), IntegerEntry(keyAmountAssetAmount(amountAssetId, priceAssetId), amountAssetAmount), IntegerEntry(keyPriceAssetAmount(amountAssetId, priceAssetId), priceAssetAmount), StringEntry(keyPoolType(amountAssetId, priceAssetId), poolType)] | |
310 | 306 | else throw("Strict value is not equal to itself.") | |
311 | 307 | } | |
312 | 308 | else throw("Strict value is not equal to itself.") | |
313 | 309 | } | |
314 | 310 | else throw("Strict value is not equal to itself.") | |
315 | 311 | } | |
312 | + | ||
313 | + | ||
314 | + | @Callable(i) | |
315 | + | func constructor (factoryV2Address,assetsStoreAddress,emissionAddress,priceAssetsMinAmount,amountAssetMinAmount,feeAssetId,feeAmount) = { | |
316 | + | let checkCaller = mustManager(i) | |
317 | + | if ((checkCaller == checkCaller)) | |
318 | + | then [StringEntry(keyFactoryContract(), factoryV2Address), StringEntry(keyAssetsStoreContract(), assetsStoreAddress), StringEntry(keyEmissionContract(), emissionAddress), StringEntry(keyPriceAssetsMinAmount(), makeString(priceAssetsMinAmount, SEP)), IntegerEntry(keyAmountAssetMinAmount(), amountAssetMinAmount), StringEntry(keyFeeAssetId(), feeAssetId), IntegerEntry(keyFeeAmount(), feeAmount)] | |
319 | + | else throw("Strict value is not equal to itself.") | |
320 | + | } | |
321 | + | ||
322 | + | ||
323 | + | ||
324 | + | @Callable(i) | |
325 | + | func create () = _create(i, VLTPOOL) | |
326 | + | ||
327 | + | ||
328 | + | ||
329 | + | @Callable(i) | |
330 | + | func createStable () = _create(i, STBLPOOL) | |
316 | 331 | ||
317 | 332 | ||
318 | 333 | ||
325 | 340 | else throwCanActivateOnlyPendingPool()] | |
326 | 341 | if ((checks == checks)) | |
327 | 342 | then { | |
328 | - | let activateNewPoolInv = invoke(factoryContract, "activateNewPool", [poolAddress, amountAssetId, priceAssetId, ((amountAssetTicker + priceAssetTicker) + "LP"), (((amountAssetTicker + "/") + priceAssetTicker) + " pool liquidity provider token"), 0, "VLTPOOL", logo], nil) | |
343 | + | let poolTypeOption = getString(this, keyPoolType(amountAssetId, priceAssetId)) | |
344 | + | let activateNewPoolInv = invoke(factoryContract, "activateNewPool", [poolAddress, amountAssetId, priceAssetId, ((amountAssetTicker + priceAssetTicker) + "LP"), (((amountAssetTicker + "/") + priceAssetTicker) + " pool liquidity provider token"), 0, if ((poolTypeOption == unit)) | |
345 | + | then "VLTPOOL" | |
346 | + | else value(poolTypeOption), logo], nil) | |
329 | 347 | if ((activateNewPoolInv == activateNewPoolInv)) | |
330 | 348 | then { | |
331 | 349 | let lpAssetId = match activateNewPoolInv { |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let contractFilename = "user_pools.ride" | |
5 | 5 | ||
6 | 6 | let SEP = "__" | |
7 | 7 | ||
8 | 8 | let wavesAssetId = "WAVES" | |
9 | + | ||
10 | + | let VLTPOOL = "VLTPOOL" | |
11 | + | ||
12 | + | let STBLPOOL = "STBLPOOL" | |
9 | 13 | ||
10 | 14 | let invalidPriceAsset = "Invalid price asset" | |
11 | 15 | ||
12 | 16 | func wrapErr (msg) = makeString([contractFilename, ": ", msg], "") | |
13 | 17 | ||
14 | 18 | ||
15 | 19 | func throwErr (msg) = throw(wrapErr(msg)) | |
16 | 20 | ||
17 | 21 | ||
18 | 22 | func throwPD () = throwErr("Permission denied") | |
19 | 23 | ||
20 | 24 | ||
21 | 25 | func throwCreateNotCalled () = throwErr("Create is not called for assets pair") | |
22 | 26 | ||
23 | 27 | ||
24 | 28 | func throwYouNotIssuer () = throwErr("You are not amountAsset issuer") | |
25 | 29 | ||
26 | 30 | ||
27 | 31 | func throwPoolExists () = throwErr("Pool with such assets already exists") | |
28 | 32 | ||
29 | 33 | ||
30 | 34 | func throwAssetNotVerified () = throwErr("Asset is not verified") | |
31 | 35 | ||
32 | 36 | ||
33 | 37 | func throwInvalidPriceAsset () = throwErr(invalidPriceAsset) | |
34 | 38 | ||
35 | 39 | ||
36 | 40 | func throwInvalidFeeAsset () = throwErr("Invalid fee asset") | |
37 | 41 | ||
38 | 42 | ||
39 | 43 | func throwInvalidAmountAsset () = throwErr("Invalid amount asset attached") | |
40 | 44 | ||
41 | 45 | ||
42 | 46 | func throwInvalidStatus () = throwErr("Invalid status") | |
43 | 47 | ||
44 | 48 | ||
45 | 49 | func throwCanActivateOnlyPendingPool () = throwErr("Can activate pool only in 'pending' status") | |
46 | 50 | ||
47 | 51 | ||
48 | 52 | func throwFactoryReturnedNotString () = throwErr("FactoryV2 returned not string") | |
49 | 53 | ||
50 | 54 | ||
51 | 55 | func throwInvalidPriceAssetAmount () = throwErr("invalid price asset amount") | |
52 | 56 | ||
53 | 57 | ||
54 | 58 | func throwInvalidFee () = throwErr("invalid fee") | |
55 | 59 | ||
56 | 60 | ||
57 | 61 | func throwInvalidAssetPair () = throwErr("invalid asset pair") | |
58 | 62 | ||
59 | 63 | ||
60 | 64 | func keyManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP) | |
61 | 65 | ||
62 | 66 | ||
63 | 67 | func keyPendingManagerPublicKey () = makeString(["%s", "pendingManagerPublicKey"], SEP) | |
64 | 68 | ||
65 | 69 | ||
66 | 70 | func keyAdminPubKeys () = makeString(["%s", "adminPubKeys"], SEP) | |
67 | 71 | ||
68 | 72 | ||
69 | 73 | func keyStatus (amountAssetId,priceAssetId) = makeString(["%s%s%s", "status", amountAssetId, priceAssetId], SEP) | |
70 | 74 | ||
71 | 75 | ||
72 | 76 | func keyFactoryContract () = makeString(["%s", "factoryContract"], SEP) | |
73 | 77 | ||
74 | 78 | ||
75 | 79 | func keyAssetsStoreContract () = makeString(["%s", "assetsStoreContract"], SEP) | |
76 | 80 | ||
77 | 81 | ||
78 | 82 | func keyEmissionContract () = makeString(["%s", "emissionContract"], SEP) | |
79 | 83 | ||
80 | 84 | ||
81 | 85 | func keySuffix (amountAssetId,priceAssetId) = makeString(["%s%s%s", "suffix", amountAssetId, priceAssetId], SEP) | |
82 | 86 | ||
83 | 87 | ||
84 | 88 | func keyLastIndex () = makeString(["%s", "lastIndex"], SEP) | |
85 | 89 | ||
86 | 90 | ||
87 | 91 | let indexSuffix = "u" | |
88 | 92 | ||
89 | 93 | let statusPending = "pending" | |
90 | 94 | ||
91 | 95 | let statusDeclined = "declined" | |
92 | 96 | ||
93 | 97 | let statusActive = "active" | |
94 | 98 | ||
95 | 99 | let statuses = [statusPending, statusDeclined, statusActive] | |
96 | 100 | ||
97 | 101 | func keyCreateCalled (amountAssetId,priceAssetId) = makeString(["%s%s%s", "createCalled", amountAssetId, priceAssetId], SEP) | |
98 | 102 | ||
99 | 103 | ||
100 | 104 | func keyCreateCaller (amountAssetId,priceAssetId) = makeString(["%s%s%s", "createCaller", amountAssetId, priceAssetId], SEP) | |
101 | 105 | ||
102 | 106 | ||
103 | 107 | func keyAmountAssetAmount (amountAssetId,priceAssetId) = makeString(["%s%s%s", "amountAssetAmount", amountAssetId, priceAssetId], SEP) | |
104 | 108 | ||
105 | 109 | ||
106 | 110 | func keyPriceAssetAmount (amountAssetId,priceAssetId) = makeString(["%s%s%s", "priceAssetAmount", amountAssetId, priceAssetId], SEP) | |
107 | 111 | ||
108 | 112 | ||
109 | 113 | func keyHeight (amountAssetId,priceAssetId) = makeString(["%s%s%s", "height", amountAssetId, priceAssetId], SEP) | |
114 | + | ||
115 | + | ||
116 | + | func keyPoolType (amountAssetId,priceAssetId) = makeString(["%s%s%s", "poolType", amountAssetId, priceAssetId], SEP) | |
110 | 117 | ||
111 | 118 | ||
112 | 119 | func keyFeeAssetId () = makeString(["%s", "feeAssetId"], SEP) | |
113 | 120 | ||
114 | 121 | ||
115 | 122 | func keyFeeAmount () = makeString(["%s", "feeAmount"], SEP) | |
116 | 123 | ||
117 | 124 | ||
118 | 125 | func keyAmountAssetMinAmount () = makeString(["%s", "amountAssetMinAmount"], SEP) | |
119 | 126 | ||
120 | 127 | ||
121 | 128 | func keyPriceAssetsMinAmount () = makeString(["%s", "priceAssetsMinAmount"], SEP) | |
122 | 129 | ||
123 | 130 | ||
124 | 131 | func keyPriceAssets () = makeString(["%s", "priceAssets"], SEP) | |
125 | 132 | ||
126 | 133 | ||
127 | 134 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " is not defined")) | |
128 | 135 | ||
129 | 136 | ||
130 | 137 | func stringOptionToList (stringOrUnit) = match stringOrUnit { | |
131 | 138 | case s: String => | |
132 | 139 | if ((size(s) == 0)) | |
133 | 140 | then nil | |
134 | 141 | else split(s, SEP) | |
135 | 142 | case _: Unit => | |
136 | 143 | nil | |
137 | 144 | case _ => | |
138 | 145 | throw("Match error") | |
139 | 146 | } | |
140 | 147 | ||
141 | 148 | ||
142 | 149 | let factoryContract = addressFromStringValue(getStringOrFail(keyFactoryContract())) | |
143 | 150 | ||
144 | 151 | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP) | |
145 | 152 | ||
146 | 153 | let votingEmissionContract = addressFromStringValue(valueOrErrorMessage(getString(factoryContract, keyVotingEmissionContract), wrapErr("voting emission contract address is required"))) | |
147 | 154 | ||
148 | 155 | let keyVotingEmissionCandidateContract = makeString(["%s", "votingEmissionCandidateContract"], SEP) | |
149 | 156 | ||
150 | 157 | let votingEmissionCandidateContract = addressFromStringValue(valueOrErrorMessage(getString(votingEmissionContract, keyVotingEmissionCandidateContract), wrapErr("voting emission candidate contract address is required"))) | |
151 | 158 | ||
152 | 159 | func isCreateCalled (amountAssetId,priceAssetId) = valueOrElse(getBoolean(keyCreateCalled(amountAssetId, priceAssetId)), false) | |
153 | 160 | ||
154 | 161 | ||
155 | 162 | func mustCreateCalled (amountAssetId,priceAssetId) = if (isCreateCalled(amountAssetId, priceAssetId)) | |
156 | 163 | then true | |
157 | 164 | else throwCreateNotCalled() | |
158 | 165 | ||
159 | 166 | ||
160 | 167 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
161 | 168 | case s: String => | |
162 | 169 | fromBase58String(s) | |
163 | 170 | case _: Unit => | |
164 | 171 | unit | |
165 | 172 | case _ => | |
166 | 173 | throw("Match error") | |
167 | 174 | } | |
168 | 175 | ||
169 | 176 | ||
170 | 177 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
171 | 178 | case s: String => | |
172 | 179 | fromBase58String(s) | |
173 | 180 | case _: Unit => | |
174 | 181 | unit | |
175 | 182 | case _ => | |
176 | 183 | throw("Match error") | |
177 | 184 | } | |
178 | 185 | ||
179 | 186 | ||
180 | 187 | func isManager (i) = match managerPublicKeyOrUnit() { | |
181 | 188 | case pk: ByteVector => | |
182 | 189 | (i.callerPublicKey == pk) | |
183 | 190 | case _: Unit => | |
184 | 191 | (i.caller == this) | |
185 | 192 | case _ => | |
186 | 193 | throw("Match error") | |
187 | 194 | } | |
188 | 195 | ||
189 | 196 | ||
190 | 197 | func mustManager (i) = if (isManager(i)) | |
191 | 198 | then true | |
192 | 199 | else throwPD() | |
193 | 200 | ||
194 | 201 | ||
195 | 202 | func mustAdmin (i) = { | |
196 | 203 | let adminPKs = stringOptionToList(getString(keyAdminPubKeys())) | |
197 | 204 | if (containsElement(adminPKs, toBase58String(i.callerPublicKey))) | |
198 | 205 | then true | |
199 | 206 | else mustManager(i) | |
200 | 207 | } | |
201 | 208 | ||
202 | 209 | ||
203 | 210 | func isVerified (assetId) = (valueOrElse(getInteger(addressFromStringValue(getStringOrFail(keyAssetsStoreContract())), (("status_<" + assetId) + ">")), 0) == 2) | |
204 | 211 | ||
205 | 212 | ||
206 | 213 | func getIdAndInfo (payment) = match payment.assetId { | |
207 | 214 | case id: ByteVector => | |
208 | 215 | let info = value(assetInfo(id)) | |
209 | 216 | $Tuple2(toBase58String(id), info) | |
210 | 217 | case _: Unit => | |
211 | 218 | $Tuple2(wavesAssetId, unit) | |
212 | 219 | case _ => | |
213 | 220 | throw("Match error") | |
214 | 221 | } | |
215 | 222 | ||
216 | 223 | ||
217 | 224 | func validStatus (status) = containsElement(statuses, status) | |
218 | 225 | ||
219 | 226 | ||
220 | - | @Callable(i) | |
221 | - | func constructor (factoryV2Address,assetsStoreAddress,emissionAddress,priceAssetsMinAmount,amountAssetMinAmount,feeAssetId,feeAmount) = { | |
222 | - | let checkCaller = mustManager(i) | |
223 | - | if ((checkCaller == checkCaller)) | |
224 | - | then [StringEntry(keyFactoryContract(), factoryV2Address), StringEntry(keyAssetsStoreContract(), assetsStoreAddress), StringEntry(keyEmissionContract(), emissionAddress), StringEntry(keyPriceAssetsMinAmount(), makeString(priceAssetsMinAmount, SEP)), IntegerEntry(keyAmountAssetMinAmount(), amountAssetMinAmount), StringEntry(keyFeeAssetId(), feeAssetId), IntegerEntry(keyFeeAmount(), feeAmount)] | |
225 | - | else throw("Strict value is not equal to itself.") | |
226 | - | } | |
227 | - | ||
228 | - | ||
229 | - | ||
230 | - | @Callable(i) | |
231 | - | func create () = { | |
227 | + | func _create (i,poolType) = { | |
232 | 228 | let asset1Payment = value(i.payments[0]) | |
233 | 229 | let asset2Payment = value(i.payments[1]) | |
234 | 230 | let feeAssetPayment = value(i.payments[2]) | |
235 | - | let $ | |
236 | - | let asset1Id = $ | |
237 | - | let asset1Info = $ | |
238 | - | let $ | |
239 | - | let asset2Id = $ | |
240 | - | let asset2Info = $ | |
241 | - | let $ | |
242 | - | let feeAssetId = $ | |
243 | - | let feeAssetInfo = $ | |
231 | + | let $t064076464 = getIdAndInfo(asset1Payment) | |
232 | + | let asset1Id = $t064076464._1 | |
233 | + | let asset1Info = $t064076464._2 | |
234 | + | let $t064676524 = getIdAndInfo(asset2Payment) | |
235 | + | let asset2Id = $t064676524._1 | |
236 | + | let asset2Info = $t064676524._2 | |
237 | + | let $t065276590 = getIdAndInfo(feeAssetPayment) | |
238 | + | let feeAssetId = $t065276590._1 | |
239 | + | let feeAssetInfo = $t065276590._2 | |
244 | 240 | let priceAssetsList = stringOptionToList(getString(factoryContract, keyPriceAssets())) | |
245 | 241 | let checkAssetsNotEqual = if ((asset1Id != asset2Id)) | |
246 | 242 | then true | |
247 | 243 | else throwInvalidAssetPair() | |
248 | 244 | if ((checkAssetsNotEqual == checkAssetsNotEqual)) | |
249 | 245 | then { | |
250 | - | let $ | |
246 | + | let $t067647225 = if (if (isManager(i)) | |
251 | 247 | then true | |
252 | 248 | else if (containsElement(priceAssetsList, asset2Id)) | |
253 | 249 | then isVerified(asset1Id) | |
254 | 250 | else false) | |
255 | 251 | then $Tuple4(asset1Id, asset1Payment.amount, asset2Id, asset2Payment.amount) | |
256 | 252 | else if (if (containsElement(priceAssetsList, asset1Id)) | |
257 | 253 | then isVerified(asset2Id) | |
258 | 254 | else false) | |
259 | 255 | then $Tuple4(asset2Id, asset2Payment.amount, asset1Id, asset1Payment.amount) | |
260 | 256 | else throwInvalidAssetPair() | |
261 | - | let amountAssetId = $ | |
262 | - | let amountAssetAmount = $ | |
263 | - | let priceAssetId = $ | |
264 | - | let priceAssetAmount = $ | |
257 | + | let amountAssetId = $t067647225._1 | |
258 | + | let amountAssetAmount = $t067647225._2 | |
259 | + | let priceAssetId = $t067647225._3 | |
260 | + | let priceAssetAmount = $t067647225._4 | |
265 | 261 | let managerPriceAssetMinAmount = 1 | |
266 | 262 | let priceAssetMinAmount = if (isManager(i)) | |
267 | 263 | then managerPriceAssetMinAmount | |
268 | 264 | else { | |
269 | 265 | let priceAssetsIndex = valueOrErrorMessage(indexOf(priceAssetsList, priceAssetId), invalidPriceAsset) | |
270 | 266 | value(parseInt(stringOptionToList(getString(keyPriceAssetsMinAmount()))[priceAssetsIndex])) | |
271 | 267 | } | |
272 | 268 | let lastIndex = valueOrElse(getInteger(keyLastIndex()), 0) | |
273 | 269 | let curIndex = (lastIndex + 1) | |
274 | 270 | let emissionContract = addressFromStringValue(getStringOrFail(keyEmissionContract())) | |
275 | 271 | let poolExists = { | |
276 | 272 | let @ = invoke(factoryContract, "poolExistsREADONLY", [amountAssetId, priceAssetId], nil) | |
277 | 273 | if ($isInstanceOf(@, "Boolean")) | |
278 | 274 | then @ | |
279 | 275 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
280 | 276 | } | |
281 | 277 | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
282 | 278 | then true | |
283 | 279 | else throwPoolExists(), if (!(poolExists)) | |
284 | 280 | then true | |
285 | 281 | else throwPoolExists(), if (if (isManager(i)) | |
286 | 282 | then true | |
287 | 283 | else (getString(keyFeeAssetId()) == feeAssetId)) | |
288 | 284 | then true | |
289 | 285 | else throwInvalidFeeAsset(), if (if (isManager(i)) | |
290 | 286 | then true | |
291 | 287 | else (amountAssetAmount >= getIntegerValue(keyAmountAssetMinAmount()))) | |
292 | 288 | then true | |
293 | 289 | else throwInvalidAmountAsset(), if (if (isManager(i)) | |
294 | 290 | then true | |
295 | 291 | else (priceAssetAmount >= priceAssetMinAmount)) | |
296 | 292 | then true | |
297 | 293 | else throwInvalidPriceAssetAmount(), if (if (isManager(i)) | |
298 | 294 | then true | |
299 | 295 | else (feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
300 | 296 | then true | |
301 | 297 | else throwInvalidFee()] | |
302 | 298 | if ((checks == checks)) | |
303 | 299 | then { | |
304 | 300 | let paymentsWithFeeSize = 3 | |
305 | 301 | let burnEmissionInv = if ((size(i.payments) >= paymentsWithFeeSize)) | |
306 | 302 | then invoke(emissionContract, "burn", nil, [AttachedPayment(fromBase58String(feeAssetId), feeAssetPayment.amount)]) | |
307 | 303 | else unit | |
308 | 304 | if ((burnEmissionInv == burnEmissionInv)) | |
309 | - | then [BooleanEntry(keyCreateCalled(amountAssetId, priceAssetId), true), StringEntry(keyCreateCaller(amountAssetId, priceAssetId), toString(i.caller)), IntegerEntry(keyLastIndex(), curIndex), StringEntry(keySuffix(amountAssetId, priceAssetId), (toString(curIndex) + indexSuffix)), IntegerEntry(keyHeight(amountAssetId, priceAssetId), height), StringEntry(keyStatus(amountAssetId, priceAssetId), statusPending), IntegerEntry(keyAmountAssetAmount(amountAssetId, priceAssetId), amountAssetAmount), IntegerEntry(keyPriceAssetAmount(amountAssetId, priceAssetId), priceAssetAmount)] | |
305 | + | then [BooleanEntry(keyCreateCalled(amountAssetId, priceAssetId), true), StringEntry(keyCreateCaller(amountAssetId, priceAssetId), toString(i.caller)), IntegerEntry(keyLastIndex(), curIndex), StringEntry(keySuffix(amountAssetId, priceAssetId), (toString(curIndex) + indexSuffix)), IntegerEntry(keyHeight(amountAssetId, priceAssetId), height), StringEntry(keyStatus(amountAssetId, priceAssetId), statusPending), IntegerEntry(keyAmountAssetAmount(amountAssetId, priceAssetId), amountAssetAmount), IntegerEntry(keyPriceAssetAmount(amountAssetId, priceAssetId), priceAssetAmount), StringEntry(keyPoolType(amountAssetId, priceAssetId), poolType)] | |
310 | 306 | else throw("Strict value is not equal to itself.") | |
311 | 307 | } | |
312 | 308 | else throw("Strict value is not equal to itself.") | |
313 | 309 | } | |
314 | 310 | else throw("Strict value is not equal to itself.") | |
315 | 311 | } | |
312 | + | ||
313 | + | ||
314 | + | @Callable(i) | |
315 | + | func constructor (factoryV2Address,assetsStoreAddress,emissionAddress,priceAssetsMinAmount,amountAssetMinAmount,feeAssetId,feeAmount) = { | |
316 | + | let checkCaller = mustManager(i) | |
317 | + | if ((checkCaller == checkCaller)) | |
318 | + | then [StringEntry(keyFactoryContract(), factoryV2Address), StringEntry(keyAssetsStoreContract(), assetsStoreAddress), StringEntry(keyEmissionContract(), emissionAddress), StringEntry(keyPriceAssetsMinAmount(), makeString(priceAssetsMinAmount, SEP)), IntegerEntry(keyAmountAssetMinAmount(), amountAssetMinAmount), StringEntry(keyFeeAssetId(), feeAssetId), IntegerEntry(keyFeeAmount(), feeAmount)] | |
319 | + | else throw("Strict value is not equal to itself.") | |
320 | + | } | |
321 | + | ||
322 | + | ||
323 | + | ||
324 | + | @Callable(i) | |
325 | + | func create () = _create(i, VLTPOOL) | |
326 | + | ||
327 | + | ||
328 | + | ||
329 | + | @Callable(i) | |
330 | + | func createStable () = _create(i, STBLPOOL) | |
316 | 331 | ||
317 | 332 | ||
318 | 333 | ||
319 | 334 | @Callable(i) | |
320 | 335 | func activate (poolAddress,amountAssetId,amountAssetTicker,priceAssetId,priceAssetTicker,logo) = { | |
321 | 336 | let checks = [mustAdmin(i), if (isCreateCalled(amountAssetId, priceAssetId)) | |
322 | 337 | then true | |
323 | 338 | else throwCreateNotCalled(), if ((value(getString(keyStatus(amountAssetId, priceAssetId))) == statusPending)) | |
324 | 339 | then true | |
325 | 340 | else throwCanActivateOnlyPendingPool()] | |
326 | 341 | if ((checks == checks)) | |
327 | 342 | then { | |
328 | - | let activateNewPoolInv = invoke(factoryContract, "activateNewPool", [poolAddress, amountAssetId, priceAssetId, ((amountAssetTicker + priceAssetTicker) + "LP"), (((amountAssetTicker + "/") + priceAssetTicker) + " pool liquidity provider token"), 0, "VLTPOOL", logo], nil) | |
343 | + | let poolTypeOption = getString(this, keyPoolType(amountAssetId, priceAssetId)) | |
344 | + | let activateNewPoolInv = invoke(factoryContract, "activateNewPool", [poolAddress, amountAssetId, priceAssetId, ((amountAssetTicker + priceAssetTicker) + "LP"), (((amountAssetTicker + "/") + priceAssetTicker) + " pool liquidity provider token"), 0, if ((poolTypeOption == unit)) | |
345 | + | then "VLTPOOL" | |
346 | + | else value(poolTypeOption), logo], nil) | |
329 | 347 | if ((activateNewPoolInv == activateNewPoolInv)) | |
330 | 348 | then { | |
331 | 349 | let lpAssetId = match activateNewPoolInv { | |
332 | 350 | case id: String => | |
333 | 351 | id | |
334 | 352 | case _ => | |
335 | 353 | throwFactoryReturnedNotString() | |
336 | 354 | } | |
337 | 355 | if ((lpAssetId == lpAssetId)) | |
338 | 356 | then { | |
339 | 357 | let beforePut = assetBalance(this, fromBase58String(lpAssetId)) | |
340 | 358 | if ((beforePut == beforePut)) | |
341 | 359 | then { | |
342 | 360 | let put = invoke(addressFromStringValue(poolAddress), "put", [0, false], [AttachedPayment(if ((amountAssetId == "WAVES")) | |
343 | 361 | then unit | |
344 | 362 | else fromBase58String(amountAssetId), value(getInteger(keyAmountAssetAmount(amountAssetId, priceAssetId)))), AttachedPayment(if ((priceAssetId == "WAVES")) | |
345 | 363 | then unit | |
346 | 364 | else fromBase58String(priceAssetId), value(getInteger(keyPriceAssetAmount(amountAssetId, priceAssetId))))]) | |
347 | 365 | if ((put == put)) | |
348 | 366 | then { | |
349 | 367 | let afterPut = assetBalance(this, fromBase58String(lpAssetId)) | |
350 | 368 | if ((afterPut == afterPut)) | |
351 | 369 | then { | |
352 | 370 | let user = value(addressFromString(value(getString(keyCreateCaller(amountAssetId, priceAssetId))))) | |
353 | 371 | let res = invoke(votingEmissionCandidateContract, "approve", [amountAssetId, priceAssetId], nil) | |
354 | 372 | if ((res == res)) | |
355 | 373 | then [StringEntry(keyStatus(amountAssetId, priceAssetId), statusActive), ScriptTransfer(user, (afterPut - beforePut), fromBase58String(lpAssetId))] | |
356 | 374 | else throw("Strict value is not equal to itself.") | |
357 | 375 | } | |
358 | 376 | else throw("Strict value is not equal to itself.") | |
359 | 377 | } | |
360 | 378 | else throw("Strict value is not equal to itself.") | |
361 | 379 | } | |
362 | 380 | else throw("Strict value is not equal to itself.") | |
363 | 381 | } | |
364 | 382 | else throw("Strict value is not equal to itself.") | |
365 | 383 | } | |
366 | 384 | else throw("Strict value is not equal to itself.") | |
367 | 385 | } | |
368 | 386 | else throw("Strict value is not equal to itself.") | |
369 | 387 | } | |
370 | 388 | ||
371 | 389 | ||
372 | 390 | ||
373 | 391 | @Callable(i) | |
374 | 392 | func setAdmins (adminPubKeys) = { | |
375 | 393 | let checkCaller = mustManager(i) | |
376 | 394 | if ((checkCaller == checkCaller)) | |
377 | 395 | then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))] | |
378 | 396 | else throw("Strict value is not equal to itself.") | |
379 | 397 | } | |
380 | 398 | ||
381 | 399 | ||
382 | 400 | ||
383 | 401 | @Callable(i) | |
384 | 402 | func setManager (pendingManagerPublicKey) = { | |
385 | 403 | let checkCaller = mustManager(i) | |
386 | 404 | if ((checkCaller == checkCaller)) | |
387 | 405 | then { | |
388 | 406 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
389 | 407 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
390 | 408 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
391 | 409 | else throw("Strict value is not equal to itself.") | |
392 | 410 | } | |
393 | 411 | else throw("Strict value is not equal to itself.") | |
394 | 412 | } | |
395 | 413 | ||
396 | 414 | ||
397 | 415 | ||
398 | 416 | @Callable(i) | |
399 | 417 | func confirmManager () = { | |
400 | 418 | let pm = pendingManagerPublicKeyOrUnit() | |
401 | 419 | let hasPM = if (isDefined(pm)) | |
402 | 420 | then true | |
403 | 421 | else throw("No pending manager") | |
404 | 422 | if ((hasPM == hasPM)) | |
405 | 423 | then { | |
406 | 424 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
407 | 425 | then true | |
408 | 426 | else throw("You are not pending manager") | |
409 | 427 | if ((checkPM == checkPM)) | |
410 | 428 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
411 | 429 | else throw("Strict value is not equal to itself.") | |
412 | 430 | } | |
413 | 431 | else throw("Strict value is not equal to itself.") | |
414 | 432 | } | |
415 | 433 | ||
416 | 434 | ||
417 | 435 | ||
418 | 436 | @Callable(i) | |
419 | 437 | func priceAssetsREADONLY () = $Tuple2(nil, stringOptionToList(getString(keyPriceAssets()))) | |
420 | 438 | ||
421 | 439 | ||
422 | 440 | ||
423 | 441 | @Callable(i) | |
424 | 442 | func statusREADONLY (amountAssetId,priceAssetId) = { | |
425 | 443 | let status = match getString(keyStatus(amountAssetId, priceAssetId)) { | |
426 | 444 | case s: String => | |
427 | 445 | s | |
428 | 446 | case _ => | |
429 | 447 | unit | |
430 | 448 | } | |
431 | 449 | $Tuple2(nil, status) | |
432 | 450 | } | |
433 | 451 | ||
434 | 452 | ||
435 | 453 | @Verifier(tx) | |
436 | 454 | func verify () = { | |
437 | 455 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
438 | 456 | case pk: ByteVector => | |
439 | 457 | pk | |
440 | 458 | case _: Unit => | |
441 | 459 | tx.senderPublicKey | |
442 | 460 | case _ => | |
443 | 461 | throw("Match error") | |
444 | 462 | } | |
445 | 463 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
446 | 464 | } | |
447 | 465 |
github/deemru/w8io/169f3d6 63.02 ms ◑