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