false
false
0
The new Blockscout UI is now open source! Learn how to deploy it here
- We're indexing this chain right now. Some of the counts may be inaccurate.

Contract Address Details

0xADF5aacfA254FbC566d3b81e04b95db4bCF7b40F

Contract Name
UpgradeableProxyADFS
Creator
0x9b35af–0a1a52 at 0xb02ae8–59083c
Balance
0 ETH
Tokens
Fetching tokens...
Transactions
31,920 Transactions
Transfers
0 Transfers
Gas Used
2,054,701,469
Last Balance Update
2635458
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
UpgradeableProxyADFS




Optimization enabled
true
Compiler version
v0.8.28+commit.7893614a




Optimization runs
200
EVM Version
paris




Verified at
2025-06-02T12:47:49.155848Z

Constructor Arguments

0x00000000000000000000000053adbdaa3ee8725de80bf97173b1f1a0a48036de

Arg [0] (address) : 0x53adbdaa3ee8725de80bf97173b1f1a0a48036de

              

contracts/UpgradeableProxyADFS.sol

// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: Copyright (c) 2024-2025 Schelling Point Labs Inc.
pragma solidity ^0.8.28;

//    ___  __         __                           _  __    __                  __
//   / _ )/ /__  ____/ /__ ___ ___ ___  ___ ___   / |/ /__ / /__    _____  ____/ /__
//  / _  / / _ \/ __/  '_/(_-</ -_) _ \(_-</ -_) /    / -_) __/ |/|/ / _ \/ __/  '_/
// /____/_/\___/\__/_/\_\/___/\__/_//_/___/\__/ /_/|_/\__/\__/|__,__/\___/_/ /_/\_\
//    _____   ____  ___    ___   ___  ________
//   / __/ | / /  |/  /   / _ | / _ \/ __/ __/
//  / _/ | |/ / /|_/ /   / __ |/ // / _/_\ \
// /___/ |___/_/  /_/   /_/ |_/____/_/ /___/
//
// Website:         https://blocksense.network/
// Git Repository:  https://github.com/blocksense-network/blocksense

/// @title UpgradeableProxyADFS
/// @author Aneta Tsvetkova
/// @notice Implements an upgradeable proxy for the Blocksense
/// Aggregated Data Feed Store (ADFS) contract.
///
/// @dev Non-management calls are delegated to the contract address stored in
/// IMPLEMENTATION_SLOT, which is upgradeable by the admin stored in the
/// ADMIN_SLOT.
///
/// Storage layout:
///   * Management space: [0 to 2**128-2**116)
///              0x0000 - latest blocknumber (used by the implementation)
///              0x0001 - implementation slot (used by this contract)
///              0x0002 - admin slot (used by this contract)
///                 ... - additional management space reserved for ADFS
///   *  ADFS data space: [2**128-2**116 to 2**160)
///
/// This contract intentionally deviates from the EIP-1967 slot scheme.
/// It was co-designed with ADFS to accomodate its custom low-level
/// storage management requirements.
///
/// Note that this deviation has implications on storage isolation and
/// upgrade safety.
contract UpgradeableProxyADFS {
  /// @notice Storage slot for the implementation address.
  /// @dev Non-management calls are delegated to this address.
  bytes32 internal constant IMPLEMENTATION_SLOT =
    0x0000000000000000000000000000000000000000000000000000000000000001;

  /// @notice Storage slot for the admin address of the upgradeable proxy.
  /// @dev This address is authorized to perform management operations, such as
  /// upgrading the implementation.
  bytes32 internal constant ADMIN_SLOT =
    0x0000000000000000000000000000000000000000000000000000000000000002;

  /// @notice The selector for the _upgradeToAndCall function.
  bytes4 internal constant UPGRADE_TO_AND_CALL_SELECTOR = 0x00000001;

  /// @notice The selector for the _setAdmin function.
  bytes4 internal constant SET_ADMIN_SELECTOR = 0x00000002;

  /// @notice Emitted when the implementation is upgraded
  /// @param implementation The new implementation address
  event Upgraded(address indexed implementation);

  /// @notice Emitted when the admin is changed
  /// @param newAdmin The new admin address
  event AdminSet(address indexed newAdmin);

  /// @notice Thrown when a non-admin attempts to perform an admin-only action.
  error ProxyDeniedAdminAccess();

  /// @notice Thrown when attempting to upgrade to an invalid implementation address.
  /// @param value The address that was attempted for upgrade
  error InvalidUpgrade(address value);

  /// @notice Thrown when an upgrade function sees `msg.value > 0` that may be lost.
  error ERC1967NonPayable();

  /// @notice Construct the UpgradeableProxy contract
  /// @param owner The address of the admin
  constructor(address owner) payable {
    _setAdmin(owner);
  }

  /// @notice Fallback function
  /// @dev Fallback function for delegating calls to the implementation contract.
  ///
  /// This function delegates non-management calls to the implementation address.
  ///
  /// Management operations are reserved for calls whose first 4 bytes (msg.sig) equal:
  ///   * 0x00000001 - _upgradeToAndCall(address newImplementation, bytes memory data)
  ///   * 0x00000002 - _setAdmin(address newAdmin)
  /// Only the admin is allowed to execute these management operations;
  /// all others will revert with ProxyDeniedAdminAccess.
  ///
  /// Note: Unlike OpenZeppelin's Transparent Proxy, the admin can invoke both
  /// management functions and delegate calls. The implementation contract is responsible
  /// for enforcing any further security measures.
  ///
  /// Note: The 0x00 prefix in the calldata helps avoid clashes in ADFS' custom
  /// function selector.
  fallback() external payable {
    if (
      msg.sig == UPGRADE_TO_AND_CALL_SELECTOR || msg.sig == SET_ADMIN_SELECTOR
    ) {
      bool isAdmin;

      assembly {
        isAdmin := eq(caller(), sload(ADMIN_SLOT))
      }

      if (!isAdmin) revert ProxyDeniedAdminAccess();

      if (msg.sig == UPGRADE_TO_AND_CALL_SELECTOR) {
        _upgradeToAndCall(address(bytes20(msg.data[4:])), msg.data[24:]);
        return;
      } else if (msg.sig == SET_ADMIN_SELECTOR) {
        _setAdmin(address(bytes20(msg.data[4:])));
        return;
      }
    }

    assembly {
      // 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(),
        sload(IMPLEMENTATION_SLOT),
        0,
        calldatasize(),
        0,
        0
      )

      if iszero(result) {
        revert(0, returndatasize())
      }

      // Copy the returned data.
      returndatacopy(0, 0, returndatasize())

      return(0, returndatasize())
    }
  }

  /// @notice Upgrades the implementation to a new contract.
  /// @param newImplementation The address of the new implementation
  /// @dev Validates that the new address contains contract code before
  /// storing.
  function _upgradeToAndCall(
    address newImplementation,
    bytes memory data
  ) internal {
    if (newImplementation.code.length == 0) {
      revert InvalidUpgrade(newImplementation);
    }

    assembly {
      sstore(IMPLEMENTATION_SLOT, newImplementation)
    }
    emit Upgraded(newImplementation);

    if (data.length > 0) {
      assembly {
        let result := delegatecall(
          gas(),
          newImplementation,
          add(data, 0x20),
          mload(data),
          0,
          0
        )
        if iszero(result) {
          revert(0, 0)
        }
      }
    } else if (msg.value > 0) {
      revert ERC1967NonPayable();
    }
  }

  /// @notice Sets a new admin address for the proxy.
  /// @param newAdmin The address of the new admin.
  /// @dev Passing address(0) revokes further upgrade permissions.
  function _setAdmin(address newAdmin) internal {
    assembly {
      sstore(ADMIN_SLOT, newAdmin)
    }
    emit AdminSet(newAdmin);
  }
}
        

Compiler Settings

{"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{},"evmVersion":"paris"}
              

Contract ABI

[{"type":"constructor","stateMutability":"payable","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"error","name":"ERC1967NonPayable","inputs":[]},{"type":"error","name":"InvalidUpgrade","inputs":[{"type":"address","name":"value","internalType":"address"}]},{"type":"error","name":"ProxyDeniedAdminAccess","inputs":[]},{"type":"event","name":"AdminSet","inputs":[{"type":"address","name":"newAdmin","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Upgraded","inputs":[{"type":"address","name":"implementation","internalType":"address","indexed":true}],"anonymous":false},{"type":"fallback","stateMutability":"payable"}]
              

Contract Creation Code

0x608060405260405161037d38038061037d8339810160408190526020916068565b602781602c565b506096565b60028190556040516001600160a01b038216907f8fe72c3e0020beb3234e76ae6676fa576fbfcae600af1c4fea44784cf0db329c90600090a250565b600060208284031215607957600080fd5b81516001600160a01b0381168114608f57600080fd5b9392505050565b6102d8806100a56000396000f3fe60806040526000356001600160e01b031916600160e01b148061003157506000356001600160e01b031916600160e11b145b1561011257600254331480610059576040516334ad5dbb60e21b815260040160405180910390fd5b6001600160e01b03196000358116016100d3576100d161007d36600481600061022b565b61008691610255565b60601c61009736601881600061022b565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061013792505050565b005b6001600160e11b03196000356001600160e01b03191601610110576100d16100ff36600481600061022b565b61010891610255565b60601c6101ef565b505b36600080376000803660006001545af48061012c573d6000fd5b503d6000803e3d6000f35b816001600160a01b03163b6000036101715760405163c72492e960e01b81526001600160a01b038316600482015260240160405180910390fd5b60018290556040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28051156101cc57600080825160208401855af4806101c757600080fd5b505050565b34156101eb5760405163b398979f60e01b815260040160405180910390fd5b5050565b60028190556040516001600160a01b038216907f8fe72c3e0020beb3234e76ae6676fa576fbfcae600af1c4fea44784cf0db329c90600090a250565b6000808585111561023b57600080fd5b8386111561024857600080fd5b5050820193919092039150565b80356bffffffffffffffffffffffff19811690601484101561029b576bffffffffffffffffffffffff196bffffffffffffffffffffffff198560140360031b1b82161691505b509291505056fea2646970667358221220c0858dd399174668415e4841d86991848e2743e309eed5a88158c51ac921c36064736f6c634300081c003300000000000000000000000053adbdaa3ee8725de80bf97173b1f1a0a48036de

Deployed ByteCode

0x60806040526000356001600160e01b031916600160e01b148061003157506000356001600160e01b031916600160e11b145b1561011257600254331480610059576040516334ad5dbb60e21b815260040160405180910390fd5b6001600160e01b03196000358116016100d3576100d161007d36600481600061022b565b61008691610255565b60601c61009736601881600061022b565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061013792505050565b005b6001600160e11b03196000356001600160e01b03191601610110576100d16100ff36600481600061022b565b61010891610255565b60601c6101ef565b505b36600080376000803660006001545af48061012c573d6000fd5b503d6000803e3d6000f35b816001600160a01b03163b6000036101715760405163c72492e960e01b81526001600160a01b038316600482015260240160405180910390fd5b60018290556040516001600160a01b038316907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a28051156101cc57600080825160208401855af4806101c757600080fd5b505050565b34156101eb5760405163b398979f60e01b815260040160405180910390fd5b5050565b60028190556040516001600160a01b038216907f8fe72c3e0020beb3234e76ae6676fa576fbfcae600af1c4fea44784cf0db329c90600090a250565b6000808585111561023b57600080fd5b8386111561024857600080fd5b5050820193919092039150565b80356bffffffffffffffffffffffff19811690601484101561029b576bffffffffffffffffffffffff196bffffffffffffffffffffffff198560140360031b1b82161691505b509291505056fea2646970667358221220c0858dd399174668415e4841d86991848e2743e309eed5a88158c51ac921c36064736f6c634300081c0033