PermissionedProxy
Description​
PermissionedProxy is a minimal access-control contract. It defines a single admin, an operator allowlist, and a deny-list of function selectors. Meant to be inherited by other contracts.
Variables​
admin
- Description - The admin with ability to perform any action, including setting a new admin admin, managing operators, and managing the deny-list.
- Type -
address - Used By
onlyAdmin
- Updated By
- Read By
admin()
operators
- Description - A mapping of addresses to operator status. Each address in the mapping that maps to true is enabled as an operator.
- Type -
mapping(address => bool) - Used By
onlyOperator
- Updated By
- Read By
operators(address)
permissionedCalls
- Description - A mapping of function selectors to true/false value. If the mapping of a function selector is true, then the proxied call is not allowed for that function.
- Type -
mapping(bytes4 => bool) - Used By
- Updated By
- Read By
permissionedCalls(bytes4)
Modifiers​
onlyAdmin
- Description - Restricts function execution to the
adminaddress. - Reverts
- With
"PD"ifmsg.sender != admin.
- With
onlyOperator
- Description - Restricts function execution to addresses with
operators[msg.sender] == true. - Reverts
- With
"PD"ifoperators[msg.sender] != true.
- With
Functions​
Admin Actions​
setAdmin(address _admin)
- Description - Sets the admin to a new address.
@param _admin- The new admin address.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
- With
"zero"if_admin == address(0).
- With
- Emits
setOperator(address _operator, bool value)
- Description - Adds or removes an address from the operator allowlist.
@param _operator- Address to update.@param value-trueto enable as an operator,falseto disable as an operator.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Reverts
- With
"zero"if_operator == address(0).
- With
- Emits
setPermissionedCall(bytes4 sig, bool value)
- Description - Marks a function selector as denied (
true) or allowed (false) forproxy(...)forwarding.@param sig- The function selector to modify.@param value- A true/false value.trueto disable proxied calls,falseto allow proxied calls.
- Visibility Specifier - external
- State Mutability Specifier - nonpayable
- Emits
proxy(address vault, bytes data)
- Description - Forwards a call to the
vaultwith the passeddata. The function must not be disabled for proxied calls through the deny list. ETH is also forwarded.@param vault- The address of the vault contract to call.@param data- ABI-encoded calldata indiciating the selector of the function to call on the vault.
- Visibility Specifier - external
- State Mutability Specifier - payable
- Access Control -
onlyAdmin - Reverts
- With
"SEL"ifdata.length < 4. - With
"PD"if the selector is on the deny list. - With
"failed"if the forwarded call returnssuccess == false.
- With
- Emits - none
Events​
-
AdminUpdated(address indexed admin)- emitted when the admin address is updated. -
OperatorUpdated(address indexed operator)- emitted when an operator address is added or removed. -
AddedPermissionedCall(bytes4 indexed sig)- emitted when a function selector’s deny list status is updated.