@ensuro/access-managed-proxy 0.2.0 → 0.3.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 (96) hide show
  1. package/README.md +12 -5
  2. package/build/build-info.json +1 -1
  3. package/build/contracts/AMPUtils.sol/AMPUtils.json +2 -2
  4. package/build/contracts/AccessManagedProxy.sol/AccessManagedProxy.json +71 -3
  5. package/build/contracts/AccessManagedProxyBase.sol/AccessManagedProxyBase.json +147 -0
  6. package/build/contracts/interfaces/IAccessManagedProxy.sol/IAccessManagedProxy.json +98 -0
  7. package/build/contracts/mock/DummyAccessManaged.sol/DummyAccessManaged.json +321 -0
  8. package/build/contracts/mock/DummyImplementation.sol/DummyImplementation.json +95 -2
  9. package/contracts/AMPUtils.sol +54 -3
  10. package/contracts/AccessManagedProxy.sol +39 -51
  11. package/contracts/AccessManagedProxyBase.sol +74 -0
  12. package/contracts/interfaces/IAccessManagedProxy.sol +51 -0
  13. package/contracts/mock/DummyAccessManaged.sol +56 -0
  14. package/contracts/mock/DummyImplementation.sol +19 -2
  15. package/js/deployProxy.js +5 -11
  16. package/package.json +1 -1
  17. package/build/contracts/amps/AccessManagedProxyS1.sol/AccessManagedProxyS1.json +0 -123
  18. package/build/contracts/amps/AccessManagedProxyS10.sol/AccessManagedProxyS10.json +0 -123
  19. package/build/contracts/amps/AccessManagedProxyS11.sol/AccessManagedProxyS11.json +0 -123
  20. package/build/contracts/amps/AccessManagedProxyS12.sol/AccessManagedProxyS12.json +0 -123
  21. package/build/contracts/amps/AccessManagedProxyS13.sol/AccessManagedProxyS13.json +0 -123
  22. package/build/contracts/amps/AccessManagedProxyS14.sol/AccessManagedProxyS14.json +0 -123
  23. package/build/contracts/amps/AccessManagedProxyS15.sol/AccessManagedProxyS15.json +0 -123
  24. package/build/contracts/amps/AccessManagedProxyS16.sol/AccessManagedProxyS16.json +0 -123
  25. package/build/contracts/amps/AccessManagedProxyS17.sol/AccessManagedProxyS17.json +0 -123
  26. package/build/contracts/amps/AccessManagedProxyS18.sol/AccessManagedProxyS18.json +0 -123
  27. package/build/contracts/amps/AccessManagedProxyS19.sol/AccessManagedProxyS19.json +0 -123
  28. package/build/contracts/amps/AccessManagedProxyS2.sol/AccessManagedProxyS2.json +0 -123
  29. package/build/contracts/amps/AccessManagedProxyS20.sol/AccessManagedProxyS20.json +0 -123
  30. package/build/contracts/amps/AccessManagedProxyS21.sol/AccessManagedProxyS21.json +0 -123
  31. package/build/contracts/amps/AccessManagedProxyS22.sol/AccessManagedProxyS22.json +0 -123
  32. package/build/contracts/amps/AccessManagedProxyS23.sol/AccessManagedProxyS23.json +0 -123
  33. package/build/contracts/amps/AccessManagedProxyS24.sol/AccessManagedProxyS24.json +0 -123
  34. package/build/contracts/amps/AccessManagedProxyS25.sol/AccessManagedProxyS25.json +0 -123
  35. package/build/contracts/amps/AccessManagedProxyS26.sol/AccessManagedProxyS26.json +0 -123
  36. package/build/contracts/amps/AccessManagedProxyS27.sol/AccessManagedProxyS27.json +0 -123
  37. package/build/contracts/amps/AccessManagedProxyS28.sol/AccessManagedProxyS28.json +0 -123
  38. package/build/contracts/amps/AccessManagedProxyS29.sol/AccessManagedProxyS29.json +0 -123
  39. package/build/contracts/amps/AccessManagedProxyS3.sol/AccessManagedProxyS3.json +0 -123
  40. package/build/contracts/amps/AccessManagedProxyS30.sol/AccessManagedProxyS30.json +0 -123
  41. package/build/contracts/amps/AccessManagedProxyS31.sol/AccessManagedProxyS31.json +0 -123
  42. package/build/contracts/amps/AccessManagedProxyS32.sol/AccessManagedProxyS32.json +0 -123
  43. package/build/contracts/amps/AccessManagedProxyS33.sol/AccessManagedProxyS33.json +0 -123
  44. package/build/contracts/amps/AccessManagedProxyS34.sol/AccessManagedProxyS34.json +0 -123
  45. package/build/contracts/amps/AccessManagedProxyS35.sol/AccessManagedProxyS35.json +0 -123
  46. package/build/contracts/amps/AccessManagedProxyS36.sol/AccessManagedProxyS36.json +0 -123
  47. package/build/contracts/amps/AccessManagedProxyS37.sol/AccessManagedProxyS37.json +0 -123
  48. package/build/contracts/amps/AccessManagedProxyS38.sol/AccessManagedProxyS38.json +0 -123
  49. package/build/contracts/amps/AccessManagedProxyS39.sol/AccessManagedProxyS39.json +0 -123
  50. package/build/contracts/amps/AccessManagedProxyS4.sol/AccessManagedProxyS4.json +0 -123
  51. package/build/contracts/amps/AccessManagedProxyS40.sol/AccessManagedProxyS40.json +0 -123
  52. package/build/contracts/amps/AccessManagedProxyS5.sol/AccessManagedProxyS5.json +0 -123
  53. package/build/contracts/amps/AccessManagedProxyS6.sol/AccessManagedProxyS6.json +0 -123
  54. package/build/contracts/amps/AccessManagedProxyS7.sol/AccessManagedProxyS7.json +0 -123
  55. package/build/contracts/amps/AccessManagedProxyS8.sol/AccessManagedProxyS8.json +0 -123
  56. package/build/contracts/amps/AccessManagedProxyS9.sol/AccessManagedProxyS9.json +0 -123
  57. package/contracts/amps/AccessManagedProxyS1.sol +0 -63
  58. package/contracts/amps/AccessManagedProxyS10.sol +0 -99
  59. package/contracts/amps/AccessManagedProxyS11.sol +0 -103
  60. package/contracts/amps/AccessManagedProxyS12.sol +0 -107
  61. package/contracts/amps/AccessManagedProxyS13.sol +0 -111
  62. package/contracts/amps/AccessManagedProxyS14.sol +0 -115
  63. package/contracts/amps/AccessManagedProxyS15.sol +0 -119
  64. package/contracts/amps/AccessManagedProxyS16.sol +0 -123
  65. package/contracts/amps/AccessManagedProxyS17.sol +0 -127
  66. package/contracts/amps/AccessManagedProxyS18.sol +0 -131
  67. package/contracts/amps/AccessManagedProxyS19.sol +0 -135
  68. package/contracts/amps/AccessManagedProxyS2.sol +0 -67
  69. package/contracts/amps/AccessManagedProxyS20.sol +0 -139
  70. package/contracts/amps/AccessManagedProxyS21.sol +0 -143
  71. package/contracts/amps/AccessManagedProxyS22.sol +0 -147
  72. package/contracts/amps/AccessManagedProxyS23.sol +0 -151
  73. package/contracts/amps/AccessManagedProxyS24.sol +0 -155
  74. package/contracts/amps/AccessManagedProxyS25.sol +0 -159
  75. package/contracts/amps/AccessManagedProxyS26.sol +0 -163
  76. package/contracts/amps/AccessManagedProxyS27.sol +0 -167
  77. package/contracts/amps/AccessManagedProxyS28.sol +0 -171
  78. package/contracts/amps/AccessManagedProxyS29.sol +0 -175
  79. package/contracts/amps/AccessManagedProxyS3.sol +0 -71
  80. package/contracts/amps/AccessManagedProxyS30.sol +0 -179
  81. package/contracts/amps/AccessManagedProxyS31.sol +0 -183
  82. package/contracts/amps/AccessManagedProxyS32.sol +0 -187
  83. package/contracts/amps/AccessManagedProxyS33.sol +0 -191
  84. package/contracts/amps/AccessManagedProxyS34.sol +0 -195
  85. package/contracts/amps/AccessManagedProxyS35.sol +0 -199
  86. package/contracts/amps/AccessManagedProxyS36.sol +0 -203
  87. package/contracts/amps/AccessManagedProxyS37.sol +0 -207
  88. package/contracts/amps/AccessManagedProxyS38.sol +0 -211
  89. package/contracts/amps/AccessManagedProxyS39.sol +0 -215
  90. package/contracts/amps/AccessManagedProxyS4.sol +0 -75
  91. package/contracts/amps/AccessManagedProxyS40.sol +0 -219
  92. package/contracts/amps/AccessManagedProxyS5.sol +0 -79
  93. package/contracts/amps/AccessManagedProxyS6.sol +0 -83
  94. package/contracts/amps/AccessManagedProxyS7.sol +0 -87
  95. package/contracts/amps/AccessManagedProxyS8.sol +0 -91
  96. package/contracts/amps/AccessManagedProxyS9.sol +0 -95
@@ -1,159 +0,0 @@
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 AccessManagedProxyS25
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 AccessManagedProxyS25 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
-
41
- /**
42
- * @notice Constructor of the proxy, defining the implementation and the access manager
43
- * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation` and
44
- * with `manager` as the ACCESS_MANAGER that will handle access control.
45
- *
46
- * @param implementation The initial implementation contract.
47
- * @param _data If nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
48
- * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
49
- * @param manager The access manager that will handle access control
50
- * @param passThruMethods The selector of methods that will skip the access control validation, typically used for
51
- * views and other methods for gas optimization.
52
- *
53
- * Requirements:
54
- *
55
- * - If `data` is empty, `msg.value` must be zero.
56
- */
57
- constructor(
58
- address implementation,
59
- bytes memory _data,
60
- IAccessManager manager,
61
- bytes4[25] memory passThruMethods
62
- ) payable AccessManagedProxy(implementation, _data, manager) {
63
- PASS_THRU_METHODS_0 = passThruMethods[0];
64
- PASS_THRU_METHODS_1 = passThruMethods[1];
65
- PASS_THRU_METHODS_2 = passThruMethods[2];
66
- PASS_THRU_METHODS_3 = passThruMethods[3];
67
- PASS_THRU_METHODS_4 = passThruMethods[4];
68
- PASS_THRU_METHODS_5 = passThruMethods[5];
69
- PASS_THRU_METHODS_6 = passThruMethods[6];
70
- PASS_THRU_METHODS_7 = passThruMethods[7];
71
- PASS_THRU_METHODS_8 = passThruMethods[8];
72
- PASS_THRU_METHODS_9 = passThruMethods[9];
73
- PASS_THRU_METHODS_10 = passThruMethods[10];
74
- PASS_THRU_METHODS_11 = passThruMethods[11];
75
- PASS_THRU_METHODS_12 = passThruMethods[12];
76
- PASS_THRU_METHODS_13 = passThruMethods[13];
77
- PASS_THRU_METHODS_14 = passThruMethods[14];
78
- PASS_THRU_METHODS_15 = passThruMethods[15];
79
- PASS_THRU_METHODS_16 = passThruMethods[16];
80
- PASS_THRU_METHODS_17 = passThruMethods[17];
81
- PASS_THRU_METHODS_18 = passThruMethods[18];
82
- PASS_THRU_METHODS_19 = passThruMethods[19];
83
- PASS_THRU_METHODS_20 = passThruMethods[20];
84
- PASS_THRU_METHODS_21 = passThruMethods[21];
85
- PASS_THRU_METHODS_22 = passThruMethods[22];
86
- PASS_THRU_METHODS_23 = passThruMethods[23];
87
- PASS_THRU_METHODS_24 = passThruMethods[24];
88
- }
89
-
90
- /*
91
- * @notice Skips the access control if the method called is one of the passThruMethods
92
- * @dev See {PASS_THRU_METHODS()}
93
- * @param selector The selector of the method called
94
- * @return Whether the access control using ACCESS_MANAGER should be skipped or not
95
- */
96
- function _skipAC(bytes4 selector) internal view override returns (bool) {
97
- return
98
- selector == PASS_THRU_METHODS_0 ||
99
- selector == PASS_THRU_METHODS_1 ||
100
- selector == PASS_THRU_METHODS_2 ||
101
- selector == PASS_THRU_METHODS_3 ||
102
- selector == PASS_THRU_METHODS_4 ||
103
- selector == PASS_THRU_METHODS_5 ||
104
- selector == PASS_THRU_METHODS_6 ||
105
- selector == PASS_THRU_METHODS_7 ||
106
- selector == PASS_THRU_METHODS_8 ||
107
- selector == PASS_THRU_METHODS_9 ||
108
- selector == PASS_THRU_METHODS_10 ||
109
- selector == PASS_THRU_METHODS_11 ||
110
- selector == PASS_THRU_METHODS_12 ||
111
- selector == PASS_THRU_METHODS_13 ||
112
- selector == PASS_THRU_METHODS_14 ||
113
- selector == PASS_THRU_METHODS_15 ||
114
- selector == PASS_THRU_METHODS_16 ||
115
- selector == PASS_THRU_METHODS_17 ||
116
- selector == PASS_THRU_METHODS_18 ||
117
- selector == PASS_THRU_METHODS_19 ||
118
- selector == PASS_THRU_METHODS_20 ||
119
- selector == PASS_THRU_METHODS_21 ||
120
- selector == PASS_THRU_METHODS_22 ||
121
- selector == PASS_THRU_METHODS_23 ||
122
- selector == PASS_THRU_METHODS_24;
123
- }
124
-
125
- /**
126
- * @notice Gives observability to the methods that are skipped from access control
127
- * @dev This list is fixed and defined on contract construction
128
- * @return methods The list of method selectors that skip ACCESS_MANAGER access control
129
- */
130
- // solhint-disable-next-line func-name-mixedcase
131
- function PASS_THRU_METHODS() external view returns (bytes4[] memory methods) {
132
- methods = new bytes4[](25);
133
- methods[0] = PASS_THRU_METHODS_0;
134
- methods[1] = PASS_THRU_METHODS_1;
135
- methods[2] = PASS_THRU_METHODS_2;
136
- methods[3] = PASS_THRU_METHODS_3;
137
- methods[4] = PASS_THRU_METHODS_4;
138
- methods[5] = PASS_THRU_METHODS_5;
139
- methods[6] = PASS_THRU_METHODS_6;
140
- methods[7] = PASS_THRU_METHODS_7;
141
- methods[8] = PASS_THRU_METHODS_8;
142
- methods[9] = PASS_THRU_METHODS_9;
143
- methods[10] = PASS_THRU_METHODS_10;
144
- methods[11] = PASS_THRU_METHODS_11;
145
- methods[12] = PASS_THRU_METHODS_12;
146
- methods[13] = PASS_THRU_METHODS_13;
147
- methods[14] = PASS_THRU_METHODS_14;
148
- methods[15] = PASS_THRU_METHODS_15;
149
- methods[16] = PASS_THRU_METHODS_16;
150
- methods[17] = PASS_THRU_METHODS_17;
151
- methods[18] = PASS_THRU_METHODS_18;
152
- methods[19] = PASS_THRU_METHODS_19;
153
- methods[20] = PASS_THRU_METHODS_20;
154
- methods[21] = PASS_THRU_METHODS_21;
155
- methods[22] = PASS_THRU_METHODS_22;
156
- methods[23] = PASS_THRU_METHODS_23;
157
- methods[24] = PASS_THRU_METHODS_24;
158
- }
159
- }
@@ -1,163 +0,0 @@
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 AccessManagedProxyS26
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 AccessManagedProxyS26 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
-
42
- /**
43
- * @notice Constructor of the proxy, defining the implementation and the access manager
44
- * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation` and
45
- * with `manager` as the ACCESS_MANAGER that will handle access control.
46
- *
47
- * @param implementation The initial implementation contract.
48
- * @param _data If nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
49
- * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
50
- * @param manager The access manager that will handle access control
51
- * @param passThruMethods The selector of methods that will skip the access control validation, typically used for
52
- * views and other methods for gas optimization.
53
- *
54
- * Requirements:
55
- *
56
- * - If `data` is empty, `msg.value` must be zero.
57
- */
58
- constructor(
59
- address implementation,
60
- bytes memory _data,
61
- IAccessManager manager,
62
- bytes4[26] memory passThruMethods
63
- ) payable AccessManagedProxy(implementation, _data, manager) {
64
- PASS_THRU_METHODS_0 = passThruMethods[0];
65
- PASS_THRU_METHODS_1 = passThruMethods[1];
66
- PASS_THRU_METHODS_2 = passThruMethods[2];
67
- PASS_THRU_METHODS_3 = passThruMethods[3];
68
- PASS_THRU_METHODS_4 = passThruMethods[4];
69
- PASS_THRU_METHODS_5 = passThruMethods[5];
70
- PASS_THRU_METHODS_6 = passThruMethods[6];
71
- PASS_THRU_METHODS_7 = passThruMethods[7];
72
- PASS_THRU_METHODS_8 = passThruMethods[8];
73
- PASS_THRU_METHODS_9 = passThruMethods[9];
74
- PASS_THRU_METHODS_10 = passThruMethods[10];
75
- PASS_THRU_METHODS_11 = passThruMethods[11];
76
- PASS_THRU_METHODS_12 = passThruMethods[12];
77
- PASS_THRU_METHODS_13 = passThruMethods[13];
78
- PASS_THRU_METHODS_14 = passThruMethods[14];
79
- PASS_THRU_METHODS_15 = passThruMethods[15];
80
- PASS_THRU_METHODS_16 = passThruMethods[16];
81
- PASS_THRU_METHODS_17 = passThruMethods[17];
82
- PASS_THRU_METHODS_18 = passThruMethods[18];
83
- PASS_THRU_METHODS_19 = passThruMethods[19];
84
- PASS_THRU_METHODS_20 = passThruMethods[20];
85
- PASS_THRU_METHODS_21 = passThruMethods[21];
86
- PASS_THRU_METHODS_22 = passThruMethods[22];
87
- PASS_THRU_METHODS_23 = passThruMethods[23];
88
- PASS_THRU_METHODS_24 = passThruMethods[24];
89
- PASS_THRU_METHODS_25 = passThruMethods[25];
90
- }
91
-
92
- /*
93
- * @notice Skips the access control if the method called is one of the passThruMethods
94
- * @dev See {PASS_THRU_METHODS()}
95
- * @param selector The selector of the method called
96
- * @return Whether the access control using ACCESS_MANAGER should be skipped or not
97
- */
98
- function _skipAC(bytes4 selector) internal view override returns (bool) {
99
- return
100
- selector == PASS_THRU_METHODS_0 ||
101
- selector == PASS_THRU_METHODS_1 ||
102
- selector == PASS_THRU_METHODS_2 ||
103
- selector == PASS_THRU_METHODS_3 ||
104
- selector == PASS_THRU_METHODS_4 ||
105
- selector == PASS_THRU_METHODS_5 ||
106
- selector == PASS_THRU_METHODS_6 ||
107
- selector == PASS_THRU_METHODS_7 ||
108
- selector == PASS_THRU_METHODS_8 ||
109
- selector == PASS_THRU_METHODS_9 ||
110
- selector == PASS_THRU_METHODS_10 ||
111
- selector == PASS_THRU_METHODS_11 ||
112
- selector == PASS_THRU_METHODS_12 ||
113
- selector == PASS_THRU_METHODS_13 ||
114
- selector == PASS_THRU_METHODS_14 ||
115
- selector == PASS_THRU_METHODS_15 ||
116
- selector == PASS_THRU_METHODS_16 ||
117
- selector == PASS_THRU_METHODS_17 ||
118
- selector == PASS_THRU_METHODS_18 ||
119
- selector == PASS_THRU_METHODS_19 ||
120
- selector == PASS_THRU_METHODS_20 ||
121
- selector == PASS_THRU_METHODS_21 ||
122
- selector == PASS_THRU_METHODS_22 ||
123
- selector == PASS_THRU_METHODS_23 ||
124
- selector == PASS_THRU_METHODS_24 ||
125
- selector == PASS_THRU_METHODS_25;
126
- }
127
-
128
- /**
129
- * @notice Gives observability to the methods that are skipped from access control
130
- * @dev This list is fixed and defined on contract construction
131
- * @return methods The list of method selectors that skip ACCESS_MANAGER access control
132
- */
133
- // solhint-disable-next-line func-name-mixedcase
134
- function PASS_THRU_METHODS() external view returns (bytes4[] memory methods) {
135
- methods = new bytes4[](26);
136
- methods[0] = PASS_THRU_METHODS_0;
137
- methods[1] = PASS_THRU_METHODS_1;
138
- methods[2] = PASS_THRU_METHODS_2;
139
- methods[3] = PASS_THRU_METHODS_3;
140
- methods[4] = PASS_THRU_METHODS_4;
141
- methods[5] = PASS_THRU_METHODS_5;
142
- methods[6] = PASS_THRU_METHODS_6;
143
- methods[7] = PASS_THRU_METHODS_7;
144
- methods[8] = PASS_THRU_METHODS_8;
145
- methods[9] = PASS_THRU_METHODS_9;
146
- methods[10] = PASS_THRU_METHODS_10;
147
- methods[11] = PASS_THRU_METHODS_11;
148
- methods[12] = PASS_THRU_METHODS_12;
149
- methods[13] = PASS_THRU_METHODS_13;
150
- methods[14] = PASS_THRU_METHODS_14;
151
- methods[15] = PASS_THRU_METHODS_15;
152
- methods[16] = PASS_THRU_METHODS_16;
153
- methods[17] = PASS_THRU_METHODS_17;
154
- methods[18] = PASS_THRU_METHODS_18;
155
- methods[19] = PASS_THRU_METHODS_19;
156
- methods[20] = PASS_THRU_METHODS_20;
157
- methods[21] = PASS_THRU_METHODS_21;
158
- methods[22] = PASS_THRU_METHODS_22;
159
- methods[23] = PASS_THRU_METHODS_23;
160
- methods[24] = PASS_THRU_METHODS_24;
161
- methods[25] = PASS_THRU_METHODS_25;
162
- }
163
- }
@@ -1,167 +0,0 @@
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 AccessManagedProxyS27
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 AccessManagedProxyS27 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
-
43
- /**
44
- * @notice Constructor of the proxy, defining the implementation and the access manager
45
- * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation` and
46
- * with `manager` as the ACCESS_MANAGER that will handle access control.
47
- *
48
- * @param implementation The initial implementation contract.
49
- * @param _data If nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
50
- * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
51
- * @param manager The access manager that will handle access control
52
- * @param passThruMethods The selector of methods that will skip the access control validation, typically used for
53
- * views and other methods for gas optimization.
54
- *
55
- * Requirements:
56
- *
57
- * - If `data` is empty, `msg.value` must be zero.
58
- */
59
- constructor(
60
- address implementation,
61
- bytes memory _data,
62
- IAccessManager manager,
63
- bytes4[27] memory passThruMethods
64
- ) payable AccessManagedProxy(implementation, _data, manager) {
65
- PASS_THRU_METHODS_0 = passThruMethods[0];
66
- PASS_THRU_METHODS_1 = passThruMethods[1];
67
- PASS_THRU_METHODS_2 = passThruMethods[2];
68
- PASS_THRU_METHODS_3 = passThruMethods[3];
69
- PASS_THRU_METHODS_4 = passThruMethods[4];
70
- PASS_THRU_METHODS_5 = passThruMethods[5];
71
- PASS_THRU_METHODS_6 = passThruMethods[6];
72
- PASS_THRU_METHODS_7 = passThruMethods[7];
73
- PASS_THRU_METHODS_8 = passThruMethods[8];
74
- PASS_THRU_METHODS_9 = passThruMethods[9];
75
- PASS_THRU_METHODS_10 = passThruMethods[10];
76
- PASS_THRU_METHODS_11 = passThruMethods[11];
77
- PASS_THRU_METHODS_12 = passThruMethods[12];
78
- PASS_THRU_METHODS_13 = passThruMethods[13];
79
- PASS_THRU_METHODS_14 = passThruMethods[14];
80
- PASS_THRU_METHODS_15 = passThruMethods[15];
81
- PASS_THRU_METHODS_16 = passThruMethods[16];
82
- PASS_THRU_METHODS_17 = passThruMethods[17];
83
- PASS_THRU_METHODS_18 = passThruMethods[18];
84
- PASS_THRU_METHODS_19 = passThruMethods[19];
85
- PASS_THRU_METHODS_20 = passThruMethods[20];
86
- PASS_THRU_METHODS_21 = passThruMethods[21];
87
- PASS_THRU_METHODS_22 = passThruMethods[22];
88
- PASS_THRU_METHODS_23 = passThruMethods[23];
89
- PASS_THRU_METHODS_24 = passThruMethods[24];
90
- PASS_THRU_METHODS_25 = passThruMethods[25];
91
- PASS_THRU_METHODS_26 = passThruMethods[26];
92
- }
93
-
94
- /*
95
- * @notice Skips the access control if the method called is one of the passThruMethods
96
- * @dev See {PASS_THRU_METHODS()}
97
- * @param selector The selector of the method called
98
- * @return Whether the access control using ACCESS_MANAGER should be skipped or not
99
- */
100
- function _skipAC(bytes4 selector) internal view override returns (bool) {
101
- return
102
- selector == PASS_THRU_METHODS_0 ||
103
- selector == PASS_THRU_METHODS_1 ||
104
- selector == PASS_THRU_METHODS_2 ||
105
- selector == PASS_THRU_METHODS_3 ||
106
- selector == PASS_THRU_METHODS_4 ||
107
- selector == PASS_THRU_METHODS_5 ||
108
- selector == PASS_THRU_METHODS_6 ||
109
- selector == PASS_THRU_METHODS_7 ||
110
- selector == PASS_THRU_METHODS_8 ||
111
- selector == PASS_THRU_METHODS_9 ||
112
- selector == PASS_THRU_METHODS_10 ||
113
- selector == PASS_THRU_METHODS_11 ||
114
- selector == PASS_THRU_METHODS_12 ||
115
- selector == PASS_THRU_METHODS_13 ||
116
- selector == PASS_THRU_METHODS_14 ||
117
- selector == PASS_THRU_METHODS_15 ||
118
- selector == PASS_THRU_METHODS_16 ||
119
- selector == PASS_THRU_METHODS_17 ||
120
- selector == PASS_THRU_METHODS_18 ||
121
- selector == PASS_THRU_METHODS_19 ||
122
- selector == PASS_THRU_METHODS_20 ||
123
- selector == PASS_THRU_METHODS_21 ||
124
- selector == PASS_THRU_METHODS_22 ||
125
- selector == PASS_THRU_METHODS_23 ||
126
- selector == PASS_THRU_METHODS_24 ||
127
- selector == PASS_THRU_METHODS_25 ||
128
- selector == PASS_THRU_METHODS_26;
129
- }
130
-
131
- /**
132
- * @notice Gives observability to the methods that are skipped from access control
133
- * @dev This list is fixed and defined on contract construction
134
- * @return methods The list of method selectors that skip ACCESS_MANAGER access control
135
- */
136
- // solhint-disable-next-line func-name-mixedcase
137
- function PASS_THRU_METHODS() external view returns (bytes4[] memory methods) {
138
- methods = new bytes4[](27);
139
- methods[0] = PASS_THRU_METHODS_0;
140
- methods[1] = PASS_THRU_METHODS_1;
141
- methods[2] = PASS_THRU_METHODS_2;
142
- methods[3] = PASS_THRU_METHODS_3;
143
- methods[4] = PASS_THRU_METHODS_4;
144
- methods[5] = PASS_THRU_METHODS_5;
145
- methods[6] = PASS_THRU_METHODS_6;
146
- methods[7] = PASS_THRU_METHODS_7;
147
- methods[8] = PASS_THRU_METHODS_8;
148
- methods[9] = PASS_THRU_METHODS_9;
149
- methods[10] = PASS_THRU_METHODS_10;
150
- methods[11] = PASS_THRU_METHODS_11;
151
- methods[12] = PASS_THRU_METHODS_12;
152
- methods[13] = PASS_THRU_METHODS_13;
153
- methods[14] = PASS_THRU_METHODS_14;
154
- methods[15] = PASS_THRU_METHODS_15;
155
- methods[16] = PASS_THRU_METHODS_16;
156
- methods[17] = PASS_THRU_METHODS_17;
157
- methods[18] = PASS_THRU_METHODS_18;
158
- methods[19] = PASS_THRU_METHODS_19;
159
- methods[20] = PASS_THRU_METHODS_20;
160
- methods[21] = PASS_THRU_METHODS_21;
161
- methods[22] = PASS_THRU_METHODS_22;
162
- methods[23] = PASS_THRU_METHODS_23;
163
- methods[24] = PASS_THRU_METHODS_24;
164
- methods[25] = PASS_THRU_METHODS_25;
165
- methods[26] = PASS_THRU_METHODS_26;
166
- }
167
- }
@@ -1,171 +0,0 @@
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 AccessManagedProxyS28
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 AccessManagedProxyS28 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
-
44
- /**
45
- * @notice Constructor of the proxy, defining the implementation and the access manager
46
- * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation` and
47
- * with `manager` as the ACCESS_MANAGER that will handle access control.
48
- *
49
- * @param implementation The initial implementation contract.
50
- * @param _data If nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
51
- * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
52
- * @param manager The access manager that will handle access control
53
- * @param passThruMethods The selector of methods that will skip the access control validation, typically used for
54
- * views and other methods for gas optimization.
55
- *
56
- * Requirements:
57
- *
58
- * - If `data` is empty, `msg.value` must be zero.
59
- */
60
- constructor(
61
- address implementation,
62
- bytes memory _data,
63
- IAccessManager manager,
64
- bytes4[28] memory passThruMethods
65
- ) payable AccessManagedProxy(implementation, _data, manager) {
66
- PASS_THRU_METHODS_0 = passThruMethods[0];
67
- PASS_THRU_METHODS_1 = passThruMethods[1];
68
- PASS_THRU_METHODS_2 = passThruMethods[2];
69
- PASS_THRU_METHODS_3 = passThruMethods[3];
70
- PASS_THRU_METHODS_4 = passThruMethods[4];
71
- PASS_THRU_METHODS_5 = passThruMethods[5];
72
- PASS_THRU_METHODS_6 = passThruMethods[6];
73
- PASS_THRU_METHODS_7 = passThruMethods[7];
74
- PASS_THRU_METHODS_8 = passThruMethods[8];
75
- PASS_THRU_METHODS_9 = passThruMethods[9];
76
- PASS_THRU_METHODS_10 = passThruMethods[10];
77
- PASS_THRU_METHODS_11 = passThruMethods[11];
78
- PASS_THRU_METHODS_12 = passThruMethods[12];
79
- PASS_THRU_METHODS_13 = passThruMethods[13];
80
- PASS_THRU_METHODS_14 = passThruMethods[14];
81
- PASS_THRU_METHODS_15 = passThruMethods[15];
82
- PASS_THRU_METHODS_16 = passThruMethods[16];
83
- PASS_THRU_METHODS_17 = passThruMethods[17];
84
- PASS_THRU_METHODS_18 = passThruMethods[18];
85
- PASS_THRU_METHODS_19 = passThruMethods[19];
86
- PASS_THRU_METHODS_20 = passThruMethods[20];
87
- PASS_THRU_METHODS_21 = passThruMethods[21];
88
- PASS_THRU_METHODS_22 = passThruMethods[22];
89
- PASS_THRU_METHODS_23 = passThruMethods[23];
90
- PASS_THRU_METHODS_24 = passThruMethods[24];
91
- PASS_THRU_METHODS_25 = passThruMethods[25];
92
- PASS_THRU_METHODS_26 = passThruMethods[26];
93
- PASS_THRU_METHODS_27 = passThruMethods[27];
94
- }
95
-
96
- /*
97
- * @notice Skips the access control if the method called is one of the passThruMethods
98
- * @dev See {PASS_THRU_METHODS()}
99
- * @param selector The selector of the method called
100
- * @return Whether the access control using ACCESS_MANAGER should be skipped or not
101
- */
102
- function _skipAC(bytes4 selector) internal view override returns (bool) {
103
- return
104
- selector == PASS_THRU_METHODS_0 ||
105
- selector == PASS_THRU_METHODS_1 ||
106
- selector == PASS_THRU_METHODS_2 ||
107
- selector == PASS_THRU_METHODS_3 ||
108
- selector == PASS_THRU_METHODS_4 ||
109
- selector == PASS_THRU_METHODS_5 ||
110
- selector == PASS_THRU_METHODS_6 ||
111
- selector == PASS_THRU_METHODS_7 ||
112
- selector == PASS_THRU_METHODS_8 ||
113
- selector == PASS_THRU_METHODS_9 ||
114
- selector == PASS_THRU_METHODS_10 ||
115
- selector == PASS_THRU_METHODS_11 ||
116
- selector == PASS_THRU_METHODS_12 ||
117
- selector == PASS_THRU_METHODS_13 ||
118
- selector == PASS_THRU_METHODS_14 ||
119
- selector == PASS_THRU_METHODS_15 ||
120
- selector == PASS_THRU_METHODS_16 ||
121
- selector == PASS_THRU_METHODS_17 ||
122
- selector == PASS_THRU_METHODS_18 ||
123
- selector == PASS_THRU_METHODS_19 ||
124
- selector == PASS_THRU_METHODS_20 ||
125
- selector == PASS_THRU_METHODS_21 ||
126
- selector == PASS_THRU_METHODS_22 ||
127
- selector == PASS_THRU_METHODS_23 ||
128
- selector == PASS_THRU_METHODS_24 ||
129
- selector == PASS_THRU_METHODS_25 ||
130
- selector == PASS_THRU_METHODS_26 ||
131
- selector == PASS_THRU_METHODS_27;
132
- }
133
-
134
- /**
135
- * @notice Gives observability to the methods that are skipped from access control
136
- * @dev This list is fixed and defined on contract construction
137
- * @return methods The list of method selectors that skip ACCESS_MANAGER access control
138
- */
139
- // solhint-disable-next-line func-name-mixedcase
140
- function PASS_THRU_METHODS() external view returns (bytes4[] memory methods) {
141
- methods = new bytes4[](28);
142
- methods[0] = PASS_THRU_METHODS_0;
143
- methods[1] = PASS_THRU_METHODS_1;
144
- methods[2] = PASS_THRU_METHODS_2;
145
- methods[3] = PASS_THRU_METHODS_3;
146
- methods[4] = PASS_THRU_METHODS_4;
147
- methods[5] = PASS_THRU_METHODS_5;
148
- methods[6] = PASS_THRU_METHODS_6;
149
- methods[7] = PASS_THRU_METHODS_7;
150
- methods[8] = PASS_THRU_METHODS_8;
151
- methods[9] = PASS_THRU_METHODS_9;
152
- methods[10] = PASS_THRU_METHODS_10;
153
- methods[11] = PASS_THRU_METHODS_11;
154
- methods[12] = PASS_THRU_METHODS_12;
155
- methods[13] = PASS_THRU_METHODS_13;
156
- methods[14] = PASS_THRU_METHODS_14;
157
- methods[15] = PASS_THRU_METHODS_15;
158
- methods[16] = PASS_THRU_METHODS_16;
159
- methods[17] = PASS_THRU_METHODS_17;
160
- methods[18] = PASS_THRU_METHODS_18;
161
- methods[19] = PASS_THRU_METHODS_19;
162
- methods[20] = PASS_THRU_METHODS_20;
163
- methods[21] = PASS_THRU_METHODS_21;
164
- methods[22] = PASS_THRU_METHODS_22;
165
- methods[23] = PASS_THRU_METHODS_23;
166
- methods[24] = PASS_THRU_METHODS_24;
167
- methods[25] = PASS_THRU_METHODS_25;
168
- methods[26] = PASS_THRU_METHODS_26;
169
- methods[27] = PASS_THRU_METHODS_27;
170
- }
171
- }