tx · H6Z8jxwUa72kBbh1sUYPe9xXtAopb5RLGchN4S6gP5oq 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh: -0.01400000 Waves 2023.07.17 14:56 [2669829] smart account 3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh > SELF 0.00000000 Waves
{ "type": 13, "id": "H6Z8jxwUa72kBbh1sUYPe9xXtAopb5RLGchN4S6gP5oq", "fee": 1400000, "feeAssetId": null, "timestamp": 1689595043044, "version": 2, "chainId": 84, "sender": "3N3g7W8FPoQ7g5EadbAD2GVjrZT5RWpHZZh", "senderPublicKey": "Ap7CkWd6fzBU34kGo4GJJzC5q4qWXuLVunzE25PchdGS", "proofs": [ "4HT44G7rm8fkXECMeFGoHKSsTg9fbZPA6QBUhk3T5F8YdtS9NPHFNLG4qHHio6x71sjaz8Rouis9o45GBCru4veW" ], "script": "base64:BgK8EAgCEgkKBwgICBgBCAESABIAEggKBggICAgICBIDCgEYEgASBAoCCAgSBAoCCAgSBAoCCAgiEGNvbnRyYWN0RmlsZW5hbWUiA1NFUCIMd2F2ZXNBc3NldElkIgdWTFRQT09MIghTVEJMUE9PTCIRaW52YWxpZFByaWNlQXNzZXQiB3dyYXBFcnIiA21zZyIIdGhyb3dFcnIiB3Rocm93UEQiFHRocm93Q3JlYXRlTm90Q2FsbGVkIhF0aHJvd1lvdU5vdElzc3VlciIPdGhyb3dQb29sRXhpc3RzIhV0aHJvd0Fzc2V0Tm90VmVyaWZpZWQiFnRocm93SW52YWxpZFByaWNlQXNzZXQiFHRocm93SW52YWxpZEZlZUFzc2V0Ihd0aHJvd0ludmFsaWRBbW91bnRBc3NldCISdGhyb3dJbnZhbGlkU3RhdHVzIh90aHJvd0NhbkFjdGl2YXRlT25seVBlbmRpbmdQb29sIh10aHJvd0ZhY3RvcnlSZXR1cm5lZE5vdFN0cmluZyIcdGhyb3dJbnZhbGlkUHJpY2VBc3NldEFtb3VudCIPdGhyb3dJbnZhbGlkRmVlIhV0aHJv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JAQFBAgUBQgUBQwkAzAgCCQELRGVsZXRlRW50cnkBCQEBUAIFAUIFAUMJAMwIAgkBC0RlbGV0ZUVudHJ5AQkBAVECBQFCBQFDCQDMCAIJAQtEZWxldGVFbnRyeQEJAQFTAgUBQgUBQwUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJiegECYkEABAJiQgQBWgkBAmFtAAMJAAECBQFaAgpCeXRlVmVjdG9yBAJhcQUBWgUCYXEDCQABAgUBWgIEVW5pdAgFAmJ6D3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJieglib2R5Qnl0ZXMJAJEDAggFAmJ6BnByb29mcwAABQJiQudRDo0=", "height": 2669829, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DGAwnEAky4Wbr9ZALyEtrrvy18ajrhH3AYfxQxiSaAGF Next: 2ueTCDCPtVL1YEctUj96QqVyped7oExYRjDmS7pnrJnV Diff:
Old | New | Differences | |
---|---|---|---|
421 | 421 | } | |
422 | 422 | ||
423 | 423 | ||
424 | + | ||
425 | + | @Callable(i) | |
426 | + | func getPoolCreatorREADONLY (amountAssetId,priceAssetId) = { | |
427 | + | let creator = valueOrElse(getString(keyCreateCaller(amountAssetId, priceAssetId)), "") | |
428 | + | $Tuple2(nil, creator) | |
429 | + | } | |
430 | + | ||
431 | + | ||
432 | + | ||
433 | + | @Callable(i) | |
434 | + | func deletePool (amountAssetId,priceAssetId) = { | |
435 | + | let checkCaller = if (if ((i.caller == factoryContract)) | |
436 | + | then true | |
437 | + | else mustManager(i)) | |
438 | + | then true | |
439 | + | else throwErr("Permission denied") | |
440 | + | if ((checkCaller == checkCaller)) | |
441 | + | 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 | + | else throw("Strict value is not equal to itself.") | |
443 | + | } | |
444 | + | ||
445 | + | ||
424 | 446 | @Verifier(tx) | |
425 | 447 | func verify () = { | |
426 | 448 | let targetPublicKey = match managerPublicKeyOrUnit() { |
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 | 125 | func keyAmountAssetMinAmount () = makeString(["%s", "amountAssetMinAmount"], SEP) | |
126 | 126 | ||
127 | 127 | ||
128 | 128 | func keyPriceAssetsMinAmount () = makeString(["%s", "priceAssetsMinAmount"], 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(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 | 232 | let $t064836555 = getIdAndInfo(amountAssetPayment) | |
233 | 233 | let amountAssetId = $t064836555._1 | |
234 | 234 | let amountAssetInfo = $t064836555._2 | |
235 | 235 | let $t065586627 = getIdAndInfo(priceAssetPayment) | |
236 | 236 | let priceAssetId = $t065586627._1 | |
237 | 237 | let priceAssetInfo = $t065586627._2 | |
238 | 238 | let $t066306693 = getIdAndInfo(feeAssetPayment) | |
239 | 239 | let feeAssetId = $t066306693._1 | |
240 | 240 | let feeAssetInfo = $t066306693._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 | 245 | let assetMinAmountDefault = getIntegerValue(keyAmountAssetMinAmount()) | |
246 | 246 | let allowedAssetsMinAmounts = stringOptionToList(getString(keyPriceAssetsMinAmount())) | |
247 | 247 | let amountAssetMinAmount = if (containsElement(priceAssetsList, amountAssetId)) | |
248 | 248 | then { | |
249 | 249 | let priceAssetsIndex = valueOrErrorMessage(indexOf(priceAssetsList, amountAssetId), invalidPriceAsset) | |
250 | 250 | value(parseInt(allowedAssetsMinAmounts[priceAssetsIndex])) | |
251 | 251 | } | |
252 | 252 | else assetMinAmountDefault | |
253 | 253 | let priceAssetMinAmount = if (containsElement(priceAssetsList, priceAssetId)) | |
254 | 254 | then { | |
255 | 255 | let priceAssetsIndex = valueOrErrorMessage(indexOf(priceAssetsList, priceAssetId), invalidPriceAsset) | |
256 | 256 | value(parseInt(allowedAssetsMinAmounts[priceAssetsIndex])) | |
257 | 257 | } | |
258 | 258 | else assetMinAmountDefault | |
259 | 259 | let lastIndex = valueOrElse(getInteger(keyLastIndex()), 0) | |
260 | 260 | let curIndex = (lastIndex + 1) | |
261 | 261 | let emissionContract = addressFromStringValue(getStringOrFail(keyEmissionContract())) | |
262 | 262 | let poolExists = { | |
263 | 263 | let @ = invoke(factoryContract, "poolExistsREADONLY", [amountAssetId, priceAssetId], nil) | |
264 | 264 | if ($isInstanceOf(@, "Boolean")) | |
265 | 265 | then @ | |
266 | 266 | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
267 | 267 | } | |
268 | 268 | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
269 | 269 | then true | |
270 | 270 | else throwPoolExists(), if (!(poolExists)) | |
271 | 271 | then true | |
272 | 272 | else throwPoolExists(), if ((amountAssetId != priceAssetId)) | |
273 | 273 | then true | |
274 | 274 | else throwInvalidAssetPair(), if (if (isManager(i)) | |
275 | 275 | then true | |
276 | 276 | else if (isVerified(amountAssetId)) | |
277 | 277 | then isVerified(priceAssetId) | |
278 | 278 | else false) | |
279 | 279 | then true | |
280 | 280 | else throwInvalidAssetPair(), if (if (containsElement(priceAssetsList, amountAssetId)) | |
281 | 281 | then true | |
282 | 282 | else containsElement(priceAssetsList, priceAssetId)) | |
283 | 283 | then true | |
284 | 284 | else throwInvalidAssetPair(), if (if (isManager(i)) | |
285 | 285 | then true | |
286 | 286 | else (getString(keyFeeAssetId()) == feeAssetId)) | |
287 | 287 | then true | |
288 | 288 | else throwInvalidFeeAsset(), if (if (isManager(i)) | |
289 | 289 | then true | |
290 | 290 | else (amountAssetAmount >= getIntegerValue(keyAmountAssetMinAmount()))) | |
291 | 291 | then true | |
292 | 292 | else throwInvalidAmountAsset(), if (if (isManager(i)) | |
293 | 293 | then true | |
294 | 294 | else (priceAssetAmount >= priceAssetMinAmount)) | |
295 | 295 | then true | |
296 | 296 | else throwInvalidPriceAssetAmount(), if (if (isManager(i)) | |
297 | 297 | then true | |
298 | 298 | else (feeAssetAmount == getInteger(keyFeeAmount()))) | |
299 | 299 | then true | |
300 | 300 | else throwInvalidFee()] | |
301 | 301 | if ((checks == checks)) | |
302 | 302 | then { | |
303 | 303 | let paymentsWithFeeSize = 3 | |
304 | 304 | let burnEmissionInv = if ((size(i.payments) >= paymentsWithFeeSize)) | |
305 | 305 | then invoke(emissionContract, "burn", nil, [AttachedPayment(fromBase58String(feeAssetId), feeAssetAmount)]) | |
306 | 306 | else unit | |
307 | 307 | if ((burnEmissionInv == burnEmissionInv)) | |
308 | 308 | 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 | 309 | else throw("Strict value is not equal to itself.") | |
310 | 310 | } | |
311 | 311 | else throw("Strict value is not equal to itself.") | |
312 | 312 | } | |
313 | 313 | ||
314 | 314 | ||
315 | 315 | @Callable(i) | |
316 | 316 | func constructor (factoryV2Address,assetsStoreAddress,emissionAddress,priceAssetsMinAmount,amountAssetMinAmount,feeAssetId,feeAmount) = { | |
317 | 317 | let checkCaller = mustManager(i) | |
318 | 318 | if ((checkCaller == checkCaller)) | |
319 | 319 | then [StringEntry(keyFactoryContract(), factoryV2Address), StringEntry(keyAssetsStoreContract(), assetsStoreAddress), StringEntry(keyEmissionContract(), emissionAddress), StringEntry(keyPriceAssetsMinAmount(), makeString(priceAssetsMinAmount, SEP)), IntegerEntry(keyAmountAssetMinAmount(), amountAssetMinAmount), StringEntry(keyFeeAssetId(), feeAssetId), IntegerEntry(keyFeeAmount(), feeAmount)] | |
320 | 320 | else throw("Strict value is not equal to itself.") | |
321 | 321 | } | |
322 | 322 | ||
323 | 323 | ||
324 | 324 | ||
325 | 325 | @Callable(i) | |
326 | 326 | func create () = _create(i, VLTPOOL) | |
327 | 327 | ||
328 | 328 | ||
329 | 329 | ||
330 | 330 | @Callable(i) | |
331 | 331 | func createStable () = { | |
332 | 332 | let checkCaller = mustManager(i) | |
333 | 333 | if ((checkCaller == checkCaller)) | |
334 | 334 | then _create(i, STBLPOOL) | |
335 | 335 | else throw("Strict value is not equal to itself.") | |
336 | 336 | } | |
337 | 337 | ||
338 | 338 | ||
339 | 339 | ||
340 | 340 | @Callable(i) | |
341 | 341 | func activate (poolAddress,amountAssetId,amountAssetTicker,priceAssetId,priceAssetTicker,logo) = { | |
342 | 342 | let checks = [mustAdmin(i), if (isCreateCalled(amountAssetId, priceAssetId)) | |
343 | 343 | then true | |
344 | 344 | else throwCreateNotCalled(), if ((value(getString(keyStatus(amountAssetId, priceAssetId))) == statusPending)) | |
345 | 345 | then true | |
346 | 346 | else throwCanActivateOnlyPendingPool()] | |
347 | 347 | if ((checks == checks)) | |
348 | 348 | then { | |
349 | 349 | let poolTypeOption = getString(this, keyPoolType(amountAssetId, priceAssetId)) | |
350 | 350 | let activateNewPoolInv = invoke(factoryContract, "activateNewPool", [poolAddress, amountAssetId, priceAssetId, ((amountAssetTicker + priceAssetTicker) + "LP"), (((amountAssetTicker + "/") + priceAssetTicker) + " pool liquidity provider token"), 0, if ((poolTypeOption == unit)) | |
351 | 351 | then "VLTPOOL" | |
352 | 352 | else value(poolTypeOption), logo], nil) | |
353 | 353 | if ((activateNewPoolInv == activateNewPoolInv)) | |
354 | 354 | then { | |
355 | 355 | let lpAssetId = match activateNewPoolInv { | |
356 | 356 | case id: String => | |
357 | 357 | id | |
358 | 358 | case _ => | |
359 | 359 | throwFactoryReturnedNotString() | |
360 | 360 | } | |
361 | 361 | if ((lpAssetId == lpAssetId)) | |
362 | 362 | then { | |
363 | 363 | let beforePut = assetBalance(this, fromBase58String(lpAssetId)) | |
364 | 364 | if ((beforePut == beforePut)) | |
365 | 365 | then { | |
366 | 366 | let put = invoke(addressFromStringValue(poolAddress), "put", [0, false], [AttachedPayment(if ((amountAssetId == "WAVES")) | |
367 | 367 | then unit | |
368 | 368 | else fromBase58String(amountAssetId), value(getInteger(keyAmountAssetAmount(amountAssetId, priceAssetId)))), AttachedPayment(if ((priceAssetId == "WAVES")) | |
369 | 369 | then unit | |
370 | 370 | else fromBase58String(priceAssetId), value(getInteger(keyPriceAssetAmount(amountAssetId, priceAssetId))))]) | |
371 | 371 | if ((put == put)) | |
372 | 372 | then { | |
373 | 373 | let afterPut = assetBalance(this, fromBase58String(lpAssetId)) | |
374 | 374 | if ((afterPut == afterPut)) | |
375 | 375 | then { | |
376 | 376 | let user = value(addressFromString(value(getString(keyCreateCaller(amountAssetId, priceAssetId))))) | |
377 | 377 | let res = invoke(votingEmissionCandidateContract, "approve", [amountAssetId, priceAssetId], nil) | |
378 | 378 | if ((res == res)) | |
379 | 379 | then [StringEntry(keyStatus(amountAssetId, priceAssetId), statusActive), ScriptTransfer(user, (afterPut - beforePut), fromBase58String(lpAssetId))] | |
380 | 380 | else throw("Strict value is not equal to itself.") | |
381 | 381 | } | |
382 | 382 | else throw("Strict value is not equal to itself.") | |
383 | 383 | } | |
384 | 384 | else throw("Strict value is not equal to itself.") | |
385 | 385 | } | |
386 | 386 | else throw("Strict value is not equal to itself.") | |
387 | 387 | } | |
388 | 388 | else throw("Strict value is not equal to itself.") | |
389 | 389 | } | |
390 | 390 | else throw("Strict value is not equal to itself.") | |
391 | 391 | } | |
392 | 392 | else throw("Strict value is not equal to itself.") | |
393 | 393 | } | |
394 | 394 | ||
395 | 395 | ||
396 | 396 | ||
397 | 397 | @Callable(i) | |
398 | 398 | func setAdmins (adminPubKeys) = { | |
399 | 399 | let checkCaller = mustManager(i) | |
400 | 400 | if ((checkCaller == checkCaller)) | |
401 | 401 | then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))] | |
402 | 402 | else throw("Strict value is not equal to itself.") | |
403 | 403 | } | |
404 | 404 | ||
405 | 405 | ||
406 | 406 | ||
407 | 407 | @Callable(i) | |
408 | 408 | func priceAssetsREADONLY () = $Tuple2(nil, stringOptionToList(getString(keyPriceAssets()))) | |
409 | 409 | ||
410 | 410 | ||
411 | 411 | ||
412 | 412 | @Callable(i) | |
413 | 413 | func statusREADONLY (amountAssetId,priceAssetId) = { | |
414 | 414 | let status = match getString(keyStatus(amountAssetId, priceAssetId)) { | |
415 | 415 | case s: String => | |
416 | 416 | s | |
417 | 417 | case _ => | |
418 | 418 | unit | |
419 | 419 | } | |
420 | 420 | $Tuple2(nil, status) | |
421 | 421 | } | |
422 | 422 | ||
423 | 423 | ||
424 | + | ||
425 | + | @Callable(i) | |
426 | + | func getPoolCreatorREADONLY (amountAssetId,priceAssetId) = { | |
427 | + | let creator = valueOrElse(getString(keyCreateCaller(amountAssetId, priceAssetId)), "") | |
428 | + | $Tuple2(nil, creator) | |
429 | + | } | |
430 | + | ||
431 | + | ||
432 | + | ||
433 | + | @Callable(i) | |
434 | + | func deletePool (amountAssetId,priceAssetId) = { | |
435 | + | let checkCaller = if (if ((i.caller == factoryContract)) | |
436 | + | then true | |
437 | + | else mustManager(i)) | |
438 | + | then true | |
439 | + | else throwErr("Permission denied") | |
440 | + | if ((checkCaller == checkCaller)) | |
441 | + | 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 | + | else throw("Strict value is not equal to itself.") | |
443 | + | } | |
444 | + | ||
445 | + | ||
424 | 446 | @Verifier(tx) | |
425 | 447 | func verify () = { | |
426 | 448 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
427 | 449 | case pk: ByteVector => | |
428 | 450 | pk | |
429 | 451 | case _: Unit => | |
430 | 452 | tx.senderPublicKey | |
431 | 453 | case _ => | |
432 | 454 | throw("Match error") | |
433 | 455 | } | |
434 | 456 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
435 | 457 | } | |
436 | 458 |
github/deemru/w8io/026f985 44.99 ms ◑