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