tx · 4t4AwaNNBonZybdCuMs47US6sSS6oQQdnF8Hf5jaYDpg 3N3wvBAJsuuVKguXHVLzV7uBNxS3JYShqaq: -0.01000000 Waves 2021.08.10 17:29 [1652368] smart account 3N3wvBAJsuuVKguXHVLzV7uBNxS3JYShqaq > SELF 0.00000000 Waves
{ "type": 13, "id": "4t4AwaNNBonZybdCuMs47US6sSS6oQQdnF8Hf5jaYDpg", "fee": 1000000, "feeAssetId": null, "timestamp": 1628605773175, "version": 2, "chainId": 84, "sender": "3N3wvBAJsuuVKguXHVLzV7uBNxS3JYShqaq", "senderPublicKey": "MimQtBx7azhStAH2R5QV7Uk8hWEbm7q89793fk1j1mh", "proofs": [ "3uEebom7WMfoZpXisLGJfFAK5psgxCZD8tkNBrxzLAb5RFhK8jKjzUP9QDarN1FKsEJkNukMSyWg2i2RR9yJrMTN" ], "script": "base64:AAIFAAAAAAAAABIIAhIICgYICAgICAESBAoCCAEAAAAXAAAAAANTRVACAAAAAl9fAAAAAApQb29sQWN0aXZlAAAAAAAAAAABAAAAAA9Qb29sUHV0RGlzYWJsZWQAAAAAAAAAAAIAAAAAE1Bvb2xNYXRjaGVyRGlzYWJsZWQAAAAAAAAAAAMAAAAADFBvb2xTaHV0ZG93bgAAAAAAAAAABAAAAAASaWR4SW50ZXJuYWxBc3NldElkAAAAAAAAAAABAAAAAA9pZHhSZXN1dEFjdGlvbnMAAAAAAAAAAAIAAAAAIGlkeElmQXNzZXRJZENhbGN1bGF0aW9uUGVyZm9ybWVkAAAAAAAAAAADAQAAABZrZXlOZXh0SW50ZXJuYWxBc3NldElkAAAAAAIAAAAXJXNfX25leHRJbnRlcm5hbEFzc2V0SWQBAAAAEWtleVBvb2xTY3JpcHRIYXNoAAAAAAIAAAAWJXMlc19fcG9vbF9fc2NyaXB0SGFzaAEAAAAfa2V5TWFwcGluZ3NJbnRlcm5hbDJiYXNlQXNzZXRJZAAAAAEAAAARaW50ZXJuYWxCYXNlQXNzZXQJAAEsAAAAAgIAAAA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UAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXmv3qbH", "height": 1652368, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: J3F4e9Myi8PKk9NvgMq3NyP6VtWEcLTwDay4eyzA4xQF Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SEP = "__" | |
5 | + | ||
6 | + | let PoolActive = 1 | |
7 | + | ||
8 | + | let PoolPutDisabled = 2 | |
9 | + | ||
10 | + | let PoolMatcherDisabled = 3 | |
11 | + | ||
12 | + | let PoolShutdown = 4 | |
13 | + | ||
14 | + | let idxInternalAssetId = 1 | |
15 | + | ||
16 | + | let idxResutActions = 2 | |
17 | + | ||
18 | + | let idxIfAssetIdCalculationPerformed = 3 | |
19 | + | ||
20 | + | func keyNextInternalAssetId () = "%s__nextInternalAssetId" | |
21 | + | ||
22 | + | ||
23 | + | func keyPoolScriptHash () = "%s%s__pool__scriptHash" | |
24 | + | ||
25 | + | ||
26 | + | func keyMappingsInternal2baseAssetId (internalBaseAsset) = ("%s%s%d__mappings__internal2baseAssetId__" + toString(internalBaseAsset)) | |
27 | + | ||
28 | + | ||
29 | + | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
30 | + | ||
31 | + | ||
32 | + | func keyPoolConfig (amountAssetInternal,priceAssetInternal) = (((("%d%d%s__" + amountAssetInternal) + "__") + priceAssetInternal) + "__config") | |
33 | + | ||
34 | + | ||
35 | + | func keyMappingLpAssetToPoolAssets (lpAssetStr) = (("%s%s%s__" + lpAssetStr) + "__mappings__lpAsset2Pool") | |
36 | + | ||
37 | + | ||
38 | + | func keyMappingPoolAssetsToLpasset (internalAmountAssetIdStr,internalPriceAssetIdStr) = (((("%d%d%s%s__" + internalAmountAssetIdStr) + "__") + internalPriceAssetIdStr) + "__mappings__lpAsset2Pool") | |
39 | + | ||
40 | + | ||
41 | + | func keyMappingPoolContractAddressToPoolAssets (poolContractAddress) = (("%s%s%s__" + poolContractAddress) + "__mappings__poolContract2LpAsset") | |
42 | + | ||
43 | + | ||
44 | + | func keyMappingPoolAssetsToPoolContractAddress (internalAmountAssetIdStr,internalPriceAssetIdStr) = (((("%d%d%s%s__" + toString(internalAmountAssetIdStr)) + "__") + toString(internalPriceAssetIdStr)) + "__mappings__lpAsset2PoolContract") | |
45 | + | ||
46 | + | ||
47 | + | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), ("No data for this.key=" + key)) | |
48 | + | ||
49 | + | ||
50 | + | func getBooleanOrFail (key) = valueOrErrorMessage(getBoolean(this, key), ("No data for this.key=" + key)) | |
51 | + | ||
52 | + | ||
53 | + | func getIntOrFail (key) = valueOrErrorMessage(getInteger(this, key), ("No data for this.key=" + key)) | |
54 | + | ||
55 | + | ||
56 | + | func dataPoolCfg (poolAddress,poolStatus,lpAssetId,amountAssetStr,priceAssetStr,amountAssetDecimals,priceAssetDecimals,amountAssetInternalId,priceAssetInternalId,poolWeight) = makeString(["%s%s%s%s%s%d%d%d%d%d%d", poolAddress, poolStatus, lpAssetId, amountAssetStr, priceAssetStr, toString(amountAssetDecimals), toString(priceAssetDecimals), toString(amountAssetInternalId), toString(priceAssetInternalId), toString(poolWeight)], SEP) | |
57 | + | ||
58 | + | ||
59 | + | func dataMappingPoolAssets (internalAmountAssetStr,internalPriceAssetStr) = makeString(["%d%d", toString(internalAmountAssetStr), toString(internalPriceAssetStr)], SEP) | |
60 | + | ||
61 | + | ||
62 | + | func getInternalAssetIdOrCreate (assetIdStr,incrementor) = { | |
63 | + | let internalAmountAssetId = valueOrElse(getInteger(this, keyMappingsBaseAsset2internalId(assetIdStr)), 0) | |
64 | + | let currentIndexOfInternalId = valueOrElse(getInteger(this, keyNextInternalAssetId()), 0) | |
65 | + | let result = if ((internalAmountAssetId == 0)) | |
66 | + | then { | |
67 | + | let newInternalAssetId = (currentIndexOfInternalId + incrementor) | |
68 | + | $Tuple3(newInternalAssetId, [IntegerEntry(keyNextInternalAssetId(), newInternalAssetId), StringEntry(keyMappingsBaseAsset2internalId(assetIdStr), toString(newInternalAssetId)), StringEntry(keyMappingsInternal2baseAssetId(newInternalAssetId), assetIdStr)], true) | |
69 | + | } | |
70 | + | else $Tuple3(internalAmountAssetId, nil, false) | |
71 | + | result | |
72 | + | } | |
73 | + | ||
74 | + | ||
75 | + | @Callable(i) | |
76 | + | func activateNewPool (poolAddress,amountAssetStr,priceAssetStr,lpAssetName,lpAssetDescr,poolWeight) = if ((i.caller != this)) | |
77 | + | then throw("permissions denied") | |
78 | + | else { | |
79 | + | let internalAmountAssetData = getInternalAssetIdOrCreate(amountAssetStr, 1) | |
80 | + | let internalAmountAssetId = internalAmountAssetData._1 | |
81 | + | let internalPriceAssetData = getInternalAssetIdOrCreate(priceAssetStr, if (internalAmountAssetData._3) | |
82 | + | then 2 | |
83 | + | else 1) | |
84 | + | let internalPriceAssetId = internalPriceAssetData._1 | |
85 | + | let poolAccountScriptHash = valueOrErrorMessage(scriptHash(addressFromStringValue(poolAddress)), ("No script has been found on pool account " + poolAddress)) | |
86 | + | let ethalonPoolAccountScriptHash = getBinaryValue(keyPoolScriptHash()) | |
87 | + | let poolConfig = getString(this, keyPoolConfig(toString(internalAmountAssetId), toString(internalPriceAssetId))) | |
88 | + | if (isDefined(poolConfig)) | |
89 | + | then throw((((("Pool " + amountAssetStr) + "/") + priceAssetStr) + " has already been activated.")) | |
90 | + | else { | |
91 | + | let poolConfigValue = value(getString(this, keyPoolConfig(toString(internalAmountAssetId), toString(internalPriceAssetId)))) | |
92 | + | if ((poolAccountScriptHash != ethalonPoolAccountScriptHash)) | |
93 | + | then throw(((("BLAKE2b-256 hashes don't match. Pool has: " + toBase58String(poolAccountScriptHash)) + " hash. Should have: ") + toBase58String(ethalonPoolAccountScriptHash))) | |
94 | + | else { | |
95 | + | let poolActivateInvokeResult = invoke(addressFromStringValue(poolAddress), "activate", [amountAssetStr, priceAssetStr, lpAssetName, lpAssetDescr, poolWeight], nil) | |
96 | + | if ((poolActivateInvokeResult == poolActivateInvokeResult)) | |
97 | + | then { | |
98 | + | let lpAssetIdStr = poolActivateInvokeResult._1 | |
99 | + | let amountAssetsDecimals = value(assetInfo(fromBase58String(amountAssetStr))).decimals | |
100 | + | let priceAssetsDecimals = value(assetInfo(fromBase58String(priceAssetStr))).decimals | |
101 | + | $Tuple2(((internalPriceAssetData._2 ++ internalAmountAssetData._2) ++ [StringEntry(keyPoolConfig(toString(internalAmountAssetId), toString(internalPriceAssetId)), dataPoolCfg(poolAddress, toString(PoolActive), lpAssetIdStr, amountAssetStr, priceAssetStr, amountAssetsDecimals, priceAssetsDecimals, internalAmountAssetId, internalPriceAssetId, poolWeight)), StringEntry(keyMappingLpAssetToPoolAssets(lpAssetIdStr), dataMappingPoolAssets(internalAmountAssetId, internalPriceAssetId)), StringEntry(keyMappingPoolAssetsToLpasset(toString(internalAmountAssetId), toString(internalPriceAssetId)), ("%s__" + lpAssetIdStr)), StringEntry(keyMappingPoolContractAddressToPoolAssets(poolAddress), dataMappingPoolAssets(internalAmountAssetId, internalPriceAssetId)), StringEntry(keyMappingPoolAssetsToPoolContractAddress(internalAmountAssetId, internalPriceAssetId), ("%s__" + poolAddress))]), "success") | |
102 | + | } | |
103 | + | else throw("Strict value is not equal to itself.") | |
104 | + | } | |
105 | + | } | |
106 | + | } | |
107 | + | ||
108 | + | ||
109 | + | ||
110 | + | @Callable(i) | |
111 | + | func managePool (lpContractAddress,newStatus) = if ((i.caller != this)) | |
112 | + | then throw("permissions denied") | |
113 | + | else nil | |
114 | + | ||
115 | + | ||
116 | + | @Verifier(tx) | |
117 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
118 | + |
github/deemru/w8io/169f3d6 39.63 ms ◑