tx · CqMsJXXECJhc8Hry3u8SDb2QiHJsxJVdfDtZdfQqZk6T 3MxPzqFNhXfv22CkzhhrnvdBQRwtYyYJo8d: -0.01700000 Waves 2023.07.19 14:44 [2672694] smart account 3MxPzqFNhXfv22CkzhhrnvdBQRwtYyYJo8d > SELF 0.00000000 Waves
{ "type": 13, "id": "CqMsJXXECJhc8Hry3u8SDb2QiHJsxJVdfDtZdfQqZk6T", "fee": 1700000, "feeAssetId": null, "timestamp": 1689767082057, "version": 2, "chainId": 84, "sender": "3MxPzqFNhXfv22CkzhhrnvdBQRwtYyYJo8d", "senderPublicKey": "29woGLpVKdVUuqfnN2trGx417VC6TpVxd2gCYBAqh8xP", "proofs": [ "wkNj7h5GioL43iryKyCbf1dVJLSWdhqHb9HxseSvWfaw6pmDbq4TEeRoaEbb9Ta3WuCgZSMo8Ahg2QyEp63ndXb" ], "script": "base64:BgIoCAISCQoHCAgIGAEIARIAEgASCAoGCAgICAgIEgMKARgSABIECgIICEEAEGNvbnRyYWN0RmlsZW5hbWUCD3VzZXJfcG9vbHMucmlkZQADU0VQAgJfXwAMd2F2ZXNBc3NldElkAgVXQVZFUwAHVkxUUE9PTAIHVkxUUE9PTAAIU1RCTFBPT0wCCFNUQkxQT09MABFpbnZhbGlkUHJpY2VBc3NldAITSW52YWxpZCBwcmljZSBhc3NldAEHd3JhcEVycgEDbXNnCQC5CQIJAMwIAgUQY29udHJhY3RGaWxlbmFtZQkAzAgCAgI6IAkAzAgCBQNtc2cFA25pbAIAAQh0aHJvd0VycgEDbXNnCQACAQkBB3dyYXBFcnIBBQNtc2cBB3Rocm93UEQACQEIdGhyb3dFcnIBAhFQZXJtaXNzaW9uIGRlbmllZAEUdGhyb3dDcmVhdGVOb3RDYWxsZWQACQEIdGhyb3dFcnIBAiRDcmVhdGUgaXMgbm90IGNhbGxlZCBmb3IgYXNzZXRzIHBhaXIBEXRocm93WW91Tm90SXNzdWVyAAkBCHRocm93RXJyAQIeWW91IGFyZSBub3QgYW1v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dWJsaWNLZXkf484j", "height": 2672694, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: ApMe4NwyrUccmhwNhunZjggVJ6t45xrwj6VF2s43Tz9h Next: none Diff:
Old | New | Differences | |
---|---|---|---|
64 | 64 | func keyManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP) | |
65 | 65 | ||
66 | 66 | ||
67 | - | func | |
67 | + | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func keyAdminPubKeys () = makeString(["%s", "adminPubKeys"], SEP) | |
131 | 131 | func keyPriceAssets () = makeString(["%s", "priceAssets"], SEP) | |
132 | 132 | ||
133 | 133 | ||
134 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
135 | + | case s: String => | |
136 | + | addressFromStringValue(s) | |
137 | + | case _ => | |
138 | + | this | |
139 | + | } | |
140 | + | ||
141 | + | ||
134 | 142 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " is not defined")) | |
135 | 143 | ||
136 | 144 | ||
164 | 172 | else throwCreateNotCalled() | |
165 | 173 | ||
166 | 174 | ||
167 | - | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
168 | - | case s: String => | |
169 | - | fromBase58String(s) | |
170 | - | case _: Unit => | |
171 | - | unit | |
172 | - | case _ => | |
173 | - | throw("Match error") | |
174 | - | } | |
175 | - | ||
176 | - | ||
177 | - | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
178 | - | case s: String => | |
179 | - | fromBase58String(s) | |
180 | - | case _: Unit => | |
181 | - | unit | |
182 | - | case _ => | |
183 | - | throw("Match error") | |
184 | - | } | |
175 | + | func managerPublicKeyOrUnit () = { | |
176 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
177 | + | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
178 | + | case s: String => | |
179 | + | fromBase58String(s) | |
180 | + | case _: Unit => | |
181 | + | unit | |
182 | + | case _ => | |
183 | + | throw("Match error") | |
184 | + | } | |
185 | + | } | |
185 | 186 | ||
186 | 187 | ||
187 | 188 | func isManager (i) = match managerPublicKeyOrUnit() { | |
225 | 226 | ||
226 | 227 | ||
227 | 228 | func _create (i,poolType) = { | |
228 | - | let | |
229 | - | let | |
229 | + | let amountAssetPayment = value(i.payments[0]) | |
230 | + | let priceAssetPayment = value(i.payments[1]) | |
230 | 231 | let feeAssetPayment = value(i.payments[2]) | |
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 | |
232 | + | let $t064836555 = getIdAndInfo(amountAssetPayment) | |
233 | + | let amountAssetId = $t064836555._1 | |
234 | + | let amountAssetInfo = $t064836555._2 | |
235 | + | let $t065586627 = getIdAndInfo(priceAssetPayment) | |
236 | + | let priceAssetId = $t065586627._1 | |
237 | + | let priceAssetInfo = $t065586627._2 | |
238 | + | let $t066306693 = getIdAndInfo(feeAssetPayment) | |
239 | + | let feeAssetId = $t066306693._1 | |
240 | + | let feeAssetInfo = $t066306693._2 | |
241 | + | let amountAssetAmount = amountAssetPayment.amount | |
242 | + | let priceAssetAmount = priceAssetPayment.amount | |
243 | + | let feeAssetAmount = feeAssetPayment.amount | |
240 | 244 | let priceAssetsList = stringOptionToList(getString(factoryContract, keyPriceAssets())) | |
241 | - | let checkAssetsNotEqual = if ((asset1Id != asset2Id)) | |
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 | |
259 | + | let lastIndex = valueOrElse(getInteger(keyLastIndex()), 0) | |
260 | + | let curIndex = (lastIndex + 1) | |
261 | + | let emissionContract = addressFromStringValue(getStringOrFail(keyEmissionContract())) | |
262 | + | let poolExists = { | |
263 | + | let @ = invoke(factoryContract, "poolExistsREADONLY", [amountAssetId, priceAssetId], nil) | |
264 | + | if ($isInstanceOf(@, "Boolean")) | |
265 | + | then @ | |
266 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
267 | + | } | |
268 | + | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
242 | 269 | then true | |
243 | - | else throwInvalidAssetPair() | |
244 | - | if ((checkAssetsNotEqual == checkAssetsNotEqual)) | |
270 | + | else throwPoolExists(), if (!(poolExists)) | |
271 | + | then true | |
272 | + | else throwPoolExists(), if ((amountAssetId != priceAssetId)) | |
273 | + | then true | |
274 | + | else throwInvalidAssetPair(), if (if (isManager(i)) | |
275 | + | then true | |
276 | + | else if (isVerified(amountAssetId)) | |
277 | + | then isVerified(priceAssetId) | |
278 | + | else false) | |
279 | + | then true | |
280 | + | else throwInvalidAssetPair(), if (if (containsElement(priceAssetsList, amountAssetId)) | |
281 | + | then true | |
282 | + | else containsElement(priceAssetsList, priceAssetId)) | |
283 | + | then true | |
284 | + | else throwInvalidAssetPair(), if (if (isManager(i)) | |
285 | + | then true | |
286 | + | else (getString(keyFeeAssetId()) == feeAssetId)) | |
287 | + | then true | |
288 | + | else throwInvalidFeeAsset(), if (if (isManager(i)) | |
289 | + | then true | |
290 | + | else (amountAssetAmount >= getIntegerValue(keyAmountAssetMinAmount()))) | |
291 | + | then true | |
292 | + | else throwInvalidAmountAsset(), if (if (isManager(i)) | |
293 | + | then true | |
294 | + | else (priceAssetAmount >= priceAssetMinAmount)) | |
295 | + | then true | |
296 | + | else throwInvalidPriceAssetAmount(), if (if (isManager(i)) | |
297 | + | then true | |
298 | + | else (feeAssetAmount == getInteger(keyFeeAmount()))) | |
299 | + | then true | |
300 | + | else throwInvalidFee()] | |
301 | + | if ((checks == checks)) | |
245 | 302 | then { | |
246 | - | let $t067647225 = if (if (isManager(i)) | |
247 | - | then true | |
248 | - | else if (containsElement(priceAssetsList, asset2Id)) | |
249 | - | then isVerified(asset1Id) | |
250 | - | else false) | |
251 | - | then $Tuple4(asset1Id, asset1Payment.amount, asset2Id, asset2Payment.amount) | |
252 | - | else if (if (containsElement(priceAssetsList, asset1Id)) | |
253 | - | then isVerified(asset2Id) | |
254 | - | else false) | |
255 | - | then $Tuple4(asset2Id, asset2Payment.amount, asset1Id, asset1Payment.amount) | |
256 | - | else throwInvalidAssetPair() | |
257 | - | let amountAssetId = $t067647225._1 | |
258 | - | let amountAssetAmount = $t067647225._2 | |
259 | - | let priceAssetId = $t067647225._3 | |
260 | - | let priceAssetAmount = $t067647225._4 | |
261 | - | let managerPriceAssetMinAmount = 1 | |
262 | - | let priceAssetMinAmount = if (isManager(i)) | |
263 | - | then managerPriceAssetMinAmount | |
264 | - | else { | |
265 | - | let priceAssetsIndex = valueOrErrorMessage(indexOf(priceAssetsList, priceAssetId), invalidPriceAsset) | |
266 | - | value(parseInt(stringOptionToList(getString(keyPriceAssetsMinAmount()))[priceAssetsIndex])) | |
267 | - | } | |
268 | - | let lastIndex = valueOrElse(getInteger(keyLastIndex()), 0) | |
269 | - | let curIndex = (lastIndex + 1) | |
270 | - | let emissionContract = addressFromStringValue(getStringOrFail(keyEmissionContract())) | |
271 | - | let poolExists = { | |
272 | - | let @ = invoke(factoryContract, "poolExistsREADONLY", [amountAssetId, priceAssetId], nil) | |
273 | - | if ($isInstanceOf(@, "Boolean")) | |
274 | - | then @ | |
275 | - | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
276 | - | } | |
277 | - | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
278 | - | then true | |
279 | - | else throwPoolExists(), if (!(poolExists)) | |
280 | - | then true | |
281 | - | else throwPoolExists(), if (if (isManager(i)) | |
282 | - | then true | |
283 | - | else (getString(keyFeeAssetId()) == feeAssetId)) | |
284 | - | then true | |
285 | - | else throwInvalidFeeAsset(), if (if (isManager(i)) | |
286 | - | then true | |
287 | - | else (amountAssetAmount >= getIntegerValue(keyAmountAssetMinAmount()))) | |
288 | - | then true | |
289 | - | else throwInvalidAmountAsset(), if (if (isManager(i)) | |
290 | - | then true | |
291 | - | else (priceAssetAmount >= priceAssetMinAmount)) | |
292 | - | then true | |
293 | - | else throwInvalidPriceAssetAmount(), if (if (isManager(i)) | |
294 | - | then true | |
295 | - | else (feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
296 | - | then true | |
297 | - | else throwInvalidFee()] | |
298 | - | if ((checks == checks)) | |
299 | - | then { | |
300 | - | let paymentsWithFeeSize = 3 | |
301 | - | let burnEmissionInv = if ((size(i.payments) >= paymentsWithFeeSize)) | |
302 | - | then invoke(emissionContract, "burn", nil, [AttachedPayment(fromBase58String(feeAssetId), feeAssetPayment.amount)]) | |
303 | - | else unit | |
304 | - | if ((burnEmissionInv == burnEmissionInv)) | |
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)] | |
306 | - | else throw("Strict value is not equal to itself.") | |
307 | - | } | |
303 | + | let paymentsWithFeeSize = 3 | |
304 | + | let burnEmissionInv = if ((size(i.payments) >= paymentsWithFeeSize)) | |
305 | + | then invoke(emissionContract, "burn", nil, [AttachedPayment(fromBase58String(feeAssetId), feeAssetAmount)]) | |
306 | + | else unit | |
307 | + | if ((burnEmissionInv == burnEmissionInv)) | |
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)] | |
308 | 309 | else throw("Strict value is not equal to itself.") | |
309 | 310 | } | |
310 | 311 | else throw("Strict value is not equal to itself.") | |
404 | 405 | ||
405 | 406 | ||
406 | 407 | @Callable(i) | |
407 | - | func setManager (pendingManagerPublicKey) = { | |
408 | - | let checkCaller = mustManager(i) | |
409 | - | if ((checkCaller == checkCaller)) | |
410 | - | then { | |
411 | - | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
412 | - | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
413 | - | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
414 | - | else throw("Strict value is not equal to itself.") | |
415 | - | } | |
416 | - | else throw("Strict value is not equal to itself.") | |
417 | - | } | |
418 | - | ||
419 | - | ||
420 | - | ||
421 | - | @Callable(i) | |
422 | - | func confirmManager () = { | |
423 | - | let pm = pendingManagerPublicKeyOrUnit() | |
424 | - | let hasPM = if (isDefined(pm)) | |
425 | - | then true | |
426 | - | else throw("No pending manager") | |
427 | - | if ((hasPM == hasPM)) | |
428 | - | then { | |
429 | - | let checkPM = if ((i.callerPublicKey == value(pm))) | |
430 | - | then true | |
431 | - | else throw("You are not pending manager") | |
432 | - | if ((checkPM == checkPM)) | |
433 | - | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
434 | - | else throw("Strict value is not equal to itself.") | |
435 | - | } | |
436 | - | else throw("Strict value is not equal to itself.") | |
437 | - | } | |
438 | - | ||
439 | - | ||
440 | - | ||
441 | - | @Callable(i) | |
442 | 408 | func priceAssetsREADONLY () = $Tuple2(nil, stringOptionToList(getString(keyPriceAssets()))) | |
443 | 409 | ||
444 | 410 |
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 | - | func | |
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 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
135 | + | case s: String => | |
136 | + | addressFromStringValue(s) | |
137 | + | case _ => | |
138 | + | this | |
139 | + | } | |
140 | + | ||
141 | + | ||
134 | 142 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " is not defined")) | |
135 | 143 | ||
136 | 144 | ||
137 | 145 | func stringOptionToList (stringOrUnit) = match stringOrUnit { | |
138 | 146 | case s: String => | |
139 | 147 | if ((size(s) == 0)) | |
140 | 148 | then nil | |
141 | 149 | else split(s, SEP) | |
142 | 150 | case _: Unit => | |
143 | 151 | nil | |
144 | 152 | case _ => | |
145 | 153 | throw("Match error") | |
146 | 154 | } | |
147 | 155 | ||
148 | 156 | ||
149 | 157 | let factoryContract = addressFromStringValue(getStringOrFail(keyFactoryContract())) | |
150 | 158 | ||
151 | 159 | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], SEP) | |
152 | 160 | ||
153 | 161 | let votingEmissionContract = addressFromStringValue(valueOrErrorMessage(getString(factoryContract, keyVotingEmissionContract), wrapErr("voting emission contract address is required"))) | |
154 | 162 | ||
155 | 163 | let keyVotingEmissionCandidateContract = makeString(["%s", "votingEmissionCandidateContract"], SEP) | |
156 | 164 | ||
157 | 165 | let votingEmissionCandidateContract = addressFromStringValue(valueOrErrorMessage(getString(votingEmissionContract, keyVotingEmissionCandidateContract), wrapErr("voting emission candidate contract address is required"))) | |
158 | 166 | ||
159 | 167 | func isCreateCalled (amountAssetId,priceAssetId) = valueOrElse(getBoolean(keyCreateCalled(amountAssetId, priceAssetId)), false) | |
160 | 168 | ||
161 | 169 | ||
162 | 170 | func mustCreateCalled (amountAssetId,priceAssetId) = if (isCreateCalled(amountAssetId, priceAssetId)) | |
163 | 171 | then true | |
164 | 172 | else throwCreateNotCalled() | |
165 | 173 | ||
166 | 174 | ||
167 | - | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
168 | - | case s: String => | |
169 | - | fromBase58String(s) | |
170 | - | case _: Unit => | |
171 | - | unit | |
172 | - | case _ => | |
173 | - | throw("Match error") | |
174 | - | } | |
175 | - | ||
176 | - | ||
177 | - | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
178 | - | case s: String => | |
179 | - | fromBase58String(s) | |
180 | - | case _: Unit => | |
181 | - | unit | |
182 | - | case _ => | |
183 | - | throw("Match error") | |
184 | - | } | |
175 | + | func managerPublicKeyOrUnit () = { | |
176 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
177 | + | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
178 | + | case s: String => | |
179 | + | fromBase58String(s) | |
180 | + | case _: Unit => | |
181 | + | unit | |
182 | + | case _ => | |
183 | + | throw("Match error") | |
184 | + | } | |
185 | + | } | |
185 | 186 | ||
186 | 187 | ||
187 | 188 | func isManager (i) = match managerPublicKeyOrUnit() { | |
188 | 189 | case pk: ByteVector => | |
189 | 190 | (i.callerPublicKey == pk) | |
190 | 191 | case _: Unit => | |
191 | 192 | (i.caller == this) | |
192 | 193 | case _ => | |
193 | 194 | throw("Match error") | |
194 | 195 | } | |
195 | 196 | ||
196 | 197 | ||
197 | 198 | func mustManager (i) = if (isManager(i)) | |
198 | 199 | then true | |
199 | 200 | else throwPD() | |
200 | 201 | ||
201 | 202 | ||
202 | 203 | func mustAdmin (i) = { | |
203 | 204 | let adminPKs = stringOptionToList(getString(keyAdminPubKeys())) | |
204 | 205 | if (containsElement(adminPKs, toBase58String(i.callerPublicKey))) | |
205 | 206 | then true | |
206 | 207 | else mustManager(i) | |
207 | 208 | } | |
208 | 209 | ||
209 | 210 | ||
210 | 211 | func isVerified (assetId) = (valueOrElse(getInteger(addressFromStringValue(getStringOrFail(keyAssetsStoreContract())), (("status_<" + assetId) + ">")), 0) == 2) | |
211 | 212 | ||
212 | 213 | ||
213 | 214 | func getIdAndInfo (payment) = match payment.assetId { | |
214 | 215 | case id: ByteVector => | |
215 | 216 | let info = value(assetInfo(id)) | |
216 | 217 | $Tuple2(toBase58String(id), info) | |
217 | 218 | case _: Unit => | |
218 | 219 | $Tuple2(wavesAssetId, unit) | |
219 | 220 | case _ => | |
220 | 221 | throw("Match error") | |
221 | 222 | } | |
222 | 223 | ||
223 | 224 | ||
224 | 225 | func validStatus (status) = containsElement(statuses, status) | |
225 | 226 | ||
226 | 227 | ||
227 | 228 | func _create (i,poolType) = { | |
228 | - | let | |
229 | - | let | |
229 | + | let amountAssetPayment = value(i.payments[0]) | |
230 | + | let priceAssetPayment = value(i.payments[1]) | |
230 | 231 | let feeAssetPayment = value(i.payments[2]) | |
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 | |
232 | + | let $t064836555 = getIdAndInfo(amountAssetPayment) | |
233 | + | let amountAssetId = $t064836555._1 | |
234 | + | let amountAssetInfo = $t064836555._2 | |
235 | + | let $t065586627 = getIdAndInfo(priceAssetPayment) | |
236 | + | let priceAssetId = $t065586627._1 | |
237 | + | let priceAssetInfo = $t065586627._2 | |
238 | + | let $t066306693 = getIdAndInfo(feeAssetPayment) | |
239 | + | let feeAssetId = $t066306693._1 | |
240 | + | let feeAssetInfo = $t066306693._2 | |
241 | + | let amountAssetAmount = amountAssetPayment.amount | |
242 | + | let priceAssetAmount = priceAssetPayment.amount | |
243 | + | let feeAssetAmount = feeAssetPayment.amount | |
240 | 244 | let priceAssetsList = stringOptionToList(getString(factoryContract, keyPriceAssets())) | |
241 | - | let checkAssetsNotEqual = if ((asset1Id != asset2Id)) | |
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 | |
259 | + | let lastIndex = valueOrElse(getInteger(keyLastIndex()), 0) | |
260 | + | let curIndex = (lastIndex + 1) | |
261 | + | let emissionContract = addressFromStringValue(getStringOrFail(keyEmissionContract())) | |
262 | + | let poolExists = { | |
263 | + | let @ = invoke(factoryContract, "poolExistsREADONLY", [amountAssetId, priceAssetId], nil) | |
264 | + | if ($isInstanceOf(@, "Boolean")) | |
265 | + | then @ | |
266 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
267 | + | } | |
268 | + | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
242 | 269 | then true | |
243 | - | else throwInvalidAssetPair() | |
244 | - | if ((checkAssetsNotEqual == checkAssetsNotEqual)) | |
270 | + | else throwPoolExists(), if (!(poolExists)) | |
271 | + | then true | |
272 | + | else throwPoolExists(), if ((amountAssetId != priceAssetId)) | |
273 | + | then true | |
274 | + | else throwInvalidAssetPair(), if (if (isManager(i)) | |
275 | + | then true | |
276 | + | else if (isVerified(amountAssetId)) | |
277 | + | then isVerified(priceAssetId) | |
278 | + | else false) | |
279 | + | then true | |
280 | + | else throwInvalidAssetPair(), if (if (containsElement(priceAssetsList, amountAssetId)) | |
281 | + | then true | |
282 | + | else containsElement(priceAssetsList, priceAssetId)) | |
283 | + | then true | |
284 | + | else throwInvalidAssetPair(), if (if (isManager(i)) | |
285 | + | then true | |
286 | + | else (getString(keyFeeAssetId()) == feeAssetId)) | |
287 | + | then true | |
288 | + | else throwInvalidFeeAsset(), if (if (isManager(i)) | |
289 | + | then true | |
290 | + | else (amountAssetAmount >= getIntegerValue(keyAmountAssetMinAmount()))) | |
291 | + | then true | |
292 | + | else throwInvalidAmountAsset(), if (if (isManager(i)) | |
293 | + | then true | |
294 | + | else (priceAssetAmount >= priceAssetMinAmount)) | |
295 | + | then true | |
296 | + | else throwInvalidPriceAssetAmount(), if (if (isManager(i)) | |
297 | + | then true | |
298 | + | else (feeAssetAmount == getInteger(keyFeeAmount()))) | |
299 | + | then true | |
300 | + | else throwInvalidFee()] | |
301 | + | if ((checks == checks)) | |
245 | 302 | then { | |
246 | - | let $t067647225 = if (if (isManager(i)) | |
247 | - | then true | |
248 | - | else if (containsElement(priceAssetsList, asset2Id)) | |
249 | - | then isVerified(asset1Id) | |
250 | - | else false) | |
251 | - | then $Tuple4(asset1Id, asset1Payment.amount, asset2Id, asset2Payment.amount) | |
252 | - | else if (if (containsElement(priceAssetsList, asset1Id)) | |
253 | - | then isVerified(asset2Id) | |
254 | - | else false) | |
255 | - | then $Tuple4(asset2Id, asset2Payment.amount, asset1Id, asset1Payment.amount) | |
256 | - | else throwInvalidAssetPair() | |
257 | - | let amountAssetId = $t067647225._1 | |
258 | - | let amountAssetAmount = $t067647225._2 | |
259 | - | let priceAssetId = $t067647225._3 | |
260 | - | let priceAssetAmount = $t067647225._4 | |
261 | - | let managerPriceAssetMinAmount = 1 | |
262 | - | let priceAssetMinAmount = if (isManager(i)) | |
263 | - | then managerPriceAssetMinAmount | |
264 | - | else { | |
265 | - | let priceAssetsIndex = valueOrErrorMessage(indexOf(priceAssetsList, priceAssetId), invalidPriceAsset) | |
266 | - | value(parseInt(stringOptionToList(getString(keyPriceAssetsMinAmount()))[priceAssetsIndex])) | |
267 | - | } | |
268 | - | let lastIndex = valueOrElse(getInteger(keyLastIndex()), 0) | |
269 | - | let curIndex = (lastIndex + 1) | |
270 | - | let emissionContract = addressFromStringValue(getStringOrFail(keyEmissionContract())) | |
271 | - | let poolExists = { | |
272 | - | let @ = invoke(factoryContract, "poolExistsREADONLY", [amountAssetId, priceAssetId], nil) | |
273 | - | if ($isInstanceOf(@, "Boolean")) | |
274 | - | then @ | |
275 | - | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
276 | - | } | |
277 | - | let checks = [if (!(isCreateCalled(amountAssetId, priceAssetId))) | |
278 | - | then true | |
279 | - | else throwPoolExists(), if (!(poolExists)) | |
280 | - | then true | |
281 | - | else throwPoolExists(), if (if (isManager(i)) | |
282 | - | then true | |
283 | - | else (getString(keyFeeAssetId()) == feeAssetId)) | |
284 | - | then true | |
285 | - | else throwInvalidFeeAsset(), if (if (isManager(i)) | |
286 | - | then true | |
287 | - | else (amountAssetAmount >= getIntegerValue(keyAmountAssetMinAmount()))) | |
288 | - | then true | |
289 | - | else throwInvalidAmountAsset(), if (if (isManager(i)) | |
290 | - | then true | |
291 | - | else (priceAssetAmount >= priceAssetMinAmount)) | |
292 | - | then true | |
293 | - | else throwInvalidPriceAssetAmount(), if (if (isManager(i)) | |
294 | - | then true | |
295 | - | else (feeAssetPayment.amount == getInteger(keyFeeAmount()))) | |
296 | - | then true | |
297 | - | else throwInvalidFee()] | |
298 | - | if ((checks == checks)) | |
299 | - | then { | |
300 | - | let paymentsWithFeeSize = 3 | |
301 | - | let burnEmissionInv = if ((size(i.payments) >= paymentsWithFeeSize)) | |
302 | - | then invoke(emissionContract, "burn", nil, [AttachedPayment(fromBase58String(feeAssetId), feeAssetPayment.amount)]) | |
303 | - | else unit | |
304 | - | if ((burnEmissionInv == burnEmissionInv)) | |
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)] | |
306 | - | else throw("Strict value is not equal to itself.") | |
307 | - | } | |
303 | + | let paymentsWithFeeSize = 3 | |
304 | + | let burnEmissionInv = if ((size(i.payments) >= paymentsWithFeeSize)) | |
305 | + | then invoke(emissionContract, "burn", nil, [AttachedPayment(fromBase58String(feeAssetId), feeAssetAmount)]) | |
306 | + | else unit | |
307 | + | if ((burnEmissionInv == burnEmissionInv)) | |
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)] | |
308 | 309 | else throw("Strict value is not equal to itself.") | |
309 | 310 | } | |
310 | 311 | else throw("Strict value is not equal to itself.") | |
311 | 312 | } | |
312 | 313 | ||
313 | 314 | ||
314 | 315 | @Callable(i) | |
315 | 316 | func constructor (factoryV2Address,assetsStoreAddress,emissionAddress,priceAssetsMinAmount,amountAssetMinAmount,feeAssetId,feeAmount) = { | |
316 | 317 | let checkCaller = mustManager(i) | |
317 | 318 | if ((checkCaller == checkCaller)) | |
318 | 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)] | |
319 | 320 | else throw("Strict value is not equal to itself.") | |
320 | 321 | } | |
321 | 322 | ||
322 | 323 | ||
323 | 324 | ||
324 | 325 | @Callable(i) | |
325 | 326 | func create () = _create(i, VLTPOOL) | |
326 | 327 | ||
327 | 328 | ||
328 | 329 | ||
329 | 330 | @Callable(i) | |
330 | 331 | func createStable () = { | |
331 | 332 | let checkCaller = mustManager(i) | |
332 | 333 | if ((checkCaller == checkCaller)) | |
333 | 334 | then _create(i, STBLPOOL) | |
334 | 335 | else throw("Strict value is not equal to itself.") | |
335 | 336 | } | |
336 | 337 | ||
337 | 338 | ||
338 | 339 | ||
339 | 340 | @Callable(i) | |
340 | 341 | func activate (poolAddress,amountAssetId,amountAssetTicker,priceAssetId,priceAssetTicker,logo) = { | |
341 | 342 | let checks = [mustAdmin(i), if (isCreateCalled(amountAssetId, priceAssetId)) | |
342 | 343 | then true | |
343 | 344 | else throwCreateNotCalled(), if ((value(getString(keyStatus(amountAssetId, priceAssetId))) == statusPending)) | |
344 | 345 | then true | |
345 | 346 | else throwCanActivateOnlyPendingPool()] | |
346 | 347 | if ((checks == checks)) | |
347 | 348 | then { | |
348 | 349 | let poolTypeOption = getString(this, keyPoolType(amountAssetId, priceAssetId)) | |
349 | 350 | let activateNewPoolInv = invoke(factoryContract, "activateNewPool", [poolAddress, amountAssetId, priceAssetId, ((amountAssetTicker + priceAssetTicker) + "LP"), (((amountAssetTicker + "/") + priceAssetTicker) + " pool liquidity provider token"), 0, if ((poolTypeOption == unit)) | |
350 | 351 | then "VLTPOOL" | |
351 | 352 | else value(poolTypeOption), logo], nil) | |
352 | 353 | if ((activateNewPoolInv == activateNewPoolInv)) | |
353 | 354 | then { | |
354 | 355 | let lpAssetId = match activateNewPoolInv { | |
355 | 356 | case id: String => | |
356 | 357 | id | |
357 | 358 | case _ => | |
358 | 359 | throwFactoryReturnedNotString() | |
359 | 360 | } | |
360 | 361 | if ((lpAssetId == lpAssetId)) | |
361 | 362 | then { | |
362 | 363 | let beforePut = assetBalance(this, fromBase58String(lpAssetId)) | |
363 | 364 | if ((beforePut == beforePut)) | |
364 | 365 | then { | |
365 | 366 | let put = invoke(addressFromStringValue(poolAddress), "put", [0, false], [AttachedPayment(if ((amountAssetId == "WAVES")) | |
366 | 367 | then unit | |
367 | 368 | else fromBase58String(amountAssetId), value(getInteger(keyAmountAssetAmount(amountAssetId, priceAssetId)))), AttachedPayment(if ((priceAssetId == "WAVES")) | |
368 | 369 | then unit | |
369 | 370 | else fromBase58String(priceAssetId), value(getInteger(keyPriceAssetAmount(amountAssetId, priceAssetId))))]) | |
370 | 371 | if ((put == put)) | |
371 | 372 | then { | |
372 | 373 | let afterPut = assetBalance(this, fromBase58String(lpAssetId)) | |
373 | 374 | if ((afterPut == afterPut)) | |
374 | 375 | then { | |
375 | 376 | let user = value(addressFromString(value(getString(keyCreateCaller(amountAssetId, priceAssetId))))) | |
376 | 377 | let res = invoke(votingEmissionCandidateContract, "approve", [amountAssetId, priceAssetId], nil) | |
377 | 378 | if ((res == res)) | |
378 | 379 | then [StringEntry(keyStatus(amountAssetId, priceAssetId), statusActive), ScriptTransfer(user, (afterPut - beforePut), fromBase58String(lpAssetId))] | |
379 | 380 | else throw("Strict value is not equal to itself.") | |
380 | 381 | } | |
381 | 382 | else throw("Strict value is not equal to itself.") | |
382 | 383 | } | |
383 | 384 | else throw("Strict value is not equal to itself.") | |
384 | 385 | } | |
385 | 386 | else throw("Strict value is not equal to itself.") | |
386 | 387 | } | |
387 | 388 | else throw("Strict value is not equal to itself.") | |
388 | 389 | } | |
389 | 390 | else throw("Strict value is not equal to itself.") | |
390 | 391 | } | |
391 | 392 | else throw("Strict value is not equal to itself.") | |
392 | 393 | } | |
393 | 394 | ||
394 | 395 | ||
395 | 396 | ||
396 | 397 | @Callable(i) | |
397 | 398 | func setAdmins (adminPubKeys) = { | |
398 | 399 | let checkCaller = mustManager(i) | |
399 | 400 | if ((checkCaller == checkCaller)) | |
400 | 401 | then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))] | |
401 | 402 | else throw("Strict value is not equal to itself.") | |
402 | 403 | } | |
403 | 404 | ||
404 | 405 | ||
405 | 406 | ||
406 | 407 | @Callable(i) | |
407 | - | func setManager (pendingManagerPublicKey) = { | |
408 | - | let checkCaller = mustManager(i) | |
409 | - | if ((checkCaller == checkCaller)) | |
410 | - | then { | |
411 | - | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
412 | - | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
413 | - | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
414 | - | else throw("Strict value is not equal to itself.") | |
415 | - | } | |
416 | - | else throw("Strict value is not equal to itself.") | |
417 | - | } | |
418 | - | ||
419 | - | ||
420 | - | ||
421 | - | @Callable(i) | |
422 | - | func confirmManager () = { | |
423 | - | let pm = pendingManagerPublicKeyOrUnit() | |
424 | - | let hasPM = if (isDefined(pm)) | |
425 | - | then true | |
426 | - | else throw("No pending manager") | |
427 | - | if ((hasPM == hasPM)) | |
428 | - | then { | |
429 | - | let checkPM = if ((i.callerPublicKey == value(pm))) | |
430 | - | then true | |
431 | - | else throw("You are not pending manager") | |
432 | - | if ((checkPM == checkPM)) | |
433 | - | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
434 | - | else throw("Strict value is not equal to itself.") | |
435 | - | } | |
436 | - | else throw("Strict value is not equal to itself.") | |
437 | - | } | |
438 | - | ||
439 | - | ||
440 | - | ||
441 | - | @Callable(i) | |
442 | 408 | func priceAssetsREADONLY () = $Tuple2(nil, stringOptionToList(getString(keyPriceAssets()))) | |
443 | 409 | ||
444 | 410 | ||
445 | 411 | ||
446 | 412 | @Callable(i) | |
447 | 413 | func statusREADONLY (amountAssetId,priceAssetId) = { | |
448 | 414 | let status = match getString(keyStatus(amountAssetId, priceAssetId)) { | |
449 | 415 | case s: String => | |
450 | 416 | s | |
451 | 417 | case _ => | |
452 | 418 | unit | |
453 | 419 | } | |
454 | 420 | $Tuple2(nil, status) | |
455 | 421 | } | |
456 | 422 | ||
457 | 423 | ||
458 | 424 | @Verifier(tx) | |
459 | 425 | func verify () = { | |
460 | 426 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
461 | 427 | case pk: ByteVector => | |
462 | 428 | pk | |
463 | 429 | case _: Unit => | |
464 | 430 | tx.senderPublicKey | |
465 | 431 | case _ => | |
466 | 432 | throw("Match error") | |
467 | 433 | } | |
468 | 434 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
469 | 435 | } | |
470 | 436 |
github/deemru/w8io/169f3d6 65.70 ms ◑