tx · 2w8uJgwuWtM6udzDVUBe8SvBmL2v8kk99HsfXZWY42jy 3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz: -0.14000000 Waves 2022.11.29 12:44 [2338224] smart account 3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz > SELF 0.00000000 Waves
{ "type": 13, "id": "2w8uJgwuWtM6udzDVUBe8SvBmL2v8kk99HsfXZWY42jy", "fee": 14000000, "feeAssetId": null, "timestamp": 1669715085714, "version": 2, "chainId": 84, "sender": "3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz", "senderPublicKey": "C3v9sfZTmGuW7YXwjUKypU41QpFcHCoJxLpvdR4d3iSv", "proofs": [ "3BJarhwxC7RdXjQpKdPfKgwgTVSNw1zuWWW4uUe71TwVhgUjnP9Xy4xMWjtn2c2ywsGpx2k2mQpL32mho2NKtCGS", "2uv6opzACnm3Ppi49tAvFcQCG4gkgYVqsLuFic5rrvhQUfVHEj8MgcHi8HjNs7UREYPGdinj9SfBrDtMKBWtu48H" ], "script": "base64:BgIhCAISBAoCAQgSBAoCCAgSAwoBBBIDCgEIEgMKAQgSABIAFQAPa1ByZWZpeFBvb2xOYW1lAgVwb29sXwAFa1BhaXICBXBhaXJfAAlrQXNzZXRJZEECCkFfYXNzZXRfaWQACWtBc3NldElkQgIKQl9hc3NldF9pZAAfa0xhdW5jaHBhZERhdGFUcmFuc2FjdGlvblN0YXR1cwIhbGF1bmNocGFkX2RhdGFfdHJhbnNhY3Rpb25fc3RhdHVzABNrQWN0aXZlQWxsQ29udHJhY3RzAhRhY3RpdmVfYWxsX2NvbnRyYWN0cwAMa0FkbWluUHViS2V5AglhZG1pbl9wdWIADWtBZG1pblB1YktleTECC2FkbWluX3B1Yl8xAA1rQWRtaW5QdWJLZXkyAgthZG1pbl9wdWJfMgANa0FkbWluUHViS2V5MwILYWRtaW5fcHViXzMAEmtBZG1pbkludm9rZVB1YktleQIQYWRtaW5faW52b2tlX3B1YgAUa0FjaGlldmVtZ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25lZAUSYWRtaW5QdWJLZXkzU2lnbmVkAAKYnTC8", "height": 2338224, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Ddeeor5SDGD6B2nPC1pVpLBz5FW7grpWRMMNyXHCbEce Next: 7WuhyMQV8CMDevX7Jjz7Ku465fvef12LV2ykRC85YXcf Diff:
Old | New | Differences | |
---|---|---|---|
11 | 11 | ||
12 | 12 | let e = "launchpad_data_transaction_status" | |
13 | 13 | ||
14 | - | let f = " | |
14 | + | let f = "active_all_contracts" | |
15 | 15 | ||
16 | - | let g = "admin_pub | |
16 | + | let g = "admin_pub" | |
17 | 17 | ||
18 | - | let h = "admin_pub_ | |
18 | + | let h = "admin_pub_1" | |
19 | 19 | ||
20 | - | let i = "admin_ | |
20 | + | let i = "admin_pub_2" | |
21 | 21 | ||
22 | - | let j = " | |
22 | + | let j = "admin_pub_3" | |
23 | 23 | ||
24 | - | let k = | |
24 | + | let k = "admin_invoke_pub" | |
25 | 25 | ||
26 | - | let l = | |
26 | + | let l = "achievements_writers" | |
27 | 27 | ||
28 | - | let m = base58' | |
28 | + | let m = base58'GFmKZ2naZFRoCvNbwKAQVGmLb1uBeWGDgFabdGBuZiuy' | |
29 | 29 | ||
30 | - | let n = base58' | |
30 | + | let n = base58'GmJXRyhRA79g8yUGgKBAVdnFfQFDMjQG98b1MmLDh5kk' | |
31 | 31 | ||
32 | - | func o (p) = if ((p.caller == this)) | |
32 | + | let o = base58'CFhbV6h41hVjbGHudGtS3fYUv7QAKRxFQzKNtx4B5PqP' | |
33 | + | ||
34 | + | let p = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
35 | + | ||
36 | + | let q = getBooleanValue(this, f) | |
37 | + | ||
38 | + | func r (s) = if ((s.caller == this)) | |
33 | 39 | then unit | |
34 | 40 | else throw("Only the Oracle itself can invoke this function") | |
35 | 41 | ||
36 | 42 | ||
37 | - | func | |
38 | - | let | |
39 | - | if (( | |
43 | + | func t (u) = { | |
44 | + | let v = valueOrErrorMessage(getString(u, "version"), "Pool is not initialized") | |
45 | + | if ((v == "1.0.0")) | |
40 | 46 | then "cpmm" | |
41 | - | else if (( | |
47 | + | else if ((v == "2.0.0")) | |
42 | 48 | then "flat" | |
43 | - | else if (( | |
49 | + | else if ((v == "3.0.0")) | |
44 | 50 | then "multycurve" | |
45 | 51 | else throw("Unknown version of pool") | |
46 | 52 | } | |
47 | 53 | ||
48 | 54 | ||
49 | - | func | |
55 | + | func w (x) = toString(valueOrErrorMessage(addressFromString(x), (("Can't parse \"" + x) + "\" as address"))) | |
50 | 56 | ||
51 | 57 | ||
52 | - | @Callable(p) | |
53 | - | func setAdmin () = valueOrElse(o(p), [StringEntry(f, toBase58String(k)), StringEntry(g, toBase58String(l)), StringEntry(h, toBase58String(m)), StringEntry(i, toBase58String(n))]) | |
58 | + | func y (s) = if (containsElement([m, n, o], s.callerPublicKey)) | |
59 | + | then unit | |
60 | + | else throw("Only admin can call this function") | |
61 | + | ||
62 | + | ||
63 | + | @Callable(s) | |
64 | + | func setAdmin (z,A) = valueOrElse(r(s), if (if ((0 > z)) | |
65 | + | then (z > 3) | |
66 | + | else false) | |
67 | + | then throw("Wrong admin id") | |
68 | + | else [StringEntry((g + toString(z)), A)]) | |
54 | 69 | ||
55 | 70 | ||
56 | 71 | ||
57 | - | @Callable( | |
58 | - | func addPool ( | |
59 | - | let | |
60 | - | let | |
61 | - | let | |
62 | - | if (isDefined( | |
63 | - | then throw((((("Pool with address \"" + | |
64 | - | else ([StringEntry( | |
72 | + | @Callable(s) | |
73 | + | func addPool (u,B) = valueOrElse(y(s), { | |
74 | + | let C = w(u) | |
75 | + | let D = (a + C) | |
76 | + | let E = getString(this, D) | |
77 | + | if (isDefined(E)) | |
78 | + | then throw((((("Pool with address \"" + C) + "\" is already defined with name \"") + value(E)) + "\"")) | |
79 | + | else ([StringEntry(D, B)] ++ (if ((t(value(addressFromString(u))) == "multycurve")) | |
65 | 80 | then nil | |
66 | 81 | else { | |
67 | - | let | |
68 | - | let | |
69 | - | [StringEntry((((b + | |
82 | + | let F = valueOrErrorMessage(getString(value(addressFromString(u)), c), "Asset id A is incorrect") | |
83 | + | let G = valueOrErrorMessage(getString(value(addressFromString(u)), d), "Asset id B is incorrect") | |
84 | + | [StringEntry((((b + F) + "_") + G), u)] | |
70 | 85 | })) | |
71 | 86 | }) | |
72 | 87 | ||
73 | 88 | ||
74 | 89 | ||
75 | - | @Callable(p) | |
76 | - | func renamePool (r,B) = valueOrElse(o(p), { | |
77 | - | let w = t(r) | |
78 | - | let x = (a + w) | |
79 | - | let y = getString(this, x) | |
80 | - | if (isDefined(y)) | |
81 | - | then [StringEntry(x, B)] | |
82 | - | else throw((("Pool with address \"" + w) + "\" has not yet been added")) | |
90 | + | @Callable(s) | |
91 | + | func launchpadDataTransactionStatus (H) = valueOrElse(y(s), [BooleanEntry(e, H)]) | |
92 | + | ||
93 | + | ||
94 | + | ||
95 | + | @Callable(s) | |
96 | + | func addAchievementsWriter (x) = valueOrElse(y(s), { | |
97 | + | let I = valueOrElse(getString(this, l), "") | |
98 | + | let J = if ((I == "")) | |
99 | + | then nil | |
100 | + | else split(I, ",") | |
101 | + | [StringEntry(l, makeString((J :+ x), ","))] | |
83 | 102 | }) | |
84 | 103 | ||
85 | 104 | ||
86 | 105 | ||
87 | - | @Callable(p) | |
88 | - | func launchpadDataTransactionStatus (C) = valueOrElse(o(p), [BooleanEntry(e, C)]) | |
89 | - | ||
90 | - | ||
91 | - | ||
92 | - | @Callable(p) | |
93 | - | func addAchievementsWriter (u) = valueOrElse(o(p), { | |
94 | - | let D = valueOrElse(getString(this, j), "") | |
95 | - | let E = if ((D == "")) | |
96 | - | then nil | |
97 | - | else split(D, ",") | |
98 | - | [StringEntry(j, makeString((E :+ u), ","))] | |
106 | + | @Callable(s) | |
107 | + | func removeAchievementsWriter (x) = valueOrElse(y(s), { | |
108 | + | let I = split(valueOrElse(getString(this, l), ""), ",") | |
109 | + | let K = valueOrErrorMessage(indexOf(I, x), "Can't find address in the list") | |
110 | + | [StringEntry(l, makeString(removeByIndex(I, K), ","))] | |
99 | 111 | }) | |
100 | 112 | ||
101 | 113 | ||
102 | 114 | ||
103 | - | @Callable(p) | |
104 | - | func removeAchievementsWriter (u) = valueOrElse(o(p), { | |
105 | - | let D = split(valueOrElse(getString(this, j), ""), ",") | |
106 | - | let F = valueOrErrorMessage(indexOf(D, u), "Can't find address in the list") | |
107 | - | [StringEntry(j, makeString(removeByIndex(D, F), ","))] | |
108 | - | }) | |
115 | + | @Callable(s) | |
116 | + | func shutdownAllContracts () = valueOrElse(y(s), if (!(q)) | |
117 | + | then throw("All contracts already shutdown") | |
118 | + | else [BooleanEntry(f, false)]) | |
109 | 119 | ||
110 | 120 | ||
111 | - | @Verifier(G) | |
112 | - | func H () = { | |
113 | - | let I = if (sigVerify(G.bodyBytes, G.proofs[0], k)) | |
121 | + | ||
122 | + | @Callable(s) | |
123 | + | func activateAllContracts () = valueOrElse(y(s), if (q) | |
124 | + | then throw("All contracts already active") | |
125 | + | else [BooleanEntry(f, true)]) | |
126 | + | ||
127 | + | ||
128 | + | @Verifier(L) | |
129 | + | func M () = { | |
130 | + | let N = if (sigVerify(L.bodyBytes, L.proofs[0], m)) | |
114 | 131 | then 1 | |
115 | 132 | else 0 | |
116 | - | let | |
133 | + | let O = if (sigVerify(L.bodyBytes, L.proofs[1], n)) | |
117 | 134 | then 1 | |
118 | 135 | else 0 | |
119 | - | let | |
136 | + | let P = if (sigVerify(L.bodyBytes, L.proofs[2], o)) | |
120 | 137 | then 1 | |
121 | 138 | else 0 | |
122 | - | let L = (((I + J) + K) >= 2) | |
123 | - | let M = (((I + J) + K) >= 1) | |
124 | - | let N = G | |
125 | - | if ($isInstanceOf(N, "InvokeScriptTransaction")) | |
126 | - | then { | |
127 | - | let O = N | |
128 | - | let P = if ((O.dApp == this)) | |
129 | - | then containsElement(["renamePool"], O.function) | |
130 | - | else false | |
131 | - | let Q = if ((O.dApp == this)) | |
132 | - | then containsElement(["setAdmin"], O.function) | |
133 | - | else false | |
134 | - | let R = if ((O.dApp == this)) | |
135 | - | then containsElement(["addPool"], O.function) | |
136 | - | else false | |
137 | - | let S = if ((O.dApp == this)) | |
138 | - | then containsElement(["launchpadDataTransactionStatus"], O.function) | |
139 | - | else false | |
140 | - | let T = if ((O.dApp == this)) | |
141 | - | then containsElement(["addAchievementsWriter"], O.function) | |
142 | - | else false | |
143 | - | let U = if ((O.dApp == this)) | |
144 | - | then containsElement(["removeAchievementsWriter"], O.function) | |
145 | - | else false | |
146 | - | if (if (if (if (if (if (if (L) | |
147 | - | then (size(O.payments) == 0) | |
148 | - | else false) | |
149 | - | then P | |
150 | - | else false) | |
151 | - | then true | |
152 | - | else if (if (M) | |
153 | - | then (size(O.payments) == 0) | |
154 | - | else false) | |
155 | - | then R | |
156 | - | else false) | |
157 | - | then true | |
158 | - | else if (if (L) | |
159 | - | then (size(O.payments) == 0) | |
160 | - | else false) | |
161 | - | then Q | |
162 | - | else false) | |
163 | - | then true | |
164 | - | else if (if (L) | |
165 | - | then (size(O.payments) == 0) | |
166 | - | else false) | |
167 | - | then S | |
168 | - | else false) | |
169 | - | then true | |
170 | - | else if (if (L) | |
171 | - | then (size(O.payments) == 0) | |
172 | - | else false) | |
173 | - | then T | |
174 | - | else false) | |
175 | - | then true | |
176 | - | else if (if (L) | |
177 | - | then (size(O.payments) == 0) | |
178 | - | else false) | |
179 | - | then U | |
180 | - | else false | |
181 | - | } | |
182 | - | else if (if ($isInstanceOf(N, "Order")) | |
183 | - | then true | |
184 | - | else if ($isInstanceOf(N, "DataTransaction")) | |
185 | - | then true | |
186 | - | else if ($isInstanceOf(N, "SponsorFeeTransaction")) | |
187 | - | then true | |
188 | - | else if ($isInstanceOf(N, "SetScriptTransaction")) | |
189 | - | then true | |
190 | - | else if ($isInstanceOf(N, "CreateAliasTransaction")) | |
191 | - | then true | |
192 | - | else if ($isInstanceOf(N, "LeaseCancelTransaction")) | |
193 | - | then true | |
194 | - | else if ($isInstanceOf(N, "LeaseTransaction")) | |
195 | - | then true | |
196 | - | else if ($isInstanceOf(N, "IssueTransaction")) | |
197 | - | then true | |
198 | - | else if ($isInstanceOf(N, "InvokeExpressionTransaction")) | |
199 | - | then true | |
200 | - | else if ($isInstanceOf(N, "UpdateAssetInfoTransaction")) | |
201 | - | then true | |
202 | - | else if ($isInstanceOf(N, "InvokeScriptTransaction")) | |
203 | - | then true | |
204 | - | else if ($isInstanceOf(N, "SetAssetScriptTransaction")) | |
205 | - | then true | |
206 | - | else if ($isInstanceOf(N, "TransferTransaction")) | |
207 | - | then true | |
208 | - | else if ($isInstanceOf(N, "ExchangeTransaction")) | |
209 | - | then true | |
210 | - | else if ($isInstanceOf(N, "MassTransferTransaction")) | |
211 | - | then true | |
212 | - | else if ($isInstanceOf(N, "BurnTransaction")) | |
213 | - | then true | |
214 | - | else $isInstanceOf(N, "ReissueTransaction")) | |
215 | - | then L | |
216 | - | else throw("Match error") | |
139 | + | (((N + O) + P) >= 2) | |
217 | 140 | } | |
218 | 141 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "pool_" | |
5 | 5 | ||
6 | 6 | let b = "pair_" | |
7 | 7 | ||
8 | 8 | let c = "A_asset_id" | |
9 | 9 | ||
10 | 10 | let d = "B_asset_id" | |
11 | 11 | ||
12 | 12 | let e = "launchpad_data_transaction_status" | |
13 | 13 | ||
14 | - | let f = " | |
14 | + | let f = "active_all_contracts" | |
15 | 15 | ||
16 | - | let g = "admin_pub | |
16 | + | let g = "admin_pub" | |
17 | 17 | ||
18 | - | let h = "admin_pub_ | |
18 | + | let h = "admin_pub_1" | |
19 | 19 | ||
20 | - | let i = "admin_ | |
20 | + | let i = "admin_pub_2" | |
21 | 21 | ||
22 | - | let j = " | |
22 | + | let j = "admin_pub_3" | |
23 | 23 | ||
24 | - | let k = | |
24 | + | let k = "admin_invoke_pub" | |
25 | 25 | ||
26 | - | let l = | |
26 | + | let l = "achievements_writers" | |
27 | 27 | ||
28 | - | let m = base58' | |
28 | + | let m = base58'GFmKZ2naZFRoCvNbwKAQVGmLb1uBeWGDgFabdGBuZiuy' | |
29 | 29 | ||
30 | - | let n = base58' | |
30 | + | let n = base58'GmJXRyhRA79g8yUGgKBAVdnFfQFDMjQG98b1MmLDh5kk' | |
31 | 31 | ||
32 | - | func o (p) = if ((p.caller == this)) | |
32 | + | let o = base58'CFhbV6h41hVjbGHudGtS3fYUv7QAKRxFQzKNtx4B5PqP' | |
33 | + | ||
34 | + | let p = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
35 | + | ||
36 | + | let q = getBooleanValue(this, f) | |
37 | + | ||
38 | + | func r (s) = if ((s.caller == this)) | |
33 | 39 | then unit | |
34 | 40 | else throw("Only the Oracle itself can invoke this function") | |
35 | 41 | ||
36 | 42 | ||
37 | - | func | |
38 | - | let | |
39 | - | if (( | |
43 | + | func t (u) = { | |
44 | + | let v = valueOrErrorMessage(getString(u, "version"), "Pool is not initialized") | |
45 | + | if ((v == "1.0.0")) | |
40 | 46 | then "cpmm" | |
41 | - | else if (( | |
47 | + | else if ((v == "2.0.0")) | |
42 | 48 | then "flat" | |
43 | - | else if (( | |
49 | + | else if ((v == "3.0.0")) | |
44 | 50 | then "multycurve" | |
45 | 51 | else throw("Unknown version of pool") | |
46 | 52 | } | |
47 | 53 | ||
48 | 54 | ||
49 | - | func | |
55 | + | func w (x) = toString(valueOrErrorMessage(addressFromString(x), (("Can't parse \"" + x) + "\" as address"))) | |
50 | 56 | ||
51 | 57 | ||
52 | - | @Callable(p) | |
53 | - | func setAdmin () = valueOrElse(o(p), [StringEntry(f, toBase58String(k)), StringEntry(g, toBase58String(l)), StringEntry(h, toBase58String(m)), StringEntry(i, toBase58String(n))]) | |
58 | + | func y (s) = if (containsElement([m, n, o], s.callerPublicKey)) | |
59 | + | then unit | |
60 | + | else throw("Only admin can call this function") | |
61 | + | ||
62 | + | ||
63 | + | @Callable(s) | |
64 | + | func setAdmin (z,A) = valueOrElse(r(s), if (if ((0 > z)) | |
65 | + | then (z > 3) | |
66 | + | else false) | |
67 | + | then throw("Wrong admin id") | |
68 | + | else [StringEntry((g + toString(z)), A)]) | |
54 | 69 | ||
55 | 70 | ||
56 | 71 | ||
57 | - | @Callable( | |
58 | - | func addPool ( | |
59 | - | let | |
60 | - | let | |
61 | - | let | |
62 | - | if (isDefined( | |
63 | - | then throw((((("Pool with address \"" + | |
64 | - | else ([StringEntry( | |
72 | + | @Callable(s) | |
73 | + | func addPool (u,B) = valueOrElse(y(s), { | |
74 | + | let C = w(u) | |
75 | + | let D = (a + C) | |
76 | + | let E = getString(this, D) | |
77 | + | if (isDefined(E)) | |
78 | + | then throw((((("Pool with address \"" + C) + "\" is already defined with name \"") + value(E)) + "\"")) | |
79 | + | else ([StringEntry(D, B)] ++ (if ((t(value(addressFromString(u))) == "multycurve")) | |
65 | 80 | then nil | |
66 | 81 | else { | |
67 | - | let | |
68 | - | let | |
69 | - | [StringEntry((((b + | |
82 | + | let F = valueOrErrorMessage(getString(value(addressFromString(u)), c), "Asset id A is incorrect") | |
83 | + | let G = valueOrErrorMessage(getString(value(addressFromString(u)), d), "Asset id B is incorrect") | |
84 | + | [StringEntry((((b + F) + "_") + G), u)] | |
70 | 85 | })) | |
71 | 86 | }) | |
72 | 87 | ||
73 | 88 | ||
74 | 89 | ||
75 | - | @Callable(p) | |
76 | - | func renamePool (r,B) = valueOrElse(o(p), { | |
77 | - | let w = t(r) | |
78 | - | let x = (a + w) | |
79 | - | let y = getString(this, x) | |
80 | - | if (isDefined(y)) | |
81 | - | then [StringEntry(x, B)] | |
82 | - | else throw((("Pool with address \"" + w) + "\" has not yet been added")) | |
90 | + | @Callable(s) | |
91 | + | func launchpadDataTransactionStatus (H) = valueOrElse(y(s), [BooleanEntry(e, H)]) | |
92 | + | ||
93 | + | ||
94 | + | ||
95 | + | @Callable(s) | |
96 | + | func addAchievementsWriter (x) = valueOrElse(y(s), { | |
97 | + | let I = valueOrElse(getString(this, l), "") | |
98 | + | let J = if ((I == "")) | |
99 | + | then nil | |
100 | + | else split(I, ",") | |
101 | + | [StringEntry(l, makeString((J :+ x), ","))] | |
83 | 102 | }) | |
84 | 103 | ||
85 | 104 | ||
86 | 105 | ||
87 | - | @Callable(p) | |
88 | - | func launchpadDataTransactionStatus (C) = valueOrElse(o(p), [BooleanEntry(e, C)]) | |
89 | - | ||
90 | - | ||
91 | - | ||
92 | - | @Callable(p) | |
93 | - | func addAchievementsWriter (u) = valueOrElse(o(p), { | |
94 | - | let D = valueOrElse(getString(this, j), "") | |
95 | - | let E = if ((D == "")) | |
96 | - | then nil | |
97 | - | else split(D, ",") | |
98 | - | [StringEntry(j, makeString((E :+ u), ","))] | |
106 | + | @Callable(s) | |
107 | + | func removeAchievementsWriter (x) = valueOrElse(y(s), { | |
108 | + | let I = split(valueOrElse(getString(this, l), ""), ",") | |
109 | + | let K = valueOrErrorMessage(indexOf(I, x), "Can't find address in the list") | |
110 | + | [StringEntry(l, makeString(removeByIndex(I, K), ","))] | |
99 | 111 | }) | |
100 | 112 | ||
101 | 113 | ||
102 | 114 | ||
103 | - | @Callable(p) | |
104 | - | func removeAchievementsWriter (u) = valueOrElse(o(p), { | |
105 | - | let D = split(valueOrElse(getString(this, j), ""), ",") | |
106 | - | let F = valueOrErrorMessage(indexOf(D, u), "Can't find address in the list") | |
107 | - | [StringEntry(j, makeString(removeByIndex(D, F), ","))] | |
108 | - | }) | |
115 | + | @Callable(s) | |
116 | + | func shutdownAllContracts () = valueOrElse(y(s), if (!(q)) | |
117 | + | then throw("All contracts already shutdown") | |
118 | + | else [BooleanEntry(f, false)]) | |
109 | 119 | ||
110 | 120 | ||
111 | - | @Verifier(G) | |
112 | - | func H () = { | |
113 | - | let I = if (sigVerify(G.bodyBytes, G.proofs[0], k)) | |
121 | + | ||
122 | + | @Callable(s) | |
123 | + | func activateAllContracts () = valueOrElse(y(s), if (q) | |
124 | + | then throw("All contracts already active") | |
125 | + | else [BooleanEntry(f, true)]) | |
126 | + | ||
127 | + | ||
128 | + | @Verifier(L) | |
129 | + | func M () = { | |
130 | + | let N = if (sigVerify(L.bodyBytes, L.proofs[0], m)) | |
114 | 131 | then 1 | |
115 | 132 | else 0 | |
116 | - | let | |
133 | + | let O = if (sigVerify(L.bodyBytes, L.proofs[1], n)) | |
117 | 134 | then 1 | |
118 | 135 | else 0 | |
119 | - | let | |
136 | + | let P = if (sigVerify(L.bodyBytes, L.proofs[2], o)) | |
120 | 137 | then 1 | |
121 | 138 | else 0 | |
122 | - | let L = (((I + J) + K) >= 2) | |
123 | - | let M = (((I + J) + K) >= 1) | |
124 | - | let N = G | |
125 | - | if ($isInstanceOf(N, "InvokeScriptTransaction")) | |
126 | - | then { | |
127 | - | let O = N | |
128 | - | let P = if ((O.dApp == this)) | |
129 | - | then containsElement(["renamePool"], O.function) | |
130 | - | else false | |
131 | - | let Q = if ((O.dApp == this)) | |
132 | - | then containsElement(["setAdmin"], O.function) | |
133 | - | else false | |
134 | - | let R = if ((O.dApp == this)) | |
135 | - | then containsElement(["addPool"], O.function) | |
136 | - | else false | |
137 | - | let S = if ((O.dApp == this)) | |
138 | - | then containsElement(["launchpadDataTransactionStatus"], O.function) | |
139 | - | else false | |
140 | - | let T = if ((O.dApp == this)) | |
141 | - | then containsElement(["addAchievementsWriter"], O.function) | |
142 | - | else false | |
143 | - | let U = if ((O.dApp == this)) | |
144 | - | then containsElement(["removeAchievementsWriter"], O.function) | |
145 | - | else false | |
146 | - | if (if (if (if (if (if (if (L) | |
147 | - | then (size(O.payments) == 0) | |
148 | - | else false) | |
149 | - | then P | |
150 | - | else false) | |
151 | - | then true | |
152 | - | else if (if (M) | |
153 | - | then (size(O.payments) == 0) | |
154 | - | else false) | |
155 | - | then R | |
156 | - | else false) | |
157 | - | then true | |
158 | - | else if (if (L) | |
159 | - | then (size(O.payments) == 0) | |
160 | - | else false) | |
161 | - | then Q | |
162 | - | else false) | |
163 | - | then true | |
164 | - | else if (if (L) | |
165 | - | then (size(O.payments) == 0) | |
166 | - | else false) | |
167 | - | then S | |
168 | - | else false) | |
169 | - | then true | |
170 | - | else if (if (L) | |
171 | - | then (size(O.payments) == 0) | |
172 | - | else false) | |
173 | - | then T | |
174 | - | else false) | |
175 | - | then true | |
176 | - | else if (if (L) | |
177 | - | then (size(O.payments) == 0) | |
178 | - | else false) | |
179 | - | then U | |
180 | - | else false | |
181 | - | } | |
182 | - | else if (if ($isInstanceOf(N, "Order")) | |
183 | - | then true | |
184 | - | else if ($isInstanceOf(N, "DataTransaction")) | |
185 | - | then true | |
186 | - | else if ($isInstanceOf(N, "SponsorFeeTransaction")) | |
187 | - | then true | |
188 | - | else if ($isInstanceOf(N, "SetScriptTransaction")) | |
189 | - | then true | |
190 | - | else if ($isInstanceOf(N, "CreateAliasTransaction")) | |
191 | - | then true | |
192 | - | else if ($isInstanceOf(N, "LeaseCancelTransaction")) | |
193 | - | then true | |
194 | - | else if ($isInstanceOf(N, "LeaseTransaction")) | |
195 | - | then true | |
196 | - | else if ($isInstanceOf(N, "IssueTransaction")) | |
197 | - | then true | |
198 | - | else if ($isInstanceOf(N, "InvokeExpressionTransaction")) | |
199 | - | then true | |
200 | - | else if ($isInstanceOf(N, "UpdateAssetInfoTransaction")) | |
201 | - | then true | |
202 | - | else if ($isInstanceOf(N, "InvokeScriptTransaction")) | |
203 | - | then true | |
204 | - | else if ($isInstanceOf(N, "SetAssetScriptTransaction")) | |
205 | - | then true | |
206 | - | else if ($isInstanceOf(N, "TransferTransaction")) | |
207 | - | then true | |
208 | - | else if ($isInstanceOf(N, "ExchangeTransaction")) | |
209 | - | then true | |
210 | - | else if ($isInstanceOf(N, "MassTransferTransaction")) | |
211 | - | then true | |
212 | - | else if ($isInstanceOf(N, "BurnTransaction")) | |
213 | - | then true | |
214 | - | else $isInstanceOf(N, "ReissueTransaction")) | |
215 | - | then L | |
216 | - | else throw("Match error") | |
139 | + | (((N + O) + P) >= 2) | |
217 | 140 | } | |
218 | 141 |
github/deemru/w8io/026f985 52.20 ms ◑