More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Upgrade To | 39589463 | 6 days ago | IN | 0 xDAI | 0.0001062 |
Latest 2 internal transactions
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
39589463 | 6 days ago | Contract Creation | 0 xDAI | |||
39589463 | 6 days ago | Contract Creation | 0 xDAI |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x13e6aC30...6B0A93734 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
Proxy
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 1000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; import { ERC1967Utils } from "./libraries/ERC1967Utils.sol"; /// @dev Initial implementation of an upgradeable proxy. /// This contract must be deployed as first proxy implementation /// before any other implementation can be deployed. contract InitialImplementation { error NotInitialOwner(address caller); /// @dev Upgrades the implementation of the proxy to `implementation` and calls `data` on it. /// If `data` is nonempty, it's used as data in a delegate call to `implementation`. /// If caller is not the temporary owner of the proxy (saved in the storage slot not(0)), it will revert. /// Slot not(0) is set to 0 when the proxy is upgraded. function upgradeTo(address implementation, bytes memory data) external { assembly ("memory-safe") { if iszero(eq(caller(), sload(not(0)))) { // NotInitialOwner selector mstore(0, 0x483ffb99) mstore(32, caller()) revert(28, 36) } sstore(not(0), 0) } ERC1967Utils.upgradeToAndCall(implementation, data); } } /// @dev This contract provides a fallback function that delegates all calls to another contract using the EVM /// instruction `delegatecall`. /// /// Delegation to the implementation can be triggered manually through the {_fallback} function. /// /// The success and return data of the delegated call will be returned back to the caller of the proxy. contract Proxy { // ========================= // constructor // ========================= /// @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation`. /// /// If `_data` is nonempty, it's used as data in a delegate call to `implementation`. This will typically be an /// encoded function call, and allows initializing the storage of the proxy like a Solidity constructor. /// /// Requirements: /// /// - If `data` is empty, `msg.value` must be zero. constructor(address initialOwner) { assembly { sstore(not(0), initialOwner) // save caller as temporary owner } ERC1967Utils.upgradeToAndCall(address(new InitialImplementation()), bytes("")); } // ========================= // fallbacks // ========================= /// @dev Fallback function that delegates calls to the address returned by `ERC1967Utils.getImplementation()`. /// Will run if no other function in the contract matches the call data. fallback() external payable { address implementation = ERC1967Utils.getImplementation(); assembly ("memory-safe") { // Copy msg.data. We take full control of memory in this inline assembly // block because it will not return to Solidity code. We overwrite the // Solidity scratch pad at memory position 0. calldatacopy(0, 0, calldatasize()) // Call the implementation. // out and outsize are 0 because we don't know the size yet. let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0) // Copy the returned data. returndatacopy(0, 0, returndatasize()) switch result // delegatecall returns 0 on error. case 0 { revert(0, returndatasize()) } default { return(0, returndatasize()) } } } /// @notice Function to receive Native currency. receive() external payable { } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.19; library ERC1967Utils { // ========================= // immutable storage // ========================= /// @dev Storage slot with the address of the current implementation. /// This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1. bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; // ========================= // events // ========================= /// @dev Emitted when the implementation is upgraded. event Upgraded(address indexed implementation); // ========================= // errors // ========================= /// @dev The `implementation` of the proxy is invalid. error ERC1967_InvalidImplementation(address implementation); /// @dev An upgrade function sees `msg.value > 0` that may be lost. error ERC1967_NonPayable(); /// @dev A call to an address target failed. The target may have reverted. error ERC1967_FailedInnerCall(); // ========================= // main functions // ========================= /// @dev Returns the current implementation address. function getImplementation() internal view returns (address implementation) { assembly ("memory-safe") { implementation := sload(IMPLEMENTATION_SLOT) } } /// @dev Stores a new address in the EIP1967 implementation slot. function setImplementation(address newImplementation) internal { assembly ("memory-safe") { if iszero(extcodesize(newImplementation)) { // "ERC1967_InvalidImplementation(address)" selector mstore(0, 0x4a4a0aa2) mstore(32, newImplementation) revert(28, 36) } sstore(IMPLEMENTATION_SLOT, newImplementation) } } /// @dev Performs implementation upgrade with additional setup call if data is nonempty. /// This function is payable only if the setup call is performed, otherwise `msg.value` is rejected /// to avoid stuck value in the contract. /// /// Emits an {IERC1967-Upgraded} event. function upgradeToAndCall(address newImplementation, bytes memory data) internal { setImplementation(newImplementation); emit Upgraded(newImplementation); if (data.length > 0) { (bool success, bytes memory returndata) = newImplementation.delegatecall(data); if (!success) { // 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") { revert(add(32, returndata), mload(returndata)) } } else { revert ERC1967_FailedInnerCall(); } } } else { _checkNonPayable(); } } // ========================= // private functions // ========================= /// @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract /// if an upgrade doesn't perform an initialization call. function _checkNonPayable() private { if (msg.value > 0) { revert ERC1967_NonPayable(); } } }
{ "remappings": [ "ds-test/=lib/solarray/lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "solarray/=lib/solarray/src/" ], "optimizer": { "enabled": true, "runs": 1000 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"initialOwner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ERC1967_FailedInnerCall","type":"error"},{"inputs":[],"name":"ERC1967_NonPayable","type":"error"},{"stateMutability":"payable","type":"fallback"},{"stateMutability":"payable","type":"receive"}]
Deployed Bytecode
0x608060405236600a57005b600060337f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b90503660008037600080366000845af43d6000803e8080156053573d6000f35b3d6000fdfea2646970667358221220064f3bd5e34592ee91aec04ca124290ae532ff39ff36a49f24abd002edead1fa64736f6c63430008130033
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
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.