Skip to content

Commit

Permalink
cleanup ITransparentProxyFactoryZkSync
Browse files Browse the repository at this point in the history
  • Loading branch information
kyzia551 committed Jul 25, 2024
1 parent 8a07620 commit c01b20f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity >=0.8.0;

import {TransparentProxyFactoryBase, ITransparentProxyFactory} from '../../../src/contracts/transparent-proxy/TransparentProxyFactoryBase.sol';
import {ITransparentProxyFactoryZkSync} from './interfaces/ITransparentProxyFactoryZkSync.sol';

/**
* @title TransparentProxyFactoryZkSync
Expand All @@ -12,7 +13,10 @@ import {TransparentProxyFactoryBase, ITransparentProxyFactory} from '../../../sr
* @dev Highly recommended to pass as `admin` on creation an OZ ProxyAdmin instance
* @dev This contract needs solc=0.8.19 and zksolc=1.4.1 as codeHashes are specifically made for those versions
**/
contract TransparentProxyFactoryZkSync is TransparentProxyFactoryBase {
contract TransparentProxyFactoryZkSync is
TransparentProxyFactoryBase,
ITransparentProxyFactoryZkSync
{
/// @inheritdoc ITransparentProxyFactoryZkSync
bytes32 public constant TRANSPARENT_UPGRADABLE_PROXY_INIT_CODE_HASH =
0x010001b73fa7f2c39ea2d9c597a419e15436fc9d3e00e032410072fb94ad95e1;
Expand All @@ -24,7 +28,7 @@ contract TransparentProxyFactoryZkSync is TransparentProxyFactoryBase {
/// @inheritdoc ITransparentProxyFactoryZkSync
bytes32 public constant ZKSYNC_CREATE2_PREFIX = keccak256('zksyncCreate2');

/// @inheritdoc ITransparentProxyFactoryZkSync
/// @inheritdoc ITransparentProxyFactory
function predictCreateDeterministic(
address logic,
address admin,
Expand All @@ -40,7 +44,7 @@ contract TransparentProxyFactoryZkSync is TransparentProxyFactoryBase {
);
}

/// @inheritdoc ITransparentProxyFactoryZkSync
/// @inheritdoc ITransparentProxyFactory
function predictCreateDeterministicProxyAdmin(bytes32 salt)
public
view
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@
pragma solidity >=0.8.0;

interface ITransparentProxyFactoryZkSync {
event ProxyCreated(address proxy, address indexed logic, address indexed proxyAdmin);
event ProxyAdminCreated(address proxyAdmin, address indexed adminOwner);
event ProxyDeterministicCreated(
address proxy,
address indexed logic,
address indexed admin,
bytes32 indexed salt
);
event ProxyAdminDeterministicCreated(
address proxyAdmin,
address indexed adminOwner,
bytes32 indexed salt
);

/**
* @notice method to get the hash of creation bytecode of the TransparentUpgradableProxy contract
* @return hashed of creation bytecode of the TransparentUpgradableProxy contract
Expand All @@ -33,78 +19,4 @@ interface ITransparentProxyFactoryZkSync {
* @return create2 prefix used for create2 address derivation
*/
function ZKSYNC_CREATE2_PREFIX() external returns (bytes32);

/**
* @notice Creates a transparent proxy instance, doing the first initialization in construction
* @dev Version using CREATE
* @param logic The address of the implementation contract
* @param admin The admin of the proxy.
* @param data abi encoded call to the function with `initializer` (or `reinitializer`) modifier.
* E.g. `abi.encodeWithSelector(mockImpl.initialize.selector, 2)`
* for an `initialize` function being `function initialize(uint256 foo) external initializer;`
* @return address The address of the proxy deployed
**/
function create(address logic, address admin, bytes memory data) external returns (address);

/**
* @notice Creates a proxyAdmin instance, and transfers ownership to provided owner
* @dev Version using CREATE
* @param adminOwner The owner of the proxyAdmin deployed.
* @return address The address of the proxyAdmin deployed
**/
function createProxyAdmin(address adminOwner) external returns (address);

/**
* @notice Creates a transparent proxy instance, doing the first initialization in construction
* @dev Version using CREATE2, so deterministic
* @param logic The address of the implementation contract
* @param admin The admin of the proxy.
* @param data abi encoded call to the function with `initializer` (or `reinitializer`) modifier.
* E.g. `abi.encodeWithSelector(mockImpl.initialize.selector, 2)`
* for an `initialize` function being `function initialize(uint256 foo) external initializer;`
* @param salt Value to be used in the address calculation, to be chosen by the account calling this function
* @return address The address of the proxy deployed
**/
function createDeterministic(
address logic,
address admin,
bytes memory data,
bytes32 salt
) external returns (address);

/**
* @notice Deterministically create a proxy admin instance and transfers ownership to provided owner.
* @dev Version using CREATE2, so deterministic
* @param adminOwner The owner of the ProxyAdmin deployed.
* @param salt Value to be used in the address calculation, to be chosen by the account calling this function
* @return address The address of the proxy admin deployed
**/
function createDeterministicProxyAdmin(
address adminOwner,
bytes32 salt
) external returns (address);

/**
* @notice Pre-calculates and return the address on which `createDeterministic` will deploy a proxy
* @param logic The address of the implementation contract
* @param admin The admin of the proxy
* @param data abi encoded call to the function with `initializer` (or `reinitializer`) modifier.
* E.g. `abi.encodeWithSelector(mockImpl.initialize.selector, 2)`
* for an `initialize` function being `function initialize(uint256 foo) external initializer;`
* @param salt Value to be used in the address calculation, to be chosen by the account calling this function
* @return address The pre-calculated address
**/
function predictCreateDeterministic(
address logic,
address admin,
bytes calldata data,
bytes32 salt
) external view returns (address);

/**
* @notice Pre-calculates and return the address on which `createDeterministic` will deploy the proxyAdmin
* @param salt Value to be used in the address calculation, to be chosen by the account calling this function
* @return address The pre-calculated address
**/
function predictCreateDeterministicProxyAdmin(bytes32 salt) external view returns (address);
}

0 comments on commit c01b20f

Please sign in to comment.