Source Code
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Cross-Chain Transactions
Loading...
Loading
Contract Name:
WatcherManager
Compiler Version
v0.8.17+commit.8df45f5f
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT OR Apache-2.0
pragma solidity 0.8.17;
import {ProposedOwnable} from "../shared/ProposedOwnable.sol";
/**
* @notice This contract manages a set of watchers. This is meant to be used as a shared resource that contracts can
* inherit to make use of the same watcher set.
*/
contract WatcherManager is ProposedOwnable {
// ============ Events ============
event WatcherAdded(address watcher);
event WatcherRemoved(address watcher);
// ============ Properties ============
mapping(address => bool) public isWatcher;
// ============ Constructor ============
constructor() ProposedOwnable() {
_setOwner(msg.sender);
}
// ============ Modifiers ============
// ============ Admin fns ============
/**
* @dev Owner can enroll a watcher (abilities are defined by inheriting contracts)
*/
function addWatcher(address _watcher) external onlyOwner {
require(!isWatcher[_watcher], "already watcher");
isWatcher[_watcher] = true;
emit WatcherAdded(_watcher);
}
/**
* @dev Owner can unenroll a watcher (abilities are defined by inheriting contracts)
*/
function removeWatcher(address _watcher) external onlyOwner {
require(isWatcher[_watcher], "!exist");
delete isWatcher[_watcher];
emit WatcherRemoved(_watcher);
}
/**
* @notice Remove ability to renounce ownership
* @dev Renounce ownership should be impossible as long as the watcher griefing
* vector exists. You can still propose `address(0)`, but it will never be accepted.
*/
function renounceOwnership() public virtual override onlyOwner {
require(false, "prohibited");
}
}// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.17;
import {IProposedOwnable} from "./interfaces/IProposedOwnable.sol";
/**
* @title ProposedOwnable
* @notice 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 via a two step process:
* 1. Call `proposeOwner`
* 2. Wait out the delay period
* 3. Call `acceptOwner`
*
* @dev 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.
*
* @dev The majority of this code was taken from the openzeppelin Ownable
* contract
*
*/
abstract contract ProposedOwnable is IProposedOwnable {
// ========== Custom Errors ===========
error ProposedOwnable__onlyOwner_notOwner();
error ProposedOwnable__onlyProposed_notProposedOwner();
error ProposedOwnable__ownershipDelayElapsed_delayNotElapsed();
error ProposedOwnable__proposeNewOwner_invalidProposal();
error ProposedOwnable__proposeNewOwner_noOwnershipChange();
error ProposedOwnable__renounceOwnership_noProposal();
error ProposedOwnable__renounceOwnership_invalidProposal();
// ============ Properties ============
address private _owner;
address private _proposed;
uint256 private _proposedOwnershipTimestamp;
uint256 private constant _delay = 7 days;
// ======== Getters =========
/**
* @notice Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @notice Returns the address of the proposed owner.
*/
function proposed() public view virtual returns (address) {
return _proposed;
}
/**
* @notice Returns the address of the proposed owner.
*/
function proposedTimestamp() public view virtual returns (uint256) {
return _proposedOwnershipTimestamp;
}
/**
* @notice Returns the delay period before a new owner can be accepted.
*/
function delay() public view virtual returns (uint256) {
return _delay;
}
/**
* @notice Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
if (_owner != msg.sender) revert ProposedOwnable__onlyOwner_notOwner();
_;
}
/**
* @notice Throws if called by any account other than the proposed owner.
*/
modifier onlyProposed() {
if (_proposed != msg.sender) revert ProposedOwnable__onlyProposed_notProposedOwner();
_;
}
/**
* @notice Throws if the ownership delay has not elapsed
*/
modifier ownershipDelayElapsed() {
// Ensure delay has elapsed
if ((block.timestamp - _proposedOwnershipTimestamp) <= _delay)
revert ProposedOwnable__ownershipDelayElapsed_delayNotElapsed();
_;
}
/**
* @notice Indicates if the ownership has been renounced() by
* checking if current owner is address(0)
*/
function renounced() public view returns (bool) {
return _owner == address(0);
}
// ======== External =========
/**
* @notice Sets the timestamp for an owner to be proposed, and sets the
* newly proposed owner as step 1 in a 2-step process
*/
function proposeNewOwner(address newlyProposed) public virtual onlyOwner {
// Contract as source of truth
if (_proposed == newlyProposed && _proposedOwnershipTimestamp != 0)
revert ProposedOwnable__proposeNewOwner_invalidProposal();
// Sanity check: reasonable proposal
if (_owner == newlyProposed) revert ProposedOwnable__proposeNewOwner_noOwnershipChange();
_setProposed(newlyProposed);
}
/**
* @notice Renounces ownership of the contract after a delay
*/
function renounceOwnership() public virtual onlyOwner ownershipDelayElapsed {
// Ensure there has been a proposal cycle started
if (_proposedOwnershipTimestamp == 0) revert ProposedOwnable__renounceOwnership_noProposal();
// Require proposed is set to 0
if (_proposed != address(0)) revert ProposedOwnable__renounceOwnership_invalidProposal();
// Emit event, set new owner, reset timestamp
_setOwner(address(0));
}
/**
* @notice Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function acceptProposedOwner() public virtual onlyProposed ownershipDelayElapsed {
// NOTE: no need to check if _owner == _proposed, because the _proposed
// is 0-d out and this check is implicitly enforced by modifier
// NOTE: no need to check if _proposedOwnershipTimestamp > 0 because
// the only time this would happen is if the _proposed was never
// set (will fail from modifier) or if the owner == _proposed (checked
// above)
// Emit event, set new owner, reset timestamp
_setOwner(_proposed);
}
// ======== Internal =========
function _setOwner(address newOwner) internal {
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
delete _proposedOwnershipTimestamp;
delete _proposed;
}
function _setProposed(address newlyProposed) private {
_proposedOwnershipTimestamp = block.timestamp;
_proposed = newlyProposed;
emit OwnershipProposed(newlyProposed);
}
}// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
/**
* @title IProposedOwnable
* @notice Defines a minimal interface for ownership with a two step proposal and acceptance
* process
*/
interface IProposedOwnable {
/**
* @dev This emits when change in ownership of a contract is proposed.
*/
event OwnershipProposed(address indexed proposedOwner);
/**
* @dev This emits when ownership of a contract changes.
*/
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @notice Get the address of the owner
* @return owner_ The address of the owner.
*/
function owner() external view returns (address owner_);
/**
* @notice Get the address of the proposed owner
* @return proposed_ The address of the proposed.
*/
function proposed() external view returns (address proposed_);
/**
* @notice Set the address of the proposed owner of the contract
* @param newlyProposed The proposed new owner of the contract
*/
function proposeNewOwner(address newlyProposed) external;
/**
* @notice Set the address of the proposed owner of the contract
*/
function acceptProposedOwner() external;
}{
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [],
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ProposedOwnable__onlyOwner_notOwner","type":"error"},{"inputs":[],"name":"ProposedOwnable__onlyProposed_notProposedOwner","type":"error"},{"inputs":[],"name":"ProposedOwnable__ownershipDelayElapsed_delayNotElapsed","type":"error"},{"inputs":[],"name":"ProposedOwnable__proposeNewOwner_invalidProposal","type":"error"},{"inputs":[],"name":"ProposedOwnable__proposeNewOwner_noOwnershipChange","type":"error"},{"inputs":[],"name":"ProposedOwnable__renounceOwnership_invalidProposal","type":"error"},{"inputs":[],"name":"ProposedOwnable__renounceOwnership_noProposal","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"proposedOwner","type":"address"}],"name":"OwnershipProposed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"watcher","type":"address"}],"name":"WatcherAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"watcher","type":"address"}],"name":"WatcherRemoved","type":"event"},{"inputs":[],"name":"acceptProposedOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_watcher","type":"address"}],"name":"addWatcher","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"delay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWatcher","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newlyProposed","type":"address"}],"name":"proposeNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"proposed","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proposedTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_watcher","type":"address"}],"name":"removeWatcher","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounced","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b5061001a3361001f565b610084565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b039092166001600160a01b0319928316178155600255600180549091169055565b6105fa806100936000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80638da5cb5b116100715780638da5cb5b1461011e578063b1f8100d14610143578063c5b350df14610156578063d1851c921461015e578063d232c2201461016f578063ec2b13451461018157600080fd5b806324bdff8c146100ae5780633cf52ffb146100c35780636a42b8f8146100da578063715018a6146100e357806384785ecd146100eb575b600080fd5b6100c16100bc36600461056d565b610194565b005b6002545b6040519081526020015b60405180910390f35b62093a806100c7565b6100c161027a565b61010e6100f936600461056d565b60036020526000908152604090205460ff1681565b60405190151581526020016100d1565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100d1565b6100c161015136600461056d565b6102dc565b6100c161037d565b6001546001600160a01b031661012b565b6000546001600160a01b03161561010e565b6100c161018f36600461056d565b6103ed565b6000546001600160a01b031633146101bf576040516311a8a1bb60e31b815260040160405180910390fd5b6001600160a01b03811660009081526003602052604090205460ff161561021f5760405162461bcd60e51b815260206004820152600f60248201526e30b63932b0b23c903bb0ba31b432b960891b60448201526064015b60405180910390fd5b6001600160a01b038116600081815260036020908152604091829020805460ff1916600117905590519182527fbd71030f437353231b6e5bedade573b1e0da5cb6e8bdde37c33c1fea986c29c791015b60405180910390a150565b6000546001600160a01b031633146102a5576040516311a8a1bb60e31b815260040160405180910390fd5b60405162461bcd60e51b815260206004820152600a6024820152691c1c9bda1a589a5d195960b21b6044820152606401610216565b565b6000546001600160a01b03163314610307576040516311a8a1bb60e31b815260040160405180910390fd5b6001546001600160a01b038281169116148015610325575060025415155b15610343576040516311bc066560e11b815260040160405180910390fd5b6000546001600160a01b0380831691160361037157604051634a2fb73f60e11b815260040160405180910390fd5b61037a816104ba565b50565b6001546001600160a01b031633146103a8576040516311a7f27160e11b815260040160405180910390fd5b62093a80600254426103ba919061059d565b116103d8576040516324e0285f60e21b815260040160405180910390fd5b6001546102da906001600160a01b0316610508565b6000546001600160a01b03163314610418576040516311a8a1bb60e31b815260040160405180910390fd5b6001600160a01b03811660009081526003602052604090205460ff166104695760405162461bcd60e51b815260206004820152600660248201526508595e1a5cdd60d21b6044820152606401610216565b6001600160a01b038116600081815260036020908152604091829020805460ff1916905590519182527ffa8eab6357bec870e7048c2413cbaa813236bb29ebac113541a76fef429e94dc910161026f565b42600255600180546001600160a01b0319166001600160a01b0383169081179091556040517f6ab4d119f23076e8ad491bc65ce85f017fb0591dce08755ba8591059cc51737a90600090a250565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b039092166001600160a01b0319928316178155600255600180549091169055565b60006020828403121561057f57600080fd5b81356001600160a01b038116811461059657600080fd5b9392505050565b818103818111156105be57634e487b7160e01b600052601160045260246000fd5b9291505056fea26469706673582212203062aca59eb8d126511deacd14118a20eb90f63721de93f013330a1f1503a78f64736f6c63430008110033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80638da5cb5b116100715780638da5cb5b1461011e578063b1f8100d14610143578063c5b350df14610156578063d1851c921461015e578063d232c2201461016f578063ec2b13451461018157600080fd5b806324bdff8c146100ae5780633cf52ffb146100c35780636a42b8f8146100da578063715018a6146100e357806384785ecd146100eb575b600080fd5b6100c16100bc36600461056d565b610194565b005b6002545b6040519081526020015b60405180910390f35b62093a806100c7565b6100c161027a565b61010e6100f936600461056d565b60036020526000908152604090205460ff1681565b60405190151581526020016100d1565b6000546001600160a01b03165b6040516001600160a01b0390911681526020016100d1565b6100c161015136600461056d565b6102dc565b6100c161037d565b6001546001600160a01b031661012b565b6000546001600160a01b03161561010e565b6100c161018f36600461056d565b6103ed565b6000546001600160a01b031633146101bf576040516311a8a1bb60e31b815260040160405180910390fd5b6001600160a01b03811660009081526003602052604090205460ff161561021f5760405162461bcd60e51b815260206004820152600f60248201526e30b63932b0b23c903bb0ba31b432b960891b60448201526064015b60405180910390fd5b6001600160a01b038116600081815260036020908152604091829020805460ff1916600117905590519182527fbd71030f437353231b6e5bedade573b1e0da5cb6e8bdde37c33c1fea986c29c791015b60405180910390a150565b6000546001600160a01b031633146102a5576040516311a8a1bb60e31b815260040160405180910390fd5b60405162461bcd60e51b815260206004820152600a6024820152691c1c9bda1a589a5d195960b21b6044820152606401610216565b565b6000546001600160a01b03163314610307576040516311a8a1bb60e31b815260040160405180910390fd5b6001546001600160a01b038281169116148015610325575060025415155b15610343576040516311bc066560e11b815260040160405180910390fd5b6000546001600160a01b0380831691160361037157604051634a2fb73f60e11b815260040160405180910390fd5b61037a816104ba565b50565b6001546001600160a01b031633146103a8576040516311a7f27160e11b815260040160405180910390fd5b62093a80600254426103ba919061059d565b116103d8576040516324e0285f60e21b815260040160405180910390fd5b6001546102da906001600160a01b0316610508565b6000546001600160a01b03163314610418576040516311a8a1bb60e31b815260040160405180910390fd5b6001600160a01b03811660009081526003602052604090205460ff166104695760405162461bcd60e51b815260206004820152600660248201526508595e1a5cdd60d21b6044820152606401610216565b6001600160a01b038116600081815260036020908152604091829020805460ff1916905590519182527ffa8eab6357bec870e7048c2413cbaa813236bb29ebac113541a76fef429e94dc910161026f565b42600255600180546001600160a01b0319166001600160a01b0383169081179091556040517f6ab4d119f23076e8ad491bc65ce85f017fb0591dce08755ba8591059cc51737a90600090a250565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b039092166001600160a01b0319928316178155600255600180549091169055565b60006020828403121561057f57600080fd5b81356001600160a01b038116811461059657600080fd5b9392505050565b818103818111156105be57634e487b7160e01b600052601160045260246000fd5b9291505056fea26469706673582212203062aca59eb8d126511deacd14118a20eb90f63721de93f013330a1f1503a78f64736f6c63430008110033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.29
Net Worth in FRAX
0.356331
Token Allocations
WETH
100.00%
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|---|---|---|---|---|
| BLAST | 100.00% | $2,888.6 | 0.0001 | $0.2888 |
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.