tx · DEyoPsRA6SAY8CuaiegoXTXofsdXJQYFoW37t7UU6rxB 3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz: -0.00800000 Waves 2023.02.02 11:23 [2431756] smart account 3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz > SELF 0.00000000 Waves
{ "type": 13, "id": "DEyoPsRA6SAY8CuaiegoXTXofsdXJQYFoW37t7UU6rxB", "fee": 800000, "feeAssetId": null, "timestamp": 1675326258520, "version": 2, "chainId": 84, "sender": "3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz", "senderPublicKey": "C3v9sfZTmGuW7YXwjUKypU41QpFcHCoJxLpvdR4d3iSv", "proofs": [ "4fPYMuriKhZCVaYrgcLxa9C7jMWXMCuaffDVupJ4QJjpGX6QdX6mdL4MtSxLhVbQrMbJfLJE3ZviB9itX7xD3QUy", "PbD9EgfTzEq6zy6HXLaKHwhKyWoH3huR2gxTtx9zB2Xcz7w4Xwg4dkYvQxpnRRL11TjofSCFvuwRChsdqxHz6PA" ], "script": "base64:BgImCAISBAoCAQgSBAoCCAgSAwoBCBIDCgEEEgMKAQgSAwoBCBIAEgAUAA9rUHJlZml4UG9vbE5hbWUCBXBvb2xfABFrUHJlZml4RGVwcmVjYXRlZAILZGVwcmVjYXRlZF8ABWtQYWlyAgVwYWlyXwAJa0Fzc2V0SWRBAgpBX2Fzc2V0X2lkAAlrQXNzZXRJZEICCkJfYXNzZXRfaWQAH2tMYXVuY2hwYWREYXRhVHJhbnNhY3Rpb25TdGF0dXMCIWxhdW5jaHBhZF9kYXRhX3RyYW5zYWN0aW9uX3N0YXR1cwATa0FjdGl2ZUFsbENvbnRyYWN0cwIUYWN0aXZlX2FsbF9jb250cmFjdHMADGtBZG1pblB1YktleQIKYWRtaW5fcHViXwANa0FkbWluUHViS2V5MQILYWRtaW5fcHViXzEADWtBZG1pblB1YktleTICC2FkbWluX3B1Yl8yAA1rQWRtaW5QdWJLZXkzAgthZG1pbl9wdWJfMwAUa0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A9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUMYWRtaW5QdWJLZXkxAAEAAAQSYWRtaW5QdWJLZXkyU2lnbmVkAwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAQUMYWRtaW5QdWJLZXkyAAEAAAQSYWRtaW5QdWJLZXkzU2lnbmVkAwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAgUMYWRtaW5QdWJLZXkzAAEAAAkAZwIJAGQCCQBkAgUSYWRtaW5QdWJLZXkxU2lnbmVkBRJhZG1pblB1YktleTJTaWduZWQFEmFkbWluUHViS2V5M1NpZ25lZAACwuXPeA==", "height": 2431756, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GrxfKTGtgvZkjo2WpZAEmfv79gjA1nSmHLnxk7ohsuQm Next: 8af99uDm7FR2ryDkZGfirMrhDKupSAQUtGY7vpSnicjG Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let kPrefixPoolName = "pool_" | |
5 | 5 | ||
6 | 6 | let kPrefixDeprecated = "deprecated_" | |
7 | 7 | ||
8 | 8 | let kPair = "pair_" | |
9 | 9 | ||
10 | 10 | let kAssetIdA = "A_asset_id" | |
11 | 11 | ||
12 | 12 | let kAssetIdB = "B_asset_id" | |
13 | 13 | ||
14 | 14 | let kLaunchpadDataTransactionStatus = "launchpad_data_transaction_status" | |
15 | 15 | ||
16 | 16 | let kActiveAllContracts = "active_all_contracts" | |
17 | 17 | ||
18 | 18 | let kAdminPubKey = "admin_pub_" | |
19 | 19 | ||
20 | 20 | let kAdminPubKey1 = "admin_pub_1" | |
21 | 21 | ||
22 | 22 | let kAdminPubKey2 = "admin_pub_2" | |
23 | 23 | ||
24 | 24 | let kAdminPubKey3 = "admin_pub_3" | |
25 | 25 | ||
26 | 26 | let kAchievementsWriters = "achievements_writers" | |
27 | 27 | ||
28 | 28 | let adminPubKey1 = fromBase58String(getStringValue(this, kAdminPubKey1)) | |
29 | 29 | ||
30 | 30 | let adminPubKey2 = fromBase58String(getStringValue(this, kAdminPubKey2)) | |
31 | 31 | ||
32 | 32 | let adminPubKey3 = fromBase58String(getStringValue(this, kAdminPubKey3)) | |
33 | 33 | ||
34 | 34 | let activeAllContracts = getBooleanValue(this, kActiveAllContracts) | |
35 | 35 | ||
36 | 36 | func isSelfCall (i) = if ((i.caller == this)) | |
37 | 37 | then unit | |
38 | 38 | else throw("Only the Oracle itself can invoke this function") | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func getPoolType (poolAddress) = { | |
42 | 42 | let version = valueOrErrorMessage(getString(poolAddress, "version"), "Pool is not initialized") | |
43 | 43 | if ((version == "1.0.0")) | |
44 | 44 | then "cpmm" | |
45 | 45 | else if ((version == "2.0.0")) | |
46 | 46 | then "flat" | |
47 | 47 | else if ((version == "3.0.0")) | |
48 | 48 | then "multycurve" | |
49 | 49 | else throw("Unknown version of pool") | |
50 | 50 | } | |
51 | 51 | ||
52 | 52 | ||
53 | 53 | func getAddressIfValid (address) = toString(valueOrErrorMessage(addressFromString(address), (("Can't parse \"" + address) + "\" as address"))) | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
57 | 57 | then unit | |
58 | 58 | else throw("Only admin can call this function") | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | @Callable(i) | |
62 | 62 | func setAdmin (adminId,adminPubKey) = valueOrElse(isSelfCall(i), if (if ((0 > adminId)) | |
63 | 63 | then (adminId > 3) | |
64 | 64 | else false) | |
65 | 65 | then throw("Wrong admin id") | |
66 | 66 | else [StringEntry((kAdminPubKey + toString(adminId)), adminPubKey)]) | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | ||
70 | 70 | @Callable(i) | |
71 | 71 | func addPool (poolAddress,poolName) = valueOrElse(isAdminCall(i), { | |
72 | 72 | let validatedAddress = getAddressIfValid(poolAddress) | |
73 | 73 | let keyName = (kPrefixPoolName + validatedAddress) | |
74 | 74 | let possiblyAlreadyAddedPool = getString(this, keyName) | |
75 | 75 | if (isDefined(possiblyAlreadyAddedPool)) | |
76 | 76 | then throw((((("Pool with address \"" + validatedAddress) + "\" is already defined with name \"") + value(possiblyAlreadyAddedPool)) + "\"")) | |
77 | 77 | else ([StringEntry(keyName, poolName)] ++ (if ((getPoolType(value(addressFromString(poolAddress))) == "multycurve")) | |
78 | 78 | then nil | |
79 | 79 | else { | |
80 | 80 | let assetIdA = valueOrErrorMessage(getString(value(addressFromString(poolAddress)), kAssetIdA), "Asset id A is incorrect") | |
81 | 81 | let assetIdB = valueOrErrorMessage(getString(value(addressFromString(poolAddress)), kAssetIdB), "Asset id B is incorrect") | |
82 | 82 | [StringEntry((((kPair + assetIdA) + "_") + assetIdB), poolAddress)] | |
83 | 83 | })) | |
84 | 84 | }) | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | ||
88 | 88 | @Callable(i) | |
89 | 89 | func setDeprecated (poolAddress) = valueOrElse(isAdminCall(i), { | |
90 | 90 | let keyName = (kPrefixPoolName + poolAddress) | |
91 | 91 | if (!(isDefined(getString(this, keyName)))) | |
92 | 92 | then throw(("Couldn't found pool with address " + poolAddress)) | |
93 | 93 | else [BooleanEntry((kPrefixDeprecated + poolAddress), true)] | |
94 | 94 | }) | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | ||
98 | 98 | @Callable(i) | |
99 | 99 | func launchpadDataTransactionStatus (status) = valueOrElse(isAdminCall(i), [BooleanEntry(kLaunchpadDataTransactionStatus, status)]) | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | ||
103 | 103 | @Callable(i) | |
104 | 104 | func addAchievementsWriter (address) = valueOrElse(isAdminCall(i), { | |
105 | 105 | let writers = valueOrElse(getString(this, kAchievementsWriters), "") | |
106 | 106 | let data = if ((writers == "")) | |
107 | 107 | then nil | |
108 | 108 | else split(writers, ",") | |
109 | 109 | [StringEntry(kAchievementsWriters, makeString((data :+ address), ","))] | |
110 | 110 | }) | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | 114 | @Callable(i) | |
115 | 115 | func removeAchievementsWriter (address) = valueOrElse(isAdminCall(i), { | |
116 | 116 | let writers = split(valueOrElse(getString(this, kAchievementsWriters), ""), ",") | |
117 | 117 | let index = valueOrErrorMessage(indexOf(writers, address), "Can't find address in the list") | |
118 | 118 | [StringEntry(kAchievementsWriters, makeString(removeByIndex(writers, index), ","))] | |
119 | 119 | }) | |
120 | 120 | ||
121 | 121 | ||
122 | 122 | ||
123 | 123 | @Callable(i) | |
124 | 124 | func shutdownAllContracts () = valueOrElse(isAdminCall(i), if (!(activeAllContracts)) | |
125 | 125 | then throw("All contracts already shutdown") | |
126 | 126 | else [BooleanEntry(kActiveAllContracts, false)]) | |
127 | 127 | ||
128 | 128 | ||
129 | 129 | ||
130 | 130 | @Callable(i) | |
131 | 131 | func activateAllContracts () = valueOrElse(isAdminCall(i), if (activeAllContracts) | |
132 | 132 | then throw("All contracts already active") | |
133 | 133 | else [BooleanEntry(kActiveAllContracts, true)]) | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | @Verifier(tx) | |
137 | 137 | func verify () = { | |
138 | 138 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
139 | 139 | then 1 | |
140 | 140 | else 0 | |
141 | 141 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
142 | 142 | then 1 | |
143 | 143 | else 0 | |
144 | 144 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
145 | 145 | then 1 | |
146 | 146 | else 0 | |
147 | 147 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
148 | 148 | } | |
149 | 149 |
github/deemru/w8io/169f3d6 44.34 ms ◑