Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- AccountGuardian
- Optimization enabled
- true
- Compiler version
- v0.8.17+commit.8df45f5f
- Optimization runs
- 200
- EVM Version
- london
- Verified at
- 2024-06-06T14:06:17.292040Z
Constructor Arguments
0x000000000000000000000000781b6a527482828bb04f33563797d4b696ddf328
Arg [0] (address) : 0x781b6a527482828bb04f33563797d4b696ddf328
src/AccountGuardian.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "@openzeppelin/contracts/access/Ownable2Step.sol";
/**
* @dev Manages upgrade and cross-chain execution settings for accounts
*/
contract AccountGuardian is Ownable2Step {
/**
* @dev mapping from implementation => is trusted
*/
mapping(address => bool) public isTrustedImplementation;
/**
* @dev mapping from cross-chain executor => is trusted
*/
mapping(address => bool) public isTrustedExecutor;
event TrustedImplementationUpdated(address implementation, bool trusted);
event TrustedExecutorUpdated(address executor, bool trusted);
constructor(address owner) {
_transferOwnership(owner);
}
/**
* @dev Sets a given implementation address as trusted, allowing accounts to upgrade to this
* implementation
*/
function setTrustedImplementation(address implementation, bool trusted) external onlyOwner {
isTrustedImplementation[implementation] = trusted;
emit TrustedImplementationUpdated(implementation, trusted);
}
/**
* @dev Sets a given cross-chain executor address as trusted, allowing it to relay operations to
* accounts on non-native chains
*/
function setTrustedExecutor(address executor, bool trusted) external onlyOwner {
isTrustedExecutor[executor] = trusted;
emit TrustedExecutorUpdated(executor, trusted);
}
}
lib/openzeppelin-contracts/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/Ownable2Step.sol)
pragma solidity ^0.8.0;
import "./Ownable.sol";
/**
* @dev Contract module which provides access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership} and {acceptOwnership}.
*
* This module is used through inheritance. It will make available all functions
* from parent (Ownable).
*/
abstract contract Ownable2Step is Ownable {
address private _pendingOwner;
event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
/**
* @dev Returns the address of the pending owner.
*/
function pendingOwner() public view virtual returns (address) {
return _pendingOwner;
}
/**
* @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual override onlyOwner {
_pendingOwner = newOwner;
emit OwnershipTransferStarted(owner(), newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual override {
delete _pendingOwner;
super._transferOwnership(newOwner);
}
/**
* @dev The new owner accepts the ownership transfer.
*/
function acceptOwnership() external {
address sender = _msgSender();
require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
_transferOwnership(sender);
}
}
lib/openzeppelin-contracts/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
Compiler Settings
{"viaIR":false,"remappings":["ds-test/=lib/forge-std/lib/ds-test/src/","forge-std/=lib/forge-std/src/","@openzeppelin/=lib/openzeppelin-contracts/","@account-abstraction/=lib/account-abstraction/","erc6551/=lib/erc6551/src/","erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/","@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/","multicall-authenticated/=lib/multicall-authenticated/src/","account-abstraction/=lib/account-abstraction/contracts/","openzeppelin-contracts/=lib/openzeppelin-contracts/"],"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":200,"enabled":true},"metadata":{"useLiteralContent":false,"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"london"}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"event","name":"OwnershipTransferStarted","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"TrustedExecutorUpdated","inputs":[{"type":"address","name":"executor","internalType":"address","indexed":false},{"type":"bool","name":"trusted","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"TrustedImplementationUpdated","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":false},{"type":"bool","name":"trusted","internalType":"bool","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"acceptOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isTrustedExecutor","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isTrustedImplementation","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"pendingOwner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTrustedExecutor","inputs":[{"type":"address","name":"executor","internalType":"address"},{"type":"bool","name":"trusted","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTrustedImplementation","inputs":[{"type":"address","name":"implementation","internalType":"address"},{"type":"bool","name":"trusted","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b506040516105b83803806105b883398101604081905261002f916100be565b61003833610047565b61004181610047565b506100ee565b600180546001600160a01b031916905561006b8161006e602090811b61034817901c565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100d057600080fd5b81516001600160a01b03811681146100e757600080fd5b9392505050565b6104bb806100fd6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c806379ba50971161006657806379ba5097146101105780638da5cb5b146101185780639472c8c91461013d578063e30c397814610150578063f2fde38b1461016157600080fd5b80631506fd4d14610098578063483c088e146100d0578063672657ca146100e5578063715018a614610108575b600080fd5b6100bb6100a6366004610427565b60026020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b6100e36100de366004610449565b610174565b005b6100bb6100f3366004610427565b60036020526000908152604090205460ff1681565b6100e36101e0565b6100e36101f4565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100c7565b6100e361014b366004610449565b610273565b6001546001600160a01b0316610125565b6100e361016f366004610427565b6102d7565b61017c610398565b6001600160a01b038216600081815260026020908152604091829020805460ff19168515159081179091558251938452908301527fd83c86b130b16028e237253bca8d22285f6de074a58017e569658653ed5bc36f91015b60405180910390a15050565b6101e8610398565b6101f260006103f2565b565b60015433906001600160a01b031681146102675760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b610270816103f2565b50565b61027b610398565b6001600160a01b038216600081815260036020908152604091829020805460ff19168515159081179091558251938452908301527f373e917f5345a453dc2334dfe07f6cdd8576bda4f79c0e323b3827b419ebaf4091016101d4565b6102df610398565b600180546001600160a01b0383166001600160a01b031990911681179091556103106000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b031633146101f25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161025e565b600180546001600160a01b031916905561027081610348565b80356001600160a01b038116811461042257600080fd5b919050565b60006020828403121561043957600080fd5b6104428261040b565b9392505050565b6000806040838503121561045c57600080fd5b6104658361040b565b91506020830135801515811461047a57600080fd5b80915050925092905056fea2646970667358221220bb21b73192200212e30a08e675c6361ed845c08930fab2bbb1cee7ac9d88007b64736f6c63430008110033000000000000000000000000781b6a527482828bb04f33563797d4b696ddf328
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100935760003560e01c806379ba50971161006657806379ba5097146101105780638da5cb5b146101185780639472c8c91461013d578063e30c397814610150578063f2fde38b1461016157600080fd5b80631506fd4d14610098578063483c088e146100d0578063672657ca146100e5578063715018a614610108575b600080fd5b6100bb6100a6366004610427565b60026020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b6100e36100de366004610449565b610174565b005b6100bb6100f3366004610427565b60036020526000908152604090205460ff1681565b6100e36101e0565b6100e36101f4565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100c7565b6100e361014b366004610449565b610273565b6001546001600160a01b0316610125565b6100e361016f366004610427565b6102d7565b61017c610398565b6001600160a01b038216600081815260026020908152604091829020805460ff19168515159081179091558251938452908301527fd83c86b130b16028e237253bca8d22285f6de074a58017e569658653ed5bc36f91015b60405180910390a15050565b6101e8610398565b6101f260006103f2565b565b60015433906001600160a01b031681146102675760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b610270816103f2565b50565b61027b610398565b6001600160a01b038216600081815260036020908152604091829020805460ff19168515159081179091558251938452908301527f373e917f5345a453dc2334dfe07f6cdd8576bda4f79c0e323b3827b419ebaf4091016101d4565b6102df610398565b600180546001600160a01b0383166001600160a01b031990911681179091556103106000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b031633146101f25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161025e565b600180546001600160a01b031916905561027081610348565b80356001600160a01b038116811461042257600080fd5b919050565b60006020828403121561043957600080fd5b6104428261040b565b9392505050565b6000806040838503121561045c57600080fd5b6104658361040b565b91506020830135801515811461047a57600080fd5b80915050925092905056fea2646970667358221220bb21b73192200212e30a08e675c6361ed845c08930fab2bbb1cee7ac9d88007b64736f6c63430008110033