Skip to content
Verified contractExactMIT

TransparentUpgradeableProxy

Address0xd75ab4b69f2edfb072fdfd7e2d15a875f95ae5ae
Balance

0 ETH

 

Transactions

33

 

Compiler

solc 0.8.20

 

Same code

1,298 more contracts

 

Details

Compiler
solc 0.8.20+commit.a1b79de6
Language
solidity
Optimization
Yes, 200 runs
EVM version
paris
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
21,853,673
Creation transaction
0xb37e190e08…3bcb276f48
Proxy implementation
0xe1f4c214…ca1e5076source code not verified
Main copy (most transactions)
0xda5e1988…847cbef6

112 files

The source code is large: one file is shown at a time. Choose a file in the list.

contracts/bridgeMiddleware/MinimalProxyFactory.sol

// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.8.20;

import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
import {Storage} from "../storage/Storage.sol";

contract MinimalProxyFactory is Context {
  address public info;

  event MinimalProxyCreated(address minimalProxy);

  error ProxyInitializationFailed();

  error Forbidden();

  constructor(address _info) {
    info = _info;
  }

  function _getContractCreationCode(address logic) internal pure returns (bytes memory) {
    bytes10 creation = 0x3d602d80600a3d3981f3;
    bytes10 prefix = 0x363d3d373d3d3d363d73;
    bytes20 targetBytes = bytes20(logic);
    bytes15 suffix = 0x5af43d82803e903d91602b57fd5bf3;

    return abi.encodePacked(creation, prefix, targetBytes, suffix);
  }

  /**
   * @notice Calculates proxy contract address for salt.
   * @param salt CREATE2 opcode salt.
   * @param implementation Proxy implementation contract address.
   * @return Proxy contract address.
   */
  function computeAddress(bytes32 salt, address implementation) external view returns (address) {
    return Create2.computeAddress(salt, keccak256(_getContractCreationCode(implementation)), address(this));
  }

  /**
   * @notice Deploy and initialize minimal proxy contract for salt.
   * @param salt CREATE2 opcode salt.
   * @param implementation Proxy implementation contract address.
   * @param data Initialize method data.
   * @return Proxy contract address.
   */
  function deploy(bytes32 salt, address implementation, bytes memory data) external returns (address) {
    bool isCallAllowed = Storage(info).getBool(
      keccak256(abi.encodePacked("EH:MinimalProxyFactory:Deployer:", _msgSender()))
    );
    if (!isCallAllowed) revert Forbidden();

    address minimalProxy = Create2.deploy(0, salt, _getContractCreationCode(implementation));
    if (data.length > 0) {
      // solhint-disable-next-line avoid-low-level-calls
      (bool success, ) = minimalProxy.call(data);
      if (!success) revert ProxyInitializationFailed();
    }

    emit MinimalProxyCreated(minimalProxy);

    return minimalProxy;
  }
}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "paris",
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.