diff --git a/src/ITransparentVerifiableProxy.sol b/src/ITransparentVerifiableProxy.sol new file mode 100644 index 0000000..c5fca5d --- /dev/null +++ b/src/ITransparentVerifiableProxy.sol @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +interface ITransParentVerifiableProxy { + function salt() external view returns (uint256); + + function owner() external view returns (address); + + function creator() external view returns (address); +} diff --git a/src/TransparentVerifiableProxy.sol b/src/TransparentVerifiableProxy.sol index d19de15..0aebffc 100644 --- a/src/TransparentVerifiableProxy.sol +++ b/src/TransparentVerifiableProxy.sol @@ -8,6 +8,7 @@ pragma solidity ^0.8.20; import {Proxy} from "@openzeppelin/contracts/proxy/Proxy.sol"; import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol"; import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; +import {ITransParentVerifiableProxy} from "./ITransparentVerifiableProxy.sol"; // EIP-2535 Diamond Storage pattern // ref: https://eips.ethereum.org/EIPS/eip-2535#storage @@ -24,7 +25,7 @@ library StorageSlot { } } -interface ITransparentVerifiableProxy { +interface ITransparentVerifiableProxy is ITransParentVerifiableProxy { /// @dev See {UUPSUpgradeable-upgradeToAndCall} function upgradeToAndCall(address newImplementation, bytes calldata data) external payable; } diff --git a/src/VerifiableFactory.sol b/src/VerifiableFactory.sol index bb9d96e..cfd427d 100644 --- a/src/VerifiableFactory.sol +++ b/src/VerifiableFactory.sol @@ -4,12 +4,7 @@ pragma solidity ^0.8.20; import {console} from "forge-std/console.sol"; import {Create2} from "@openzeppelin/contracts/utils/Create2.sol"; import {ITransparentVerifiableProxy, TransparentVerifiableProxy} from "./TransparentVerifiableProxy.sol"; - -interface IProxy { - function salt() external view returns (uint256); - - function owner() external view returns (address); -} +import {ITransParentVerifiableProxy} from "./ITransParentVerifiableProxy.sol"; contract VerifiableFactory { event ProxyDeployed(address indexed sender, address indexed proxyAddress, uint256 salt, address implementation); @@ -48,7 +43,7 @@ contract VerifiableFactory { // Function to upgrade the proxy's implementation (only owner of proxy can call this) function upgradeImplementation(address proxyAddress, address newImplementation, bytes memory data) external { - address owner = IProxy(proxyAddress).owner(); + address owner = ITransparentVerifiableProxy(proxyAddress).owner(); require(owner == msg.sender, "Only the owner can upgrade"); // Upgrade the proxy to point to the new implementation @@ -69,8 +64,8 @@ contract VerifiableFactory { if (!isContract(proxy)) { return false; } - try IProxy(proxy).salt() returns (uint256 salt) { - try IProxy(proxy).owner() returns (address owner) { + try ITransparentVerifiableProxy(proxy).salt() returns (uint256 salt) { + try ITransparentVerifiableProxy(proxy).owner() returns (address owner) { return _verifyContract(proxy, owner, salt); } catch {} } catch {}