Forkchoice Ethereum Mainnet

Address Contract Verified

Address 0xc3a6CfC4c8112fBfd77f0d095a0eE2f2F4505Eef
Balance 0 ETH
Nonce 1
Code Size 3324 bytes
Indexed Transactions 0 (1 on-chain, 1.5% indexed)
External Etherscan · Sourcify

Contract Bytecode

3324 bytes
Copy Bytecode
0x6080604052600436106100bf575f3560e01c806379ba50971161007c578063c4b0bbab11610057578063c4b0bbab14610215578063c7b785e814610229578063e30c397814610248578063f2fde38b14610265575f5ffd5b806379ba5097146101c6578063879c5fa2146101da5780638da5cb5b146101f9575f5ffd5b80631fa5635e146100c35780632b71cbfd146100e4578063444714151461011057806354fd4d50146101305780636429212d1461016d578063715018a6146101b2575b5f5ffd5b3480156100ce575f5ffd5b506100e26100dd36600461096a565b610284565b005b3480156100ef575f5ffd5b506040515f516020610ca75f395f51905f5281526020015b60405180910390f35b61012361011e36600461099b565b6102df565b6040516101079190610a3a565b34801561013b575f5ffd5b50610160604051806040016040528060058152602001640312e302e360dc1b81525081565b6040516101079190610a9d565b348015610178575f5ffd5b5061019a610187366004610aaf565b5f516020610ca75f395f51905f52015490565b6040516001600160a01b039091168152602001610107565b3480156101bd575f5ffd5b506100e261049e565b3480156101d1575f5ffd5b506100e26104b1565b3480156101e5575f5ffd5b506100e26101f436600461096a565b6104f5565b348015610204575f5ffd5b505f546001600160a01b031661019a565b348015610220575f5ffd5b5061016061063d565b348015610234575f5ffd5b50610160610243366004610aaf565b6106ab565b348015610253575f5ffd5b506001546001600160a01b031661019a565b348015610270575f5ffd5b506100e261027f366004610ac8565b610741565b5f61029c835f516020610ca75f395f51905f52015490565b6001600160a01b03161482906102d05760405163027b58bf60e41b815260ff90911660048201526024015b60405180910390fd5b506102db82826104f5565b5050565b60605f8267ffffffffffffffff8111156102fb576102fb610ae1565b60405190808252806020026020018201604052801561032e57816020015b60608152602001906001900390816103195790505b5090505f5b83811015610496575f61039086868481811061035157610351610af5565b90506020028101906103639190610b09565b5f81811061037357610373610af5565b919091013560f81c90505f516020610ca75f395f51905f52015490565b90506001600160a01b03811615158686848181106103b0576103b0610af5565b90506020028101906103c29190610b09565b5f8181106103d2576103d2610af5565b919091013560f81c91905061040057604051634f2da44960e11b815260ff90911660048201526024016102c7565b506104708187878581811061041757610417610af5565b90506020028101906104299190610b09565b610437916001908290610b53565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506107b192505050565b83838151811061048257610482610af5565b602090810291909101015250600101610333565b509392505050565b6104a6610823565b6104af5f61084f565b565b60015433906001600160a01b031681146104e95760405163118cdaa760e01b81526001600160a01b03821660048201526024016102c7565b6104f28161084f565b50565b6104fd610823565b5f816001600160a01b03166306fdde036040518163ffffffff1660e01b81526004015f60405180830381865afa158015610539573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526105609190810190610b7a565b905080515f036105835760405163441ea50560e01b815260040160405180910390fd5b5f5f516020610ca75f395f51905f52905082848201558360ff167fedc7f66a6391d877278e0356bf1610da9f641d3c879afb07d520d1a42fbd97d384856001600160a01b03166306fdde036040518163ffffffff1660e01b81526004015f60405180830381865afa1580156105fa573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526106219190810190610b7a565b60405161062f929190610c2d565b60405180910390a250505050565b60605f5b60ff81811610156106a7575f610664825f516020610ca75f395f51905f52015490565b90506001600160a01b03811661067957505090565b828160405160200161068c929190610c6f565b60408051601f19818403018152919052925050600101610641565b5090565b60605f6106c5835f516020610ca75f395f51905f52015490565b90506001600160a01b0381161561073b57806001600160a01b03166306fdde036040518163ffffffff1660e01b81526004015f60405180830381865afa158015610711573d5f5f3e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526107389190810190610b7a565b91505b50919050565b610749610823565b600180546001600160a01b0383166001600160a01b031990911681179091556107795f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b60605f5f846001600160a01b0316846040516107cd9190610c9b565b5f60405180830381855af49150503d805f8114610805576040519150601f19603f3d011682016040523d82523d5f602084013e61080a565b606091505b509150915061081a858383610868565b95945050505050565b5f546001600160a01b031633146104af5760405163118cdaa760e01b81523360048201526024016102c7565b600180546001600160a01b03191690556104f2816108c7565b60608261087d5761087882610916565b6108c0565b815115801561089457506001600160a01b0384163b155b156108bd57604051639996b31560e01b81526001600160a01b03851660048201526024016102c7565b50805b9392505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8051156109265780518082602001fd5b60405163d6bda27560e01b815260040160405180910390fd5b803560ff8116811461094f575f5ffd5b919050565b80356001600160a01b038116811461094f575f5ffd5b5f5f6040838503121561097b575f5ffd5b6109848361093f565b915061099260208401610954565b90509250929050565b5f5f602083850312156109ac575f5ffd5b823567ffffffffffffffff8111156109c2575f5ffd5b8301601f810185136109d2575f5ffd5b803567ffffffffffffffff8111156109e8575f5ffd5b8560208260051b84010111156109fc575f5ffd5b6020919091019590945092505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b5f602082016020835280845180835260408501915060408160051b8601019250602086015f5b82811015610a9157603f19878603018452610a7c858351610a0c565b94506020938401939190910190600101610a60565b50929695505050505050565b602081525f6108c06020830184610a0c565b5f60208284031215610abf575f5ffd5b6108c08261093f565b5f60208284031215610ad8575f5ffd5b6108c082610954565b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b5f5f8335601e19843603018112610b1e575f5ffd5b83018035915067ffffffffffffffff821115610b38575f5ffd5b602001915036819003821315610b4c575f5ffd5b9250929050565b5f5f85851115610b61575f5ffd5b83861115610b6d575f5ffd5b5050820193919092039150565b5f60208284031215610b8a575f5ffd5b815167ffffffffffffffff811115610ba0575f5ffd5b8201601f81018413610bb0575f5ffd5b805167ffffffffffffffff811115610bca57610bca610ae1565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715610bf957610bf9610ae1565b604052818152828201602001861015610c10575f5ffd5b8160208401602083015e5f91810160200191909152949350505050565b6001600160a01b03831681526040602082018190525f90610c5090830184610a0c565b949350505050565b5f81518060208401855e5f93019283525090919050565b5f610c7a8285610c58565b60609390931b6bffffffffffffffffffffffff191683525050601401919050565b5f6108c08284610c5856fe5fb198ff3ff065a7e746cc70c28b38b1f3eeaf1a559ede71c28b60a0759b061ba2646970667358221220952f75fa1e30d3df8b51646ad3bdbae4f986d7ccddf7478dbe7ceb2c543749b864736f6c634300081c0033

Verified Source Code Full Match

Compiler: v0.8.28+commit.7893614a EVM: cancun Optimization: Yes (200 runs)
Router.sol 178 lines
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.28;

import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {Ownable2Step, Ownable} from "@openzeppelin/contracts/access/Ownable2Step.sol";

import {IRouter} from "src/interfaces/IRouter.sol";
import {IRouterModule} from "src/interfaces/IRouterModule.sol";

/// @title Router.
/// @author Stake DAO
/// @custom:github @stake-dao
/// @custom:contact [email protected]

/// @notice Router serves as the single entry point for all Staking V2 operations.
///         It allows for the execution of arbitrary delegate calls to registered modules,
///         enabling modular functionality extension while maintaining a unified interface.
contract Router is IRouter, Ownable2Step {
    ///////////////////////////////////////////////////////////////
    // --- CONSTANTS
    ///////////////////////////////////////////////////////////////

    /// @notice The storage buffer for the modules
    /// @dev Instead of using a traditional mapping that hashes the key to calculate the slot,
    ///      we directly use the unique identifier of each module as the storage slot.
    ///
    ///      The storage buffer exists to avoid future collisions. Note the owner of this
    ///      contract takes one slot in storage (slot 0).
    ///
    ///      The value of the buffer is equal to the keccak256 hash of the constant
    ///      string "STAKEDAO.STAKING.V2.ROUTER.V1", meaning the modules will be
    ///      stored starting at slot `0x5fb198ff3ff065a7e746cc70c28b38b1f3eeaf1a559ede71c28b60a0759b061b`.
    ///      This is a gas cost optimization made possible due to the simplicity of the storage layout.
    bytes32 internal constant $buffer = keccak256("STAKEDAO.STAKING.V2.ROUTER.V1");
    string public constant version = "1.0.0";

    ///////////////////////////////////////////////////////////////
    // --- EVENTS - ERRORS
    ///////////////////////////////////////////////////////////////

    // @notice Thrown when trying to set a module with an empty name
    error EmptyModuleName();

    /// @notice Emitted when a module is set
    /// @param identifier The unique identifier of the module (indexed value)
    /// @param module The address of the module
    /// @param name The name of the module
    event ModuleSet(uint8 indexed identifier, address module, string name);

    // @notice Thrown when a module is already set
    // @dev Only thrown when setting a module in safe mode

    error IdentifierAlreadyUsed(uint8 identifier);

    // @notice Thrown when trying to call a module that is not set
    error ModuleNotSet(uint8 identifier);

    constructor() Ownable(msg.sender) {}

    ///////////////////////////////////////////////////////////////
    // --- MODULES MANAGEMENT
    ///////////////////////////////////////////////////////////////

    /**
     * @notice Gets the storage buffer used to store the modules.
     *         The buffer acts as an offset for the storage of modules.
     * @return buffer The storage buffer
     */
    function getStorageBuffer() public pure returns (bytes32 buffer) {
        buffer = $buffer;
    }

    /// @notice Sets a module
    /// @dev The module is set at the storage slot `buffer + identifier`
    ///
    ///      While not enforced by the code, developers are expected to use
    ///      incremental identifiers when setting modules.
    ///      This allows modules to be enumerated using the `enumerateModules` helper.
    ///      Note that this is just a convention, and modules should be indexed off-chain for
    ///      efficiency and correctness.
    /// @param identifier The unique identifier of the module
    /// @param module The address of the module
    /// @custom:throws OwnableUnauthorizedAccount if the caller is not the owner
    function setModule(uint8 identifier, address module) public onlyOwner {
        string memory moduleName = IRouterModule(module).name();
        require(bytes(moduleName).length != 0, EmptyModuleName());

        bytes32 buffer = getStorageBuffer();
        assembly ("memory-safe") {
            sstore(add(buffer, identifier), module)
        }

        emit ModuleSet(identifier, module, IRouterModule(module).name());
    }

    /// @notice Sets a module in safe mode
    /// @dev The module can be set to address(0) to erase it
    /// @param identifier The unique identifier of the module
    /// @param module The address of the module
    /// @custom:throws OwnableUnauthorizedAccount if the caller is not the owner
    /// @custom:throws IdentifierAlreadyUsed if the identifier is already set
    function safeSetModule(uint8 identifier, address module) external {
        require(getModule(identifier) == address(0), IdentifierAlreadyUsed(identifier));

        setModule(identifier, module);
    }

    /// @notice Gets the module at the given identifier
    /// @param identifier The unique identifier of the module
    /// @return module The address of the module. Returns address(0) if the module is not set
    function getModule(uint8 identifier) public view returns (address module) {
        bytes32 buffer = getStorageBuffer();
        assembly ("memory-safe") {
            module := sload(add(buffer, identifier))
        }
    }

    /// @notice Gets the name of the module at the given identifier
    /// @param identifier The unique identifier of the module
    /// @return name The name of the module. Returns an empty string if the module is not set
    function getModuleName(uint8 identifier) public view returns (string memory name) {
        address module = getModule(identifier);
        if (module != address(0)) name = IRouterModule(module).name();
    }

    /// @notice Convenient function to enumerate the incrementally stored modules
    /// @dev Never call this function on-chain. It is only meant to be used off-chain for informational purposes.
    ///      This function should not replace off-chain indexing of the modules.
    ///
    ///      This function stops iterating when it encounters address(0). This means that
    ///      if the modules are not stored contiguously, this function will return only a subset of the modules.
    /// @return modules The concatenated addresses of the modules in a bytes array.
    ///                 The length of the returned bytes array is `20 * n`, where `n` is the number of modules.
    ///                 Returns an empty bytes array if the first slot is not set.
    function enumerateModules() external view returns (bytes memory modules) {
        for (uint8 i; i < type(uint8).max; i++) {
            address module = getModule(i);

            if (module == address(0)) break;

            modules = abi.encodePacked(modules, module);
        }
    }

    ///////////////////////////////////////////////////////////////
    // --- EXECUTION
    ///////////////////////////////////////////////////////////////

    /// @notice Executes a batch of delegate calls to registered modules.
    /// @dev Each element in the `calls` array must be encoded as:
    ///      - 1 byte: the module identifier (`uint8`), corresponding to a registered module.
    ///      - N bytes: Optional ABI-encoded call data using `abi.encodeWithSelector(...)`, where:
    ///         - The first 4 bytes represent the function selector.
    ///         - The remaining bytes (a multiple of 32) represent the function arguments.
    ///
    ///      Example: `bytes.concat(bytes1(identifier), abi.encodeWithSelector(...))`
    ///
    ///      All calls are performed using `delegatecall`, so state changes affect this contract.
    /// @param calls An array of encoded calls. Each call must start with a 1-byte module identifier
    ///              followed by the ABI-encoded function call data.
    /// @return returnData An array containing the returned data for each call, in order.
    /// @custom:throws OwnableUnauthorizedAccount if the caller is not the owner
    /// @custom:throws ModuleNotSet if the module for a given identifier is not set
    /// @custom:throws _ if a `calls[i]` element is empty
    function execute(bytes[] calldata calls) external payable returns (bytes[] memory) {
        bytes[] memory returnData = new bytes[](calls.length);

        for (uint256 i; i < calls.length; i++) {
            address module = getModule(uint8(calls[i][0]));
            require(module != address(0), ModuleNotSet(uint8(calls[i][0])));

            // `calls[i][1:]` is the optional calldata, including the function selector, w/o the module identifier
            returnData[i] = Address.functionDelegateCall(module, calls[i][1:]);
        }

        return returnData;
    }
}
Address.sol 150 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (utils/Address.sol)

pragma solidity ^0.8.20;

import {Errors} from "./Errors.sol";

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert Errors.InsufficientBalance(address(this).balance, amount);
        }

        (bool success, bytes memory returndata) = recipient.call{value: amount}("");
        if (!success) {
            _revert(returndata);
        }
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {Errors.FailedCall} error.
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert Errors.InsufficientBalance(address(this).balance, value);
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
     * of an unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {Errors.FailedCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            assembly ("memory-safe") {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert Errors.FailedCall();
        }
    }
}
Ownable2Step.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.20;

import {Ownable} from "./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.
 *
 * This extension of the {Ownable} contract includes a two-step mechanism to transfer
 * ownership, where the new owner must call {acceptOwnership} in order to replace the
 * old one. This can help prevent common mistakes, such as transfers of ownership to
 * incorrect accounts, or to contracts that are unable to interact with the
 * permission system.
 *
 * The initial owner is specified at deployment time in the constructor for `Ownable`. 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.
     *
     * Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer.
     */
    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() public virtual {
        address sender = _msgSender();
        if (pendingOwner() != sender) {
            revert OwnableUnauthorizedAccount(sender);
        }
        _transferOwnership(sender);
    }
}
IRouter.sol 11 lines
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.28;

interface IRouter {
    function execute(bytes[] calldata data) external payable returns (bytes[] memory returnData);
    function setModule(uint8 identifier, address module) external;
    function safeSetModule(uint8 identifier, address module) external;
    function getModule(uint8 identifier) external view returns (address module);
    function getModuleName(uint8 identifier) external view returns (string memory name);
    function version() external view returns (string memory version);
}
IRouterModule.sol 7 lines
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.28;

interface IRouterModule {
    function name() external view returns (string memory name);
    function version() external view returns (string memory version);
}
Errors.sol 34 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of common custom errors used in multiple contracts
 *
 * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
 * It is recommended to avoid relying on the error API for critical functionality.
 *
 * _Available since v5.1._
 */
library Errors {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error InsufficientBalance(uint256 balance, uint256 needed);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedCall();

    /**
     * @dev The deployment failed.
     */
    error FailedDeployment();

    /**
     * @dev A necessary precompile is missing.
     */
    error MissingPrecompile(address);
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../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.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @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 {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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 {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _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);
    }
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

Read Contract

enumerateModules 0xc4b0bbab → bytes
getModule 0x6429212d → address
getModuleName 0xc7b785e8 → string
getStorageBuffer 0x2b71cbfd → bytes32
owner 0x8da5cb5b → address
pendingOwner 0xe30c3978 → address
version 0x54fd4d50 → string

Write Contract 6 functions

These functions modify contract state and require a wallet transaction to execute.

acceptOwnership 0x79ba5097
No parameters
execute 0x44471415
bytes[] calls
returns: bytes[]
renounceOwnership 0x715018a6
No parameters
safeSetModule 0x1fa5635e
uint8 identifier
address module
setModule 0x879c5fa2
uint8 identifier
address module
transferOwnership 0xf2fde38b
address newOwner

Recent Transactions

This address has 1 on-chain transactions, but only 1.5% of the chain is indexed. Transactions will appear as indexing progresses. View on Etherscan →