tx · CBsJMtfca1ASq6C6nftddgzYuZ24BxZbrT6o3Z7jUqpH 3MsMP2pb2p8MDd6Rxb7XEXqqwEhE8ATfyai: -0.02600000 Waves 2023.07.27 12:32 [2684077] smart account 3MsMP2pb2p8MDd6Rxb7XEXqqwEhE8ATfyai > SELF 0.00000000 Waves
{ "type": 13, "id": "CBsJMtfca1ASq6C6nftddgzYuZ24BxZbrT6o3Z7jUqpH", "fee": 2600000, "feeAssetId": null, "timestamp": 1690450362465, "version": 2, "chainId": 84, "sender": "3MsMP2pb2p8MDd6Rxb7XEXqqwEhE8ATfyai", "senderPublicKey": "2JEaBjtjvMoNGKZmL9QxYefa1VkMJM3vMW8rNvTs9R2H", "proofs": [ "2gbqPsGJqY9GwaTCtDUf66mbwd7UNtEH18tkhHb5TWAnzz8Y3VvpFtibgLTLMBN4GxXyWjtyzUppJArZ9TDYQbCx" ], "script": "base64:BgKiKwgCEgASBAoCCAgSBAoCCAgSAwoBCBIKCggICAgICAgIARIDCgEIEgYKBAgICAgSBAoCCBgSAwoBCBIECgIIGBIDCgEYEgoKCAgICAgIAQgIEgQKAggBEgMKAQESAwoBARIECgIIARIGCgQICAgIEgQKAggIEgQKAggIEgQKAggIEgMKAQgSAwoBCBIDCgEIEgMKAQgSAwoBCBIECgIICBIDCgEIEgMKAQgSAwoBCBIECgIICBIDCgEIEgMKAQgSAwoBCCIGU0NBTEU4IgVNVUxUOCIGTVVMVDEyIgdTQ0FMRTE4IgZNVUxUMTgiDlBPT0xXRUlHSFRNVUxUIg5HV1h2aXJ0dWFsUE9PTCIMbGFiZWxQb29sc0xwIg1kZWZhdWx0U3ByZWFkIgt3YXZlc1N0cmluZyIRZGVjaW1hbHNNdWx0UHJpY2UiA1NFUCIFRU1QVFkiClBvb2xBY3RpdmUiD1Bvb2xQdXREaXNhYmxlZCITUG9vbE1hdGNoZXJEaXNhYmxlZCIMUG9vbFNodXRkb3duIhJpZHhJbnRlcm5hbEFzc2V0SWQiD2lkeFJlc3V0QWN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diff:
Old | New | Differences | |
---|---|---|---|
20 | 20 | let defaultSpread = 2000000 | |
21 | 21 | ||
22 | 22 | let wavesString = "WAVES" | |
23 | - | ||
24 | - | let contractFilename = "factory_v2.ride" | |
25 | 23 | ||
26 | 24 | let decimalsMultPrice = ((100 * 1000) * 1000) | |
27 | 25 | ||
69 | 67 | ||
70 | 68 | let validPoolLabels = [poolLabelWxEmission] | |
71 | 69 | ||
72 | - | func wrapErr (msg) = makeString([contractFilename, ": ", msg], "") | |
73 | - | ||
74 | - | ||
75 | - | func throwErr (msg) = throw(wrapErr(msg)) | |
76 | - | ||
77 | - | ||
78 | 70 | func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash" | |
79 | 71 | ||
80 | 72 | ||
117 | 109 | func keyVotingEmissionContract () = "%s__votingEmissionContract" | |
118 | 110 | ||
119 | 111 | ||
120 | - | func keyUserPoolsContract () = "%s__userPoolsContract" | |
121 | - | ||
122 | - | ||
123 | 112 | func keyPriceAssets () = makeString(["%s", "priceAssets"], SEP) | |
124 | 113 | ||
125 | 114 | ||
148 | 137 | ||
149 | 138 | ||
150 | 139 | func keyPoolOneTokenOperationsDisabled (assetsInternal) = { | |
151 | - | let $ | |
152 | - | let amountAssetInternal = $ | |
153 | - | let priceAssetInternal = $ | |
140 | + | let $t036583720 = assetsInternal | |
141 | + | let amountAssetInternal = $t036583720._1 | |
142 | + | let priceAssetInternal = $t036583720._2 | |
154 | 143 | makeString(["%d%d%s", toString(amountAssetInternal), toString(priceAssetInternal), "oneTokenOperationsDisabled"], SEP) | |
155 | 144 | } | |
156 | 145 | ||
312 | 301 | } | |
313 | 302 | ||
314 | 303 | ||
315 | - | let permissionDeniedError = | |
304 | + | let permissionDeniedError = throw("Permission denied") | |
316 | 305 | ||
317 | - | let testError = | |
306 | + | let testError = throw("Test error here") | |
318 | 307 | ||
319 | 308 | func mustThis (i) = if ((i.caller == this)) | |
320 | 309 | then true | |
402 | 391 | } | |
403 | 392 | ||
404 | 393 | ||
405 | - | func getAssetsDataFromPoolAddress (poolContractAddress) = { | |
406 | - | let poolAssets = match getString(keyMappingPoolContractAddressToPoolAssets(poolContractAddress)) { | |
407 | - | case s: String => | |
408 | - | split(s, SEP) | |
409 | - | case _ => | |
410 | - | throwErr(makeString([poolContractAddress, "pool is not found"], " ")) | |
411 | - | } | |
412 | - | let amountAssetInternal = parseIntValue(poolAssets[1]) | |
413 | - | let priceAssetInternal = parseIntValue(poolAssets[2]) | |
414 | - | let amountAssetId = getStringValue(keyMappingsInternal2baseAssetId(amountAssetInternal)) | |
415 | - | let priceAssetId = getStringValue(keyMappingsInternal2baseAssetId(priceAssetInternal)) | |
416 | - | let lpAssetId = getStringValue(keyMappingPoolContractToLPAsset(poolContractAddress)) | |
417 | - | $Tuple5(amountAssetId, priceAssetId, lpAssetId, amountAssetInternal, priceAssetInternal) | |
418 | - | } | |
419 | - | ||
420 | - | ||
421 | - | func getPoolCreator (poolContractAddress) = { | |
422 | - | let $t01526915406 = getAssetsDataFromPoolAddress(poolContractAddress) | |
423 | - | let amountAssetId = $t01526915406._1 | |
424 | - | let priceAssetId = $t01526915406._2 | |
425 | - | let lpAssetId = $t01526915406._3 | |
426 | - | let amountAssetInternal = $t01526915406._4 | |
427 | - | let priceAssetInternal = $t01526915406._5 | |
428 | - | let userPoolsContract = addressFromStringValue(getStringValue(keyUserPoolsContract())) | |
429 | - | let poolCreator = invoke(userPoolsContract, "getPoolCreatorREADONLY", [amountAssetId, priceAssetId], nil) | |
430 | - | poolCreator | |
431 | - | } | |
432 | - | ||
433 | - | ||
434 | - | func getAddressBalance (addressString,assetIdString) = { | |
435 | - | let address = addressFromStringValue(addressString) | |
436 | - | if ((assetIdString == "WAVES")) | |
437 | - | then wavesBalance(address).regular | |
438 | - | else { | |
439 | - | let assetId = fromBase58String(assetIdString) | |
440 | - | assetBalance(address, assetId) | |
441 | - | } | |
442 | - | } | |
443 | - | ||
444 | - | ||
445 | - | func isPoolEmpty (poolContractAddress) = { | |
446 | - | let $t01598116118 = getAssetsDataFromPoolAddress(poolContractAddress) | |
447 | - | let amountAssetId = $t01598116118._1 | |
448 | - | let priceAssetId = $t01598116118._2 | |
449 | - | let lpAssetId = $t01598116118._3 | |
450 | - | let amountAssetInternal = $t01598116118._4 | |
451 | - | let priceAssetInternal = $t01598116118._5 | |
452 | - | if ((getAddressBalance(poolContractAddress, amountAssetId) == 0)) | |
453 | - | then (getAddressBalance(poolContractAddress, priceAssetId) == 0) | |
454 | - | else false | |
455 | - | } | |
456 | - | ||
457 | - | ||
458 | 394 | @Callable(i) | |
459 | 395 | func getSwapContractREADONLY () = $Tuple2(nil, getStringOrFail(swapContract())) | |
460 | 396 | ||
462 | 398 | ||
463 | 399 | @Callable(i) | |
464 | 400 | func getPoolLeaseConfigREADONLY (poolAddress,assetId) = { | |
465 | - | let $ | |
401 | + | let $t01440714711 = match getInteger(this, keyLeasedRatio(poolAddress, assetId)) { | |
466 | 402 | case r: Int => | |
467 | 403 | $Tuple2(true, min([100, max([0, r])])) | |
468 | 404 | case _ => | |
473 | 409 | $Tuple2(false, 0) | |
474 | 410 | } | |
475 | 411 | } | |
476 | - | let isLeasable = $ | |
477 | - | let leasedRatio = $ | |
412 | + | let isLeasable = $t01440714711._1 | |
413 | + | let leasedRatio = $t01440714711._2 | |
478 | 414 | let minBalance = match getInteger(this, keyMinBalance(poolAddress, assetId)) { | |
479 | 415 | case b: Int => | |
480 | 416 | max([0, b]) | |
486 | 422 | 0 | |
487 | 423 | } | |
488 | 424 | } | |
489 | - | let $ | |
425 | + | let $t01497715201 = if ((assetId == "WAVES")) | |
490 | 426 | then $Tuple3(valueOrElse(getString(this, keySWavesProxyAddress()), ""), getString(this, valueOrElse(keySWavesAssetId(), "")), MULT12) | |
491 | 427 | else $Tuple3("", "", 0) | |
492 | - | let proxyAddress = $ | |
493 | - | let proxyAssetId = $ | |
494 | - | let proxyRateMul = $ | |
428 | + | let proxyAddress = $t01497715201._1 | |
429 | + | let proxyAssetId = $t01497715201._2 | |
430 | + | let proxyRateMul = $t01497715201._3 | |
495 | 431 | let stakingProfitAddress = valueOrElse(getString(this, keyStakingProfitAddress()), "") | |
496 | 432 | $Tuple2(nil, $Tuple7(isLeasable, leasedRatio, minBalance, proxyAddress, proxyAssetId, proxyRateMul, stakingProfitAddress)) | |
497 | 433 | } | |
605 | 541 | let checkCaller = mustAdmin(i) | |
606 | 542 | if ((checkCaller == checkCaller)) | |
607 | 543 | then if (isDefined(getString(keyMappingPoolContractAddressToPoolAssets(poolAddress)))) | |
608 | - | then | |
544 | + | then throw((("Pool address " + poolAddress) + " already registered.")) | |
609 | 545 | else { | |
610 | 546 | let internalAmountAssetData = getInternalAssetIdOrCreate(amountAssetStr, 1) | |
611 | 547 | let internalAmountAssetId = internalAmountAssetData._1 | |
617 | 553 | let ethalonPoolAccountScriptHash = getBinaryValue(keyPoolScriptHash()) | |
618 | 554 | let poolExists = poolExistsInternal(amountAssetStr, priceAssetStr) | |
619 | 555 | if (poolExists) | |
620 | - | then | |
556 | + | then throw((((("Pool " + amountAssetStr) + "/") + priceAssetStr) + " has already been activated.")) | |
621 | 557 | else { | |
622 | 558 | let poolConfigValue = value(getString(this, keyPoolConfig(toString(internalAmountAssetId), toString(internalPriceAssetId)))) | |
623 | 559 | let amountAssetsDecimals = if ((amountAssetStr == "WAVES")) | |
632 | 568 | let poolActivateInvokeResult = invoke(addressFromStringValue(poolAddress), "activate", [amountAssetStr, priceAssetStr], nil) | |
633 | 569 | if ((poolActivateInvokeResult == poolActivateInvokeResult)) | |
634 | 570 | then if ((poolActivateInvokeResult != "success")) | |
635 | - | then | |
571 | + | then throw("Pool initialisation error happened.") | |
636 | 572 | else { | |
637 | 573 | let assetsStoreContract = addressFromStringValue(getStringOrFail(keyAssetsStoreContract())) | |
638 | 574 | let createOrUpdateLpAssetInv = invoke(assetsStoreContract, "createOrUpdate", [lpAssetIdStr, lpAssetName, false], nil) | |
717 | 653 | let inAmountAssetId = toBase58String(value(payment.assetId)) | |
718 | 654 | let lpAssetRequestedForBurning = valueOrErrorMessage(getString(keyMappingPoolContractToLPAsset(toString(caller))), "Invalid LP address called me.") | |
719 | 655 | if ((inAmountAssetId != lpAssetRequestedForBurning)) | |
720 | - | then | |
656 | + | then throw("Invalid asset passed.") | |
721 | 657 | else if ((amountToBurn != paymentAmount)) | |
722 | - | then | |
658 | + | then throw("Invalid amount passed.") | |
723 | 659 | else { | |
724 | 660 | let lpAsset = fromBase58String(lpAssetRequestedForBurning) | |
725 | 661 | $Tuple2([Burn(lpAsset, amountToBurn)], "success") | |
783 | 719 | let btcWeightNew = (btcWeight - weightDecrement) | |
784 | 720 | let ethWeightNew = (ethWeight - weightDecrement) | |
785 | 721 | if ((0 >= btcWeightNew)) | |
786 | - | then | |
722 | + | then throw(("invalid btcWeightNew: " + toString(btcWeightNew))) | |
787 | 723 | else if ((0 >= ethWeightNew)) | |
788 | - | then | |
724 | + | then throw(("invalid ethWeightNew: " + toString(ethWeightNew))) | |
789 | 725 | else { | |
790 | 726 | let btcLpAssetIdStr = getStringOrFail(keyMappingPoolContractToLPAsset(btcPoolAddress)) | |
791 | 727 | let ethLpAssetIdStr = getStringOrFail(keyMappingPoolContractToLPAsset(ethPoolAddress)) | |
862 | 798 | let priceAssets = getPriceAssets() | |
863 | 799 | let checkPriceAssetsSize = if ((size(priceAssets) > 0)) | |
864 | 800 | then true | |
865 | - | else | |
801 | + | else throw("invalid price assets") | |
866 | 802 | if ((checkPriceAssetsSize == checkPriceAssetsSize)) | |
867 | 803 | then { | |
868 | 804 | func cb (acc,priceAsset) = { | |
1024 | 960 | } | |
1025 | 961 | ||
1026 | 962 | ||
1027 | - | ||
1028 | - | @Callable(i) | |
1029 | - | func deletePool (poolContractAddress) = { | |
1030 | - | let poolConfig = getPoolConfig(poolContractAddress) | |
1031 | - | let checkCaller = if ((toString(i.caller) == getPoolCreator(poolContractAddress))) | |
1032 | - | then if (isPoolEmpty(poolContractAddress)) | |
1033 | - | then true | |
1034 | - | else throwErr("Pool is not empty") | |
1035 | - | else mustManager(i) | |
1036 | - | if ((checkCaller == checkCaller)) | |
1037 | - | then { | |
1038 | - | let checkWeight = if ((valueOrElse(getInteger(keyPoolToWeight(poolContractAddress)), 0) == 0)) | |
1039 | - | then true | |
1040 | - | else throwErr("Pool weight is not Zero") | |
1041 | - | if ((checkWeight == checkWeight)) | |
1042 | - | then { | |
1043 | - | let checkStatus = if ((poolConfig[idxPoolStatus] == toString(PoolShutdown))) | |
1044 | - | then true | |
1045 | - | else throwErr("Pool must be SHUTDOWN (4)") | |
1046 | - | if ((checkStatus == checkStatus)) | |
1047 | - | then { | |
1048 | - | let $t03961739754 = getAssetsDataFromPoolAddress(poolContractAddress) | |
1049 | - | let amountAssetId = $t03961739754._1 | |
1050 | - | let priceAssetId = $t03961739754._2 | |
1051 | - | let lpAssetId = $t03961739754._3 | |
1052 | - | let amountAssetInternal = $t03961739754._4 | |
1053 | - | let priceAssetInternal = $t03961739754._5 | |
1054 | - | let userPoolsContract = addressFromStringValue(getStringValue(keyUserPoolsContract())) | |
1055 | - | let userPoolsInvoke = invoke(userPoolsContract, "deletePool", [amountAssetId, priceAssetId], nil) | |
1056 | - | if ((userPoolsInvoke == userPoolsInvoke)) | |
1057 | - | then { | |
1058 | - | let votingEmissionContract = addressFromStringValue(getStringValue(keyVotingEmissionContract())) | |
1059 | - | let votingEmissionInvoke = invoke(votingEmissionContract, "deletePool", [amountAssetId, priceAssetId], nil) | |
1060 | - | if ((votingEmissionInvoke == votingEmissionInvoke)) | |
1061 | - | then { | |
1062 | - | let assetsStoreContract = addressFromStringValue(getStringValue(keyAssetsStoreContract())) | |
1063 | - | let assetsStoreInvoke = invoke(assetsStoreContract, "deletePool", [amountAssetId, priceAssetId], nil) | |
1064 | - | if ((assetsStoreInvoke == assetsStoreInvoke)) | |
1065 | - | then [DeleteEntry(keyMappingPoolContractToLPAsset(poolContractAddress)), DeleteEntry(keyMappingPoolContractAddressToPoolAssets(poolContractAddress)), DeleteEntry(keyMappingPoolAssetsToLpasset(toString(amountAssetInternal), toString(priceAssetInternal))), DeleteEntry(keyMappingPoolAssetsToPoolContractAddress(amountAssetInternal, priceAssetInternal)), DeleteEntry(keyPoolConfig(toString(amountAssetInternal), toString(priceAssetInternal))), DeleteEntry(keyMappingLpAssetToPoolAssets(lpAssetId)), DeleteEntry(keyMappingPoolLPAssetToPoolContractAddress(lpAssetId)), DeleteEntry(keyWxEmission(amountAssetId, priceAssetId)), DeleteEntry(keyPoolToWeight(poolContractAddress)), DeleteEntry(keyPoolSpread(poolContractAddress)), DeleteEntry(keyInFee(poolContractAddress)), DeleteEntry(keyOutFee(poolContractAddress)), DeleteEntry(keySkipOrderValidation(poolContractAddress)), DeleteEntry(keyChangeAmpDelay(poolContractAddress)), DeleteEntry(keyChangeAmpDelta(poolContractAddress)), DeleteEntry(keyChangeAmpTarget(poolContractAddress))] | |
1066 | - | else throw("Strict value is not equal to itself.") | |
1067 | - | } | |
1068 | - | else throw("Strict value is not equal to itself.") | |
1069 | - | } | |
1070 | - | else throw("Strict value is not equal to itself.") | |
1071 | - | } | |
1072 | - | else throw("Strict value is not equal to itself.") | |
1073 | - | } | |
1074 | - | else throw("Strict value is not equal to itself.") | |
1075 | - | } | |
1076 | - | else throw("Strict value is not equal to itself.") | |
1077 | - | } | |
1078 | - | ||
1079 | - | ||
1080 | 963 | @Verifier(tx) | |
1081 | 964 | func verify () = { | |
1082 | 965 | 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 SCALE8 = 8 | |
5 | 5 | ||
6 | 6 | let MULT8 = 100000000 | |
7 | 7 | ||
8 | 8 | let MULT12 = 1000000000000 | |
9 | 9 | ||
10 | 10 | let SCALE18 = 18 | |
11 | 11 | ||
12 | 12 | let MULT18 = toBigInt(1000000000000000000) | |
13 | 13 | ||
14 | 14 | let POOLWEIGHTMULT = MULT8 | |
15 | 15 | ||
16 | 16 | let GWXvirtualPOOL = "GWXvirtualPOOL" | |
17 | 17 | ||
18 | 18 | let labelPoolsLp = "POOLS_LP" | |
19 | 19 | ||
20 | 20 | let defaultSpread = 2000000 | |
21 | 21 | ||
22 | 22 | let wavesString = "WAVES" | |
23 | - | ||
24 | - | let contractFilename = "factory_v2.ride" | |
25 | 23 | ||
26 | 24 | let decimalsMultPrice = ((100 * 1000) * 1000) | |
27 | 25 | ||
28 | 26 | let SEP = "__" | |
29 | 27 | ||
30 | 28 | let EMPTY = "" | |
31 | 29 | ||
32 | 30 | let PoolActive = 1 | |
33 | 31 | ||
34 | 32 | let PoolPutDisabled = 2 | |
35 | 33 | ||
36 | 34 | let PoolMatcherDisabled = 3 | |
37 | 35 | ||
38 | 36 | let PoolShutdown = 4 | |
39 | 37 | ||
40 | 38 | let idxInternalAssetId = 1 | |
41 | 39 | ||
42 | 40 | let idxResutActions = 2 | |
43 | 41 | ||
44 | 42 | let idxIfAssetIdCalculationPerformed = 3 | |
45 | 43 | ||
46 | 44 | let idxPoolAddress = 1 | |
47 | 45 | ||
48 | 46 | let idxPoolStatus = 2 | |
49 | 47 | ||
50 | 48 | let idxPoolLPAssetId = 3 | |
51 | 49 | ||
52 | 50 | let idxAmtAssetId = 4 | |
53 | 51 | ||
54 | 52 | let idxPriceAssetId = 5 | |
55 | 53 | ||
56 | 54 | let idxAmtAssetDcm = 6 | |
57 | 55 | ||
58 | 56 | let idxPriceAssetDcm = 7 | |
59 | 57 | ||
60 | 58 | let idxIAmtAssetId = 8 | |
61 | 59 | ||
62 | 60 | let idxIPriceAssetId = 9 | |
63 | 61 | ||
64 | 62 | let idxLPAssetDcm = 10 | |
65 | 63 | ||
66 | 64 | let idxPoolType = 11 | |
67 | 65 | ||
68 | 66 | let poolLabelWxEmission = "WX_EMISSION" | |
69 | 67 | ||
70 | 68 | let validPoolLabels = [poolLabelWxEmission] | |
71 | 69 | ||
72 | - | func wrapErr (msg) = makeString([contractFilename, ": ", msg], "") | |
73 | - | ||
74 | - | ||
75 | - | func throwErr (msg) = throw(wrapErr(msg)) | |
76 | - | ||
77 | - | ||
78 | 70 | func keyAllowedLpScriptHash () = "%s__allowedLpScriptHash" | |
79 | 71 | ||
80 | 72 | ||
81 | 73 | func keyAllowedLpStableScriptHash () = "%s__allowedLpStableScriptHash" | |
82 | 74 | ||
83 | 75 | ||
84 | 76 | func swapContract () = "%s__swapContract" | |
85 | 77 | ||
86 | 78 | ||
87 | 79 | func keyFactoryConfig () = "%s__factoryConfig" | |
88 | 80 | ||
89 | 81 | ||
90 | 82 | func keyLpTokensList () = "%s__lpTokensList" | |
91 | 83 | ||
92 | 84 | ||
93 | 85 | func keyPoolScriptHash () = "%s%s__pool__scriptHash" | |
94 | 86 | ||
95 | 87 | ||
96 | 88 | func keyMatcherPub () = "%s%s__matcher__publicKey" | |
97 | 89 | ||
98 | 90 | ||
99 | 91 | func keyLegacyFactoryContract () = "%s__legacyFactoryContract" | |
100 | 92 | ||
101 | 93 | ||
102 | 94 | func keyLegacyPools () = "%s__legacyPools" | |
103 | 95 | ||
104 | 96 | ||
105 | 97 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
106 | 98 | ||
107 | 99 | ||
108 | 100 | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
109 | 101 | ||
110 | 102 | ||
111 | 103 | func keyAdminPubKeys () = "%s__adminPubKeys" | |
112 | 104 | ||
113 | 105 | ||
114 | 106 | func keyAssetsStoreContract () = "%s__assetsStoreContract" | |
115 | 107 | ||
116 | 108 | ||
117 | 109 | func keyVotingEmissionContract () = "%s__votingEmissionContract" | |
118 | 110 | ||
119 | 111 | ||
120 | - | func keyUserPoolsContract () = "%s__userPoolsContract" | |
121 | - | ||
122 | - | ||
123 | 112 | func keyPriceAssets () = makeString(["%s", "priceAssets"], SEP) | |
124 | 113 | ||
125 | 114 | ||
126 | 115 | func keyPriceDecimals () = "%s__priceDecimals" | |
127 | 116 | ||
128 | 117 | ||
129 | 118 | func keyAllPoolsShutdown () = "%s__shutdown" | |
130 | 119 | ||
131 | 120 | ||
132 | 121 | func keyNextInternalAssetId () = "%s__nextInternalAssetId" | |
133 | 122 | ||
134 | 123 | ||
135 | 124 | func keyPoolToWeight (poolAddress) = ("%s%s__poolWeight__" + poolAddress) | |
136 | 125 | ||
137 | 126 | ||
138 | 127 | func keyPoolToWeightHistory (poolAddress,num) = ((("%s%s__poolWeight__" + poolAddress) + "__") + toString(num)) | |
139 | 128 | ||
140 | 129 | ||
141 | 130 | func keyMappingsInternal2baseAssetId (internalBaseAsset) = ("%s%s%d__mappings__internal2baseAssetId__" + toString(internalBaseAsset)) | |
142 | 131 | ||
143 | 132 | ||
144 | 133 | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
145 | 134 | ||
146 | 135 | ||
147 | 136 | func keyPoolConfig (amountAssetInternal,priceAssetInternal) = (((("%d%d%s__" + amountAssetInternal) + "__") + priceAssetInternal) + "__config") | |
148 | 137 | ||
149 | 138 | ||
150 | 139 | func keyPoolOneTokenOperationsDisabled (assetsInternal) = { | |
151 | - | let $ | |
152 | - | let amountAssetInternal = $ | |
153 | - | let priceAssetInternal = $ | |
140 | + | let $t036583720 = assetsInternal | |
141 | + | let amountAssetInternal = $t036583720._1 | |
142 | + | let priceAssetInternal = $t036583720._2 | |
154 | 143 | makeString(["%d%d%s", toString(amountAssetInternal), toString(priceAssetInternal), "oneTokenOperationsDisabled"], SEP) | |
155 | 144 | } | |
156 | 145 | ||
157 | 146 | ||
158 | 147 | func keyAllPoolsOneTokenOperationsDisabled () = makeString(["%s", "oneTokenOperationsDisabled"], SEP) | |
159 | 148 | ||
160 | 149 | ||
161 | 150 | func keyMappingLpAssetToPoolAssets (lpAssetStr) = (("%s%s%s__" + lpAssetStr) + "__mappings__lpAsset2Pool") | |
162 | 151 | ||
163 | 152 | ||
164 | 153 | func keyMappingPoolAssetsToLpasset (internalAmountAssetIdStr,internalPriceAssetIdStr) = (((("%d%d%s%s__" + internalAmountAssetIdStr) + "__") + internalPriceAssetIdStr) + "__mappings__PoolAssets2LpAsset") | |
165 | 154 | ||
166 | 155 | ||
167 | 156 | func keyPoolSpread (poolAddress) = ("%s%s__spread__" + poolAddress) | |
168 | 157 | ||
169 | 158 | ||
170 | 159 | func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2PoolAssets") | |
171 | 160 | ||
172 | 161 | ||
173 | 162 | func keyMappingPoolAssetsToPoolContractAddress (internalAmountAssetIdStr,internalPriceAssetIdStr) = (((("%d%d%s%s__" + toString(internalAmountAssetIdStr)) + "__") + toString(internalPriceAssetIdStr)) + "__mappings__poolAssets2PoolContract") | |
174 | 163 | ||
175 | 164 | ||
176 | 165 | func keyMappingPoolContractToLPAsset (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset") | |
177 | 166 | ||
178 | 167 | ||
179 | 168 | func keyMappingPoolLPAssetToPoolContractAddress (lpAssetStr) = (("%s%s%s__" + lpAssetStr) + "__mappings__lpAsset2PoolContract") | |
180 | 169 | ||
181 | 170 | ||
182 | 171 | func keyWxEmission (amountAssetId,priceAssetId) = ((("%s%s%s__wxEmission__" + amountAssetId) + "__") + priceAssetId) | |
183 | 172 | ||
184 | 173 | ||
185 | 174 | func keyInFee (poolAddress) = ("%s%s__inFee__" + poolAddress) | |
186 | 175 | ||
187 | 176 | ||
188 | 177 | func keyInFeeDefault () = "%s__inFeeDefault" | |
189 | 178 | ||
190 | 179 | ||
191 | 180 | func keySwapFee (poolAddress) = ("%s%s__swapFee__" + poolAddress) | |
192 | 181 | ||
193 | 182 | ||
194 | 183 | func keyOutFee (poolAddress) = ("%s%s__outFee__" + poolAddress) | |
195 | 184 | ||
196 | 185 | ||
197 | 186 | func keyOutFeeDefault () = "%s__outFeeDefault" | |
198 | 187 | ||
199 | 188 | ||
200 | 189 | func keySkipOrderValidation (poolAddress) = ("%s%s__skipOrderValidation__" + poolAddress) | |
201 | 190 | ||
202 | 191 | ||
203 | 192 | func keyChangeAmpDelay (poolAddress) = ("%s%s__changeAmpDelay__" + poolAddress) | |
204 | 193 | ||
205 | 194 | ||
206 | 195 | func keyChangeAmpDelta (poolAddress) = ("%s%s__changeAmpDelta__" + poolAddress) | |
207 | 196 | ||
208 | 197 | ||
209 | 198 | func keyChangeAmpTarget (poolAddress) = ("%s%s__changeAmpTarget__" + poolAddress) | |
210 | 199 | ||
211 | 200 | ||
212 | 201 | func keySWavesProxyAddress () = "%s__sWavesProxyAddress" | |
213 | 202 | ||
214 | 203 | ||
215 | 204 | func keySWavesAssetId () = "%s__sWavesAssetId" | |
216 | 205 | ||
217 | 206 | ||
218 | 207 | func keyStakingProfitAddress () = "%s__stakingProfitAddress" | |
219 | 208 | ||
220 | 209 | ||
221 | 210 | func keyLeasedRatio (poolAddress,assetId) = makeString(["%s%s%s", "leasedRatio", poolAddress, assetId], SEP) | |
222 | 211 | ||
223 | 212 | ||
224 | 213 | func keyLeasedRatioDefault (assetId) = makeString(["%s%s", "leasedRatioDefault", assetId], SEP) | |
225 | 214 | ||
226 | 215 | ||
227 | 216 | func keyLeasedRatioTolerance (poolAddress,assetId) = makeString(["%s%s%s", "leasedRatioTolerance", poolAddress, assetId], SEP) | |
228 | 217 | ||
229 | 218 | ||
230 | 219 | func keyMinBalance (poolAddress,assetId) = makeString(["%s%s%s", "minBalance", poolAddress, assetId], SEP) | |
231 | 220 | ||
232 | 221 | ||
233 | 222 | func keyMinBalanceDefault (assetId) = makeString(["%s%s", "minBalanceDefault", assetId], SEP) | |
234 | 223 | ||
235 | 224 | ||
236 | 225 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), ("No data for this.key=" + key)) | |
237 | 226 | ||
238 | 227 | ||
239 | 228 | func getBooleanOrFail (key) = valueOrErrorMessage(getBoolean(this, key), ("No data for this.key=" + key)) | |
240 | 229 | ||
241 | 230 | ||
242 | 231 | func getIntOrFail (key) = valueOrErrorMessage(getInteger(this, key), ("No data for this.key=" + key)) | |
243 | 232 | ||
244 | 233 | ||
245 | 234 | func parseAssetId (input) = if ((input == wavesString)) | |
246 | 235 | then unit | |
247 | 236 | else fromBase58String(input) | |
248 | 237 | ||
249 | 238 | ||
250 | 239 | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
251 | 240 | case s: String => | |
252 | 241 | addressFromStringValue(s) | |
253 | 242 | case _ => | |
254 | 243 | this | |
255 | 244 | } | |
256 | 245 | ||
257 | 246 | ||
258 | 247 | let IdxFactoryCfgStakingDapp = 1 | |
259 | 248 | ||
260 | 249 | let IdxFactoryCfgBoostingDapp = 2 | |
261 | 250 | ||
262 | 251 | let IdxFactoryCfgIdoDapp = 3 | |
263 | 252 | ||
264 | 253 | let IdxFactoryCfgTeamDapp = 4 | |
265 | 254 | ||
266 | 255 | let IdxFactoryCfgEmissionDapp = 5 | |
267 | 256 | ||
268 | 257 | let IdxFactoryCfgRestDapp = 6 | |
269 | 258 | ||
270 | 259 | let IdxFactoryCfgSlippageDapp = 7 | |
271 | 260 | ||
272 | 261 | let IdxFactoryCfgDaoDapp = 8 | |
273 | 262 | ||
274 | 263 | let IdxFactoryCfgMarketingDapp = 9 | |
275 | 264 | ||
276 | 265 | let IdxFactoryCfgGwxRewardDapp = 10 | |
277 | 266 | ||
278 | 267 | let IdxFactoryCfgBirdsDapp = 11 | |
279 | 268 | ||
280 | 269 | func getBoostingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgBoostingDapp]) | |
281 | 270 | ||
282 | 271 | ||
283 | 272 | func getEmissionAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgEmissionDapp]) | |
284 | 273 | ||
285 | 274 | ||
286 | 275 | func getStakingAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgStakingDapp]) | |
287 | 276 | ||
288 | 277 | ||
289 | 278 | func getGwxRewardAddressOrFail (factoryCfg) = addressFromStringValue(factoryCfg[IdxFactoryCfgGwxRewardDapp]) | |
290 | 279 | ||
291 | 280 | ||
292 | 281 | func getPriceAssets () = match getString(keyPriceAssets()) { | |
293 | 282 | case s: String => | |
294 | 283 | if ((size(s) == 0)) | |
295 | 284 | then nil | |
296 | 285 | else split_4C(s, SEP) | |
297 | 286 | case _ => | |
298 | 287 | nil | |
299 | 288 | } | |
300 | 289 | ||
301 | 290 | ||
302 | 291 | func managerPublicKeyOrUnit () = { | |
303 | 292 | let managerVaultAddress = getManagerVaultAddressOrThis() | |
304 | 293 | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
305 | 294 | case s: String => | |
306 | 295 | fromBase58String(s) | |
307 | 296 | case _: Unit => | |
308 | 297 | unit | |
309 | 298 | case _ => | |
310 | 299 | throw("Match error") | |
311 | 300 | } | |
312 | 301 | } | |
313 | 302 | ||
314 | 303 | ||
315 | - | let permissionDeniedError = | |
304 | + | let permissionDeniedError = throw("Permission denied") | |
316 | 305 | ||
317 | - | let testError = | |
306 | + | let testError = throw("Test error here") | |
318 | 307 | ||
319 | 308 | func mustThis (i) = if ((i.caller == this)) | |
320 | 309 | then true | |
321 | 310 | else permissionDeniedError | |
322 | 311 | ||
323 | 312 | ||
324 | 313 | func mustManager (i) = match managerPublicKeyOrUnit() { | |
325 | 314 | case pk: ByteVector => | |
326 | 315 | if ((i.callerPublicKey == pk)) | |
327 | 316 | then true | |
328 | 317 | else permissionDeniedError | |
329 | 318 | case _: Unit => | |
330 | 319 | mustThis(i) | |
331 | 320 | case _ => | |
332 | 321 | throw("Match error") | |
333 | 322 | } | |
334 | 323 | ||
335 | 324 | ||
336 | 325 | func dataFactoryCfgV3 (stakingAddress,boostingAddress,idoContract,teamContract,emissionContract,restContract,slippageContract,daoContract,marketingContract,gwxRewardsContract,birdsContract) = makeString(["%s%s%s%s%s%s%s%s%s%s%s", stakingAddress, boostingAddress, idoContract, teamContract, emissionContract, restContract, slippageContract, daoContract, marketingContract, gwxRewardsContract, birdsContract], SEP) | |
337 | 326 | ||
338 | 327 | ||
339 | 328 | func dataFactoryCfg (stakingAddress,boostingAddress,idoContract,teamContract,emissionContract,restContract,slippageContract) = makeString(["%s%s%s%s%s%s", stakingAddress, boostingAddress, idoContract, teamContract, emissionContract, restContract, slippageContract], SEP) | |
340 | 329 | ||
341 | 330 | ||
342 | 331 | func dataPoolCfg (poolAddress,poolStatus,lpAssetId,amountAssetStr,priceAssetStr,amountAssetDecimals,priceAssetDecimals,amountAssetInternalId,priceAssetInternalId,lpAssetDecimals,poolType) = makeString(["%s%d%s%s%s%d%d%d%d%d%s", poolAddress, poolStatus, lpAssetId, amountAssetStr, priceAssetStr, toString(amountAssetDecimals), toString(priceAssetDecimals), toString(amountAssetInternalId), toString(priceAssetInternalId), toString(lpAssetDecimals), poolType], SEP) | |
343 | 332 | ||
344 | 333 | ||
345 | 334 | func dataMappingPoolAssets (internalAmountAssetStr,internalPriceAssetStr) = makeString(["%d%d", toString(internalAmountAssetStr), toString(internalPriceAssetStr)], SEP) | |
346 | 335 | ||
347 | 336 | ||
348 | 337 | func getPoolConfig (poolAddress) = { | |
349 | 338 | let poolAssets = split(getStringOrFail(keyMappingPoolContractAddressToPoolAssets(poolAddress)), SEP) | |
350 | 339 | let amountAssetInternal = poolAssets[1] | |
351 | 340 | let priceAssetInternal = poolAssets[2] | |
352 | 341 | split(getStringOrFail(keyPoolConfig(amountAssetInternal, priceAssetInternal)), SEP) | |
353 | 342 | } | |
354 | 343 | ||
355 | 344 | ||
356 | 345 | func getInternalAssetIdOrCreate (assetIdStr,incrementor) = { | |
357 | 346 | let internalAssetId = valueOrElse(getInteger(this, keyMappingsBaseAsset2internalId(assetIdStr)), 0) | |
358 | 347 | let currentIndexOfInternalId = valueOrElse(getInteger(this, keyNextInternalAssetId()), 0) | |
359 | 348 | let result = if ((internalAssetId == 0)) | |
360 | 349 | then { | |
361 | 350 | let newInternalAssetId = (currentIndexOfInternalId + incrementor) | |
362 | 351 | $Tuple3(newInternalAssetId, [IntegerEntry(keyNextInternalAssetId(), newInternalAssetId), IntegerEntry(keyMappingsBaseAsset2internalId(assetIdStr), newInternalAssetId), StringEntry(keyMappingsInternal2baseAssetId(newInternalAssetId), assetIdStr)], true) | |
363 | 352 | } | |
364 | 353 | else $Tuple3(internalAssetId, nil, false) | |
365 | 354 | result | |
366 | 355 | } | |
367 | 356 | ||
368 | 357 | ||
369 | 358 | func mustAdmin (i) = { | |
370 | 359 | let adminPKs = split(valueOrElse(getString(keyAdminPubKeys()), EMPTY), SEP) | |
371 | 360 | if (containsElement(adminPKs, toBase58String(i.callerPublicKey))) | |
372 | 361 | then true | |
373 | 362 | else { | |
374 | 363 | let isManager = mustManager(i) | |
375 | 364 | if ((isManager == isManager)) | |
376 | 365 | then true | |
377 | 366 | else throw("Strict value is not equal to itself.") | |
378 | 367 | } | |
379 | 368 | } | |
380 | 369 | ||
381 | 370 | ||
382 | 371 | func intOrDefaultOrFallback (key,keyDefault,valueFallback) = valueOrElse(getInteger(this, key), valueOrElse(getInteger(this, keyDefault), valueFallback)) | |
383 | 372 | ||
384 | 373 | ||
385 | 374 | func poolExistsInternal (amountAssetId,priceAssetId) = { | |
386 | 375 | let amountAssetInternal = getInteger(keyMappingsBaseAsset2internalId(amountAssetId)) | |
387 | 376 | let priceAssetInternal = getInteger(keyMappingsBaseAsset2internalId(priceAssetId)) | |
388 | 377 | if (if ((amountAssetInternal == unit)) | |
389 | 378 | then true | |
390 | 379 | else (priceAssetInternal == unit)) | |
391 | 380 | then false | |
392 | 381 | else { | |
393 | 382 | let amAs = toString(value(amountAssetInternal)) | |
394 | 383 | let prAs = toString(value(priceAssetInternal)) | |
395 | 384 | let cfg = getString(keyPoolConfig(amAs, prAs)) | |
396 | 385 | let cfgReverse = getString(keyPoolConfig(prAs, amAs)) | |
397 | 386 | let exists = if ((cfg != unit)) | |
398 | 387 | then true | |
399 | 388 | else (cfgReverse != unit) | |
400 | 389 | exists | |
401 | 390 | } | |
402 | 391 | } | |
403 | 392 | ||
404 | 393 | ||
405 | - | func getAssetsDataFromPoolAddress (poolContractAddress) = { | |
406 | - | let poolAssets = match getString(keyMappingPoolContractAddressToPoolAssets(poolContractAddress)) { | |
407 | - | case s: String => | |
408 | - | split(s, SEP) | |
409 | - | case _ => | |
410 | - | throwErr(makeString([poolContractAddress, "pool is not found"], " ")) | |
411 | - | } | |
412 | - | let amountAssetInternal = parseIntValue(poolAssets[1]) | |
413 | - | let priceAssetInternal = parseIntValue(poolAssets[2]) | |
414 | - | let amountAssetId = getStringValue(keyMappingsInternal2baseAssetId(amountAssetInternal)) | |
415 | - | let priceAssetId = getStringValue(keyMappingsInternal2baseAssetId(priceAssetInternal)) | |
416 | - | let lpAssetId = getStringValue(keyMappingPoolContractToLPAsset(poolContractAddress)) | |
417 | - | $Tuple5(amountAssetId, priceAssetId, lpAssetId, amountAssetInternal, priceAssetInternal) | |
418 | - | } | |
419 | - | ||
420 | - | ||
421 | - | func getPoolCreator (poolContractAddress) = { | |
422 | - | let $t01526915406 = getAssetsDataFromPoolAddress(poolContractAddress) | |
423 | - | let amountAssetId = $t01526915406._1 | |
424 | - | let priceAssetId = $t01526915406._2 | |
425 | - | let lpAssetId = $t01526915406._3 | |
426 | - | let amountAssetInternal = $t01526915406._4 | |
427 | - | let priceAssetInternal = $t01526915406._5 | |
428 | - | let userPoolsContract = addressFromStringValue(getStringValue(keyUserPoolsContract())) | |
429 | - | let poolCreator = invoke(userPoolsContract, "getPoolCreatorREADONLY", [amountAssetId, priceAssetId], nil) | |
430 | - | poolCreator | |
431 | - | } | |
432 | - | ||
433 | - | ||
434 | - | func getAddressBalance (addressString,assetIdString) = { | |
435 | - | let address = addressFromStringValue(addressString) | |
436 | - | if ((assetIdString == "WAVES")) | |
437 | - | then wavesBalance(address).regular | |
438 | - | else { | |
439 | - | let assetId = fromBase58String(assetIdString) | |
440 | - | assetBalance(address, assetId) | |
441 | - | } | |
442 | - | } | |
443 | - | ||
444 | - | ||
445 | - | func isPoolEmpty (poolContractAddress) = { | |
446 | - | let $t01598116118 = getAssetsDataFromPoolAddress(poolContractAddress) | |
447 | - | let amountAssetId = $t01598116118._1 | |
448 | - | let priceAssetId = $t01598116118._2 | |
449 | - | let lpAssetId = $t01598116118._3 | |
450 | - | let amountAssetInternal = $t01598116118._4 | |
451 | - | let priceAssetInternal = $t01598116118._5 | |
452 | - | if ((getAddressBalance(poolContractAddress, amountAssetId) == 0)) | |
453 | - | then (getAddressBalance(poolContractAddress, priceAssetId) == 0) | |
454 | - | else false | |
455 | - | } | |
456 | - | ||
457 | - | ||
458 | 394 | @Callable(i) | |
459 | 395 | func getSwapContractREADONLY () = $Tuple2(nil, getStringOrFail(swapContract())) | |
460 | 396 | ||
461 | 397 | ||
462 | 398 | ||
463 | 399 | @Callable(i) | |
464 | 400 | func getPoolLeaseConfigREADONLY (poolAddress,assetId) = { | |
465 | - | let $ | |
401 | + | let $t01440714711 = match getInteger(this, keyLeasedRatio(poolAddress, assetId)) { | |
466 | 402 | case r: Int => | |
467 | 403 | $Tuple2(true, min([100, max([0, r])])) | |
468 | 404 | case _ => | |
469 | 405 | match getInteger(this, keyLeasedRatioDefault(assetId)) { | |
470 | 406 | case rd: Int => | |
471 | 407 | $Tuple2(true, min([100, max([0, rd])])) | |
472 | 408 | case _ => | |
473 | 409 | $Tuple2(false, 0) | |
474 | 410 | } | |
475 | 411 | } | |
476 | - | let isLeasable = $ | |
477 | - | let leasedRatio = $ | |
412 | + | let isLeasable = $t01440714711._1 | |
413 | + | let leasedRatio = $t01440714711._2 | |
478 | 414 | let minBalance = match getInteger(this, keyMinBalance(poolAddress, assetId)) { | |
479 | 415 | case b: Int => | |
480 | 416 | max([0, b]) | |
481 | 417 | case _ => | |
482 | 418 | match getInteger(this, keyMinBalanceDefault(assetId)) { | |
483 | 419 | case bd: Int => | |
484 | 420 | max([0, bd]) | |
485 | 421 | case _ => | |
486 | 422 | 0 | |
487 | 423 | } | |
488 | 424 | } | |
489 | - | let $ | |
425 | + | let $t01497715201 = if ((assetId == "WAVES")) | |
490 | 426 | then $Tuple3(valueOrElse(getString(this, keySWavesProxyAddress()), ""), getString(this, valueOrElse(keySWavesAssetId(), "")), MULT12) | |
491 | 427 | else $Tuple3("", "", 0) | |
492 | - | let proxyAddress = $ | |
493 | - | let proxyAssetId = $ | |
494 | - | let proxyRateMul = $ | |
428 | + | let proxyAddress = $t01497715201._1 | |
429 | + | let proxyAssetId = $t01497715201._2 | |
430 | + | let proxyRateMul = $t01497715201._3 | |
495 | 431 | let stakingProfitAddress = valueOrElse(getString(this, keyStakingProfitAddress()), "") | |
496 | 432 | $Tuple2(nil, $Tuple7(isLeasable, leasedRatio, minBalance, proxyAddress, proxyAssetId, proxyRateMul, stakingProfitAddress)) | |
497 | 433 | } | |
498 | 434 | ||
499 | 435 | ||
500 | 436 | ||
501 | 437 | @Callable(i) | |
502 | 438 | func getLpAssetFromPoolAssetsREADONLY (asset1,asset2) = if (if ((asset1 == "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS")) | |
503 | 439 | then (asset2 == "WAVES") | |
504 | 440 | else false) | |
505 | 441 | then $Tuple2(nil, unit) | |
506 | 442 | else { | |
507 | 443 | let assetNum1 = value(getInteger(this, keyMappingsBaseAsset2internalId(asset1))) | |
508 | 444 | let assetNum2 = value(getInteger(this, keyMappingsBaseAsset2internalId(asset2))) | |
509 | 445 | let ee = getString(this, keyMappingPoolAssetsToLpasset(toString(assetNum1), toString(assetNum2))) | |
510 | 446 | let res = if ((ee == unit)) | |
511 | 447 | then unit | |
512 | 448 | else drop(value(ee), 4) | |
513 | 449 | $Tuple2(nil, res) | |
514 | 450 | } | |
515 | 451 | ||
516 | 452 | ||
517 | 453 | ||
518 | 454 | @Callable(i) | |
519 | 455 | func getPoolAddressFromLpAssetREADONLY (lp) = $Tuple2(nil, valueOrElse(getString(this, keyMappingPoolLPAssetToPoolContractAddress(lp)), "")) | |
520 | 456 | ||
521 | 457 | ||
522 | 458 | ||
523 | 459 | @Callable(i) | |
524 | 460 | func constructor (stakingContract,boostingContract,idoContract,teamContract,emissionContract,restContract,slpipageContract,priceDecimals) = { | |
525 | 461 | let checkCaller = mustManager(i) | |
526 | 462 | if ((checkCaller == checkCaller)) | |
527 | 463 | then [StringEntry(keyFactoryConfig(), dataFactoryCfg(stakingContract, boostingContract, idoContract, teamContract, emissionContract, restContract, slpipageContract)), IntegerEntry(keyPriceDecimals(), priceDecimals)] | |
528 | 464 | else throw("Strict value is not equal to itself.") | |
529 | 465 | } | |
530 | 466 | ||
531 | 467 | ||
532 | 468 | ||
533 | 469 | @Callable(i) | |
534 | 470 | func constructorV2 (mathcherPub58Str) = { | |
535 | 471 | let checkCaller = mustManager(i) | |
536 | 472 | if ((checkCaller == checkCaller)) | |
537 | 473 | then { | |
538 | 474 | let mathcerPub = addressFromPublicKey(fromBase58String(mathcherPub58Str)) | |
539 | 475 | if ((mathcerPub == mathcerPub)) | |
540 | 476 | then [StringEntry(keyMatcherPub(), mathcherPub58Str)] | |
541 | 477 | else throw("Strict value is not equal to itself.") | |
542 | 478 | } | |
543 | 479 | else throw("Strict value is not equal to itself.") | |
544 | 480 | } | |
545 | 481 | ||
546 | 482 | ||
547 | 483 | ||
548 | 484 | @Callable(i) | |
549 | 485 | func constructorV3 (daoContract,marketingContract,gwxRewardsContract,birdsContract) = { | |
550 | 486 | let checkCaller = mustManager(i) | |
551 | 487 | if ((checkCaller == checkCaller)) | |
552 | 488 | then { | |
553 | 489 | let factoryCfg = split(getStringOrFail(keyFactoryConfig()), SEP) | |
554 | 490 | [StringEntry(keyFactoryConfig(), dataFactoryCfgV3(factoryCfg[1], factoryCfg[2], factoryCfg[3], factoryCfg[4], factoryCfg[5], factoryCfg[6], factoryCfg[7], daoContract, marketingContract, gwxRewardsContract, birdsContract))] | |
555 | 491 | } | |
556 | 492 | else throw("Strict value is not equal to itself.") | |
557 | 493 | } | |
558 | 494 | ||
559 | 495 | ||
560 | 496 | ||
561 | 497 | @Callable(i) | |
562 | 498 | func constructorV4 (legacyFactoryContract,legacyPools) = { | |
563 | 499 | let checkCaller = mustManager(i) | |
564 | 500 | if ((checkCaller == checkCaller)) | |
565 | 501 | then [StringEntry(keyLegacyFactoryContract(), legacyFactoryContract), StringEntry(keyLegacyPools(), makeString(legacyPools, SEP))] | |
566 | 502 | else throw("Strict value is not equal to itself.") | |
567 | 503 | } | |
568 | 504 | ||
569 | 505 | ||
570 | 506 | ||
571 | 507 | @Callable(i) | |
572 | 508 | func constructorV5 (assetsStoreContract) = { | |
573 | 509 | let checkCaller = mustManager(i) | |
574 | 510 | if ((checkCaller == checkCaller)) | |
575 | 511 | then [StringEntry(keyAssetsStoreContract(), assetsStoreContract)] | |
576 | 512 | else throw("Strict value is not equal to itself.") | |
577 | 513 | } | |
578 | 514 | ||
579 | 515 | ||
580 | 516 | ||
581 | 517 | @Callable(i) | |
582 | 518 | func constructorV6 (votingEmissionContract,priceAssets) = { | |
583 | 519 | let cheks = [mustManager(i), if ((addressFromString(votingEmissionContract) != unit)) | |
584 | 520 | then true | |
585 | 521 | else "invalid voting emission contract address"] | |
586 | 522 | if ((cheks == cheks)) | |
587 | 523 | then [StringEntry(keyVotingEmissionContract(), votingEmissionContract), StringEntry(keyPriceAssets(), makeString(priceAssets, SEP))] | |
588 | 524 | else throw("Strict value is not equal to itself.") | |
589 | 525 | } | |
590 | 526 | ||
591 | 527 | ||
592 | 528 | ||
593 | 529 | @Callable(i) | |
594 | 530 | func setAdmins (adminPubKeys) = { | |
595 | 531 | let checkCaller = mustManager(i) | |
596 | 532 | if ((checkCaller == checkCaller)) | |
597 | 533 | then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))] | |
598 | 534 | else throw("Strict value is not equal to itself.") | |
599 | 535 | } | |
600 | 536 | ||
601 | 537 | ||
602 | 538 | ||
603 | 539 | @Callable(i) | |
604 | 540 | func activateNewPool (poolAddress,amountAssetStr,priceAssetStr,lpAssetName,lpAssetDescr,poolWeight,poolType,logo) = { | |
605 | 541 | let checkCaller = mustAdmin(i) | |
606 | 542 | if ((checkCaller == checkCaller)) | |
607 | 543 | then if (isDefined(getString(keyMappingPoolContractAddressToPoolAssets(poolAddress)))) | |
608 | - | then | |
544 | + | then throw((("Pool address " + poolAddress) + " already registered.")) | |
609 | 545 | else { | |
610 | 546 | let internalAmountAssetData = getInternalAssetIdOrCreate(amountAssetStr, 1) | |
611 | 547 | let internalAmountAssetId = internalAmountAssetData._1 | |
612 | 548 | let internalPriceAssetData = getInternalAssetIdOrCreate(priceAssetStr, if (internalAmountAssetData._3) | |
613 | 549 | then 2 | |
614 | 550 | else 1) | |
615 | 551 | let internalPriceAssetId = internalPriceAssetData._1 | |
616 | 552 | let poolAccountScriptHash = valueOrErrorMessage(scriptHash(addressFromStringValue(poolAddress)), ("No script has been found on pool account " + poolAddress)) | |
617 | 553 | let ethalonPoolAccountScriptHash = getBinaryValue(keyPoolScriptHash()) | |
618 | 554 | let poolExists = poolExistsInternal(amountAssetStr, priceAssetStr) | |
619 | 555 | if (poolExists) | |
620 | - | then | |
556 | + | then throw((((("Pool " + amountAssetStr) + "/") + priceAssetStr) + " has already been activated.")) | |
621 | 557 | else { | |
622 | 558 | let poolConfigValue = value(getString(this, keyPoolConfig(toString(internalAmountAssetId), toString(internalPriceAssetId)))) | |
623 | 559 | let amountAssetsDecimals = if ((amountAssetStr == "WAVES")) | |
624 | 560 | then decimalsMultPrice | |
625 | 561 | else pow(10, 0, value(assetInfo(fromBase58String(amountAssetStr))).decimals, 0, 0, DOWN) | |
626 | 562 | let priceAssetsDecimals = if ((priceAssetStr == "WAVES")) | |
627 | 563 | then decimalsMultPrice | |
628 | 564 | else pow(10, 0, value(assetInfo(fromBase58String(priceAssetStr))).decimals, 0, 0, DOWN) | |
629 | 565 | let lpAssetIssueAction = Issue(lpAssetName, lpAssetDescr, 1, 8, true) | |
630 | 566 | let lpAssetId = calculateAssetId(lpAssetIssueAction) | |
631 | 567 | let lpAssetIdStr = toBase58String(lpAssetId) | |
632 | 568 | let poolActivateInvokeResult = invoke(addressFromStringValue(poolAddress), "activate", [amountAssetStr, priceAssetStr], nil) | |
633 | 569 | if ((poolActivateInvokeResult == poolActivateInvokeResult)) | |
634 | 570 | then if ((poolActivateInvokeResult != "success")) | |
635 | - | then | |
571 | + | then throw("Pool initialisation error happened.") | |
636 | 572 | else { | |
637 | 573 | let assetsStoreContract = addressFromStringValue(getStringOrFail(keyAssetsStoreContract())) | |
638 | 574 | let createOrUpdateLpAssetInv = invoke(assetsStoreContract, "createOrUpdate", [lpAssetIdStr, lpAssetName, false], nil) | |
639 | 575 | if ((createOrUpdateLpAssetInv == createOrUpdateLpAssetInv)) | |
640 | 576 | then { | |
641 | 577 | let addPoolsLpLabelInv = invoke(assetsStoreContract, "addLabel", [lpAssetIdStr, labelPoolsLp], nil) | |
642 | 578 | if ((addPoolsLpLabelInv == addPoolsLpLabelInv)) | |
643 | 579 | then { | |
644 | 580 | let setLogoInv = invoke(assetsStoreContract, "setLogo", [lpAssetIdStr, logo], nil) | |
645 | 581 | if ((setLogoInv == setLogoInv)) | |
646 | 582 | then { | |
647 | 583 | let addAssetsLinkInv = invoke(assetsStoreContract, "addAssetsLink", [amountAssetStr, priceAssetStr, lpAssetIdStr], nil) | |
648 | 584 | if ((addAssetsLinkInv == addAssetsLinkInv)) | |
649 | 585 | then { | |
650 | 586 | let increaseAssetPoolsNumberInv = invoke(assetsStoreContract, "increaseAssetPoolsNumber", [amountAssetStr], nil) | |
651 | 587 | if ((increaseAssetPoolsNumberInv == increaseAssetPoolsNumberInv)) | |
652 | 588 | then $Tuple2(((internalAmountAssetData._2 ++ internalPriceAssetData._2) ++ [lpAssetIssueAction, Burn(lpAssetId, 1), StringEntry(keyPoolConfig(toString(internalAmountAssetId), toString(internalPriceAssetId)), dataPoolCfg(poolAddress, toString(PoolActive), lpAssetIdStr, amountAssetStr, priceAssetStr, amountAssetsDecimals, priceAssetsDecimals, internalAmountAssetId, internalPriceAssetId, decimalsMultPrice, poolType)), StringEntry(keyMappingLpAssetToPoolAssets(lpAssetIdStr), dataMappingPoolAssets(internalAmountAssetId, internalPriceAssetId)), StringEntry(keyMappingPoolAssetsToLpasset(toString(internalAmountAssetId), toString(internalPriceAssetId)), ("%s__" + lpAssetIdStr)), StringEntry(keyMappingPoolContractAddressToPoolAssets(poolAddress), dataMappingPoolAssets(internalAmountAssetId, internalPriceAssetId)), StringEntry(keyMappingPoolAssetsToPoolContractAddress(internalAmountAssetId, internalPriceAssetId), poolAddress), StringEntry(keyMappingPoolLPAssetToPoolContractAddress(lpAssetIdStr), poolAddress), StringEntry(keyMappingPoolContractToLPAsset(poolAddress), lpAssetIdStr), IntegerEntry(keyPoolToWeight(poolAddress), poolWeight), IntegerEntry(keyPoolSpread(poolAddress), defaultSpread)]), lpAssetIdStr) | |
653 | 589 | else throw("Strict value is not equal to itself.") | |
654 | 590 | } | |
655 | 591 | else throw("Strict value is not equal to itself.") | |
656 | 592 | } | |
657 | 593 | else throw("Strict value is not equal to itself.") | |
658 | 594 | } | |
659 | 595 | else throw("Strict value is not equal to itself.") | |
660 | 596 | } | |
661 | 597 | else throw("Strict value is not equal to itself.") | |
662 | 598 | } | |
663 | 599 | else throw("Strict value is not equal to itself.") | |
664 | 600 | } | |
665 | 601 | } | |
666 | 602 | else throw("Strict value is not equal to itself.") | |
667 | 603 | } | |
668 | 604 | ||
669 | 605 | ||
670 | 606 | ||
671 | 607 | @Callable(i) | |
672 | 608 | func managePool (poolAddress,newStatus) = { | |
673 | 609 | let checkCaller = mustManager(i) | |
674 | 610 | if ((checkCaller == checkCaller)) | |
675 | 611 | then { | |
676 | 612 | let poolConfig = getPoolConfig(poolAddress) | |
677 | 613 | let poolStatus = poolConfig[idxPoolStatus] | |
678 | 614 | let lpAssetIdStr = poolConfig[idxPoolLPAssetId] | |
679 | 615 | let amountAssetStr = poolConfig[idxAmtAssetId] | |
680 | 616 | let priceAssetStr = poolConfig[idxPriceAssetId] | |
681 | 617 | let amountAssetsDecimals = parseIntValue(poolConfig[idxAmtAssetDcm]) | |
682 | 618 | let priceAssetsDecimals = parseIntValue(poolConfig[idxPriceAssetDcm]) | |
683 | 619 | let internalAmountAssetId = parseIntValue(poolConfig[idxIAmtAssetId]) | |
684 | 620 | let internalPriceAssetId = parseIntValue(poolConfig[idxIPriceAssetId]) | |
685 | 621 | let lpAssetDcm = parseIntValue(poolConfig[idxLPAssetDcm]) | |
686 | 622 | let poolType = poolConfig[idxPoolType] | |
687 | 623 | [StringEntry(keyPoolConfig(toString(internalAmountAssetId), toString(internalPriceAssetId)), dataPoolCfg(poolAddress, toString(newStatus), lpAssetIdStr, amountAssetStr, priceAssetStr, amountAssetsDecimals, priceAssetsDecimals, internalAmountAssetId, internalPriceAssetId, lpAssetDcm, poolType))] | |
688 | 624 | } | |
689 | 625 | else throw("Strict value is not equal to itself.") | |
690 | 626 | } | |
691 | 627 | ||
692 | 628 | ||
693 | 629 | ||
694 | 630 | @Callable(i) | |
695 | 631 | func emit (amountToEmit) = { | |
696 | 632 | let caller = i.caller | |
697 | 633 | let originCaller = i.originCaller | |
698 | 634 | let lpAssetRequested = valueOrErrorMessage(getString(keyMappingPoolContractToLPAsset(toString(caller))), "Invalid LP address called me.") | |
699 | 635 | let lpAsset = fromBase58String(lpAssetRequested) | |
700 | 636 | let legacyPools = split(valueOrElse(getString(keyLegacyPools()), EMPTY), SEP) | |
701 | 637 | let legacyFactoryContract = addressFromStringValue(valueOrErrorMessage(getString(keyLegacyFactoryContract()), "Legacy factory contract does not exists.")) | |
702 | 638 | if ((0 >= amountToEmit)) | |
703 | 639 | then nil | |
704 | 640 | else if (containsElement(legacyPools, toString(caller))) | |
705 | 641 | then $Tuple2(nil, legacyFactoryContract) | |
706 | 642 | else $Tuple2([Reissue(lpAsset, amountToEmit, true), ScriptTransfer(i.caller, amountToEmit, lpAsset)], "success") | |
707 | 643 | } | |
708 | 644 | ||
709 | 645 | ||
710 | 646 | ||
711 | 647 | @Callable(i) | |
712 | 648 | func burn (amountToBurn) = { | |
713 | 649 | let caller = i.caller | |
714 | 650 | let originCaller = i.originCaller | |
715 | 651 | let payment = value(i.payments[0]) | |
716 | 652 | let paymentAmount = value(payment.amount) | |
717 | 653 | let inAmountAssetId = toBase58String(value(payment.assetId)) | |
718 | 654 | let lpAssetRequestedForBurning = valueOrErrorMessage(getString(keyMappingPoolContractToLPAsset(toString(caller))), "Invalid LP address called me.") | |
719 | 655 | if ((inAmountAssetId != lpAssetRequestedForBurning)) | |
720 | - | then | |
656 | + | then throw("Invalid asset passed.") | |
721 | 657 | else if ((amountToBurn != paymentAmount)) | |
722 | - | then | |
658 | + | then throw("Invalid amount passed.") | |
723 | 659 | else { | |
724 | 660 | let lpAsset = fromBase58String(lpAssetRequestedForBurning) | |
725 | 661 | $Tuple2([Burn(lpAsset, amountToBurn)], "success") | |
726 | 662 | } | |
727 | 663 | } | |
728 | 664 | ||
729 | 665 | ||
730 | 666 | ||
731 | 667 | @Callable(i) | |
732 | 668 | func modifyWeight (lpAssetId,share) = { | |
733 | 669 | let checkCaller = if ((toBase58String(i.caller.bytes) == valueOrElse(getString(this, keyVotingEmissionContract()), ""))) | |
734 | 670 | then true | |
735 | 671 | else mustManager(i) | |
736 | 672 | if ((checkCaller == checkCaller)) | |
737 | 673 | then { | |
738 | 674 | let poolContractAddress = getStringOrFail(keyMappingPoolLPAssetToPoolContractAddress(lpAssetId)) | |
739 | 675 | let poolWeightKey = keyPoolToWeight(poolContractAddress) | |
740 | 676 | let gwxWeightKey = keyPoolToWeight(GWXvirtualPOOL) | |
741 | 677 | let gwxWeight = valueOrElse(getInteger(gwxWeightKey), 0) | |
742 | 678 | let poolWeight = valueOrElse(getInteger(poolWeightKey), 0) | |
743 | 679 | let poolWeightNew = share | |
744 | 680 | let factoryCfg = split(getStringOrFail(keyFactoryConfig()), SEP) | |
745 | 681 | let stakingContract = getStakingAddressOrFail(factoryCfg) | |
746 | 682 | let onModifyWeightInv = invoke(stakingContract, "onModifyWeight", [lpAssetId, poolContractAddress], nil) | |
747 | 683 | if ((onModifyWeightInv == onModifyWeightInv)) | |
748 | 684 | then { | |
749 | 685 | let gwxVirtualPoolActions = if ((gwxWeight == 0)) | |
750 | 686 | then nil | |
751 | 687 | else [IntegerEntry(gwxWeightKey, 0)] | |
752 | 688 | let poolWeightHistoryKey = keyPoolToWeightHistory(poolContractAddress, 0) | |
753 | 689 | let poolWeightHistoryOrUnit = getInteger(poolWeightHistoryKey) | |
754 | 690 | let poolWeightHistoryActions = if ((poolWeightHistoryOrUnit == unit)) | |
755 | 691 | then nil | |
756 | 692 | else [DeleteEntry(poolWeightHistoryKey)] | |
757 | 693 | (([IntegerEntry(poolWeightKey, poolWeightNew)] ++ gwxVirtualPoolActions) ++ poolWeightHistoryActions) | |
758 | 694 | } | |
759 | 695 | else throw("Strict value is not equal to itself.") | |
760 | 696 | } | |
761 | 697 | else throw("Strict value is not equal to itself.") | |
762 | 698 | } | |
763 | 699 | ||
764 | 700 | ||
765 | 701 | ||
766 | 702 | @Callable(i) | |
767 | 703 | func modifyWeights (btcPoolAddress,ethPoolAddress,ethBtcPoolAddress,usdcUsdtPoolAddress) = { | |
768 | 704 | let checkCaller = mustManager(i) | |
769 | 705 | if ((checkCaller == checkCaller)) | |
770 | 706 | then { | |
771 | 707 | let ethBtcWeightNew = ((5 * POOLWEIGHTMULT) / 100) | |
772 | 708 | let usdcUsdtWeightNew = ((5 * POOLWEIGHTMULT) / 100) | |
773 | 709 | let weightDecrement = ((5 * POOLWEIGHTMULT) / 100) | |
774 | 710 | let factoryCfg = split(getStringOrFail(keyFactoryConfig()), SEP) | |
775 | 711 | let stakingDapp = getStakingAddressOrFail(factoryCfg) | |
776 | 712 | let gwxRewardDapp = getGwxRewardAddressOrFail(factoryCfg) | |
777 | 713 | let btcWeightKEY = keyPoolToWeight(btcPoolAddress) | |
778 | 714 | let ethWeightKEY = keyPoolToWeight(ethPoolAddress) | |
779 | 715 | let ethBtcWeightKEY = keyPoolToWeight(ethBtcPoolAddress) | |
780 | 716 | let usdcUsdtWeightKEY = keyPoolToWeight(usdcUsdtPoolAddress) | |
781 | 717 | let btcWeight = getIntOrFail(btcWeightKEY) | |
782 | 718 | let ethWeight = getIntOrFail(ethWeightKEY) | |
783 | 719 | let btcWeightNew = (btcWeight - weightDecrement) | |
784 | 720 | let ethWeightNew = (ethWeight - weightDecrement) | |
785 | 721 | if ((0 >= btcWeightNew)) | |
786 | - | then | |
722 | + | then throw(("invalid btcWeightNew: " + toString(btcWeightNew))) | |
787 | 723 | else if ((0 >= ethWeightNew)) | |
788 | - | then | |
724 | + | then throw(("invalid ethWeightNew: " + toString(ethWeightNew))) | |
789 | 725 | else { | |
790 | 726 | let btcLpAssetIdStr = getStringOrFail(keyMappingPoolContractToLPAsset(btcPoolAddress)) | |
791 | 727 | let ethLpAssetIdStr = getStringOrFail(keyMappingPoolContractToLPAsset(ethPoolAddress)) | |
792 | 728 | let ethBtcLpAssetIdStr = getStringOrFail(keyMappingPoolContractToLPAsset(ethBtcPoolAddress)) | |
793 | 729 | let usdcUsdtLpAssetIdStr = getStringOrFail(keyMappingPoolContractToLPAsset(usdcUsdtPoolAddress)) | |
794 | 730 | let onModifyWeightBtc = invoke(stakingDapp, "onModifyWeight", [btcLpAssetIdStr, btcPoolAddress], nil) | |
795 | 731 | if ((onModifyWeightBtc == onModifyWeightBtc)) | |
796 | 732 | then { | |
797 | 733 | let onModifyWeightEth = invoke(stakingDapp, "onModifyWeight", [ethLpAssetIdStr, ethPoolAddress], nil) | |
798 | 734 | if ((onModifyWeightEth == onModifyWeightEth)) | |
799 | 735 | then { | |
800 | 736 | let onModifyWeightEthBtc = invoke(stakingDapp, "onModifyWeight", [ethBtcLpAssetIdStr, ethBtcPoolAddress], nil) | |
801 | 737 | if ((onModifyWeightEthBtc == onModifyWeightEthBtc)) | |
802 | 738 | then { | |
803 | 739 | let onModifyWeightUsdcUsdt = invoke(stakingDapp, "onModifyWeight", [usdcUsdtLpAssetIdStr, usdcUsdtPoolAddress], nil) | |
804 | 740 | if ((onModifyWeightUsdcUsdt == onModifyWeightUsdcUsdt)) | |
805 | 741 | then [IntegerEntry(btcWeightKEY, btcWeightNew), IntegerEntry(ethWeightKEY, ethWeightNew), IntegerEntry(ethBtcWeightKEY, ethBtcWeightNew), IntegerEntry(usdcUsdtWeightKEY, usdcUsdtWeightNew), IntegerEntry(keyPoolToWeightHistory(btcPoolAddress, 0), btcWeight), IntegerEntry(keyPoolToWeightHistory(ethPoolAddress, 0), ethWeight), IntegerEntry(keyPoolToWeightHistory(ethBtcPoolAddress, 0), ethBtcWeightNew), IntegerEntry(keyPoolToWeightHistory(usdcUsdtPoolAddress, 0), usdcUsdtWeightNew)] | |
806 | 742 | else throw("Strict value is not equal to itself.") | |
807 | 743 | } | |
808 | 744 | else throw("Strict value is not equal to itself.") | |
809 | 745 | } | |
810 | 746 | else throw("Strict value is not equal to itself.") | |
811 | 747 | } | |
812 | 748 | else throw("Strict value is not equal to itself.") | |
813 | 749 | } | |
814 | 750 | } | |
815 | 751 | else throw("Strict value is not equal to itself.") | |
816 | 752 | } | |
817 | 753 | ||
818 | 754 | ||
819 | 755 | ||
820 | 756 | @Callable(i) | |
821 | 757 | func checkWxEmissionPoolLabel (amountAssetId,priceAssetId) = { | |
822 | 758 | let haveLabel = match getBoolean(keyWxEmission(amountAssetId, priceAssetId)) { | |
823 | 759 | case b: Boolean => | |
824 | 760 | b | |
825 | 761 | case _ => | |
826 | 762 | false | |
827 | 763 | } | |
828 | 764 | $Tuple2(nil, haveLabel) | |
829 | 765 | } | |
830 | 766 | ||
831 | 767 | ||
832 | 768 | ||
833 | 769 | @Callable(i) | |
834 | 770 | func setWxEmissionPoolLabel (amountAssetId,priceAssetId) = { | |
835 | 771 | let checkCaller = mustAdmin(i) | |
836 | 772 | if ((checkCaller == checkCaller)) | |
837 | 773 | then $Tuple2([BooleanEntry(keyWxEmission(amountAssetId, priceAssetId), true)], unit) | |
838 | 774 | else throw("Strict value is not equal to itself.") | |
839 | 775 | } | |
840 | 776 | ||
841 | 777 | ||
842 | 778 | ||
843 | 779 | @Callable(i) | |
844 | 780 | func deleteWxEmissionPoolLabel (amountAssetId,priceAssetId) = { | |
845 | 781 | let checkCaller = if ((i.caller == this)) | |
846 | 782 | then true | |
847 | 783 | else mustAdmin(i) | |
848 | 784 | if ((checkCaller == checkCaller)) | |
849 | 785 | then $Tuple2([DeleteEntry(keyWxEmission(amountAssetId, priceAssetId))], unit) | |
850 | 786 | else throw("Strict value is not equal to itself.") | |
851 | 787 | } | |
852 | 788 | ||
853 | 789 | ||
854 | 790 | ||
855 | 791 | @Callable(i) | |
856 | 792 | func onVerificationLoss (assetId) = { | |
857 | 793 | let checkCaller = if ((toBase58String(i.caller.bytes) == valueOrElse(getString(this, keyAssetsStoreContract()), ""))) | |
858 | 794 | then true | |
859 | 795 | else mustManager(i) | |
860 | 796 | if ((checkCaller == checkCaller)) | |
861 | 797 | then { | |
862 | 798 | let priceAssets = getPriceAssets() | |
863 | 799 | let checkPriceAssetsSize = if ((size(priceAssets) > 0)) | |
864 | 800 | then true | |
865 | - | else | |
801 | + | else throw("invalid price assets") | |
866 | 802 | if ((checkPriceAssetsSize == checkPriceAssetsSize)) | |
867 | 803 | then { | |
868 | 804 | func cb (acc,priceAsset) = { | |
869 | 805 | let r = invoke(this, "deleteWxEmissionPoolLabel", [assetId, priceAsset], nil) | |
870 | 806 | if ((r == r)) | |
871 | 807 | then unit | |
872 | 808 | else throw("Strict value is not equal to itself.") | |
873 | 809 | } | |
874 | 810 | ||
875 | 811 | let actions = { | |
876 | 812 | let $l = priceAssets | |
877 | 813 | let $s = size($l) | |
878 | 814 | let $acc0 = unit | |
879 | 815 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
880 | 816 | then $a | |
881 | 817 | else cb($a, $l[$i]) | |
882 | 818 | ||
883 | 819 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
884 | 820 | then $a | |
885 | 821 | else throw("List size exceeds 13") | |
886 | 822 | ||
887 | 823 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13) | |
888 | 824 | } | |
889 | 825 | if ((actions == actions)) | |
890 | 826 | then $Tuple2(nil, unit) | |
891 | 827 | else throw("Strict value is not equal to itself.") | |
892 | 828 | } | |
893 | 829 | else throw("Strict value is not equal to itself.") | |
894 | 830 | } | |
895 | 831 | else throw("Strict value is not equal to itself.") | |
896 | 832 | } | |
897 | 833 | ||
898 | 834 | ||
899 | 835 | ||
900 | 836 | @Callable(i) | |
901 | 837 | func isPoolOneTokenOperationsDisabledREADONLY (poolAddress) = { | |
902 | 838 | let poolConfig = getPoolConfig(poolAddress) | |
903 | 839 | let assetsInternal = $Tuple2(parseIntValue(poolConfig[idxIAmtAssetId]), parseIntValue(poolConfig[idxIPriceAssetId])) | |
904 | 840 | let poolOneTokenOperationsDisabled = valueOrElse(getBoolean(keyPoolOneTokenOperationsDisabled(assetsInternal)), false) | |
905 | 841 | let allPoolsOneTokenOperationsDisabled = valueOrElse(getBoolean(keyAllPoolsOneTokenOperationsDisabled()), false) | |
906 | 842 | $Tuple2(nil, if (allPoolsOneTokenOperationsDisabled) | |
907 | 843 | then true | |
908 | 844 | else poolOneTokenOperationsDisabled) | |
909 | 845 | } | |
910 | 846 | ||
911 | 847 | ||
912 | 848 | ||
913 | 849 | @Callable(i) | |
914 | 850 | func getInFeeREADONLY (poolAddress) = { | |
915 | 851 | let fee = intOrDefaultOrFallback(keyInFee(poolAddress), keyInFeeDefault(), 0) | |
916 | 852 | $Tuple2(nil, fee) | |
917 | 853 | } | |
918 | 854 | ||
919 | 855 | ||
920 | 856 | ||
921 | 857 | @Callable(i) | |
922 | 858 | func getOutFeeREADONLY (poolAddress) = { | |
923 | 859 | let fee = intOrDefaultOrFallback(keyOutFee(poolAddress), keyOutFeeDefault(), fraction(10, MULT8, 10000)) | |
924 | 860 | $Tuple2(nil, fee) | |
925 | 861 | } | |
926 | 862 | ||
927 | 863 | ||
928 | 864 | ||
929 | 865 | @Callable(i) | |
930 | 866 | func getSwapFeeREADONLY (poolAddressStr) = { | |
931 | 867 | let feeOption = match getString(this, keySwapFee(poolAddressStr)) { | |
932 | 868 | case s: String => | |
933 | 869 | let parts = split(s, SEP) | |
934 | 870 | let poolFee = parseIntValue(parts[1]) | |
935 | 871 | let protocolFee = parseIntValue(parts[2]) | |
936 | 872 | $Tuple2(poolFee, protocolFee) | |
937 | 873 | case _: Unit => | |
938 | 874 | unit | |
939 | 875 | case _ => | |
940 | 876 | throw("Match error") | |
941 | 877 | } | |
942 | 878 | $Tuple2(nil, feeOption) | |
943 | 879 | } | |
944 | 880 | ||
945 | 881 | ||
946 | 882 | ||
947 | 883 | @Callable(i) | |
948 | 884 | func poolInfoREADONLY (amountAssetIdStr,priceAssetIdStr) = { | |
949 | 885 | let amountAssetInternalIdOption = getInteger(this, keyMappingsBaseAsset2internalId(amountAssetIdStr)) | |
950 | 886 | let priceAssetInternalIdOption = getInteger(this, keyMappingsBaseAsset2internalId(priceAssetIdStr)) | |
951 | 887 | let poolContractAddressOption = getString(this, keyMappingPoolAssetsToPoolContractAddress(value(amountAssetInternalIdOption), value(priceAssetInternalIdOption))) | |
952 | 888 | let lpAssetIdOption = getString(this, keyMappingPoolContractToLPAsset(value(poolContractAddressOption))) | |
953 | 889 | let poolExists = if (if (isDefined(amountAssetInternalIdOption)) | |
954 | 890 | then isDefined(priceAssetInternalIdOption) | |
955 | 891 | else false) | |
956 | 892 | then isDefined(poolContractAddressOption) | |
957 | 893 | else false | |
958 | 894 | let poolInfo = if (poolExists) | |
959 | 895 | then $Tuple2(addressFromStringValue(value(poolContractAddressOption)), parseAssetId(value(lpAssetIdOption))) | |
960 | 896 | else unit | |
961 | 897 | $Tuple2(nil, poolInfo) | |
962 | 898 | } | |
963 | 899 | ||
964 | 900 | ||
965 | 901 | ||
966 | 902 | @Callable(i) | |
967 | 903 | func getPoolStatusREADONLY (poolAddress) = { | |
968 | 904 | let poolAssets = split(getStringOrFail(keyMappingPoolContractAddressToPoolAssets(poolAddress)), SEP) | |
969 | 905 | let amountAssetInternal = poolAssets[1] | |
970 | 906 | let priceAssetInternal = poolAssets[2] | |
971 | 907 | let cfg = split(getStringOrFail(keyPoolConfig(amountAssetInternal, priceAssetInternal)), SEP) | |
972 | 908 | $Tuple2(nil, parseIntValue(cfg[idxPoolStatus])) | |
973 | 909 | } | |
974 | 910 | ||
975 | 911 | ||
976 | 912 | ||
977 | 913 | @Callable(i) | |
978 | 914 | func getPoolConfigREADONLY (poolAddress) = { | |
979 | 915 | let poolAssets = split(getStringOrFail(keyMappingPoolContractAddressToPoolAssets(poolAddress)), SEP) | |
980 | 916 | let amountAssetInternal = poolAssets[1] | |
981 | 917 | let priceAssetInternal = poolAssets[2] | |
982 | 918 | let cfg = split(getStringOrFail(keyPoolConfig(amountAssetInternal, priceAssetInternal)), SEP) | |
983 | 919 | $Tuple2(nil, cfg) | |
984 | 920 | } | |
985 | 921 | ||
986 | 922 | ||
987 | 923 | ||
988 | 924 | @Callable(i) | |
989 | 925 | func getPoolConfigByLpAssetIdREADONLY (lpAssetIdStr) = { | |
990 | 926 | let poolAssets = split(getStringOrFail(keyMappingLpAssetToPoolAssets(lpAssetIdStr)), SEP) | |
991 | 927 | let amountAssetInternal = poolAssets[1] | |
992 | 928 | let priceAssetInternal = poolAssets[2] | |
993 | 929 | let cfg = split(getStringOrFail(keyPoolConfig(amountAssetInternal, priceAssetInternal)), SEP) | |
994 | 930 | $Tuple2(nil, cfg) | |
995 | 931 | } | |
996 | 932 | ||
997 | 933 | ||
998 | 934 | ||
999 | 935 | @Callable(i) | |
1000 | 936 | func poolExistsREADONLY (amountAssetId,priceAssetId) = $Tuple2(nil, poolExistsInternal(amountAssetId, priceAssetId)) | |
1001 | 937 | ||
1002 | 938 | ||
1003 | 939 | ||
1004 | 940 | @Callable(i) | |
1005 | 941 | func skipOrderValidationREADONLY (poolAddress) = $Tuple2(nil, valueOrElse(getBoolean(keySkipOrderValidation(poolAddress)), false)) | |
1006 | 942 | ||
1007 | 943 | ||
1008 | 944 | ||
1009 | 945 | @Callable(i) | |
1010 | 946 | func getChangeAmpConfigREADONLY (poolAddress) = { | |
1011 | 947 | let delay = getIntegerValue(keyChangeAmpDelay(poolAddress)) | |
1012 | 948 | let delta = getIntegerValue(keyChangeAmpDelta(poolAddress)) | |
1013 | 949 | let target = getIntegerValue(keyChangeAmpTarget(poolAddress)) | |
1014 | 950 | $Tuple2(nil, [delay, delta, target]) | |
1015 | 951 | } | |
1016 | 952 | ||
1017 | 953 | ||
1018 | 954 | ||
1019 | 955 | @Callable(i) | |
1020 | 956 | func getPoolWeightREADONLY (lpAssetId) = { | |
1021 | 957 | let poolAddress = getStringOrFail(keyMappingPoolLPAssetToPoolContractAddress(lpAssetId)) | |
1022 | 958 | let weight = valueOrElse(getInteger(keyPoolToWeight(poolAddress)), 0) | |
1023 | 959 | $Tuple2(nil, weight) | |
1024 | 960 | } | |
1025 | 961 | ||
1026 | 962 | ||
1027 | - | ||
1028 | - | @Callable(i) | |
1029 | - | func deletePool (poolContractAddress) = { | |
1030 | - | let poolConfig = getPoolConfig(poolContractAddress) | |
1031 | - | let checkCaller = if ((toString(i.caller) == getPoolCreator(poolContractAddress))) | |
1032 | - | then if (isPoolEmpty(poolContractAddress)) | |
1033 | - | then true | |
1034 | - | else throwErr("Pool is not empty") | |
1035 | - | else mustManager(i) | |
1036 | - | if ((checkCaller == checkCaller)) | |
1037 | - | then { | |
1038 | - | let checkWeight = if ((valueOrElse(getInteger(keyPoolToWeight(poolContractAddress)), 0) == 0)) | |
1039 | - | then true | |
1040 | - | else throwErr("Pool weight is not Zero") | |
1041 | - | if ((checkWeight == checkWeight)) | |
1042 | - | then { | |
1043 | - | let checkStatus = if ((poolConfig[idxPoolStatus] == toString(PoolShutdown))) | |
1044 | - | then true | |
1045 | - | else throwErr("Pool must be SHUTDOWN (4)") | |
1046 | - | if ((checkStatus == checkStatus)) | |
1047 | - | then { | |
1048 | - | let $t03961739754 = getAssetsDataFromPoolAddress(poolContractAddress) | |
1049 | - | let amountAssetId = $t03961739754._1 | |
1050 | - | let priceAssetId = $t03961739754._2 | |
1051 | - | let lpAssetId = $t03961739754._3 | |
1052 | - | let amountAssetInternal = $t03961739754._4 | |
1053 | - | let priceAssetInternal = $t03961739754._5 | |
1054 | - | let userPoolsContract = addressFromStringValue(getStringValue(keyUserPoolsContract())) | |
1055 | - | let userPoolsInvoke = invoke(userPoolsContract, "deletePool", [amountAssetId, priceAssetId], nil) | |
1056 | - | if ((userPoolsInvoke == userPoolsInvoke)) | |
1057 | - | then { | |
1058 | - | let votingEmissionContract = addressFromStringValue(getStringValue(keyVotingEmissionContract())) | |
1059 | - | let votingEmissionInvoke = invoke(votingEmissionContract, "deletePool", [amountAssetId, priceAssetId], nil) | |
1060 | - | if ((votingEmissionInvoke == votingEmissionInvoke)) | |
1061 | - | then { | |
1062 | - | let assetsStoreContract = addressFromStringValue(getStringValue(keyAssetsStoreContract())) | |
1063 | - | let assetsStoreInvoke = invoke(assetsStoreContract, "deletePool", [amountAssetId, priceAssetId], nil) | |
1064 | - | if ((assetsStoreInvoke == assetsStoreInvoke)) | |
1065 | - | then [DeleteEntry(keyMappingPoolContractToLPAsset(poolContractAddress)), DeleteEntry(keyMappingPoolContractAddressToPoolAssets(poolContractAddress)), DeleteEntry(keyMappingPoolAssetsToLpasset(toString(amountAssetInternal), toString(priceAssetInternal))), DeleteEntry(keyMappingPoolAssetsToPoolContractAddress(amountAssetInternal, priceAssetInternal)), DeleteEntry(keyPoolConfig(toString(amountAssetInternal), toString(priceAssetInternal))), DeleteEntry(keyMappingLpAssetToPoolAssets(lpAssetId)), DeleteEntry(keyMappingPoolLPAssetToPoolContractAddress(lpAssetId)), DeleteEntry(keyWxEmission(amountAssetId, priceAssetId)), DeleteEntry(keyPoolToWeight(poolContractAddress)), DeleteEntry(keyPoolSpread(poolContractAddress)), DeleteEntry(keyInFee(poolContractAddress)), DeleteEntry(keyOutFee(poolContractAddress)), DeleteEntry(keySkipOrderValidation(poolContractAddress)), DeleteEntry(keyChangeAmpDelay(poolContractAddress)), DeleteEntry(keyChangeAmpDelta(poolContractAddress)), DeleteEntry(keyChangeAmpTarget(poolContractAddress))] | |
1066 | - | else throw("Strict value is not equal to itself.") | |
1067 | - | } | |
1068 | - | else throw("Strict value is not equal to itself.") | |
1069 | - | } | |
1070 | - | else throw("Strict value is not equal to itself.") | |
1071 | - | } | |
1072 | - | else throw("Strict value is not equal to itself.") | |
1073 | - | } | |
1074 | - | else throw("Strict value is not equal to itself.") | |
1075 | - | } | |
1076 | - | else throw("Strict value is not equal to itself.") | |
1077 | - | } | |
1078 | - | ||
1079 | - | ||
1080 | 963 | @Verifier(tx) | |
1081 | 964 | func verify () = { | |
1082 | 965 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
1083 | 966 | case pk: ByteVector => | |
1084 | 967 | pk | |
1085 | 968 | case _: Unit => | |
1086 | 969 | tx.senderPublicKey | |
1087 | 970 | case _ => | |
1088 | 971 | throw("Match error") | |
1089 | 972 | } | |
1090 | 973 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
1091 | 974 | } | |
1092 | 975 |
github/deemru/w8io/169f3d6 276.53 ms ◑