Skip to content

Commit 01bf257

Browse files
authored
fix: transparent factory natspec correction (#63)
1 parent a440288 commit 01bf257

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

src/contracts/transparent-proxy/TransparentProxyFactory.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {TransparentProxyFactoryBase} from './TransparentProxyFactoryBase.sol';
99
* @notice Factory contract to create transparent proxies, both with CREATE and CREATE2
1010
* @dev `create()` and `createDeterministic()` are not unified for clearer interface, and at the same
1111
* time allowing `createDeterministic()` with salt == 0
12-
* @dev Highly recommended to pass as `admin` on creation an OZ ProxyAdmin instance
1312
**/
1413
contract TransparentProxyFactory is TransparentProxyFactoryBase {
1514
function _predictCreate2Address(

src/contracts/transparent-proxy/TransparentProxyFactoryBase.sol

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {ITransparentProxyFactory} from './interfaces/ITransparentProxyFactory.so
1111
* @notice Factory contract to create transparent proxies, both with CREATE and CREATE2
1212
* @dev `create()` and `createDeterministic()` are not unified for clearer interface, and at the same
1313
* time allowing `createDeterministic()` with salt == 0
14-
* @dev Highly recommended to pass as `admin` on creation an OZ ProxyAdmin instance
1514
**/
1615
abstract contract TransparentProxyFactoryBase is ITransparentProxyFactory {
1716
mapping(address proxy => address admin) internal _proxyToAdmin;
@@ -23,54 +22,54 @@ abstract contract TransparentProxyFactoryBase is ITransparentProxyFactory {
2322
/// @inheritdoc ITransparentProxyFactory
2423
function create(
2524
address logic,
26-
address adminOwner,
25+
address initialOwner,
2726
bytes calldata data
2827
) external returns (address) {
29-
address proxy = address(new TransparentUpgradeableProxy(logic, adminOwner, data));
28+
address proxy = address(new TransparentUpgradeableProxy(logic, initialOwner, data));
3029
_storeProxyInRegistry(proxy);
3130

32-
emit ProxyCreated(proxy, logic, adminOwner);
31+
emit ProxyCreated(proxy, logic, initialOwner);
3332

3433
return proxy;
3534
}
3635

3736
/// @inheritdoc ITransparentProxyFactory
38-
function createProxyAdmin(address adminOwner) external returns (address) {
39-
address proxyAdmin = address(new ProxyAdmin(adminOwner));
37+
function createProxyAdmin(address initialOwner) external returns (address) {
38+
address proxyAdmin = address(new ProxyAdmin(initialOwner));
4039

41-
emit ProxyAdminCreated(proxyAdmin, adminOwner);
40+
emit ProxyAdminCreated(proxyAdmin, initialOwner);
4241
return proxyAdmin;
4342
}
4443

4544
/// @inheritdoc ITransparentProxyFactory
4645
function createDeterministic(
4746
address logic,
48-
address adminOwner,
47+
address initialOwner,
4948
bytes calldata data,
5049
bytes32 salt
5150
) external returns (address) {
52-
address proxy = address(new TransparentUpgradeableProxy{salt: salt}(logic, adminOwner, data));
51+
address proxy = address(new TransparentUpgradeableProxy{salt: salt}(logic, initialOwner, data));
5352
_storeProxyInRegistry(proxy);
5453

55-
emit ProxyDeterministicCreated(proxy, logic, adminOwner, salt);
54+
emit ProxyDeterministicCreated(proxy, logic, initialOwner, salt);
5655
return proxy;
5756
}
5857

5958
/// @inheritdoc ITransparentProxyFactory
6059
function createDeterministicProxyAdmin(
61-
address adminOwner,
60+
address initialOwner,
6261
bytes32 salt
6362
) external returns (address) {
64-
address proxyAdmin = address(new ProxyAdmin{salt: salt}(adminOwner));
63+
address proxyAdmin = address(new ProxyAdmin{salt: salt}(initialOwner));
6564

66-
emit ProxyAdminDeterministicCreated(proxyAdmin, adminOwner, salt);
65+
emit ProxyAdminDeterministicCreated(proxyAdmin, initialOwner, salt);
6766
return proxyAdmin;
6867
}
6968

7069
/// @inheritdoc ITransparentProxyFactory
7170
function predictCreateDeterministic(
7271
address logic,
73-
address admin,
72+
address initialOwner,
7473
bytes calldata data,
7574
bytes32 salt
7675
) public view returns (address) {
@@ -79,7 +78,7 @@ abstract contract TransparentProxyFactoryBase is ITransparentProxyFactory {
7978
address(this),
8079
salt,
8180
type(TransparentUpgradeableProxy).creationCode,
82-
abi.encode(logic, admin, data)
81+
abi.encode(logic, initialOwner, data)
8382
);
8483
}
8584

src/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,50 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity >=0.8.0;
33

4-
54
interface ITransparentProxyFactory {
6-
event ProxyCreated(address proxy, address indexed logic, address indexed proxyAdmin);
7-
event ProxyAdminCreated(address proxyAdmin, address indexed adminOwner);
5+
event ProxyCreated(address proxy, address indexed logic, address indexed initialOwner);
6+
event ProxyAdminCreated(address proxyAdmin, address indexed initialOwner);
87
event ProxyDeterministicCreated(
98
address proxy,
109
address indexed logic,
11-
address indexed admin,
10+
address indexed initialOwner,
1211
bytes32 indexed salt
1312
);
1413
event ProxyAdminDeterministicCreated(
1514
address proxyAdmin,
16-
address indexed adminOwner,
15+
address indexed initialOwner,
1716
bytes32 indexed salt
1817
);
1918

2019
/**
2120
* @notice Creates a transparent proxy instance, doing the first initialization in construction
2221
* @dev Version using CREATE
2322
* @param logic The address of the implementation contract
24-
* @param admin The admin of the proxy.
23+
* @param initialOwner The initial owner of the admin of the proxy.
2524
* @param data abi encoded call to the function with `initializer` (or `reinitializer`) modifier.
2625
* E.g. `abi.encodeWithSelector(mockImpl.initialize.selector, 2)`
2726
* for an `initialize` function being `function initialize(uint256 foo) external initializer;`
2827
* @return address The address of the proxy deployed
2928
**/
30-
function create(address logic, address admin, bytes memory data) external returns (address);
29+
function create(
30+
address logic,
31+
address initialOwner,
32+
bytes memory data
33+
) external returns (address);
3134

3235
/**
3336
* @notice Creates a proxyAdmin instance, and transfers ownership to provided owner
3437
* @dev Version using CREATE
35-
* @param adminOwner The owner of the proxyAdmin deployed.
38+
* @param initialOwner The initial owner of the proxyAdmin deployed.
3639
* @return address The address of the proxyAdmin deployed
3740
**/
38-
function createProxyAdmin(address adminOwner) external returns (address);
41+
function createProxyAdmin(address initialOwner) external returns (address);
3942

4043
/**
4144
* @notice Creates a transparent proxy instance, doing the first initialization in construction
4245
* @dev Version using CREATE2, so deterministic
4346
* @param logic The address of the implementation contract
44-
* @param admin The admin of the proxy.
47+
* @param initialOwner The initial owner of the admin of the proxy.
4548
* @param data abi encoded call to the function with `initializer` (or `reinitializer`) modifier.
4649
* E.g. `abi.encodeWithSelector(mockImpl.initialize.selector, 2)`
4750
* for an `initialize` function being `function initialize(uint256 foo) external initializer;`
@@ -50,7 +53,7 @@ interface ITransparentProxyFactory {
5053
**/
5154
function createDeterministic(
5255
address logic,
53-
address admin,
56+
address initialOwner,
5457
bytes memory data,
5558
bytes32 salt
5659
) external returns (address);
@@ -70,7 +73,7 @@ interface ITransparentProxyFactory {
7073
/**
7174
* @notice Pre-calculates and return the address on which `createDeterministic` will deploy a proxy
7275
* @param logic The address of the implementation contract
73-
* @param admin The admin of the proxy
76+
* @param initialOwner The initial owner of the admin of the proxy.
7477
* @param data abi encoded call to the function with `initializer` (or `reinitializer`) modifier.
7578
* E.g. `abi.encodeWithSelector(mockImpl.initialize.selector, 2)`
7679
* for an `initialize` function being `function initialize(uint256 foo) external initializer;`
@@ -79,7 +82,7 @@ interface ITransparentProxyFactory {
7982
**/
8083
function predictCreateDeterministic(
8184
address logic,
82-
address admin,
85+
address initialOwner,
8386
bytes calldata data,
8487
bytes32 salt
8588
) external view returns (address);

zksync/src/contracts/transparent-proxy/TransparentProxyFactoryZkSync.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {ITransparentProxyFactoryZkSync} from './interfaces/ITransparentProxyFact
1010
* @notice Factory contract specific to zkSync to create transparent proxies, both with CREATE and CREATE2
1111
* @dev `create()` and `createDeterministic()` are not unified for clearer interface, and at the same
1212
* time allowing `createDeterministic()` with salt == 0
13-
* @dev Highly recommended to pass as `admin` on creation an OZ ProxyAdmin instance
1413
**/
1514
contract TransparentProxyFactoryZkSync is
1615
TransparentProxyFactoryBase,

0 commit comments

Comments
 (0)