tx · CCULoPK3Xs1fpTp9cw5aZN7QXJPXse3HxBJxyH2uxBsc 3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz: -0.05000000 Waves 2022.11.29 18:34 [2338578] smart account 3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz > SELF 0.00000000 Waves
{ "type": 13, "id": "CCULoPK3Xs1fpTp9cw5aZN7QXJPXse3HxBJxyH2uxBsc", "fee": 5000000, "feeAssetId": null, "timestamp": 1669736055220, "version": 2, "chainId": 84, "sender": "3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz", "senderPublicKey": "C3v9sfZTmGuW7YXwjUKypU41QpFcHCoJxLpvdR4d3iSv", "proofs": [ "55im5NapoAuBymrxNppLWQjtquFwFyX1LmQjjbn9n8jHeGkAMAERQHQf6yVg5fnKXAF9pVcGcw9q9uuwRgCAFpaR", "5xRBHhazi6LXDMJVK1SdTvdDTZdJhmMqguXB4DiuGBR3fS5wddFwgquFbsoypJkDcMLub1AVCqYkic28KVWedbAi" ], "script": "base64:BgIhCAISBAoCAQgSBAoCCAgSAwoBBBIDCgEIEgMKAQgSABIAFAAPa1ByZWZpeFBvb2xOYW1lAgVwb29sXwAFa1BhaXICBXBhaXJfAAlrQXNzZXRJZEECCkFfYXNzZXRfaWQACWtBc3NldElkQgIKQl9hc3NldF9pZAAfa0xhdW5jaHBhZERhdGFUcmFuc2FjdGlvblN0YXR1cwIhbGF1bmNocGFkX2RhdGFfdHJhbnNhY3Rpb25fc3RhdHVzABNrQWN0aXZlQWxsQ29udHJhY3RzAhRhY3RpdmVfYWxsX2NvbnRyYWN0cwAMa0FkbWluUHViS2V5AgphZG1pbl9wdWJfAA1rQWRtaW5QdWJLZXkxAgthZG1pbl9wdWJfMQANa0FkbWluUHViS2V5MgILYWRtaW5fcHViXzIADWtBZG1pblB1YktleTMCC2FkbWluX3B1Yl8zABJrQWRtaW5JbnZva2VQdWJLZXkCEGFkbWluX2ludm9rZV9wdWIAFGtBY2hpZXZlb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blB1YktleTNTaWduZWQAAi91dRA=", "height": 2338578, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7WuhyMQV8CMDevX7Jjz7Ku465fvef12LV2ykRC85YXcf Next: 2KzffYLLdDPu6L12mnejYehEXPNSe4gvi4PFcQUEVP8t Diff:
Old | New | Differences | |
---|---|---|---|
13 | 13 | ||
14 | 14 | let kActiveAllContracts = "active_all_contracts" | |
15 | 15 | ||
16 | - | let kAdminPubKey = "admin_pub" | |
16 | + | let kAdminPubKey = "admin_pub_" | |
17 | 17 | ||
18 | 18 | let kAdminPubKey1 = "admin_pub_1" | |
19 | 19 |
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 kPair = "pair_" | |
7 | 7 | ||
8 | 8 | let kAssetIdA = "A_asset_id" | |
9 | 9 | ||
10 | 10 | let kAssetIdB = "B_asset_id" | |
11 | 11 | ||
12 | 12 | let kLaunchpadDataTransactionStatus = "launchpad_data_transaction_status" | |
13 | 13 | ||
14 | 14 | let kActiveAllContracts = "active_all_contracts" | |
15 | 15 | ||
16 | - | let kAdminPubKey = "admin_pub" | |
16 | + | let kAdminPubKey = "admin_pub_" | |
17 | 17 | ||
18 | 18 | let kAdminPubKey1 = "admin_pub_1" | |
19 | 19 | ||
20 | 20 | let kAdminPubKey2 = "admin_pub_2" | |
21 | 21 | ||
22 | 22 | let kAdminPubKey3 = "admin_pub_3" | |
23 | 23 | ||
24 | 24 | let kAdminInvokePubKey = "admin_invoke_pub" | |
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 launchpadDataTransactionStatus (status) = valueOrElse(isAdminCall(i), [BooleanEntry(kLaunchpadDataTransactionStatus, status)]) | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | ||
93 | 93 | @Callable(i) | |
94 | 94 | func addAchievementsWriter (address) = valueOrElse(isAdminCall(i), { | |
95 | 95 | let writers = valueOrElse(getString(this, kAchievementsWriters), "") | |
96 | 96 | let data = if ((writers == "")) | |
97 | 97 | then nil | |
98 | 98 | else split(writers, ",") | |
99 | 99 | [StringEntry(kAchievementsWriters, makeString((data :+ address), ","))] | |
100 | 100 | }) | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | ||
104 | 104 | @Callable(i) | |
105 | 105 | func removeAchievementsWriter (address) = valueOrElse(isAdminCall(i), { | |
106 | 106 | let writers = split(valueOrElse(getString(this, kAchievementsWriters), ""), ",") | |
107 | 107 | let index = valueOrErrorMessage(indexOf(writers, address), "Can't find address in the list") | |
108 | 108 | [StringEntry(kAchievementsWriters, makeString(removeByIndex(writers, index), ","))] | |
109 | 109 | }) | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | ||
113 | 113 | @Callable(i) | |
114 | 114 | func shutdownAllContracts () = valueOrElse(isAdminCall(i), if (!(activeAllContracts)) | |
115 | 115 | then throw("All contracts already shutdown") | |
116 | 116 | else [BooleanEntry(kActiveAllContracts, false)]) | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | ||
120 | 120 | @Callable(i) | |
121 | 121 | func activateAllContracts () = valueOrElse(isAdminCall(i), if (activeAllContracts) | |
122 | 122 | then throw("All contracts already active") | |
123 | 123 | else [BooleanEntry(kActiveAllContracts, true)]) | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | @Verifier(tx) | |
127 | 127 | func verify () = { | |
128 | 128 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
129 | 129 | then 1 | |
130 | 130 | else 0 | |
131 | 131 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
132 | 132 | then 1 | |
133 | 133 | else 0 | |
134 | 134 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
135 | 135 | then 1 | |
136 | 136 | else 0 | |
137 | 137 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
138 | 138 | } | |
139 | 139 |
github/deemru/w8io/169f3d6 48.47 ms ◑