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