Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00Multichain Info
N/A
Loading...
Loading
Contract Name:
UpgradeableBeacon
Compiler Version
v0.8.22+commit.4fc1097e
Optimization Enabled:
No with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/UpgradeableBeacon.sol) pragma solidity ^0.8.20; import {IBeacon} from "./IBeacon.sol"; import {Ownable} from "../../access/Ownable.sol"; /** * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their * implementation contract, which is where they will delegate all function calls. * * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon. */ contract UpgradeableBeacon is IBeacon, Ownable { address private _implementation; /** * @dev The `implementation` of the beacon is invalid. */ error BeaconInvalidImplementation(address implementation); /** * @dev Emitted when the implementation returned by the beacon is changed. */ event Upgraded(address indexed implementation); /** * @dev Sets the address of the initial implementation, and the initial owner who can upgrade the beacon. */ constructor(address implementation_, address initialOwner) Ownable(initialOwner) { _setImplementation(implementation_); } /** * @dev Returns the current implementation address. */ function implementation() public view virtual returns (address) { return _implementation; } /** * @dev Upgrades the beacon to a new implementation. * * Emits an {Upgraded} event. * * Requirements: * * - msg.sender must be the owner of the contract. * - `newImplementation` must be a contract. */ function upgradeTo(address newImplementation) public virtual onlyOwner { _setImplementation(newImplementation); } /** * @dev Sets the implementation contract address for this beacon * * Requirements: * * - `newImplementation` must be a contract. */ function _setImplementation(address newImplementation) private { if (newImplementation.code.length == 0) { revert BeaconInvalidImplementation(newImplementation); } _implementation = newImplementation; emit Upgraded(newImplementation); } }
// 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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.20; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeacon { /** * @dev Must return an address that can be used as a delegate call target. * * {UpgradeableBeacon} will check that this address is a contract. */ function implementation() external view returns (address); }
// 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; } }
{ "evmVersion": "shanghai", "libraries": {}, "metadata": { "appendCBOR": true, "bytecodeHash": "ipfs", "useLiteralContent": false }, "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "remappings": [ "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/", "openzeppelin-erc20-basic/=lib/openzeppelin-contracts/contracts/token/ERC20/", "openzeppelin-erc20-extensions/=lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/", "openzeppelin-erc20/=lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/", "openzeppelin-math/=lib/openzeppelin-contracts/contracts/utils/math/", "openzeppelin-proxy/=lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/", "openzeppelin-utils/=lib/openzeppelin-contracts/contracts/utils/", "config/=lib/spectra-contracts-configs/script/", "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/", "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/", "spectra-contracts-configs/=lib/spectra-contracts-configs/" ], "viaIR": false }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"implementation_","type":"address"},{"internalType":"address","name":"initialOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"BeaconInvalidImplementation","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"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":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561000f575f80fd5b50604051610823380380610823833981810160405281019061003191906102c8565b805f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036100a2575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016100999190610315565b60405180910390fd5b6100b1816100c860201b60201c565b506100c18261018960201b60201c565b505061032e565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f8173ffffffffffffffffffffffffffffffffffffffff163b036101e457806040517f847ac5640000000000000000000000000000000000000000000000000000000081526004016101db9190610315565b60405180910390fd5b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6102978261026e565b9050919050565b6102a78161028d565b81146102b1575f80fd5b50565b5f815190506102c28161029e565b92915050565b5f80604083850312156102de576102dd61026a565b5b5f6102eb858286016102b4565b92505060206102fc858286016102b4565b9150509250929050565b61030f8161028d565b82525050565b5f6020820190506103285f830184610306565b92915050565b6104e88061033b5f395ff3fe608060405234801561000f575f80fd5b5060043610610055575f3560e01c80633659cfe6146100595780635c60da1b14610075578063715018a6146100935780638da5cb5b1461009d578063f2fde38b146100bb575b5f80fd5b610073600480360381019061006e919061045f565b6100d7565b005b61007d6100eb565b60405161008a9190610499565b60405180910390f35b61009b610113565b005b6100a5610126565b6040516100b29190610499565b60405180910390f35b6100d560048036038101906100d0919061045f565b61014d565b005b6100df6101d1565b6100e881610258565b50565b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61011b6101d1565b6101245f610339565b565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6101556101d1565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036101c5575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016101bc9190610499565b60405180910390fd5b6101ce81610339565b50565b6101d96103fa565b73ffffffffffffffffffffffffffffffffffffffff166101f7610126565b73ffffffffffffffffffffffffffffffffffffffff16146102565761021a6103fa565b6040517f118cdaa700000000000000000000000000000000000000000000000000000000815260040161024d9190610499565b60405180910390fd5b565b5f8173ffffffffffffffffffffffffffffffffffffffff163b036102b357806040517f847ac5640000000000000000000000000000000000000000000000000000000081526004016102aa9190610499565b60405180910390fd5b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f33905090565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61042e82610405565b9050919050565b61043e81610424565b8114610448575f80fd5b50565b5f8135905061045981610435565b92915050565b5f6020828403121561047457610473610401565b5b5f6104818482850161044b565b91505092915050565b61049381610424565b82525050565b5f6020820190506104ac5f83018461048a565b9291505056fea2646970667358221220086e1707a89d734c18fddcb88a7dafc84114e15bd208a8c7c401bdf2a3f2e56d64736f6c634300081600330000000000000000000000002c869c812bf8519e4a8dc42dcd8793ec09f776c1000000000000000000000000e59d75c87ed608e4f5f22c9f9affb7b6fd02cc7c
Deployed Bytecode
0x608060405234801561000f575f80fd5b5060043610610055575f3560e01c80633659cfe6146100595780635c60da1b14610075578063715018a6146100935780638da5cb5b1461009d578063f2fde38b146100bb575b5f80fd5b610073600480360381019061006e919061045f565b6100d7565b005b61007d6100eb565b60405161008a9190610499565b60405180910390f35b61009b610113565b005b6100a5610126565b6040516100b29190610499565b60405180910390f35b6100d560048036038101906100d0919061045f565b61014d565b005b6100df6101d1565b6100e881610258565b50565b5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61011b6101d1565b6101245f610339565b565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6101556101d1565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036101c5575f6040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016101bc9190610499565b60405180910390fd5b6101ce81610339565b50565b6101d96103fa565b73ffffffffffffffffffffffffffffffffffffffff166101f7610126565b73ffffffffffffffffffffffffffffffffffffffff16146102565761021a6103fa565b6040517f118cdaa700000000000000000000000000000000000000000000000000000000815260040161024d9190610499565b60405180910390fd5b565b5f8173ffffffffffffffffffffffffffffffffffffffff163b036102b357806040517f847ac5640000000000000000000000000000000000000000000000000000000081526004016102aa9190610499565b60405180910390fd5b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b5f805f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f33905090565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61042e82610405565b9050919050565b61043e81610424565b8114610448575f80fd5b50565b5f8135905061045981610435565b92915050565b5f6020828403121561047457610473610401565b5b5f6104818482850161044b565b91505092915050565b61049381610424565b82525050565b5f6020820190506104ac5f83018461048a565b9291505056fea2646970667358221220086e1707a89d734c18fddcb88a7dafc84114e15bd208a8c7c401bdf2a3f2e56d64736f6c63430008160033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000002c869c812bf8519e4a8dc42dcd8793ec09f776c1000000000000000000000000e59d75c87ed608e4f5f22c9f9affb7b6fd02cc7c
-----Decoded View---------------
Arg [0] : implementation_ (address): 0x2c869C812BF8519E4A8dc42dcd8793Ec09f776c1
Arg [1] : initialOwner (address): 0xe59d75C87ED608E4f5F22c9f9AFFb7b6fd02cc7C
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000002c869c812bf8519e4a8dc42dcd8793ec09f776c1
Arg [1] : 000000000000000000000000e59d75c87ed608e4f5f22c9f9affb7b6fd02cc7c
Loading...
Loading
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.