@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,127 +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 AccessManagedProxyS17
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 AccessManagedProxyS17 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
-
33
- /**
34
- * @notice Constructor of the proxy, defining the implementation and the access manager
35
- * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation` and
36
- * with `manager` as the ACCESS_MANAGER that will handle access control.
37
- *
38
- * @param implementation The initial implementation contract.
39
- * @param _data If nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
40
- * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
41
- * @param manager The access manager that will handle access control
42
- * @param passThruMethods The selector of methods that will skip the access control validation, typically used for
43
- * views and other methods for gas optimization.
44
- *
45
- * Requirements:
46
- *
47
- * - If `data` is empty, `msg.value` must be zero.
48
- */
49
- constructor(
50
- address implementation,
51
- bytes memory _data,
52
- IAccessManager manager,
53
- bytes4[17] memory passThruMethods
54
- ) payable AccessManagedProxy(implementation, _data, manager) {
55
- PASS_THRU_METHODS_0 = passThruMethods[0];
56
- PASS_THRU_METHODS_1 = passThruMethods[1];
57
- PASS_THRU_METHODS_2 = passThruMethods[2];
58
- PASS_THRU_METHODS_3 = passThruMethods[3];
59
- PASS_THRU_METHODS_4 = passThruMethods[4];
60
- PASS_THRU_METHODS_5 = passThruMethods[5];
61
- PASS_THRU_METHODS_6 = passThruMethods[6];
62
- PASS_THRU_METHODS_7 = passThruMethods[7];
63
- PASS_THRU_METHODS_8 = passThruMethods[8];
64
- PASS_THRU_METHODS_9 = passThruMethods[9];
65
- PASS_THRU_METHODS_10 = passThruMethods[10];
66
- PASS_THRU_METHODS_11 = passThruMethods[11];
67
- PASS_THRU_METHODS_12 = passThruMethods[12];
68
- PASS_THRU_METHODS_13 = passThruMethods[13];
69
- PASS_THRU_METHODS_14 = passThruMethods[14];
70
- PASS_THRU_METHODS_15 = passThruMethods[15];
71
- PASS_THRU_METHODS_16 = passThruMethods[16];
72
- }
73
-
74
- /*
75
- * @notice Skips the access control if the method called is one of the passThruMethods
76
- * @dev See {PASS_THRU_METHODS()}
77
- * @param selector The selector of the method called
78
- * @return Whether the access control using ACCESS_MANAGER should be skipped or not
79
- */
80
- function _skipAC(bytes4 selector) internal view override returns (bool) {
81
- return
82
- selector == PASS_THRU_METHODS_0 ||
83
- selector == PASS_THRU_METHODS_1 ||
84
- selector == PASS_THRU_METHODS_2 ||
85
- selector == PASS_THRU_METHODS_3 ||
86
- selector == PASS_THRU_METHODS_4 ||
87
- selector == PASS_THRU_METHODS_5 ||
88
- selector == PASS_THRU_METHODS_6 ||
89
- selector == PASS_THRU_METHODS_7 ||
90
- selector == PASS_THRU_METHODS_8 ||
91
- selector == PASS_THRU_METHODS_9 ||
92
- selector == PASS_THRU_METHODS_10 ||
93
- selector == PASS_THRU_METHODS_11 ||
94
- selector == PASS_THRU_METHODS_12 ||
95
- selector == PASS_THRU_METHODS_13 ||
96
- selector == PASS_THRU_METHODS_14 ||
97
- selector == PASS_THRU_METHODS_15 ||
98
- selector == PASS_THRU_METHODS_16;
99
- }
100
-
101
- /**
102
- * @notice Gives observability to the methods that are skipped from access control
103
- * @dev This list is fixed and defined on contract construction
104
- * @return methods The list of method selectors that skip ACCESS_MANAGER access control
105
- */
106
- // solhint-disable-next-line func-name-mixedcase
107
- function PASS_THRU_METHODS() external view returns (bytes4[] memory methods) {
108
- methods = new bytes4[](17);
109
- methods[0] = PASS_THRU_METHODS_0;
110
- methods[1] = PASS_THRU_METHODS_1;
111
- methods[2] = PASS_THRU_METHODS_2;
112
- methods[3] = PASS_THRU_METHODS_3;
113
- methods[4] = PASS_THRU_METHODS_4;
114
- methods[5] = PASS_THRU_METHODS_5;
115
- methods[6] = PASS_THRU_METHODS_6;
116
- methods[7] = PASS_THRU_METHODS_7;
117
- methods[8] = PASS_THRU_METHODS_8;
118
- methods[9] = PASS_THRU_METHODS_9;
119
- methods[10] = PASS_THRU_METHODS_10;
120
- methods[11] = PASS_THRU_METHODS_11;
121
- methods[12] = PASS_THRU_METHODS_12;
122
- methods[13] = PASS_THRU_METHODS_13;
123
- methods[14] = PASS_THRU_METHODS_14;
124
- methods[15] = PASS_THRU_METHODS_15;
125
- methods[16] = PASS_THRU_METHODS_16;
126
- }
127
- }
@@ -1,131 +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 AccessManagedProxyS18
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 AccessManagedProxyS18 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
-
34
- /**
35
- * @notice Constructor of the proxy, defining the implementation and the access manager
36
- * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation` and
37
- * with `manager` as the ACCESS_MANAGER that will handle access control.
38
- *
39
- * @param implementation The initial implementation contract.
40
- * @param _data If nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
41
- * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
42
- * @param manager The access manager that will handle access control
43
- * @param passThruMethods The selector of methods that will skip the access control validation, typically used for
44
- * views and other methods for gas optimization.
45
- *
46
- * Requirements:
47
- *
48
- * - If `data` is empty, `msg.value` must be zero.
49
- */
50
- constructor(
51
- address implementation,
52
- bytes memory _data,
53
- IAccessManager manager,
54
- bytes4[18] memory passThruMethods
55
- ) payable AccessManagedProxy(implementation, _data, manager) {
56
- PASS_THRU_METHODS_0 = passThruMethods[0];
57
- PASS_THRU_METHODS_1 = passThruMethods[1];
58
- PASS_THRU_METHODS_2 = passThruMethods[2];
59
- PASS_THRU_METHODS_3 = passThruMethods[3];
60
- PASS_THRU_METHODS_4 = passThruMethods[4];
61
- PASS_THRU_METHODS_5 = passThruMethods[5];
62
- PASS_THRU_METHODS_6 = passThruMethods[6];
63
- PASS_THRU_METHODS_7 = passThruMethods[7];
64
- PASS_THRU_METHODS_8 = passThruMethods[8];
65
- PASS_THRU_METHODS_9 = passThruMethods[9];
66
- PASS_THRU_METHODS_10 = passThruMethods[10];
67
- PASS_THRU_METHODS_11 = passThruMethods[11];
68
- PASS_THRU_METHODS_12 = passThruMethods[12];
69
- PASS_THRU_METHODS_13 = passThruMethods[13];
70
- PASS_THRU_METHODS_14 = passThruMethods[14];
71
- PASS_THRU_METHODS_15 = passThruMethods[15];
72
- PASS_THRU_METHODS_16 = passThruMethods[16];
73
- PASS_THRU_METHODS_17 = passThruMethods[17];
74
- }
75
-
76
- /*
77
- * @notice Skips the access control if the method called is one of the passThruMethods
78
- * @dev See {PASS_THRU_METHODS()}
79
- * @param selector The selector of the method called
80
- * @return Whether the access control using ACCESS_MANAGER should be skipped or not
81
- */
82
- function _skipAC(bytes4 selector) internal view override returns (bool) {
83
- return
84
- selector == PASS_THRU_METHODS_0 ||
85
- selector == PASS_THRU_METHODS_1 ||
86
- selector == PASS_THRU_METHODS_2 ||
87
- selector == PASS_THRU_METHODS_3 ||
88
- selector == PASS_THRU_METHODS_4 ||
89
- selector == PASS_THRU_METHODS_5 ||
90
- selector == PASS_THRU_METHODS_6 ||
91
- selector == PASS_THRU_METHODS_7 ||
92
- selector == PASS_THRU_METHODS_8 ||
93
- selector == PASS_THRU_METHODS_9 ||
94
- selector == PASS_THRU_METHODS_10 ||
95
- selector == PASS_THRU_METHODS_11 ||
96
- selector == PASS_THRU_METHODS_12 ||
97
- selector == PASS_THRU_METHODS_13 ||
98
- selector == PASS_THRU_METHODS_14 ||
99
- selector == PASS_THRU_METHODS_15 ||
100
- selector == PASS_THRU_METHODS_16 ||
101
- selector == PASS_THRU_METHODS_17;
102
- }
103
-
104
- /**
105
- * @notice Gives observability to the methods that are skipped from access control
106
- * @dev This list is fixed and defined on contract construction
107
- * @return methods The list of method selectors that skip ACCESS_MANAGER access control
108
- */
109
- // solhint-disable-next-line func-name-mixedcase
110
- function PASS_THRU_METHODS() external view returns (bytes4[] memory methods) {
111
- methods = new bytes4[](18);
112
- methods[0] = PASS_THRU_METHODS_0;
113
- methods[1] = PASS_THRU_METHODS_1;
114
- methods[2] = PASS_THRU_METHODS_2;
115
- methods[3] = PASS_THRU_METHODS_3;
116
- methods[4] = PASS_THRU_METHODS_4;
117
- methods[5] = PASS_THRU_METHODS_5;
118
- methods[6] = PASS_THRU_METHODS_6;
119
- methods[7] = PASS_THRU_METHODS_7;
120
- methods[8] = PASS_THRU_METHODS_8;
121
- methods[9] = PASS_THRU_METHODS_9;
122
- methods[10] = PASS_THRU_METHODS_10;
123
- methods[11] = PASS_THRU_METHODS_11;
124
- methods[12] = PASS_THRU_METHODS_12;
125
- methods[13] = PASS_THRU_METHODS_13;
126
- methods[14] = PASS_THRU_METHODS_14;
127
- methods[15] = PASS_THRU_METHODS_15;
128
- methods[16] = PASS_THRU_METHODS_16;
129
- methods[17] = PASS_THRU_METHODS_17;
130
- }
131
- }
@@ -1,135 +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 AccessManagedProxyS19
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 AccessManagedProxyS19 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
-
35
- /**
36
- * @notice Constructor of the proxy, defining the implementation and the access manager
37
- * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation` and
38
- * with `manager` as the ACCESS_MANAGER that will handle access control.
39
- *
40
- * @param implementation The initial implementation contract.
41
- * @param _data If nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
42
- * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
43
- * @param manager The access manager that will handle access control
44
- * @param passThruMethods The selector of methods that will skip the access control validation, typically used for
45
- * views and other methods for gas optimization.
46
- *
47
- * Requirements:
48
- *
49
- * - If `data` is empty, `msg.value` must be zero.
50
- */
51
- constructor(
52
- address implementation,
53
- bytes memory _data,
54
- IAccessManager manager,
55
- bytes4[19] memory passThruMethods
56
- ) payable AccessManagedProxy(implementation, _data, manager) {
57
- PASS_THRU_METHODS_0 = passThruMethods[0];
58
- PASS_THRU_METHODS_1 = passThruMethods[1];
59
- PASS_THRU_METHODS_2 = passThruMethods[2];
60
- PASS_THRU_METHODS_3 = passThruMethods[3];
61
- PASS_THRU_METHODS_4 = passThruMethods[4];
62
- PASS_THRU_METHODS_5 = passThruMethods[5];
63
- PASS_THRU_METHODS_6 = passThruMethods[6];
64
- PASS_THRU_METHODS_7 = passThruMethods[7];
65
- PASS_THRU_METHODS_8 = passThruMethods[8];
66
- PASS_THRU_METHODS_9 = passThruMethods[9];
67
- PASS_THRU_METHODS_10 = passThruMethods[10];
68
- PASS_THRU_METHODS_11 = passThruMethods[11];
69
- PASS_THRU_METHODS_12 = passThruMethods[12];
70
- PASS_THRU_METHODS_13 = passThruMethods[13];
71
- PASS_THRU_METHODS_14 = passThruMethods[14];
72
- PASS_THRU_METHODS_15 = passThruMethods[15];
73
- PASS_THRU_METHODS_16 = passThruMethods[16];
74
- PASS_THRU_METHODS_17 = passThruMethods[17];
75
- PASS_THRU_METHODS_18 = passThruMethods[18];
76
- }
77
-
78
- /*
79
- * @notice Skips the access control if the method called is one of the passThruMethods
80
- * @dev See {PASS_THRU_METHODS()}
81
- * @param selector The selector of the method called
82
- * @return Whether the access control using ACCESS_MANAGER should be skipped or not
83
- */
84
- function _skipAC(bytes4 selector) internal view override returns (bool) {
85
- return
86
- selector == PASS_THRU_METHODS_0 ||
87
- selector == PASS_THRU_METHODS_1 ||
88
- selector == PASS_THRU_METHODS_2 ||
89
- selector == PASS_THRU_METHODS_3 ||
90
- selector == PASS_THRU_METHODS_4 ||
91
- selector == PASS_THRU_METHODS_5 ||
92
- selector == PASS_THRU_METHODS_6 ||
93
- selector == PASS_THRU_METHODS_7 ||
94
- selector == PASS_THRU_METHODS_8 ||
95
- selector == PASS_THRU_METHODS_9 ||
96
- selector == PASS_THRU_METHODS_10 ||
97
- selector == PASS_THRU_METHODS_11 ||
98
- selector == PASS_THRU_METHODS_12 ||
99
- selector == PASS_THRU_METHODS_13 ||
100
- selector == PASS_THRU_METHODS_14 ||
101
- selector == PASS_THRU_METHODS_15 ||
102
- selector == PASS_THRU_METHODS_16 ||
103
- selector == PASS_THRU_METHODS_17 ||
104
- selector == PASS_THRU_METHODS_18;
105
- }
106
-
107
- /**
108
- * @notice Gives observability to the methods that are skipped from access control
109
- * @dev This list is fixed and defined on contract construction
110
- * @return methods The list of method selectors that skip ACCESS_MANAGER access control
111
- */
112
- // solhint-disable-next-line func-name-mixedcase
113
- function PASS_THRU_METHODS() external view returns (bytes4[] memory methods) {
114
- methods = new bytes4[](19);
115
- methods[0] = PASS_THRU_METHODS_0;
116
- methods[1] = PASS_THRU_METHODS_1;
117
- methods[2] = PASS_THRU_METHODS_2;
118
- methods[3] = PASS_THRU_METHODS_3;
119
- methods[4] = PASS_THRU_METHODS_4;
120
- methods[5] = PASS_THRU_METHODS_5;
121
- methods[6] = PASS_THRU_METHODS_6;
122
- methods[7] = PASS_THRU_METHODS_7;
123
- methods[8] = PASS_THRU_METHODS_8;
124
- methods[9] = PASS_THRU_METHODS_9;
125
- methods[10] = PASS_THRU_METHODS_10;
126
- methods[11] = PASS_THRU_METHODS_11;
127
- methods[12] = PASS_THRU_METHODS_12;
128
- methods[13] = PASS_THRU_METHODS_13;
129
- methods[14] = PASS_THRU_METHODS_14;
130
- methods[15] = PASS_THRU_METHODS_15;
131
- methods[16] = PASS_THRU_METHODS_16;
132
- methods[17] = PASS_THRU_METHODS_17;
133
- methods[18] = PASS_THRU_METHODS_18;
134
- }
135
- }
@@ -1,67 +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 AccessManagedProxyS2
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 AccessManagedProxyS2 is AccessManagedProxy {
15
- bytes4 internal immutable PASS_THRU_METHODS_0;
16
- bytes4 internal immutable PASS_THRU_METHODS_1;
17
-
18
- /**
19
- * @notice Constructor of the proxy, defining the implementation and the access manager
20
- * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation` and
21
- * with `manager` as the ACCESS_MANAGER that will handle access control.
22
- *
23
- * @param implementation The initial implementation contract.
24
- * @param _data If nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
25
- * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
26
- * @param manager The access manager that will handle access control
27
- * @param passThruMethods The selector of methods that will skip the access control validation, typically used for
28
- * views and other methods for gas optimization.
29
- *
30
- * Requirements:
31
- *
32
- * - If `data` is empty, `msg.value` must be zero.
33
- */
34
- constructor(
35
- address implementation,
36
- bytes memory _data,
37
- IAccessManager manager,
38
- bytes4[2] memory passThruMethods
39
- ) payable AccessManagedProxy(implementation, _data, manager) {
40
- PASS_THRU_METHODS_0 = passThruMethods[0];
41
- PASS_THRU_METHODS_1 = passThruMethods[1];
42
- }
43
-
44
- /*
45
- * @notice Skips the access control if the method called is one of the passThruMethods
46
- * @dev See {PASS_THRU_METHODS()}
47
- * @param selector The selector of the method called
48
- * @return Whether the access control using ACCESS_MANAGER should be skipped or not
49
- */
50
- function _skipAC(bytes4 selector) internal view override returns (bool) {
51
- return
52
- selector == PASS_THRU_METHODS_0 ||
53
- selector == PASS_THRU_METHODS_1;
54
- }
55
-
56
- /**
57
- * @notice Gives observability to the methods that are skipped from access control
58
- * @dev This list is fixed and defined on contract construction
59
- * @return methods The list of method selectors that skip ACCESS_MANAGER access control
60
- */
61
- // solhint-disable-next-line func-name-mixedcase
62
- function PASS_THRU_METHODS() external view returns (bytes4[] memory methods) {
63
- methods = new bytes4[](2);
64
- methods[0] = PASS_THRU_METHODS_0;
65
- methods[1] = PASS_THRU_METHODS_1;
66
- }
67
- }
@@ -1,139 +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 AccessManagedProxyS20
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 AccessManagedProxyS20 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
-
36
- /**
37
- * @notice Constructor of the proxy, defining the implementation and the access manager
38
- * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation` and
39
- * with `manager` as the ACCESS_MANAGER that will handle access control.
40
- *
41
- * @param implementation The initial implementation contract.
42
- * @param _data If nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
43
- * encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
44
- * @param manager The access manager that will handle access control
45
- * @param passThruMethods The selector of methods that will skip the access control validation, typically used for
46
- * views and other methods for gas optimization.
47
- *
48
- * Requirements:
49
- *
50
- * - If `data` is empty, `msg.value` must be zero.
51
- */
52
- constructor(
53
- address implementation,
54
- bytes memory _data,
55
- IAccessManager manager,
56
- bytes4[20] memory passThruMethods
57
- ) payable AccessManagedProxy(implementation, _data, manager) {
58
- PASS_THRU_METHODS_0 = passThruMethods[0];
59
- PASS_THRU_METHODS_1 = passThruMethods[1];
60
- PASS_THRU_METHODS_2 = passThruMethods[2];
61
- PASS_THRU_METHODS_3 = passThruMethods[3];
62
- PASS_THRU_METHODS_4 = passThruMethods[4];
63
- PASS_THRU_METHODS_5 = passThruMethods[5];
64
- PASS_THRU_METHODS_6 = passThruMethods[6];
65
- PASS_THRU_METHODS_7 = passThruMethods[7];
66
- PASS_THRU_METHODS_8 = passThruMethods[8];
67
- PASS_THRU_METHODS_9 = passThruMethods[9];
68
- PASS_THRU_METHODS_10 = passThruMethods[10];
69
- PASS_THRU_METHODS_11 = passThruMethods[11];
70
- PASS_THRU_METHODS_12 = passThruMethods[12];
71
- PASS_THRU_METHODS_13 = passThruMethods[13];
72
- PASS_THRU_METHODS_14 = passThruMethods[14];
73
- PASS_THRU_METHODS_15 = passThruMethods[15];
74
- PASS_THRU_METHODS_16 = passThruMethods[16];
75
- PASS_THRU_METHODS_17 = passThruMethods[17];
76
- PASS_THRU_METHODS_18 = passThruMethods[18];
77
- PASS_THRU_METHODS_19 = passThruMethods[19];
78
- }
79
-
80
- /*
81
- * @notice Skips the access control if the method called is one of the passThruMethods
82
- * @dev See {PASS_THRU_METHODS()}
83
- * @param selector The selector of the method called
84
- * @return Whether the access control using ACCESS_MANAGER should be skipped or not
85
- */
86
- function _skipAC(bytes4 selector) internal view override returns (bool) {
87
- return
88
- selector == PASS_THRU_METHODS_0 ||
89
- selector == PASS_THRU_METHODS_1 ||
90
- selector == PASS_THRU_METHODS_2 ||
91
- selector == PASS_THRU_METHODS_3 ||
92
- selector == PASS_THRU_METHODS_4 ||
93
- selector == PASS_THRU_METHODS_5 ||
94
- selector == PASS_THRU_METHODS_6 ||
95
- selector == PASS_THRU_METHODS_7 ||
96
- selector == PASS_THRU_METHODS_8 ||
97
- selector == PASS_THRU_METHODS_9 ||
98
- selector == PASS_THRU_METHODS_10 ||
99
- selector == PASS_THRU_METHODS_11 ||
100
- selector == PASS_THRU_METHODS_12 ||
101
- selector == PASS_THRU_METHODS_13 ||
102
- selector == PASS_THRU_METHODS_14 ||
103
- selector == PASS_THRU_METHODS_15 ||
104
- selector == PASS_THRU_METHODS_16 ||
105
- selector == PASS_THRU_METHODS_17 ||
106
- selector == PASS_THRU_METHODS_18 ||
107
- selector == PASS_THRU_METHODS_19;
108
- }
109
-
110
- /**
111
- * @notice Gives observability to the methods that are skipped from access control
112
- * @dev This list is fixed and defined on contract construction
113
- * @return methods The list of method selectors that skip ACCESS_MANAGER access control
114
- */
115
- // solhint-disable-next-line func-name-mixedcase
116
- function PASS_THRU_METHODS() external view returns (bytes4[] memory methods) {
117
- methods = new bytes4[](20);
118
- methods[0] = PASS_THRU_METHODS_0;
119
- methods[1] = PASS_THRU_METHODS_1;
120
- methods[2] = PASS_THRU_METHODS_2;
121
- methods[3] = PASS_THRU_METHODS_3;
122
- methods[4] = PASS_THRU_METHODS_4;
123
- methods[5] = PASS_THRU_METHODS_5;
124
- methods[6] = PASS_THRU_METHODS_6;
125
- methods[7] = PASS_THRU_METHODS_7;
126
- methods[8] = PASS_THRU_METHODS_8;
127
- methods[9] = PASS_THRU_METHODS_9;
128
- methods[10] = PASS_THRU_METHODS_10;
129
- methods[11] = PASS_THRU_METHODS_11;
130
- methods[12] = PASS_THRU_METHODS_12;
131
- methods[13] = PASS_THRU_METHODS_13;
132
- methods[14] = PASS_THRU_METHODS_14;
133
- methods[15] = PASS_THRU_METHODS_15;
134
- methods[16] = PASS_THRU_METHODS_16;
135
- methods[17] = PASS_THRU_METHODS_17;
136
- methods[18] = PASS_THRU_METHODS_18;
137
- methods[19] = PASS_THRU_METHODS_19;
138
- }
139
- }