From f629e9bcaa6b65f62e4a301aad62a8d69843f013 Mon Sep 17 00:00:00 2001 From: aritkulova Date: Mon, 5 Aug 2024 17:24:52 +0300 Subject: [PATCH] Renamed TransparentUpgradeableProxy to avoid collisions --- .../contracts-registry/AbstractContractsRegistry.sol | 4 ++-- ...gradeableProxy.sol => SolarityTransparentProxy.sol} | 10 +++++----- .../proxy/transparent/TransparentProxyUpgrader.sol | 4 ++-- .../proxy/transparent/TransparentProxyUpgrader.test.ts | 8 ++++---- .../transparent/TransparentUpgradeableProxy.test.ts | 10 +++++----- 5 files changed, 18 insertions(+), 18 deletions(-) rename contracts/proxy/transparent/{TransparentUpgradeableProxy.sol => SolarityTransparentProxy.sol} (88%) diff --git a/contracts/contracts-registry/AbstractContractsRegistry.sol b/contracts/contracts-registry/AbstractContractsRegistry.sol index cb898e9d..982b242a 100644 --- a/contracts/contracts-registry/AbstractContractsRegistry.sol +++ b/contracts/contracts-registry/AbstractContractsRegistry.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.4; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import {TransparentProxyUpgrader} from "../proxy/transparent/TransparentProxyUpgrader.sol"; -import {TransparentUpgradeableProxy} from "../proxy/transparent/TransparentUpgradeableProxy.sol"; +import {SolarityTransparentProxy} from "../proxy/transparent/SolarityTransparentProxy.sol"; import {AbstractDependant} from "./AbstractDependant.sol"; /** @@ -254,6 +254,6 @@ abstract contract AbstractContractsRegistry is Initializable { address admin_, bytes memory data_ ) internal virtual returns (address) { - return address(new TransparentUpgradeableProxy(contractAddress_, admin_, data_)); + return address(new SolarityTransparentProxy(contractAddress_, admin_, data_)); } } diff --git a/contracts/proxy/transparent/TransparentUpgradeableProxy.sol b/contracts/proxy/transparent/SolarityTransparentProxy.sol similarity index 88% rename from contracts/proxy/transparent/TransparentUpgradeableProxy.sol rename to contracts/proxy/transparent/SolarityTransparentProxy.sol index 541300e1..a36699b1 100644 --- a/contracts/proxy/transparent/TransparentUpgradeableProxy.sol +++ b/contracts/proxy/transparent/SolarityTransparentProxy.sol @@ -10,9 +10,9 @@ import {IERC1967} from "@openzeppelin/contracts/interfaces/IERC1967.sol"; /** * @notice The proxies module * - * Interface for TransparentUpgradeableProxy. + * Interface for SolarityTransparentProxy. **/ -interface ITransparentUpgradeableProxy is IERC1967 { +interface ISolarityTransparentProxy is IERC1967 { /** * @notice The function to upgrade the implementation contract with additional setup call if data is nonempty. */ @@ -34,7 +34,7 @@ interface ITransparentUpgradeableProxy is IERC1967 { * * For more information about proxy logic, please refer to the OpenZeppelin documentation. */ -contract TransparentUpgradeableProxy is ERC1967Proxy { +contract SolarityTransparentProxy is ERC1967Proxy { address private immutable _admin; error ProxyDeniedAdminAccess(); @@ -52,9 +52,9 @@ contract TransparentUpgradeableProxy is ERC1967Proxy { if (msg.sender == _admin) { bytes4 selector_ = msg.sig; - if (selector_ == ITransparentUpgradeableProxy.upgradeToAndCall.selector) { + if (selector_ == ISolarityTransparentProxy.upgradeToAndCall.selector) { _dispatchUpgradeToAndCall(); - } else if (selector_ == ITransparentUpgradeableProxy.implementation.selector) { + } else if (selector_ == ISolarityTransparentProxy.implementation.selector) { bytes memory returndata_ = _dispatchImplementation(); assembly { diff --git a/contracts/proxy/transparent/TransparentProxyUpgrader.sol b/contracts/proxy/transparent/TransparentProxyUpgrader.sol index 48dca66f..0aa51a56 100644 --- a/contracts/proxy/transparent/TransparentProxyUpgrader.sol +++ b/contracts/proxy/transparent/TransparentProxyUpgrader.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.4; import {PermanentOwnable} from "../../access/PermanentOwnable.sol"; -import {ITransparentUpgradeableProxy} from "./TransparentUpgradeableProxy.sol"; +import {ISolarityTransparentProxy} from "./SolarityTransparentProxy.sol"; /** * @notice The proxies module @@ -19,7 +19,7 @@ contract TransparentProxyUpgrader is PermanentOwnable { * @param data_ arbitrary data the proxy will be called with after the upgrade */ function upgrade(address what_, address to_, bytes calldata data_) external virtual onlyOwner { - ITransparentUpgradeableProxy(payable(what_)).upgradeToAndCall(to_, data_); + ISolarityTransparentProxy(payable(what_)).upgradeToAndCall(to_, data_); } /** diff --git a/test/proxy/transparent/TransparentProxyUpgrader.test.ts b/test/proxy/transparent/TransparentProxyUpgrader.test.ts index 6b021e42..ee184530 100644 --- a/test/proxy/transparent/TransparentProxyUpgrader.test.ts +++ b/test/proxy/transparent/TransparentProxyUpgrader.test.ts @@ -3,7 +3,7 @@ import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers"; import { expect } from "chai"; import { Reverter } from "@/test/helpers/reverter"; -import { TransparentProxyUpgrader, TransparentUpgradeableProxy, ERC20Mock } from "@ethers-v6"; +import { TransparentProxyUpgrader, SolarityTransparentProxy, ERC20Mock } from "@ethers-v6"; describe("TransparentProxyUpgrader", () => { const reverter = new Reverter(); @@ -13,19 +13,19 @@ describe("TransparentProxyUpgrader", () => { let transparentProxyUpgrader: TransparentProxyUpgrader; let token: ERC20Mock; - let proxy: TransparentUpgradeableProxy; + let proxy: SolarityTransparentProxy; before("setup", async () => { [OWNER, SECOND] = await ethers.getSigners(); const ERC20Mock = await ethers.getContractFactory("ERC20Mock"); const TransparentProxyUpgrader = await ethers.getContractFactory("TransparentProxyUpgrader"); - const TransparentUpgradeableProxy = await ethers.getContractFactory("TransparentUpgradeableProxy"); + const SolarityTransparentProxy = await ethers.getContractFactory("SolarityTransparentProxy"); token = await ERC20Mock.deploy("mock", "mock", 18); transparentProxyUpgrader = await TransparentProxyUpgrader.deploy(); - proxy = await TransparentUpgradeableProxy.deploy( + proxy = await SolarityTransparentProxy.deploy( await token.getAddress(), await transparentProxyUpgrader.getAddress(), "0x", diff --git a/test/proxy/transparent/TransparentUpgradeableProxy.test.ts b/test/proxy/transparent/TransparentUpgradeableProxy.test.ts index bdde58b0..f8c4af4c 100644 --- a/test/proxy/transparent/TransparentUpgradeableProxy.test.ts +++ b/test/proxy/transparent/TransparentUpgradeableProxy.test.ts @@ -4,15 +4,15 @@ import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers"; import { expect } from "chai"; import { Reverter } from "@/test/helpers/reverter"; -import { TransparentProxyUpgrader, TransparentUpgradeableProxy, ERC20Mock } from "@ethers-v6"; +import { TransparentProxyUpgrader, SolarityTransparentProxy, ERC20Mock } from "@ethers-v6"; -describe("TransparentUpgradeableProxy", () => { +describe("SolarityTransparentProxy", () => { const reverter = new Reverter(); let OWNER: SignerWithAddress; let PROXY_UPGRADER: SignerWithAddress; - let proxy: TransparentUpgradeableProxy; + let proxy: SolarityTransparentProxy; let tokenProxy: ERC20Mock; before("setup", async () => { @@ -20,12 +20,12 @@ describe("TransparentUpgradeableProxy", () => { const ERC20Mock = await ethers.getContractFactory("ERC20Mock"); const TransparentProxyUpgrader = await ethers.getContractFactory("TransparentProxyUpgrader"); - const TransparentUpgradeableProxy = await ethers.getContractFactory("TransparentUpgradeableProxy"); + const SolarityTransparentProxy = await ethers.getContractFactory("SolarityTransparentProxy"); const token: ERC20Mock = await ERC20Mock.deploy("mock", "mock", 18); const transparentProxyUpgrader: TransparentProxyUpgrader = await TransparentProxyUpgrader.deploy(); - proxy = await TransparentUpgradeableProxy.deploy( + proxy = await SolarityTransparentProxy.deploy( await token.getAddress(), await transparentProxyUpgrader.getAddress(), "0x",