execute
Executes a transaction (called directly from an admin, or by entryPoint)
_target
The target contract to call.
_value
The amount of native tokens to send to the target contract.
_calldata
The bytes
calldata to send to the target contract.
function execute(
address _target,
uint256 _value,
bytes calldata _calldata
) external virtual onlyAdminOrEntrypoint {
_call(_target, _value, _calldata);
}
executeBatch
Executes a sequence transaction (called directly from an admin, or by entryPoint)
_target
The target contracts to call.
_value
The amounts of native tokens to send to the target contracts.
_calldata
The bytes
calldata to send to the target contracts.
function executeBatch(
address[] calldata _target,
uint256[] calldata _value,
bytes[] calldata _calldata
) external virtual onlyAdminOrEntrypoint {
require(_target.length == _calldata.length && _target.length == _value.length, "Account: wrong array lengths.");
for (uint256 i = 0; i < _target.length; i++) {
_call(_target[i], _value[i], _calldata[i]);
}
}
_call
Calls a target contract and reverts if it fails.
_target
The target contract to call.
_value
The amount of native tokens to send to the target contract.
_calldata
The bytes
calldata to send to the target contract.
function _call(
address _target,
uint256 value,
bytes memory _calldata
) internal {
(bool success, bytes memory result) = _target.call{ value: value }(_calldata);
if (!success) {
assembly {
revert(add(result, 32), mload(result))
}
}
}
_canSetContractURI
Returns whether contract metadata can be set in the given execution context.
function _canSetContractURI() internal view virtual override returns (bool) {
return hasRole(DEFAULT_ADMIN_ROLE, msg.sender);
}
_setupRole
Registers a signer in the factory.
role
The role to set up. Must be of type bytes32
.
account
The address of the account to register for the role.
function _setupRole(bytes32 role, address account) internal virtual override {
super._setupRole(role, account);
if (role == SIGNER_ROLE && factory.code.length > 0) {
IAccountFactory(factory).addSigner(account);
}
}
_revokeRole
Un-registers a signer in the factory.
role
The role to revoke. Must be of type bytes32
.
account
The address of the account to un-register for the role.
function _revokeRole(bytes32 role, address account) internal virtual override {
super._revokeRole(role, account);
if (role == SIGNER_ROLE && factory.code.length > 0) {
IAccountFactory(factory).removeSigner(account);
}
}