This contract provides an access control mechanism, where an owner can register operator accounts that can call arbitrary contracts on behalf of this contract.
The owner account is initially set as the deployer address.
mapping(address => bool) operators
constructor(address initialOwner) public
Sets the initial owner of the contract.
modifier onlyOperator()
Modifier that requires the msg.sender
to be an operator.
Reverts with a NotOperator error if the condition is not met.
function isOperator(address account) external view returns (bool)
Returns whether an address is an operator.
Name | Type | Description |
---|---|---|
account | address | Address to check |
Name | Type | Description |
---|---|---|
[0] | bool | boolean whether the address is an operator |
function addOperator(address operator) external
Adds an address as an operator.
Can only be called by the current owner.
Name | Type | Description |
---|---|---|
operator | address | address to be added as operator |
function removeOperator(address operator) external
Removes an address as an operator.
Can only be called by the current owner.
Name | Type | Description |
---|---|---|
operator | address | address to be removed as operator |
function executeContract(address target, bytes callData, uint256 nativeValue) external payable returns (bytes)
Allows an operator to execute arbitrary functions on any smart contract.
Can only be called by an operator.
Name | Type | Description |
---|---|---|
target | address | address of the contract to execute the function on. Existence is not checked. |
callData | bytes | ABI encoded function call to execute on target |
nativeValue | uint256 | The amount of native asset to send with the call. If nativeValue is set to 0 , then msg.value is forwarded instead. |
Name | Type | Description |
---|---|---|
[0] | bytes | data return data from executed function call |
receive() external payable
This function enables the contract to accept native value transfers.