@ensuro/access-managed-proxy 0.1.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.
- package/README.md +15 -0
- package/build/build-info.json +1 -0
- package/build/contracts/AccessManagedProxy.sol/AccessManagedProxy.json +105 -0
- package/build/contracts/amps/AccessManagedProxyS1.sol/AccessManagedProxyS1.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS10.sol/AccessManagedProxyS10.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS11.sol/AccessManagedProxyS11.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS12.sol/AccessManagedProxyS12.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS13.sol/AccessManagedProxyS13.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS14.sol/AccessManagedProxyS14.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS15.sol/AccessManagedProxyS15.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS16.sol/AccessManagedProxyS16.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS17.sol/AccessManagedProxyS17.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS18.sol/AccessManagedProxyS18.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS19.sol/AccessManagedProxyS19.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS2.sol/AccessManagedProxyS2.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS20.sol/AccessManagedProxyS20.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS21.sol/AccessManagedProxyS21.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS22.sol/AccessManagedProxyS22.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS23.sol/AccessManagedProxyS23.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS24.sol/AccessManagedProxyS24.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS3.sol/AccessManagedProxyS3.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS4.sol/AccessManagedProxyS4.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS5.sol/AccessManagedProxyS5.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS6.sol/AccessManagedProxyS6.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS7.sol/AccessManagedProxyS7.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS8.sol/AccessManagedProxyS8.json +123 -0
- package/build/contracts/amps/AccessManagedProxyS9.sol/AccessManagedProxyS9.json +123 -0
- package/build/contracts/mock/DummyImplementation.sol/DummyImplementation.json +225 -0
- package/contracts/AccessManagedProxy.sol +85 -0
- package/contracts/amps/AccessManagedProxyS1.sol +63 -0
- package/contracts/amps/AccessManagedProxyS10.sol +99 -0
- package/contracts/amps/AccessManagedProxyS11.sol +103 -0
- package/contracts/amps/AccessManagedProxyS12.sol +107 -0
- package/contracts/amps/AccessManagedProxyS13.sol +111 -0
- package/contracts/amps/AccessManagedProxyS14.sol +115 -0
- package/contracts/amps/AccessManagedProxyS15.sol +119 -0
- package/contracts/amps/AccessManagedProxyS16.sol +123 -0
- package/contracts/amps/AccessManagedProxyS17.sol +127 -0
- package/contracts/amps/AccessManagedProxyS18.sol +131 -0
- package/contracts/amps/AccessManagedProxyS19.sol +135 -0
- package/contracts/amps/AccessManagedProxyS2.sol +67 -0
- package/contracts/amps/AccessManagedProxyS20.sol +139 -0
- package/contracts/amps/AccessManagedProxyS21.sol +143 -0
- package/contracts/amps/AccessManagedProxyS22.sol +147 -0
- package/contracts/amps/AccessManagedProxyS23.sol +151 -0
- package/contracts/amps/AccessManagedProxyS24.sol +155 -0
- package/contracts/amps/AccessManagedProxyS3.sol +71 -0
- package/contracts/amps/AccessManagedProxyS4.sol +75 -0
- package/contracts/amps/AccessManagedProxyS5.sol +79 -0
- package/contracts/amps/AccessManagedProxyS6.sol +83 -0
- package/contracts/amps/AccessManagedProxyS7.sol +87 -0
- package/contracts/amps/AccessManagedProxyS8.sol +91 -0
- package/contracts/amps/AccessManagedProxyS9.sol +95 -0
- package/contracts/mock/DummyImplementation.sol +53 -0
- package/package.json +28 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_format": "hh-sol-artifact-1",
|
|
3
|
+
"contractName": "AccessManagedProxyS9",
|
|
4
|
+
"sourceName": "contracts/amps/AccessManagedProxyS9.sol",
|
|
5
|
+
"abi": [
|
|
6
|
+
{
|
|
7
|
+
"inputs": [
|
|
8
|
+
{
|
|
9
|
+
"internalType": "address",
|
|
10
|
+
"name": "implementation",
|
|
11
|
+
"type": "address"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"internalType": "bytes",
|
|
15
|
+
"name": "_data",
|
|
16
|
+
"type": "bytes"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"internalType": "contract IAccessManager",
|
|
20
|
+
"name": "manager",
|
|
21
|
+
"type": "address"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"internalType": "bytes4[9]",
|
|
25
|
+
"name": "passThruMethods",
|
|
26
|
+
"type": "bytes4[9]"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"stateMutability": "payable",
|
|
30
|
+
"type": "constructor"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"inputs": [
|
|
34
|
+
{
|
|
35
|
+
"internalType": "address",
|
|
36
|
+
"name": "caller",
|
|
37
|
+
"type": "address"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"name": "AccessManagedUnauthorized",
|
|
41
|
+
"type": "error"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"inputs": [
|
|
45
|
+
{
|
|
46
|
+
"internalType": "address",
|
|
47
|
+
"name": "target",
|
|
48
|
+
"type": "address"
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"name": "AddressEmptyCode",
|
|
52
|
+
"type": "error"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"inputs": [
|
|
56
|
+
{
|
|
57
|
+
"internalType": "address",
|
|
58
|
+
"name": "implementation",
|
|
59
|
+
"type": "address"
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"name": "ERC1967InvalidImplementation",
|
|
63
|
+
"type": "error"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"inputs": [],
|
|
67
|
+
"name": "ERC1967NonPayable",
|
|
68
|
+
"type": "error"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"inputs": [],
|
|
72
|
+
"name": "FailedCall",
|
|
73
|
+
"type": "error"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"anonymous": false,
|
|
77
|
+
"inputs": [
|
|
78
|
+
{
|
|
79
|
+
"indexed": true,
|
|
80
|
+
"internalType": "address",
|
|
81
|
+
"name": "implementation",
|
|
82
|
+
"type": "address"
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"name": "Upgraded",
|
|
86
|
+
"type": "event"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"stateMutability": "payable",
|
|
90
|
+
"type": "fallback"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"inputs": [],
|
|
94
|
+
"name": "ACCESS_MANAGER",
|
|
95
|
+
"outputs": [
|
|
96
|
+
{
|
|
97
|
+
"internalType": "contract IAccessManager",
|
|
98
|
+
"name": "",
|
|
99
|
+
"type": "address"
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"stateMutability": "view",
|
|
103
|
+
"type": "function"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"inputs": [],
|
|
107
|
+
"name": "PASS_THRU_METHODS",
|
|
108
|
+
"outputs": [
|
|
109
|
+
{
|
|
110
|
+
"internalType": "bytes4[]",
|
|
111
|
+
"name": "methods",
|
|
112
|
+
"type": "bytes4[]"
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"stateMutability": "view",
|
|
116
|
+
"type": "function"
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"bytecode": "0x6101c0604052604051610db8380380610db883398101604081905261002391610395565b838383828261003282826100b5565b50506001600160a01b0316608090815283516001600160e01b031990811660a09081526020860151821660c09081526040870151831660e09081526060880151841661010090815294880151841661012052918701518316610140528601518216610160528501518116610180529301519092166101a052506104739350505050565b6100be82610113565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a280511561010757610102828261018e565b505050565b61010f610201565b5050565b806001600160a01b03163b5f0361014d57604051634c9c8ce360e01b81526001600160a01b03821660048201526024015b60405180910390fd5b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b60605f5f846001600160a01b0316846040516101aa919061045d565b5f60405180830381855af49150503d805f81146101e2576040519150601f19603f3d011682016040523d82523d5f602084013e6101e7565b606091505b5090925090506101f8858383610222565b95945050505050565b34156102205760405163b398979f60e01b815260040160405180910390fd5b565b6060826102375761023282610281565b61027a565b815115801561024e57506001600160a01b0384163b155b1561027757604051639996b31560e01b81526001600160a01b0385166004820152602401610144565b50805b9392505050565b80511561029057805160208201fd5b60405163d6bda27560e01b815260040160405180910390fd5b50565b6001600160a01b03811681146102a9575f5ffd5b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b03811182821017156102fc576102fc6102c0565b604052919050565b805161030f816102ac565b919050565b5f82601f830112610323575f5ffd5b60405161012081016001600160401b0381118282101715610346576103466102c0565b6040528061012084018581111561035b575f5ffd5b845b8181101561038a5780516001600160e01b03198116811461037c575f5ffd5b83526020928301920161035d565b509195945050505050565b5f5f5f5f61018085870312156103a9575f5ffd5b84516103b4816102ac565b60208601519094506001600160401b038111156103cf575f5ffd5b8501601f810187136103df575f5ffd5b80516001600160401b038111156103f8576103f86102c0565b61040b601f8201601f19166020016102d4565b81815288602083850101111561041f575f5ffd5b8160208401602083015e5f6020838301015280955050505061044360408601610304565b91506104528660608701610314565b905092959194509250565b5f82518060208501845e5f920191825250919050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a0516108926105265f395f818161038f01526106ff01525f818161033901526106c101525f81816102e3015261068301525f818161028d015261064501525f8181610237015261060701525f81816101e101526105c901525f818161018b015261058b01525f8181610135015261054d01525f818160e0015261051001525f8181606d015261046901526108925ff3fe608060405260043610610028575f3560e01c806314416c03146100325780633a7b7a391461005c575b6100306100a7565b005b34801561003d575f5ffd5b506100466100b9565b6040516100539190610759565b60405180910390f35b348015610067575f5ffd5b5061008f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610053565b6100b76100b26103dd565b610414565b565b604080516009808252610140820190925260609160208201610120803683370190505090507f0000000000000000000000000000000000000000000000000000000000000000815f81518110610111576101116107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f000000000000000000000000000000000000000000000000000000000000000081600181518110610167576101676107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f0000000000000000000000000000000000000000000000000000000000000000816002815181106101bd576101bd6107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f000000000000000000000000000000000000000000000000000000000000000081600381518110610213576102136107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f000000000000000000000000000000000000000000000000000000000000000081600481518110610269576102696107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f0000000000000000000000000000000000000000000000000000000000000000816005815181106102bf576102bf6107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f000000000000000000000000000000000000000000000000000000000000000081600681518110610315576103156107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f00000000000000000000000000000000000000000000000000000000000000008160078151811061036b5761036b6107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f0000000000000000000000000000000000000000000000000000000000000000816008815181106103c1576103c16107a5565b6001600160e01b03199092166020928302919091019091015290565b5f61040f7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b5f61042260048236816107b9565b61042b916107e0565b90505f6104378261050d565b9050806104ff5760405163b700961360e01b81523360048201523060248201526001600160e01b0319831660448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063b7009613906064016040805180830381865afa1580156104b5573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104d99190610818565b509050806104ff5760405162d1953b60e31b815233600482015260240160405180910390fd5b6105088361073b565b505050565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916148061058357507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b806105c157507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b806105ff57507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b8061063d57507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b8061067b57507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b806106b957507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b806106f757507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b8061073557507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b92915050565b365f5f375f5f365f845af43d5f5f3e808015610755573d5ff35b3d5ffd5b602080825282518282018190525f918401906040840190835b8181101561079a5783516001600160e01b031916835260209384019390920191600101610772565b509095945050505050565b634e487b7160e01b5f52603260045260245ffd5b5f5f858511156107c7575f5ffd5b838611156107d3575f5ffd5b5050820193919092039150565b80356001600160e01b03198116906004841015610811576001600160e01b0319600485900360031b81901b82161691505b5092915050565b5f5f60408385031215610829575f5ffd5b82518015158114610838575f5ffd5b602084015190925063ffffffff81168114610851575f5ffd5b80915050925092905056fea26469706673582212206460973825867c720121f3bf916539e19779b999b27b8001127cfb946ae456e264736f6c634300081c0033",
|
|
120
|
+
"deployedBytecode": "0x608060405260043610610028575f3560e01c806314416c03146100325780633a7b7a391461005c575b6100306100a7565b005b34801561003d575f5ffd5b506100466100b9565b6040516100539190610759565b60405180910390f35b348015610067575f5ffd5b5061008f7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610053565b6100b76100b26103dd565b610414565b565b604080516009808252610140820190925260609160208201610120803683370190505090507f0000000000000000000000000000000000000000000000000000000000000000815f81518110610111576101116107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f000000000000000000000000000000000000000000000000000000000000000081600181518110610167576101676107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f0000000000000000000000000000000000000000000000000000000000000000816002815181106101bd576101bd6107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f000000000000000000000000000000000000000000000000000000000000000081600381518110610213576102136107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f000000000000000000000000000000000000000000000000000000000000000081600481518110610269576102696107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f0000000000000000000000000000000000000000000000000000000000000000816005815181106102bf576102bf6107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f000000000000000000000000000000000000000000000000000000000000000081600681518110610315576103156107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f00000000000000000000000000000000000000000000000000000000000000008160078151811061036b5761036b6107a5565b60200260200101906001600160e01b03191690816001600160e01b031916815250507f0000000000000000000000000000000000000000000000000000000000000000816008815181106103c1576103c16107a5565b6001600160e01b03199092166020928302919091019091015290565b5f61040f7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b905090565b5f61042260048236816107b9565b61042b916107e0565b90505f6104378261050d565b9050806104ff5760405163b700961360e01b81523360048201523060248201526001600160e01b0319831660448201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063b7009613906064016040805180830381865afa1580156104b5573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906104d99190610818565b509050806104ff5760405162d1953b60e31b815233600482015260240160405180910390fd5b6105088361073b565b505050565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916148061058357507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b806105c157507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b806105ff57507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b8061063d57507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b8061067b57507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b806106b957507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b806106f757507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b8061073557507f00000000000000000000000000000000000000000000000000000000000000006001600160e01b031916826001600160e01b031916145b92915050565b365f5f375f5f365f845af43d5f5f3e808015610755573d5ff35b3d5ffd5b602080825282518282018190525f918401906040840190835b8181101561079a5783516001600160e01b031916835260209384019390920191600101610772565b509095945050505050565b634e487b7160e01b5f52603260045260245ffd5b5f5f858511156107c7575f5ffd5b838611156107d3575f5ffd5b5050820193919092039150565b80356001600160e01b03198116906004841015610811576001600160e01b0319600485900360031b81901b82161691505b5092915050565b5f5f60408385031215610829575f5ffd5b82518015158114610838575f5ffd5b602084015190925063ffffffff81168114610851575f5ffd5b80915050925092905056fea26469706673582212206460973825867c720121f3bf916539e19779b999b27b8001127cfb946ae456e264736f6c634300081c0033",
|
|
121
|
+
"linkReferences": {},
|
|
122
|
+
"deployedLinkReferences": {}
|
|
123
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_format": "hh-sol-artifact-1",
|
|
3
|
+
"contractName": "DummyImplementation",
|
|
4
|
+
"sourceName": "contracts/mock/DummyImplementation.sol",
|
|
5
|
+
"abi": [
|
|
6
|
+
{
|
|
7
|
+
"inputs": [],
|
|
8
|
+
"stateMutability": "nonpayable",
|
|
9
|
+
"type": "constructor"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"internalType": "address",
|
|
15
|
+
"name": "target",
|
|
16
|
+
"type": "address"
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"name": "AddressEmptyCode",
|
|
20
|
+
"type": "error"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"inputs": [
|
|
24
|
+
{
|
|
25
|
+
"internalType": "address",
|
|
26
|
+
"name": "implementation",
|
|
27
|
+
"type": "address"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"name": "ERC1967InvalidImplementation",
|
|
31
|
+
"type": "error"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"inputs": [],
|
|
35
|
+
"name": "ERC1967NonPayable",
|
|
36
|
+
"type": "error"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"inputs": [],
|
|
40
|
+
"name": "FailedCall",
|
|
41
|
+
"type": "error"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"inputs": [],
|
|
45
|
+
"name": "InvalidInitialization",
|
|
46
|
+
"type": "error"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"inputs": [],
|
|
50
|
+
"name": "NotInitializing",
|
|
51
|
+
"type": "error"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"inputs": [],
|
|
55
|
+
"name": "UUPSUnauthorizedCallContext",
|
|
56
|
+
"type": "error"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"inputs": [
|
|
60
|
+
{
|
|
61
|
+
"internalType": "bytes32",
|
|
62
|
+
"name": "slot",
|
|
63
|
+
"type": "bytes32"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"name": "UUPSUnsupportedProxiableUUID",
|
|
67
|
+
"type": "error"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"anonymous": false,
|
|
71
|
+
"inputs": [
|
|
72
|
+
{
|
|
73
|
+
"indexed": false,
|
|
74
|
+
"internalType": "uint64",
|
|
75
|
+
"name": "version",
|
|
76
|
+
"type": "uint64"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"name": "Initialized",
|
|
80
|
+
"type": "event"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"anonymous": false,
|
|
84
|
+
"inputs": [
|
|
85
|
+
{
|
|
86
|
+
"indexed": false,
|
|
87
|
+
"internalType": "bytes4",
|
|
88
|
+
"name": "selector",
|
|
89
|
+
"type": "bytes4"
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"name": "MethodCalled",
|
|
93
|
+
"type": "event"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"anonymous": false,
|
|
97
|
+
"inputs": [
|
|
98
|
+
{
|
|
99
|
+
"indexed": true,
|
|
100
|
+
"internalType": "address",
|
|
101
|
+
"name": "implementation",
|
|
102
|
+
"type": "address"
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"name": "Upgraded",
|
|
106
|
+
"type": "event"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"inputs": [],
|
|
110
|
+
"name": "UPGRADE_INTERFACE_VERSION",
|
|
111
|
+
"outputs": [
|
|
112
|
+
{
|
|
113
|
+
"internalType": "string",
|
|
114
|
+
"name": "",
|
|
115
|
+
"type": "string"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"stateMutability": "view",
|
|
119
|
+
"type": "function"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"inputs": [],
|
|
123
|
+
"name": "callDirect",
|
|
124
|
+
"outputs": [],
|
|
125
|
+
"stateMutability": "nonpayable",
|
|
126
|
+
"type": "function"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"inputs": [],
|
|
130
|
+
"name": "callThru1967",
|
|
131
|
+
"outputs": [],
|
|
132
|
+
"stateMutability": "nonpayable",
|
|
133
|
+
"type": "function"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"inputs": [],
|
|
137
|
+
"name": "callThruAMP",
|
|
138
|
+
"outputs": [],
|
|
139
|
+
"stateMutability": "nonpayable",
|
|
140
|
+
"type": "function"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"inputs": [],
|
|
144
|
+
"name": "callThruAMPNonSkippedMethod",
|
|
145
|
+
"outputs": [],
|
|
146
|
+
"stateMutability": "nonpayable",
|
|
147
|
+
"type": "function"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"inputs": [],
|
|
151
|
+
"name": "callThruAMPSkippedMethod",
|
|
152
|
+
"outputs": [],
|
|
153
|
+
"stateMutability": "nonpayable",
|
|
154
|
+
"type": "function"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"inputs": [],
|
|
158
|
+
"name": "initialize",
|
|
159
|
+
"outputs": [],
|
|
160
|
+
"stateMutability": "nonpayable",
|
|
161
|
+
"type": "function"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"inputs": [],
|
|
165
|
+
"name": "proxiableUUID",
|
|
166
|
+
"outputs": [
|
|
167
|
+
{
|
|
168
|
+
"internalType": "bytes32",
|
|
169
|
+
"name": "",
|
|
170
|
+
"type": "bytes32"
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
"stateMutability": "view",
|
|
174
|
+
"type": "function"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"inputs": [],
|
|
178
|
+
"name": "pureMethod",
|
|
179
|
+
"outputs": [
|
|
180
|
+
{
|
|
181
|
+
"internalType": "uint256",
|
|
182
|
+
"name": "",
|
|
183
|
+
"type": "uint256"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"stateMutability": "pure",
|
|
187
|
+
"type": "function"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"inputs": [
|
|
191
|
+
{
|
|
192
|
+
"internalType": "address",
|
|
193
|
+
"name": "newImplementation",
|
|
194
|
+
"type": "address"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"internalType": "bytes",
|
|
198
|
+
"name": "data",
|
|
199
|
+
"type": "bytes"
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
"name": "upgradeToAndCall",
|
|
203
|
+
"outputs": [],
|
|
204
|
+
"stateMutability": "payable",
|
|
205
|
+
"type": "function"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"inputs": [],
|
|
209
|
+
"name": "viewMethod",
|
|
210
|
+
"outputs": [
|
|
211
|
+
{
|
|
212
|
+
"internalType": "address",
|
|
213
|
+
"name": "",
|
|
214
|
+
"type": "address"
|
|
215
|
+
}
|
|
216
|
+
],
|
|
217
|
+
"stateMutability": "view",
|
|
218
|
+
"type": "function"
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
"bytecode": "0x60a060405230608052348015610013575f5ffd5b5061001c610021565b6100d3565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff16156100715760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b03908116146100d05780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b6080516109086100f95f395f81816103bc015281816103e5015261052801526109085ff3fe60806040526004361061009a575f3560e01c80639ba7fcaa116100625780639ba7fcaa14610116578063ad3cb1cc1461012b578063becf8b4914610168578063caa719a81461017c578063e68be8a914610190578063fc7b17b9146101a4575f5ffd5b80634f1ef2861461009e57806352d1902d146100b357806375a62cfb146100da5780638129fc1c146100ee5780638c3fce0e14610102575b5f5ffd5b6100b16100ac36600461074a565b6101be565b005b3480156100be575f5ffd5b506100c76101d4565b6040519081526020015b60405180910390f35b3480156100e5575f5ffd5b506100b16101ef565b3480156100f9575f5ffd5b506100b161021d565b34801561010d575f5ffd5b506100b1610321565b348015610121575f5ffd5b506201e2406100c7565b348015610136575f5ffd5b5061015b604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516100d1919061081b565b348015610173575f5ffd5b506100b1610345565b348015610187575f5ffd5b506100b1610369565b34801561019b575f5ffd5b506100b161038d565b3480156101af575f5ffd5b506040513381526020016100d1565b6101c66103b1565b6101d08282610457565b5050565b5f6101dd61051d565b505f5160206108b35f395f51905f5290565b6040515f5160206108935f395f51905f5290610213906375a62cfb60e01b90610850565b60405180910390a1565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff165f811580156102625750825b90505f8267ffffffffffffffff16600114801561027e5750303b155b90508115801561028c575080155b156102aa5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156102d457845460ff60401b1916600160401b1785555b831561031a57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050565b6040515f5160206108935f395f51905f52906102139063461fe70760e11b90610850565b6040515f5160206108935f395f51905f52906102139063becf8b4960e01b90610850565b6040515f5160206108935f395f51905f529061021390631954e33560e31b90610850565b6040515f5160206108935f395f51905f52906102139063e68be8a960e01b90610850565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061043757507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661042b5f5160206108b35f395f51905f52546001600160a01b031690565b6001600160a01b031614155b156104555760405163703e46dd60e11b815260040160405180910390fd5b565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156104b1575060408051601f3d908101601f191682019092526104ae91810190610865565b60015b6104de57604051634c9c8ce360e01b81526001600160a01b03831660048201526024015b60405180910390fd5b5f5160206108b35f395f51905f52811461050e57604051632a87526960e21b8152600481018290526024016104d5565b6105188383610566565b505050565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104555760405163703e46dd60e11b815260040160405180910390fd5b61056f826105bb565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a28051156105b357610518828261061e565b6101d0610690565b806001600160a01b03163b5f036105f057604051634c9c8ce360e01b81526001600160a01b03821660048201526024016104d5565b5f5160206108b35f395f51905f5280546001600160a01b0319166001600160a01b0392909216919091179055565b60605f5f846001600160a01b03168460405161063a919061087c565b5f60405180830381855af49150503d805f8114610672576040519150601f19603f3d011682016040523d82523d5f602084013e610677565b606091505b50915091506106878583836106af565b95945050505050565b34156104555760405163b398979f60e01b815260040160405180910390fd5b6060826106c4576106bf8261070e565b610707565b81511580156106db57506001600160a01b0384163b155b1561070457604051639996b31560e01b81526001600160a01b03851660048201526024016104d5565b50805b9392505050565b80511561071d57805160208201fd5b60405163d6bda27560e01b815260040160405180910390fd5b634e487b7160e01b5f52604160045260245ffd5b5f5f6040838503121561075b575f5ffd5b82356001600160a01b0381168114610771575f5ffd5b9150602083013567ffffffffffffffff81111561078c575f5ffd5b8301601f8101851361079c575f5ffd5b803567ffffffffffffffff8111156107b6576107b6610736565b604051601f8201601f19908116603f0116810167ffffffffffffffff811182821017156107e5576107e5610736565b6040528181528282016020018710156107fc575f5ffd5b816020840160208301375f602083830101528093505050509250929050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b6001600160e01b031991909116815260200190565b5f60208284031215610875575f5ffd5b5051919050565b5f82518060208501845e5f92019182525091905056fe617c4c611bb184fbd3981dfb9b9f6d8419815420c7dfd77bb6de24d0d2d5147c360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220c0a1ae47485b869db394e008810abb3c35eecdc46cb221b2ddb879874daca0dd64736f6c634300081c0033",
|
|
222
|
+
"deployedBytecode": "0x60806040526004361061009a575f3560e01c80639ba7fcaa116100625780639ba7fcaa14610116578063ad3cb1cc1461012b578063becf8b4914610168578063caa719a81461017c578063e68be8a914610190578063fc7b17b9146101a4575f5ffd5b80634f1ef2861461009e57806352d1902d146100b357806375a62cfb146100da5780638129fc1c146100ee5780638c3fce0e14610102575b5f5ffd5b6100b16100ac36600461074a565b6101be565b005b3480156100be575f5ffd5b506100c76101d4565b6040519081526020015b60405180910390f35b3480156100e5575f5ffd5b506100b16101ef565b3480156100f9575f5ffd5b506100b161021d565b34801561010d575f5ffd5b506100b1610321565b348015610121575f5ffd5b506201e2406100c7565b348015610136575f5ffd5b5061015b604051806040016040528060058152602001640352e302e360dc1b81525081565b6040516100d1919061081b565b348015610173575f5ffd5b506100b1610345565b348015610187575f5ffd5b506100b1610369565b34801561019b575f5ffd5b506100b161038d565b3480156101af575f5ffd5b506040513381526020016100d1565b6101c66103b1565b6101d08282610457565b5050565b5f6101dd61051d565b505f5160206108b35f395f51905f5290565b6040515f5160206108935f395f51905f5290610213906375a62cfb60e01b90610850565b60405180910390a1565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff165f811580156102625750825b90505f8267ffffffffffffffff16600114801561027e5750303b155b90508115801561028c575080155b156102aa5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff1916600117855583156102d457845460ff60401b1916600160401b1785555b831561031a57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050565b6040515f5160206108935f395f51905f52906102139063461fe70760e11b90610850565b6040515f5160206108935f395f51905f52906102139063becf8b4960e01b90610850565b6040515f5160206108935f395f51905f529061021390631954e33560e31b90610850565b6040515f5160206108935f395f51905f52906102139063e68be8a960e01b90610850565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148061043757507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661042b5f5160206108b35f395f51905f52546001600160a01b031690565b6001600160a01b031614155b156104555760405163703e46dd60e11b815260040160405180910390fd5b565b816001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa9250505080156104b1575060408051601f3d908101601f191682019092526104ae91810190610865565b60015b6104de57604051634c9c8ce360e01b81526001600160a01b03831660048201526024015b60405180910390fd5b5f5160206108b35f395f51905f52811461050e57604051632a87526960e21b8152600481018290526024016104d5565b6105188383610566565b505050565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104555760405163703e46dd60e11b815260040160405180910390fd5b61056f826105bb565b6040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b905f90a28051156105b357610518828261061e565b6101d0610690565b806001600160a01b03163b5f036105f057604051634c9c8ce360e01b81526001600160a01b03821660048201526024016104d5565b5f5160206108b35f395f51905f5280546001600160a01b0319166001600160a01b0392909216919091179055565b60605f5f846001600160a01b03168460405161063a919061087c565b5f60405180830381855af49150503d805f8114610672576040519150601f19603f3d011682016040523d82523d5f602084013e610677565b606091505b50915091506106878583836106af565b95945050505050565b34156104555760405163b398979f60e01b815260040160405180910390fd5b6060826106c4576106bf8261070e565b610707565b81511580156106db57506001600160a01b0384163b155b1561070457604051639996b31560e01b81526001600160a01b03851660048201526024016104d5565b50805b9392505050565b80511561071d57805160208201fd5b60405163d6bda27560e01b815260040160405180910390fd5b634e487b7160e01b5f52604160045260245ffd5b5f5f6040838503121561075b575f5ffd5b82356001600160a01b0381168114610771575f5ffd5b9150602083013567ffffffffffffffff81111561078c575f5ffd5b8301601f8101851361079c575f5ffd5b803567ffffffffffffffff8111156107b6576107b6610736565b604051601f8201601f19908116603f0116810167ffffffffffffffff811182821017156107e5576107e5610736565b6040528181528282016020018710156107fc575f5ffd5b816020840160208301375f602083830101528093505050509250929050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b6001600160e01b031991909116815260200190565b5f60208284031215610875575f5ffd5b5051919050565b5f82518060208501845e5f92019182525091905056fe617c4c611bb184fbd3981dfb9b9f6d8419815420c7dfd77bb6de24d0d2d5147c360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbca2646970667358221220c0a1ae47485b869db394e008810abb3c35eecdc46cb221b2ddb879874daca0dd64736f6c634300081c0033",
|
|
223
|
+
"linkReferences": {},
|
|
224
|
+
"deployedLinkReferences": {}
|
|
225
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
|
|
5
|
+
import {IAccessManager} from "@openzeppelin/contracts/access/manager/IAccessManager.sol";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @title AccessManagedProxy
|
|
9
|
+
* @notice Proxy contract using IAccessManager to manage access control before delegating calls.
|
|
10
|
+
* @dev It's a variant of ERC1967Proxy.
|
|
11
|
+
*
|
|
12
|
+
* Currently the check is executed on any call received by the proxy contract even calls to view methods
|
|
13
|
+
* (staticcall). In the setup of the ACCESS_MANAGER permissions you would want to make all the views and pure
|
|
14
|
+
* functions enabled for the PUBLIC_ROLE.
|
|
15
|
+
*
|
|
16
|
+
* For gas efficiency, the ACCESS_MANAGER is immutable, so take care you don't lose control of it, otherwise
|
|
17
|
+
* it will make your contract inaccesible or other bad things will happen.
|
|
18
|
+
*
|
|
19
|
+
* Check https://forum.openzeppelin.com/t/accessmanagedproxy-is-a-good-idea/41917 for a discussion on the
|
|
20
|
+
* advantages and disadvantages of using it.
|
|
21
|
+
*
|
|
22
|
+
* @custom:security-contact security@ensuro.co
|
|
23
|
+
* @author Ensuro
|
|
24
|
+
*/
|
|
25
|
+
contract AccessManagedProxy is ERC1967Proxy {
|
|
26
|
+
/**
|
|
27
|
+
* @notice AccessManager contract that handles the permissions to access the implementation methods
|
|
28
|
+
*/
|
|
29
|
+
IAccessManager public immutable ACCESS_MANAGER;
|
|
30
|
+
|
|
31
|
+
// Error copied from IAccessManaged
|
|
32
|
+
error AccessManagedUnauthorized(address caller);
|
|
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
|
+
*
|
|
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
|
+
) payable ERC1967Proxy(implementation, _data) {
|
|
53
|
+
ACCESS_MANAGER = manager;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @notice Intercepts the super._delegate call to implement access control
|
|
58
|
+
* @dev Checks with the ACCESS_MANAGER if msg.sender is authorized to call the current call's function,
|
|
59
|
+
* and if so, delegates the current call to `implementation`.
|
|
60
|
+
* @param implementation The implementation contract
|
|
61
|
+
*
|
|
62
|
+
* This function does not return to its internal call site, it will return directly to the external caller.
|
|
63
|
+
*/
|
|
64
|
+
function _delegate(address implementation) internal virtual override {
|
|
65
|
+
bytes4 selector = bytes4(msg.data[0:4]);
|
|
66
|
+
bool immediate = _skipAC(selector); // reuse immediate variable both for skipped methods and canCall result
|
|
67
|
+
if (!immediate) {
|
|
68
|
+
(immediate, ) = ACCESS_MANAGER.canCall(msg.sender, address(this), selector);
|
|
69
|
+
if (!immediate) revert AccessManagedUnauthorized(msg.sender);
|
|
70
|
+
}
|
|
71
|
+
super._delegate(implementation);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @notice Returns whether to skip the access control validation or not
|
|
76
|
+
* @dev Hook called before ACCESS_MANAGER.canCall to enable skipping the call to the access manager for performance
|
|
77
|
+
* reasons (for example on views) or to remove access control for other specific cases
|
|
78
|
+
* @param selector The selector of the method called
|
|
79
|
+
* @return Whether the access control using ACCESS_MANAGER should be skipped or not
|
|
80
|
+
*/
|
|
81
|
+
// solhint-disable-next-line no-unused-vars
|
|
82
|
+
function _skipAC(bytes4 selector) internal view virtual returns (bool) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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 AccessManagedProxyS1
|
|
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 AccessManagedProxyS1 is AccessManagedProxy {
|
|
15
|
+
bytes4 internal immutable PASS_THRU_METHODS_0;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @notice Constructor of the proxy, defining the implementation and the access manager
|
|
19
|
+
* @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation` and
|
|
20
|
+
* with `manager` as the ACCESS_MANAGER that will handle access control.
|
|
21
|
+
*
|
|
22
|
+
* @param implementation The initial implementation contract.
|
|
23
|
+
* @param _data If nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
|
|
24
|
+
* encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
|
|
25
|
+
* @param manager The access manager that will handle access control
|
|
26
|
+
* @param passThruMethods The selector of methods that will skip the access control validation, typically used for
|
|
27
|
+
* views and other methods for gas optimization.
|
|
28
|
+
*
|
|
29
|
+
* Requirements:
|
|
30
|
+
*
|
|
31
|
+
* - If `data` is empty, `msg.value` must be zero.
|
|
32
|
+
*/
|
|
33
|
+
constructor(
|
|
34
|
+
address implementation,
|
|
35
|
+
bytes memory _data,
|
|
36
|
+
IAccessManager manager,
|
|
37
|
+
bytes4[1] memory passThruMethods
|
|
38
|
+
) payable AccessManagedProxy(implementation, _data, manager) {
|
|
39
|
+
PASS_THRU_METHODS_0 = passThruMethods[0];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/*
|
|
43
|
+
* @notice Skips the access control if the method called is one of the passThruMethods
|
|
44
|
+
* @dev See {PASS_THRU_METHODS()}
|
|
45
|
+
* @param selector The selector of the method called
|
|
46
|
+
* @return Whether the access control using ACCESS_MANAGER should be skipped or not
|
|
47
|
+
*/
|
|
48
|
+
function _skipAC(bytes4 selector) internal view override returns (bool) {
|
|
49
|
+
return
|
|
50
|
+
selector == PASS_THRU_METHODS_0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @notice Gives observability to the methods that are skipped from access control
|
|
55
|
+
* @dev This list is fixed and defined on contract construction
|
|
56
|
+
* @return methods The list of method selectors that skip ACCESS_MANAGER access control
|
|
57
|
+
*/
|
|
58
|
+
// solhint-disable-next-line func-name-mixedcase
|
|
59
|
+
function PASS_THRU_METHODS() external view returns (bytes4[] memory methods) {
|
|
60
|
+
methods = new bytes4[](1);
|
|
61
|
+
methods[0] = PASS_THRU_METHODS_0;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
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 AccessManagedProxyS10
|
|
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 AccessManagedProxyS10 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
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @notice Constructor of the proxy, defining the implementation and the access manager
|
|
28
|
+
* @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation` and
|
|
29
|
+
* with `manager` as the ACCESS_MANAGER that will handle access control.
|
|
30
|
+
*
|
|
31
|
+
* @param implementation The initial implementation contract.
|
|
32
|
+
* @param _data If nonempty, it's used as data in a delegate call to `implementation`. This will typically be an
|
|
33
|
+
* encoded function call, and allows initializing the storage of the proxy like a Solidity constructor.
|
|
34
|
+
* @param manager The access manager that will handle access control
|
|
35
|
+
* @param passThruMethods The selector of methods that will skip the access control validation, typically used for
|
|
36
|
+
* views and other methods for gas optimization.
|
|
37
|
+
*
|
|
38
|
+
* Requirements:
|
|
39
|
+
*
|
|
40
|
+
* - If `data` is empty, `msg.value` must be zero.
|
|
41
|
+
*/
|
|
42
|
+
constructor(
|
|
43
|
+
address implementation,
|
|
44
|
+
bytes memory _data,
|
|
45
|
+
IAccessManager manager,
|
|
46
|
+
bytes4[10] memory passThruMethods
|
|
47
|
+
) payable AccessManagedProxy(implementation, _data, manager) {
|
|
48
|
+
PASS_THRU_METHODS_0 = passThruMethods[0];
|
|
49
|
+
PASS_THRU_METHODS_1 = passThruMethods[1];
|
|
50
|
+
PASS_THRU_METHODS_2 = passThruMethods[2];
|
|
51
|
+
PASS_THRU_METHODS_3 = passThruMethods[3];
|
|
52
|
+
PASS_THRU_METHODS_4 = passThruMethods[4];
|
|
53
|
+
PASS_THRU_METHODS_5 = passThruMethods[5];
|
|
54
|
+
PASS_THRU_METHODS_6 = passThruMethods[6];
|
|
55
|
+
PASS_THRU_METHODS_7 = passThruMethods[7];
|
|
56
|
+
PASS_THRU_METHODS_8 = passThruMethods[8];
|
|
57
|
+
PASS_THRU_METHODS_9 = passThruMethods[9];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
* @notice Skips the access control if the method called is one of the passThruMethods
|
|
62
|
+
* @dev See {PASS_THRU_METHODS()}
|
|
63
|
+
* @param selector The selector of the method called
|
|
64
|
+
* @return Whether the access control using ACCESS_MANAGER should be skipped or not
|
|
65
|
+
*/
|
|
66
|
+
function _skipAC(bytes4 selector) internal view override returns (bool) {
|
|
67
|
+
return
|
|
68
|
+
selector == PASS_THRU_METHODS_0 ||
|
|
69
|
+
selector == PASS_THRU_METHODS_1 ||
|
|
70
|
+
selector == PASS_THRU_METHODS_2 ||
|
|
71
|
+
selector == PASS_THRU_METHODS_3 ||
|
|
72
|
+
selector == PASS_THRU_METHODS_4 ||
|
|
73
|
+
selector == PASS_THRU_METHODS_5 ||
|
|
74
|
+
selector == PASS_THRU_METHODS_6 ||
|
|
75
|
+
selector == PASS_THRU_METHODS_7 ||
|
|
76
|
+
selector == PASS_THRU_METHODS_8 ||
|
|
77
|
+
selector == PASS_THRU_METHODS_9;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* @notice Gives observability to the methods that are skipped from access control
|
|
82
|
+
* @dev This list is fixed and defined on contract construction
|
|
83
|
+
* @return methods The list of method selectors that skip ACCESS_MANAGER access control
|
|
84
|
+
*/
|
|
85
|
+
// solhint-disable-next-line func-name-mixedcase
|
|
86
|
+
function PASS_THRU_METHODS() external view returns (bytes4[] memory methods) {
|
|
87
|
+
methods = new bytes4[](10);
|
|
88
|
+
methods[0] = PASS_THRU_METHODS_0;
|
|
89
|
+
methods[1] = PASS_THRU_METHODS_1;
|
|
90
|
+
methods[2] = PASS_THRU_METHODS_2;
|
|
91
|
+
methods[3] = PASS_THRU_METHODS_3;
|
|
92
|
+
methods[4] = PASS_THRU_METHODS_4;
|
|
93
|
+
methods[5] = PASS_THRU_METHODS_5;
|
|
94
|
+
methods[6] = PASS_THRU_METHODS_6;
|
|
95
|
+
methods[7] = PASS_THRU_METHODS_7;
|
|
96
|
+
methods[8] = PASS_THRU_METHODS_8;
|
|
97
|
+
methods[9] = PASS_THRU_METHODS_9;
|
|
98
|
+
}
|
|
99
|
+
}
|