tx · JQUSrNwvcpHMkBi1rwd9mRYKvJi3KS2oLTNKoJ6VLzM 3MwwmRTwTh2hpQprGouEAzmDUnjb83PtzVG: -0.01000000 Waves 2021.08.12 16:35 [1655223] smart account 3MwwmRTwTh2hpQprGouEAzmDUnjb83PtzVG > SELF 0.00000000 Waves
{ "type": 13, "id": "JQUSrNwvcpHMkBi1rwd9mRYKvJi3KS2oLTNKoJ6VLzM", "fee": 1000000, "feeAssetId": null, "timestamp": 1628775327977, "version": 2, "chainId": 84, "sender": "3MwwmRTwTh2hpQprGouEAzmDUnjb83PtzVG", "senderPublicKey": "6pJkrwfWyhZjm3LoQWRjjNVaLt5CQzqfggzXyqr7nrwA", "proofs": [ "5t6dMJZBakMrwhiYu9ZPojjEoWoTodGqY5No66PAg8uuzYv2i4QzC4fpm19bwCq9hvQu32guS4qvyU6kM9y8Umxy" ], "script": "base64:AAIFAAAAAAAAABIIAhIICgYICAgICAESBAoCCAEAAAAXAAAAAANTRVACAAAAAl9fAAAAAApQb29sQWN0aXZlAAAAAAAAAAABAAAAAA9Qb29sUHV0RGlzYWJsZWQAAAAAAAAAAAIAAAAAE1Bvb2xNYXRjaGVyRGlzYWJsZWQAAAAAAAAAAAMAAAAADFBvb2xTaHV0ZG93bgAAAAAAAAAABAAAAAASaWR4SW50ZXJuYWxBc3NldElkAAAAAAAAAAABAAAAAA9pZHhSZXN1dEFjdGlvbnMAAAAAAAAAAAIAAAAAIGlkeElmQXNzZXRJZENhbGN1bGF0aW9uUGVyZm9ybWVkAAAAAAAAAAADAQAAABZrZXlOZXh0SW50ZXJuYWxBc3NldElkAAAAAAIAAAAXJXNfX25leHRJbnRlcm5hbEFzc2V0SWQBAAAAEWtleVBvb2xTY3JpcHRIYXNoAAAAAAIAAAAWJXMlc19fcG9vbF9fc2NyaXB0SGFzaAEAAAAfa2V5TWFwcGluZ3NJbnRlcm5hbDJiYXNlQXNzZXRJZAAAAAEAAAARaW50ZXJuYWxCYXNlQXNzZXQJAAEsAAAAA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AAEnBlcm1pc3Npb25zIGRlbmllZAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXldMQtc", "height": 1655223, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none 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%d%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 internalAssetId = valueOrElse(getInteger(this, keyMappingsBaseAsset2internalId(assetIdStr)), 0) | |
64 | + | let currentIndexOfInternalId = valueOrElse(getInteger(this, keyNextInternalAssetId()), 0) | |
65 | + | let result = if ((internalAssetId == 0)) | |
66 | + | then { | |
67 | + | let newInternalAssetId = (currentIndexOfInternalId + incrementor) | |
68 | + | $Tuple3(newInternalAssetId, [IntegerEntry(keyNextInternalAssetId(), newInternalAssetId), IntegerEntry(keyMappingsBaseAsset2internalId(assetIdStr), newInternalAssetId), StringEntry(keyMappingsInternal2baseAssetId(newInternalAssetId), assetIdStr)], true) | |
69 | + | } | |
70 | + | else $Tuple3(internalAssetId, 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 if (isDefined(getString(keyMappingPoolContractAddressToPoolAssets(poolAddress)))) | |
79 | + | then throw((("Pool address " + poolAddress) + " already registered.")) | |
80 | + | else { | |
81 | + | let internalAmountAssetData = getInternalAssetIdOrCreate(amountAssetStr, 1) | |
82 | + | let internalAmountAssetId = internalAmountAssetData._1 | |
83 | + | let internalPriceAssetData = getInternalAssetIdOrCreate(priceAssetStr, if (internalAmountAssetData._3) | |
84 | + | then 2 | |
85 | + | else 1) | |
86 | + | let internalPriceAssetId = internalPriceAssetData._1 | |
87 | + | let poolAccountScriptHash = valueOrErrorMessage(scriptHash(addressFromStringValue(poolAddress)), ("No script has been found on pool account " + poolAddress)) | |
88 | + | let ethalonPoolAccountScriptHash = getBinaryValue(keyPoolScriptHash()) | |
89 | + | let poolConfig = getString(this, keyPoolConfig(toString(internalAmountAssetId), toString(internalPriceAssetId))) | |
90 | + | if (isDefined(poolConfig)) | |
91 | + | then throw((((("Pool " + amountAssetStr) + "/") + priceAssetStr) + " has already been activated.")) | |
92 | + | else { | |
93 | + | let poolConfigValue = value(getString(this, keyPoolConfig(toString(internalAmountAssetId), toString(internalPriceAssetId)))) | |
94 | + | let poolActivateInvokeResult = invoke(addressFromStringValue(poolAddress), "activate", [amountAssetStr, priceAssetStr, lpAssetName, lpAssetDescr, poolWeight], nil) | |
95 | + | if ((poolActivateInvokeResult == poolActivateInvokeResult)) | |
96 | + | then { | |
97 | + | let lpAssetIdStr = valueOrElse(poolActivateInvokeResult, "") | |
98 | + | if ((lpAssetIdStr == "")) | |
99 | + | then throw("Failure during dapp2dapp call activate on Pool.") | |
100 | + | else { | |
101 | + | let amountAssetsDecimals = if ((amountAssetStr == "")) | |
102 | + | then 8 | |
103 | + | else value(assetInfo(fromBase58String(amountAssetStr))).decimals | |
104 | + | let priceAssetsDecimals = value(assetInfo(fromBase58String(priceAssetStr))).decimals | |
105 | + | $Tuple2(((internalAmountAssetData._2 ++ internalPriceAssetData._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") | |
106 | + | } | |
107 | + | } | |
108 | + | else throw("Strict value is not equal to itself.") | |
109 | + | } | |
110 | + | } | |
111 | + | ||
112 | + | ||
113 | + | ||
114 | + | @Callable(i) | |
115 | + | func managePool (lpContractAddress,newStatus) = if ((i.caller != this)) | |
116 | + | then throw("permissions denied") | |
117 | + | else nil | |
118 | + | ||
119 | + | ||
120 | + | @Verifier(tx) | |
121 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
122 | + |
github/deemru/w8io/169f3d6 17.52 ms ◑