Skip to content

Commit

Permalink
Renamed TransparentUpgradeableProxy to avoid collisions
Browse files Browse the repository at this point in the history
  • Loading branch information
aritkulova committed Aug 5, 2024
1 parent 7cb5d08 commit f629e9b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions contracts/contracts-registry/AbstractContractsRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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";

/**
Expand Down Expand Up @@ -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_));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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();
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions contracts/proxy/transparent/TransparentProxyUpgrader.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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_);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions test/proxy/transparent/TransparentProxyUpgrader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions test/proxy/transparent/TransparentUpgradeableProxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ 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 () => {
[OWNER] = 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");

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",
Expand Down

0 comments on commit f629e9b

Please sign in to comment.