@ensuro/access-managed-proxy 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +38 -2
  2. package/build/build-info.json +1 -1
  3. package/build/contracts/AMPUtils.sol/AMPUtils.json +22 -0
  4. package/build/contracts/amps/AccessManagedProxyS25.sol/AccessManagedProxyS25.json +123 -0
  5. package/build/contracts/amps/AccessManagedProxyS26.sol/AccessManagedProxyS26.json +123 -0
  6. package/build/contracts/amps/AccessManagedProxyS27.sol/AccessManagedProxyS27.json +123 -0
  7. package/build/contracts/amps/AccessManagedProxyS28.sol/AccessManagedProxyS28.json +123 -0
  8. package/build/contracts/amps/AccessManagedProxyS29.sol/AccessManagedProxyS29.json +123 -0
  9. package/build/contracts/amps/AccessManagedProxyS30.sol/AccessManagedProxyS30.json +123 -0
  10. package/build/contracts/amps/AccessManagedProxyS31.sol/AccessManagedProxyS31.json +123 -0
  11. package/build/contracts/amps/AccessManagedProxyS32.sol/AccessManagedProxyS32.json +123 -0
  12. package/build/contracts/amps/AccessManagedProxyS33.sol/AccessManagedProxyS33.json +123 -0
  13. package/build/contracts/amps/AccessManagedProxyS34.sol/AccessManagedProxyS34.json +123 -0
  14. package/build/contracts/amps/AccessManagedProxyS35.sol/AccessManagedProxyS35.json +123 -0
  15. package/build/contracts/amps/AccessManagedProxyS36.sol/AccessManagedProxyS36.json +123 -0
  16. package/build/contracts/amps/AccessManagedProxyS37.sol/AccessManagedProxyS37.json +123 -0
  17. package/build/contracts/amps/AccessManagedProxyS38.sol/AccessManagedProxyS38.json +123 -0
  18. package/build/contracts/amps/AccessManagedProxyS39.sol/AccessManagedProxyS39.json +123 -0
  19. package/build/contracts/amps/AccessManagedProxyS40.sol/AccessManagedProxyS40.json +123 -0
  20. package/contracts/AMPUtils.sol +37 -0
  21. package/contracts/amps/AccessManagedProxyS25.sol +159 -0
  22. package/contracts/amps/AccessManagedProxyS26.sol +163 -0
  23. package/contracts/amps/AccessManagedProxyS27.sol +167 -0
  24. package/contracts/amps/AccessManagedProxyS28.sol +171 -0
  25. package/contracts/amps/AccessManagedProxyS29.sol +175 -0
  26. package/contracts/amps/AccessManagedProxyS30.sol +179 -0
  27. package/contracts/amps/AccessManagedProxyS31.sol +183 -0
  28. package/contracts/amps/AccessManagedProxyS32.sol +187 -0
  29. package/contracts/amps/AccessManagedProxyS33.sol +191 -0
  30. package/contracts/amps/AccessManagedProxyS34.sol +195 -0
  31. package/contracts/amps/AccessManagedProxyS35.sol +199 -0
  32. package/contracts/amps/AccessManagedProxyS36.sol +203 -0
  33. package/contracts/amps/AccessManagedProxyS37.sol +207 -0
  34. package/contracts/amps/AccessManagedProxyS38.sol +211 -0
  35. package/contracts/amps/AccessManagedProxyS39.sol +215 -0
  36. package/contracts/amps/AccessManagedProxyS40.sol +219 -0
  37. package/js/deployProxy.js +75 -0
  38. package/package.json +1 -1
@@ -0,0 +1,195 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.0;
3
+
4
+ import {AccessManagedProxy} from "../AccessManagedProxy.sol";
5
+ import {IAccessManager} from "@openzeppelin/contracts/access/manager/IAccessManager.sol";
6
+
7
+ /**
8
+ * @title AccessManagedProxyS34
9
+ * @notice Specialization of AccessManagedProxy with pass thru (skips AM) for some messages for gas optimization
10
+ *
11
+ * @custom:security-contact security@ensuro.co
12
+ * @author Ensuro
13
+ */
14
+ contract AccessManagedProxyS34 is AccessManagedProxy {
15
+ bytes4 internal immutable PASS_THRU_METHODS_0;
16
+ bytes4 internal immutable PASS_THRU_METHODS_1;
17
+ bytes4 internal immutable PASS_THRU_METHODS_2;
18
+ bytes4 internal immutable PASS_THRU_METHODS_3;
19
+ bytes4 internal immutable PASS_THRU_METHODS_4;
20
+ bytes4 internal immutable PASS_THRU_METHODS_5;
21
+ bytes4 internal immutable PASS_THRU_METHODS_6;
22
+ bytes4 internal immutable PASS_THRU_METHODS_7;
23
+ bytes4 internal immutable PASS_THRU_METHODS_8;
24
+ bytes4 internal immutable PASS_THRU_METHODS_9;
25
+ bytes4 internal immutable PASS_THRU_METHODS_10;
26
+ bytes4 internal immutable PASS_THRU_METHODS_11;
27
+ bytes4 internal immutable PASS_THRU_METHODS_12;
28
+ bytes4 internal immutable PASS_THRU_METHODS_13;
29
+ bytes4 internal immutable PASS_THRU_METHODS_14;
30
+ bytes4 internal immutable PASS_THRU_METHODS_15;
31
+ bytes4 internal immutable PASS_THRU_METHODS_16;
32
+ bytes4 internal immutable PASS_THRU_METHODS_17;
33
+ bytes4 internal immutable PASS_THRU_METHODS_18;
34
+ bytes4 internal immutable PASS_THRU_METHODS_19;
35
+ bytes4 internal immutable PASS_THRU_METHODS_20;
36
+ bytes4 internal immutable PASS_THRU_METHODS_21;
37
+ bytes4 internal immutable PASS_THRU_METHODS_22;
38
+ bytes4 internal immutable PASS_THRU_METHODS_23;
39
+ bytes4 internal immutable PASS_THRU_METHODS_24;
40
+ bytes4 internal immutable PASS_THRU_METHODS_25;
41
+ bytes4 internal immutable PASS_THRU_METHODS_26;
42
+ bytes4 internal immutable PASS_THRU_METHODS_27;
43
+ bytes4 internal immutable PASS_THRU_METHODS_28;
44
+ bytes4 internal immutable PASS_THRU_METHODS_29;
45
+ bytes4 internal immutable PASS_THRU_METHODS_30;
46
+ bytes4 internal immutable PASS_THRU_METHODS_31;
47
+ bytes4 internal immutable PASS_THRU_METHODS_32;
48
+ bytes4 internal immutable PASS_THRU_METHODS_33;
49
+
50
+ /**
51
+ * @notice Constructor of the proxy, defining the implementation and the access manager
52
+ * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation` and
53
+ * with `manager` as the ACCESS_MANAGER that will handle access control.
54
+ *
55
+ * @param implementation The initial implementation contract.
56
+ * @param _data If nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
57
+ * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
58
+ * @param manager The access manager that will handle access control
59
+ * @param passThruMethods The selector of methods that will skip the access control validation, typically used for
60
+ * views and other methods for gas optimization.
61
+ *
62
+ * Requirements:
63
+ *
64
+ * - If `data` is empty, `msg.value` must be zero.
65
+ */
66
+ constructor(
67
+ address implementation,
68
+ bytes memory _data,
69
+ IAccessManager manager,
70
+ bytes4[34] memory passThruMethods
71
+ ) payable AccessManagedProxy(implementation, _data, manager) {
72
+ PASS_THRU_METHODS_0 = passThruMethods[0];
73
+ PASS_THRU_METHODS_1 = passThruMethods[1];
74
+ PASS_THRU_METHODS_2 = passThruMethods[2];
75
+ PASS_THRU_METHODS_3 = passThruMethods[3];
76
+ PASS_THRU_METHODS_4 = passThruMethods[4];
77
+ PASS_THRU_METHODS_5 = passThruMethods[5];
78
+ PASS_THRU_METHODS_6 = passThruMethods[6];
79
+ PASS_THRU_METHODS_7 = passThruMethods[7];
80
+ PASS_THRU_METHODS_8 = passThruMethods[8];
81
+ PASS_THRU_METHODS_9 = passThruMethods[9];
82
+ PASS_THRU_METHODS_10 = passThruMethods[10];
83
+ PASS_THRU_METHODS_11 = passThruMethods[11];
84
+ PASS_THRU_METHODS_12 = passThruMethods[12];
85
+ PASS_THRU_METHODS_13 = passThruMethods[13];
86
+ PASS_THRU_METHODS_14 = passThruMethods[14];
87
+ PASS_THRU_METHODS_15 = passThruMethods[15];
88
+ PASS_THRU_METHODS_16 = passThruMethods[16];
89
+ PASS_THRU_METHODS_17 = passThruMethods[17];
90
+ PASS_THRU_METHODS_18 = passThruMethods[18];
91
+ PASS_THRU_METHODS_19 = passThruMethods[19];
92
+ PASS_THRU_METHODS_20 = passThruMethods[20];
93
+ PASS_THRU_METHODS_21 = passThruMethods[21];
94
+ PASS_THRU_METHODS_22 = passThruMethods[22];
95
+ PASS_THRU_METHODS_23 = passThruMethods[23];
96
+ PASS_THRU_METHODS_24 = passThruMethods[24];
97
+ PASS_THRU_METHODS_25 = passThruMethods[25];
98
+ PASS_THRU_METHODS_26 = passThruMethods[26];
99
+ PASS_THRU_METHODS_27 = passThruMethods[27];
100
+ PASS_THRU_METHODS_28 = passThruMethods[28];
101
+ PASS_THRU_METHODS_29 = passThruMethods[29];
102
+ PASS_THRU_METHODS_30 = passThruMethods[30];
103
+ PASS_THRU_METHODS_31 = passThruMethods[31];
104
+ PASS_THRU_METHODS_32 = passThruMethods[32];
105
+ PASS_THRU_METHODS_33 = passThruMethods[33];
106
+ }
107
+
108
+ /*
109
+ * @notice Skips the access control if the method called is one of the passThruMethods
110
+ * @dev See {PASS_THRU_METHODS()}
111
+ * @param selector The selector of the method called
112
+ * @return Whether the access control using ACCESS_MANAGER should be skipped or not
113
+ */
114
+ function _skipAC(bytes4 selector) internal view override returns (bool) {
115
+ return
116
+ selector == PASS_THRU_METHODS_0 ||
117
+ selector == PASS_THRU_METHODS_1 ||
118
+ selector == PASS_THRU_METHODS_2 ||
119
+ selector == PASS_THRU_METHODS_3 ||
120
+ selector == PASS_THRU_METHODS_4 ||
121
+ selector == PASS_THRU_METHODS_5 ||
122
+ selector == PASS_THRU_METHODS_6 ||
123
+ selector == PASS_THRU_METHODS_7 ||
124
+ selector == PASS_THRU_METHODS_8 ||
125
+ selector == PASS_THRU_METHODS_9 ||
126
+ selector == PASS_THRU_METHODS_10 ||
127
+ selector == PASS_THRU_METHODS_11 ||
128
+ selector == PASS_THRU_METHODS_12 ||
129
+ selector == PASS_THRU_METHODS_13 ||
130
+ selector == PASS_THRU_METHODS_14 ||
131
+ selector == PASS_THRU_METHODS_15 ||
132
+ selector == PASS_THRU_METHODS_16 ||
133
+ selector == PASS_THRU_METHODS_17 ||
134
+ selector == PASS_THRU_METHODS_18 ||
135
+ selector == PASS_THRU_METHODS_19 ||
136
+ selector == PASS_THRU_METHODS_20 ||
137
+ selector == PASS_THRU_METHODS_21 ||
138
+ selector == PASS_THRU_METHODS_22 ||
139
+ selector == PASS_THRU_METHODS_23 ||
140
+ selector == PASS_THRU_METHODS_24 ||
141
+ selector == PASS_THRU_METHODS_25 ||
142
+ selector == PASS_THRU_METHODS_26 ||
143
+ selector == PASS_THRU_METHODS_27 ||
144
+ selector == PASS_THRU_METHODS_28 ||
145
+ selector == PASS_THRU_METHODS_29 ||
146
+ selector == PASS_THRU_METHODS_30 ||
147
+ selector == PASS_THRU_METHODS_31 ||
148
+ selector == PASS_THRU_METHODS_32 ||
149
+ selector == PASS_THRU_METHODS_33;
150
+ }
151
+
152
+ /**
153
+ * @notice Gives observability to the methods that are skipped from access control
154
+ * @dev This list is fixed and defined on contract construction
155
+ * @return methods The list of method selectors that skip ACCESS_MANAGER access control
156
+ */
157
+ // solhint-disable-next-line func-name-mixedcase
158
+ function PASS_THRU_METHODS() external view returns (bytes4[] memory methods) {
159
+ methods = new bytes4[](34);
160
+ methods[0] = PASS_THRU_METHODS_0;
161
+ methods[1] = PASS_THRU_METHODS_1;
162
+ methods[2] = PASS_THRU_METHODS_2;
163
+ methods[3] = PASS_THRU_METHODS_3;
164
+ methods[4] = PASS_THRU_METHODS_4;
165
+ methods[5] = PASS_THRU_METHODS_5;
166
+ methods[6] = PASS_THRU_METHODS_6;
167
+ methods[7] = PASS_THRU_METHODS_7;
168
+ methods[8] = PASS_THRU_METHODS_8;
169
+ methods[9] = PASS_THRU_METHODS_9;
170
+ methods[10] = PASS_THRU_METHODS_10;
171
+ methods[11] = PASS_THRU_METHODS_11;
172
+ methods[12] = PASS_THRU_METHODS_12;
173
+ methods[13] = PASS_THRU_METHODS_13;
174
+ methods[14] = PASS_THRU_METHODS_14;
175
+ methods[15] = PASS_THRU_METHODS_15;
176
+ methods[16] = PASS_THRU_METHODS_16;
177
+ methods[17] = PASS_THRU_METHODS_17;
178
+ methods[18] = PASS_THRU_METHODS_18;
179
+ methods[19] = PASS_THRU_METHODS_19;
180
+ methods[20] = PASS_THRU_METHODS_20;
181
+ methods[21] = PASS_THRU_METHODS_21;
182
+ methods[22] = PASS_THRU_METHODS_22;
183
+ methods[23] = PASS_THRU_METHODS_23;
184
+ methods[24] = PASS_THRU_METHODS_24;
185
+ methods[25] = PASS_THRU_METHODS_25;
186
+ methods[26] = PASS_THRU_METHODS_26;
187
+ methods[27] = PASS_THRU_METHODS_27;
188
+ methods[28] = PASS_THRU_METHODS_28;
189
+ methods[29] = PASS_THRU_METHODS_29;
190
+ methods[30] = PASS_THRU_METHODS_30;
191
+ methods[31] = PASS_THRU_METHODS_31;
192
+ methods[32] = PASS_THRU_METHODS_32;
193
+ methods[33] = PASS_THRU_METHODS_33;
194
+ }
195
+ }
@@ -0,0 +1,199 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.0;
3
+
4
+ import {AccessManagedProxy} from "../AccessManagedProxy.sol";
5
+ import {IAccessManager} from "@openzeppelin/contracts/access/manager/IAccessManager.sol";
6
+
7
+ /**
8
+ * @title AccessManagedProxyS35
9
+ * @notice Specialization of AccessManagedProxy with pass thru (skips AM) for some messages for gas optimization
10
+ *
11
+ * @custom:security-contact security@ensuro.co
12
+ * @author Ensuro
13
+ */
14
+ contract AccessManagedProxyS35 is AccessManagedProxy {
15
+ bytes4 internal immutable PASS_THRU_METHODS_0;
16
+ bytes4 internal immutable PASS_THRU_METHODS_1;
17
+ bytes4 internal immutable PASS_THRU_METHODS_2;
18
+ bytes4 internal immutable PASS_THRU_METHODS_3;
19
+ bytes4 internal immutable PASS_THRU_METHODS_4;
20
+ bytes4 internal immutable PASS_THRU_METHODS_5;
21
+ bytes4 internal immutable PASS_THRU_METHODS_6;
22
+ bytes4 internal immutable PASS_THRU_METHODS_7;
23
+ bytes4 internal immutable PASS_THRU_METHODS_8;
24
+ bytes4 internal immutable PASS_THRU_METHODS_9;
25
+ bytes4 internal immutable PASS_THRU_METHODS_10;
26
+ bytes4 internal immutable PASS_THRU_METHODS_11;
27
+ bytes4 internal immutable PASS_THRU_METHODS_12;
28
+ bytes4 internal immutable PASS_THRU_METHODS_13;
29
+ bytes4 internal immutable PASS_THRU_METHODS_14;
30
+ bytes4 internal immutable PASS_THRU_METHODS_15;
31
+ bytes4 internal immutable PASS_THRU_METHODS_16;
32
+ bytes4 internal immutable PASS_THRU_METHODS_17;
33
+ bytes4 internal immutable PASS_THRU_METHODS_18;
34
+ bytes4 internal immutable PASS_THRU_METHODS_19;
35
+ bytes4 internal immutable PASS_THRU_METHODS_20;
36
+ bytes4 internal immutable PASS_THRU_METHODS_21;
37
+ bytes4 internal immutable PASS_THRU_METHODS_22;
38
+ bytes4 internal immutable PASS_THRU_METHODS_23;
39
+ bytes4 internal immutable PASS_THRU_METHODS_24;
40
+ bytes4 internal immutable PASS_THRU_METHODS_25;
41
+ bytes4 internal immutable PASS_THRU_METHODS_26;
42
+ bytes4 internal immutable PASS_THRU_METHODS_27;
43
+ bytes4 internal immutable PASS_THRU_METHODS_28;
44
+ bytes4 internal immutable PASS_THRU_METHODS_29;
45
+ bytes4 internal immutable PASS_THRU_METHODS_30;
46
+ bytes4 internal immutable PASS_THRU_METHODS_31;
47
+ bytes4 internal immutable PASS_THRU_METHODS_32;
48
+ bytes4 internal immutable PASS_THRU_METHODS_33;
49
+ bytes4 internal immutable PASS_THRU_METHODS_34;
50
+
51
+ /**
52
+ * @notice Constructor of the proxy, defining the implementation and the access manager
53
+ * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation` and
54
+ * with `manager` as the ACCESS_MANAGER that will handle access control.
55
+ *
56
+ * @param implementation The initial implementation contract.
57
+ * @param _data If nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
58
+ * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
59
+ * @param manager The access manager that will handle access control
60
+ * @param passThruMethods The selector of methods that will skip the access control validation, typically used for
61
+ * views and other methods for gas optimization.
62
+ *
63
+ * Requirements:
64
+ *
65
+ * - If `data` is empty, `msg.value` must be zero.
66
+ */
67
+ constructor(
68
+ address implementation,
69
+ bytes memory _data,
70
+ IAccessManager manager,
71
+ bytes4[35] memory passThruMethods
72
+ ) payable AccessManagedProxy(implementation, _data, manager) {
73
+ PASS_THRU_METHODS_0 = passThruMethods[0];
74
+ PASS_THRU_METHODS_1 = passThruMethods[1];
75
+ PASS_THRU_METHODS_2 = passThruMethods[2];
76
+ PASS_THRU_METHODS_3 = passThruMethods[3];
77
+ PASS_THRU_METHODS_4 = passThruMethods[4];
78
+ PASS_THRU_METHODS_5 = passThruMethods[5];
79
+ PASS_THRU_METHODS_6 = passThruMethods[6];
80
+ PASS_THRU_METHODS_7 = passThruMethods[7];
81
+ PASS_THRU_METHODS_8 = passThruMethods[8];
82
+ PASS_THRU_METHODS_9 = passThruMethods[9];
83
+ PASS_THRU_METHODS_10 = passThruMethods[10];
84
+ PASS_THRU_METHODS_11 = passThruMethods[11];
85
+ PASS_THRU_METHODS_12 = passThruMethods[12];
86
+ PASS_THRU_METHODS_13 = passThruMethods[13];
87
+ PASS_THRU_METHODS_14 = passThruMethods[14];
88
+ PASS_THRU_METHODS_15 = passThruMethods[15];
89
+ PASS_THRU_METHODS_16 = passThruMethods[16];
90
+ PASS_THRU_METHODS_17 = passThruMethods[17];
91
+ PASS_THRU_METHODS_18 = passThruMethods[18];
92
+ PASS_THRU_METHODS_19 = passThruMethods[19];
93
+ PASS_THRU_METHODS_20 = passThruMethods[20];
94
+ PASS_THRU_METHODS_21 = passThruMethods[21];
95
+ PASS_THRU_METHODS_22 = passThruMethods[22];
96
+ PASS_THRU_METHODS_23 = passThruMethods[23];
97
+ PASS_THRU_METHODS_24 = passThruMethods[24];
98
+ PASS_THRU_METHODS_25 = passThruMethods[25];
99
+ PASS_THRU_METHODS_26 = passThruMethods[26];
100
+ PASS_THRU_METHODS_27 = passThruMethods[27];
101
+ PASS_THRU_METHODS_28 = passThruMethods[28];
102
+ PASS_THRU_METHODS_29 = passThruMethods[29];
103
+ PASS_THRU_METHODS_30 = passThruMethods[30];
104
+ PASS_THRU_METHODS_31 = passThruMethods[31];
105
+ PASS_THRU_METHODS_32 = passThruMethods[32];
106
+ PASS_THRU_METHODS_33 = passThruMethods[33];
107
+ PASS_THRU_METHODS_34 = passThruMethods[34];
108
+ }
109
+
110
+ /*
111
+ * @notice Skips the access control if the method called is one of the passThruMethods
112
+ * @dev See {PASS_THRU_METHODS()}
113
+ * @param selector The selector of the method called
114
+ * @return Whether the access control using ACCESS_MANAGER should be skipped or not
115
+ */
116
+ function _skipAC(bytes4 selector) internal view override returns (bool) {
117
+ return
118
+ selector == PASS_THRU_METHODS_0 ||
119
+ selector == PASS_THRU_METHODS_1 ||
120
+ selector == PASS_THRU_METHODS_2 ||
121
+ selector == PASS_THRU_METHODS_3 ||
122
+ selector == PASS_THRU_METHODS_4 ||
123
+ selector == PASS_THRU_METHODS_5 ||
124
+ selector == PASS_THRU_METHODS_6 ||
125
+ selector == PASS_THRU_METHODS_7 ||
126
+ selector == PASS_THRU_METHODS_8 ||
127
+ selector == PASS_THRU_METHODS_9 ||
128
+ selector == PASS_THRU_METHODS_10 ||
129
+ selector == PASS_THRU_METHODS_11 ||
130
+ selector == PASS_THRU_METHODS_12 ||
131
+ selector == PASS_THRU_METHODS_13 ||
132
+ selector == PASS_THRU_METHODS_14 ||
133
+ selector == PASS_THRU_METHODS_15 ||
134
+ selector == PASS_THRU_METHODS_16 ||
135
+ selector == PASS_THRU_METHODS_17 ||
136
+ selector == PASS_THRU_METHODS_18 ||
137
+ selector == PASS_THRU_METHODS_19 ||
138
+ selector == PASS_THRU_METHODS_20 ||
139
+ selector == PASS_THRU_METHODS_21 ||
140
+ selector == PASS_THRU_METHODS_22 ||
141
+ selector == PASS_THRU_METHODS_23 ||
142
+ selector == PASS_THRU_METHODS_24 ||
143
+ selector == PASS_THRU_METHODS_25 ||
144
+ selector == PASS_THRU_METHODS_26 ||
145
+ selector == PASS_THRU_METHODS_27 ||
146
+ selector == PASS_THRU_METHODS_28 ||
147
+ selector == PASS_THRU_METHODS_29 ||
148
+ selector == PASS_THRU_METHODS_30 ||
149
+ selector == PASS_THRU_METHODS_31 ||
150
+ selector == PASS_THRU_METHODS_32 ||
151
+ selector == PASS_THRU_METHODS_33 ||
152
+ selector == PASS_THRU_METHODS_34;
153
+ }
154
+
155
+ /**
156
+ * @notice Gives observability to the methods that are skipped from access control
157
+ * @dev This list is fixed and defined on contract construction
158
+ * @return methods The list of method selectors that skip ACCESS_MANAGER access control
159
+ */
160
+ // solhint-disable-next-line func-name-mixedcase
161
+ function PASS_THRU_METHODS() external view returns (bytes4[] memory methods) {
162
+ methods = new bytes4[](35);
163
+ methods[0] = PASS_THRU_METHODS_0;
164
+ methods[1] = PASS_THRU_METHODS_1;
165
+ methods[2] = PASS_THRU_METHODS_2;
166
+ methods[3] = PASS_THRU_METHODS_3;
167
+ methods[4] = PASS_THRU_METHODS_4;
168
+ methods[5] = PASS_THRU_METHODS_5;
169
+ methods[6] = PASS_THRU_METHODS_6;
170
+ methods[7] = PASS_THRU_METHODS_7;
171
+ methods[8] = PASS_THRU_METHODS_8;
172
+ methods[9] = PASS_THRU_METHODS_9;
173
+ methods[10] = PASS_THRU_METHODS_10;
174
+ methods[11] = PASS_THRU_METHODS_11;
175
+ methods[12] = PASS_THRU_METHODS_12;
176
+ methods[13] = PASS_THRU_METHODS_13;
177
+ methods[14] = PASS_THRU_METHODS_14;
178
+ methods[15] = PASS_THRU_METHODS_15;
179
+ methods[16] = PASS_THRU_METHODS_16;
180
+ methods[17] = PASS_THRU_METHODS_17;
181
+ methods[18] = PASS_THRU_METHODS_18;
182
+ methods[19] = PASS_THRU_METHODS_19;
183
+ methods[20] = PASS_THRU_METHODS_20;
184
+ methods[21] = PASS_THRU_METHODS_21;
185
+ methods[22] = PASS_THRU_METHODS_22;
186
+ methods[23] = PASS_THRU_METHODS_23;
187
+ methods[24] = PASS_THRU_METHODS_24;
188
+ methods[25] = PASS_THRU_METHODS_25;
189
+ methods[26] = PASS_THRU_METHODS_26;
190
+ methods[27] = PASS_THRU_METHODS_27;
191
+ methods[28] = PASS_THRU_METHODS_28;
192
+ methods[29] = PASS_THRU_METHODS_29;
193
+ methods[30] = PASS_THRU_METHODS_30;
194
+ methods[31] = PASS_THRU_METHODS_31;
195
+ methods[32] = PASS_THRU_METHODS_32;
196
+ methods[33] = PASS_THRU_METHODS_33;
197
+ methods[34] = PASS_THRU_METHODS_34;
198
+ }
199
+ }
@@ -0,0 +1,203 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.0;
3
+
4
+ import {AccessManagedProxy} from "../AccessManagedProxy.sol";
5
+ import {IAccessManager} from "@openzeppelin/contracts/access/manager/IAccessManager.sol";
6
+
7
+ /**
8
+ * @title AccessManagedProxyS36
9
+ * @notice Specialization of AccessManagedProxy with pass thru (skips AM) for some messages for gas optimization
10
+ *
11
+ * @custom:security-contact security@ensuro.co
12
+ * @author Ensuro
13
+ */
14
+ contract AccessManagedProxyS36 is AccessManagedProxy {
15
+ bytes4 internal immutable PASS_THRU_METHODS_0;
16
+ bytes4 internal immutable PASS_THRU_METHODS_1;
17
+ bytes4 internal immutable PASS_THRU_METHODS_2;
18
+ bytes4 internal immutable PASS_THRU_METHODS_3;
19
+ bytes4 internal immutable PASS_THRU_METHODS_4;
20
+ bytes4 internal immutable PASS_THRU_METHODS_5;
21
+ bytes4 internal immutable PASS_THRU_METHODS_6;
22
+ bytes4 internal immutable PASS_THRU_METHODS_7;
23
+ bytes4 internal immutable PASS_THRU_METHODS_8;
24
+ bytes4 internal immutable PASS_THRU_METHODS_9;
25
+ bytes4 internal immutable PASS_THRU_METHODS_10;
26
+ bytes4 internal immutable PASS_THRU_METHODS_11;
27
+ bytes4 internal immutable PASS_THRU_METHODS_12;
28
+ bytes4 internal immutable PASS_THRU_METHODS_13;
29
+ bytes4 internal immutable PASS_THRU_METHODS_14;
30
+ bytes4 internal immutable PASS_THRU_METHODS_15;
31
+ bytes4 internal immutable PASS_THRU_METHODS_16;
32
+ bytes4 internal immutable PASS_THRU_METHODS_17;
33
+ bytes4 internal immutable PASS_THRU_METHODS_18;
34
+ bytes4 internal immutable PASS_THRU_METHODS_19;
35
+ bytes4 internal immutable PASS_THRU_METHODS_20;
36
+ bytes4 internal immutable PASS_THRU_METHODS_21;
37
+ bytes4 internal immutable PASS_THRU_METHODS_22;
38
+ bytes4 internal immutable PASS_THRU_METHODS_23;
39
+ bytes4 internal immutable PASS_THRU_METHODS_24;
40
+ bytes4 internal immutable PASS_THRU_METHODS_25;
41
+ bytes4 internal immutable PASS_THRU_METHODS_26;
42
+ bytes4 internal immutable PASS_THRU_METHODS_27;
43
+ bytes4 internal immutable PASS_THRU_METHODS_28;
44
+ bytes4 internal immutable PASS_THRU_METHODS_29;
45
+ bytes4 internal immutable PASS_THRU_METHODS_30;
46
+ bytes4 internal immutable PASS_THRU_METHODS_31;
47
+ bytes4 internal immutable PASS_THRU_METHODS_32;
48
+ bytes4 internal immutable PASS_THRU_METHODS_33;
49
+ bytes4 internal immutable PASS_THRU_METHODS_34;
50
+ bytes4 internal immutable PASS_THRU_METHODS_35;
51
+
52
+ /**
53
+ * @notice Constructor of the proxy, defining the implementation and the access manager
54
+ * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation` and
55
+ * with `manager` as the ACCESS_MANAGER that will handle access control.
56
+ *
57
+ * @param implementation The initial implementation contract.
58
+ * @param _data If nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
59
+ * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
60
+ * @param manager The access manager that will handle access control
61
+ * @param passThruMethods The selector of methods that will skip the access control validation, typically used for
62
+ * views and other methods for gas optimization.
63
+ *
64
+ * Requirements:
65
+ *
66
+ * - If `data` is empty, `msg.value` must be zero.
67
+ */
68
+ constructor(
69
+ address implementation,
70
+ bytes memory _data,
71
+ IAccessManager manager,
72
+ bytes4[36] memory passThruMethods
73
+ ) payable AccessManagedProxy(implementation, _data, manager) {
74
+ PASS_THRU_METHODS_0 = passThruMethods[0];
75
+ PASS_THRU_METHODS_1 = passThruMethods[1];
76
+ PASS_THRU_METHODS_2 = passThruMethods[2];
77
+ PASS_THRU_METHODS_3 = passThruMethods[3];
78
+ PASS_THRU_METHODS_4 = passThruMethods[4];
79
+ PASS_THRU_METHODS_5 = passThruMethods[5];
80
+ PASS_THRU_METHODS_6 = passThruMethods[6];
81
+ PASS_THRU_METHODS_7 = passThruMethods[7];
82
+ PASS_THRU_METHODS_8 = passThruMethods[8];
83
+ PASS_THRU_METHODS_9 = passThruMethods[9];
84
+ PASS_THRU_METHODS_10 = passThruMethods[10];
85
+ PASS_THRU_METHODS_11 = passThruMethods[11];
86
+ PASS_THRU_METHODS_12 = passThruMethods[12];
87
+ PASS_THRU_METHODS_13 = passThruMethods[13];
88
+ PASS_THRU_METHODS_14 = passThruMethods[14];
89
+ PASS_THRU_METHODS_15 = passThruMethods[15];
90
+ PASS_THRU_METHODS_16 = passThruMethods[16];
91
+ PASS_THRU_METHODS_17 = passThruMethods[17];
92
+ PASS_THRU_METHODS_18 = passThruMethods[18];
93
+ PASS_THRU_METHODS_19 = passThruMethods[19];
94
+ PASS_THRU_METHODS_20 = passThruMethods[20];
95
+ PASS_THRU_METHODS_21 = passThruMethods[21];
96
+ PASS_THRU_METHODS_22 = passThruMethods[22];
97
+ PASS_THRU_METHODS_23 = passThruMethods[23];
98
+ PASS_THRU_METHODS_24 = passThruMethods[24];
99
+ PASS_THRU_METHODS_25 = passThruMethods[25];
100
+ PASS_THRU_METHODS_26 = passThruMethods[26];
101
+ PASS_THRU_METHODS_27 = passThruMethods[27];
102
+ PASS_THRU_METHODS_28 = passThruMethods[28];
103
+ PASS_THRU_METHODS_29 = passThruMethods[29];
104
+ PASS_THRU_METHODS_30 = passThruMethods[30];
105
+ PASS_THRU_METHODS_31 = passThruMethods[31];
106
+ PASS_THRU_METHODS_32 = passThruMethods[32];
107
+ PASS_THRU_METHODS_33 = passThruMethods[33];
108
+ PASS_THRU_METHODS_34 = passThruMethods[34];
109
+ PASS_THRU_METHODS_35 = passThruMethods[35];
110
+ }
111
+
112
+ /*
113
+ * @notice Skips the access control if the method called is one of the passThruMethods
114
+ * @dev See {PASS_THRU_METHODS()}
115
+ * @param selector The selector of the method called
116
+ * @return Whether the access control using ACCESS_MANAGER should be skipped or not
117
+ */
118
+ function _skipAC(bytes4 selector) internal view override returns (bool) {
119
+ return
120
+ selector == PASS_THRU_METHODS_0 ||
121
+ selector == PASS_THRU_METHODS_1 ||
122
+ selector == PASS_THRU_METHODS_2 ||
123
+ selector == PASS_THRU_METHODS_3 ||
124
+ selector == PASS_THRU_METHODS_4 ||
125
+ selector == PASS_THRU_METHODS_5 ||
126
+ selector == PASS_THRU_METHODS_6 ||
127
+ selector == PASS_THRU_METHODS_7 ||
128
+ selector == PASS_THRU_METHODS_8 ||
129
+ selector == PASS_THRU_METHODS_9 ||
130
+ selector == PASS_THRU_METHODS_10 ||
131
+ selector == PASS_THRU_METHODS_11 ||
132
+ selector == PASS_THRU_METHODS_12 ||
133
+ selector == PASS_THRU_METHODS_13 ||
134
+ selector == PASS_THRU_METHODS_14 ||
135
+ selector == PASS_THRU_METHODS_15 ||
136
+ selector == PASS_THRU_METHODS_16 ||
137
+ selector == PASS_THRU_METHODS_17 ||
138
+ selector == PASS_THRU_METHODS_18 ||
139
+ selector == PASS_THRU_METHODS_19 ||
140
+ selector == PASS_THRU_METHODS_20 ||
141
+ selector == PASS_THRU_METHODS_21 ||
142
+ selector == PASS_THRU_METHODS_22 ||
143
+ selector == PASS_THRU_METHODS_23 ||
144
+ selector == PASS_THRU_METHODS_24 ||
145
+ selector == PASS_THRU_METHODS_25 ||
146
+ selector == PASS_THRU_METHODS_26 ||
147
+ selector == PASS_THRU_METHODS_27 ||
148
+ selector == PASS_THRU_METHODS_28 ||
149
+ selector == PASS_THRU_METHODS_29 ||
150
+ selector == PASS_THRU_METHODS_30 ||
151
+ selector == PASS_THRU_METHODS_31 ||
152
+ selector == PASS_THRU_METHODS_32 ||
153
+ selector == PASS_THRU_METHODS_33 ||
154
+ selector == PASS_THRU_METHODS_34 ||
155
+ selector == PASS_THRU_METHODS_35;
156
+ }
157
+
158
+ /**
159
+ * @notice Gives observability to the methods that are skipped from access control
160
+ * @dev This list is fixed and defined on contract construction
161
+ * @return methods The list of method selectors that skip ACCESS_MANAGER access control
162
+ */
163
+ // solhint-disable-next-line func-name-mixedcase
164
+ function PASS_THRU_METHODS() external view returns (bytes4[] memory methods) {
165
+ methods = new bytes4[](36);
166
+ methods[0] = PASS_THRU_METHODS_0;
167
+ methods[1] = PASS_THRU_METHODS_1;
168
+ methods[2] = PASS_THRU_METHODS_2;
169
+ methods[3] = PASS_THRU_METHODS_3;
170
+ methods[4] = PASS_THRU_METHODS_4;
171
+ methods[5] = PASS_THRU_METHODS_5;
172
+ methods[6] = PASS_THRU_METHODS_6;
173
+ methods[7] = PASS_THRU_METHODS_7;
174
+ methods[8] = PASS_THRU_METHODS_8;
175
+ methods[9] = PASS_THRU_METHODS_9;
176
+ methods[10] = PASS_THRU_METHODS_10;
177
+ methods[11] = PASS_THRU_METHODS_11;
178
+ methods[12] = PASS_THRU_METHODS_12;
179
+ methods[13] = PASS_THRU_METHODS_13;
180
+ methods[14] = PASS_THRU_METHODS_14;
181
+ methods[15] = PASS_THRU_METHODS_15;
182
+ methods[16] = PASS_THRU_METHODS_16;
183
+ methods[17] = PASS_THRU_METHODS_17;
184
+ methods[18] = PASS_THRU_METHODS_18;
185
+ methods[19] = PASS_THRU_METHODS_19;
186
+ methods[20] = PASS_THRU_METHODS_20;
187
+ methods[21] = PASS_THRU_METHODS_21;
188
+ methods[22] = PASS_THRU_METHODS_22;
189
+ methods[23] = PASS_THRU_METHODS_23;
190
+ methods[24] = PASS_THRU_METHODS_24;
191
+ methods[25] = PASS_THRU_METHODS_25;
192
+ methods[26] = PASS_THRU_METHODS_26;
193
+ methods[27] = PASS_THRU_METHODS_27;
194
+ methods[28] = PASS_THRU_METHODS_28;
195
+ methods[29] = PASS_THRU_METHODS_29;
196
+ methods[30] = PASS_THRU_METHODS_30;
197
+ methods[31] = PASS_THRU_METHODS_31;
198
+ methods[32] = PASS_THRU_METHODS_32;
199
+ methods[33] = PASS_THRU_METHODS_33;
200
+ methods[34] = PASS_THRU_METHODS_34;
201
+ methods[35] = PASS_THRU_METHODS_35;
202
+ }
203
+ }