Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions contracts/libraries/CMTATBeaconFactoryBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ abstract contract CMTATBeaconFactoryBase is CMTATFactoryRoot {
* @notice get the implementation address from the beacon
* @return beaconImplementation Address of the CMTAT implementation contract.
*/
function implementation() public virtual view returns (address beaconImplementation) {
function implementation() public view virtual returns (address beaconImplementation) {
return beacon.implementation();
}

Expand All @@ -52,6 +52,15 @@ abstract contract CMTATBeaconFactoryBase is CMTATFactoryRoot {
return cmtat;
}

/**
* @dev Deploy CMTAT and push the created CMTAT in the list.
*/
function _deployBeaconProxyBytecode(bytes memory bytecode, bytes32 deploymentSalt) internal returns (BeaconProxy cmtat) {
address cmtatAddress = _deployAndRegisterProxy(bytecode, deploymentSalt);
cmtat = BeaconProxy(payable(cmtatAddress));
return cmtat;
}

/**
* @dev Compute a beacon proxy address for an already-derived effective salt.
*/
Expand All @@ -76,15 +85,6 @@ abstract contract CMTATBeaconFactoryBase is CMTATFactoryRoot {
);
}

/**
* @dev Deploy CMTAT and push the created CMTAT in the list.
*/
function _deployBeaconProxyBytecode(bytes memory bytecode, bytes32 deploymentSalt) internal returns (BeaconProxy cmtat) {
address cmtatAddress = _deployAndRegisterProxy(bytecode, deploymentSalt);
cmtat = BeaconProxy(payable(cmtatAddress));
return cmtat;
}

/**
* @dev return the beacon proxy bytecode
*/
Expand Down
14 changes: 7 additions & 7 deletions contracts/libraries/CMTATFactoryRoot.sol
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ abstract contract CMTATFactoryRoot is AccessControl, ContractVersion, CMTATFacto
}
}

/**
* @dev Mirrors deployment salt selection without mutating customSaltUsed.
*/
function _computeDeploymentSalt(bytes32 deploymentSaltInput) internal view virtual returns(bytes32 saltBytes){
return useCustomSalt ? deploymentSaltInput : nextDeploymentSalt();
}

/**
* @dev Deploy CMTAT proxy and register it in the factory index.
* @dev Reentrancy window: Create2.deploy below runs the proxy constructor (and its CMTAT initializer) BEFORE
Expand All @@ -121,4 +114,11 @@ abstract contract CMTATFactoryRoot is AccessControl, ContractVersion, CMTATFacto
++cmtatCounterId;
cmtatsList.push(cmtatAddress);
}

/**
* @dev Mirrors deployment salt selection without mutating customSaltUsed.
*/
function _computeDeploymentSalt(bytes32 deploymentSaltInput) internal view virtual returns(bytes32 saltBytes){
return useCustomSalt ? deploymentSaltInput : nextDeploymentSalt();
}
}
18 changes: 9 additions & 9 deletions contracts/libraries/CMTATTransparentFactoryBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ abstract contract CMTATTransparentFactoryBase is CMTATFactoryBase {
return cmtat;
}

/**
* @dev Deploy CMTAT and push the created CMTAT in the list.
*/
function _deployTransparentProxyBytecode(bytes memory bytecode, bytes32 deploymentSalt) internal returns (TransparentUpgradeableProxy cmtat) {
address cmtatAddress = _deployAndRegisterProxy(bytecode, deploymentSalt);
cmtat = TransparentUpgradeableProxy(payable(cmtatAddress));
return cmtat;
}

/**
* @dev Compute a transparent proxy address for an already-derived effective salt.
*/
Expand Down Expand Up @@ -60,15 +69,6 @@ abstract contract CMTATTransparentFactoryBase is CMTATFactoryBase {
);
}

/**
* @dev Deploy CMTAT and push the created CMTAT in the list.
*/
function _deployTransparentProxyBytecode(bytes memory bytecode, bytes32 deploymentSalt) internal returns (TransparentUpgradeableProxy cmtat) {
address cmtatAddress = _deployAndRegisterProxy(bytecode, deploymentSalt);
cmtat = TransparentUpgradeableProxy(payable(cmtatAddress));
return cmtat;
}

/**
* @dev Reverts if the transparent proxy admin owner is zero.
*/
Expand Down
4 changes: 2 additions & 2 deletions contracts/light/CMTAT_LIGHT_BEACON_FACTORY.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ contract CMTAT_LIGHT_BEACON_FACTORY is CMTATBeaconFactoryBase, ReentrancyGuard {
*/
function computedProxyAddress(
bytes32 effectiveDeploymentSalt,
CMTAT_LIGHT_ARGUMENT calldata cmtatArgument) public virtual view returns (address cmtatProxy) {
CMTAT_LIGHT_ARGUMENT calldata cmtatArgument) public view virtual returns (address cmtatProxy) {
return _computedBeaconProxyAddress(effectiveDeploymentSalt, _initializerData(cmtatArgument));
}

Expand All @@ -66,7 +66,7 @@ contract CMTAT_LIGHT_BEACON_FACTORY is CMTATBeaconFactoryBase, ReentrancyGuard {
*/
function computedNextProxyAddress(
bytes32 deploymentSaltInput,
CMTAT_LIGHT_ARGUMENT calldata cmtatArgument) public virtual view returns (address cmtatProxy) {
CMTAT_LIGHT_ARGUMENT calldata cmtatArgument) public view virtual returns (address cmtatProxy) {
return _computedNextBeaconProxyAddress(deploymentSaltInput, _initializerData(cmtatArgument));
}

Expand Down
4 changes: 2 additions & 2 deletions contracts/light/CMTAT_LIGHT_TP_FACTORY.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ contract CMTAT_LIGHT_TP_FACTORY is CMTATTransparentFactoryBase, ReentrancyGuard
function computedProxyAddress(
bytes32 effectiveDeploymentSalt,
address proxyAdminOwner,
CMTAT_LIGHT_ARGUMENT calldata cmtatArgument) public virtual view returns (address cmtatProxy) {
CMTAT_LIGHT_ARGUMENT calldata cmtatArgument) public view virtual returns (address cmtatProxy) {
return _computedTransparentProxyAddress(effectiveDeploymentSalt, proxyAdminOwner, _initializerData(cmtatArgument));
}

Expand All @@ -61,7 +61,7 @@ contract CMTAT_LIGHT_TP_FACTORY is CMTATTransparentFactoryBase, ReentrancyGuard
function computedNextProxyAddress(
bytes32 deploymentSaltInput,
address proxyAdminOwner,
CMTAT_LIGHT_ARGUMENT calldata cmtatArgument) public virtual view returns (address cmtatProxy) {
CMTAT_LIGHT_ARGUMENT calldata cmtatArgument) public view virtual returns (address cmtatProxy) {
return _computedNextTransparentProxyAddress(deploymentSaltInput, proxyAdminOwner, _initializerData(cmtatArgument));
}

Expand Down
4 changes: 2 additions & 2 deletions contracts/mocks/ReentrancyDeployMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ contract ReentrantInitLogicMock {
ATTACKER = attacker_;
}

receive() external payable {}

fallback() external payable {
ReentrancyDeployAttacker(ATTACKER).attack();
}

receive() external payable {}
}
4 changes: 2 additions & 2 deletions contracts/standard/CMTAT_BEACON_FACTORY.sol
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ contract CMTAT_BEACON_FACTORY is CMTATBeaconFactoryBase, ReentrancyGuard {
function computedProxyAddress(
bytes32 effectiveDeploymentSalt,
// CMTAT function initialize
CMTAT_ARGUMENT calldata cmtatArgument) public virtual view returns (address cmtatProxy) {
CMTAT_ARGUMENT calldata cmtatArgument) public view virtual returns (address cmtatProxy) {
return _computedBeaconProxyAddress(effectiveDeploymentSalt, _initializerData(cmtatArgument));
}

Expand All @@ -78,7 +78,7 @@ contract CMTAT_BEACON_FACTORY is CMTATBeaconFactoryBase, ReentrancyGuard {
*/
function computedNextProxyAddress(
bytes32 deploymentSaltInput,
CMTAT_ARGUMENT calldata cmtatArgument) public virtual view returns (address cmtatProxy) {
CMTAT_ARGUMENT calldata cmtatArgument) public view virtual returns (address cmtatProxy) {
return _computedNextBeaconProxyAddress(deploymentSaltInput, _initializerData(cmtatArgument));
}

Expand Down
4 changes: 2 additions & 2 deletions contracts/standard/CMTAT_TP_FACTORY.sol
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ contract CMTAT_TP_FACTORY is CMTATTransparentFactoryBase, ReentrancyGuard {
bytes32 effectiveDeploymentSalt,
address proxyAdminOwner,
// CMTAT function initialize
CMTAT_ARGUMENT calldata cmtatArgument) public virtual view returns (address cmtatProxy) {
CMTAT_ARGUMENT calldata cmtatArgument) public view virtual returns (address cmtatProxy) {
return _computedTransparentProxyAddress(effectiveDeploymentSalt, proxyAdminOwner, _initializerData(cmtatArgument));
}

Expand All @@ -72,7 +72,7 @@ contract CMTAT_TP_FACTORY is CMTATTransparentFactoryBase, ReentrancyGuard {
function computedNextProxyAddress(
bytes32 deploymentSaltInput,
address proxyAdminOwner,
CMTAT_ARGUMENT calldata cmtatArgument) public virtual view returns (address cmtatProxy) {
CMTAT_ARGUMENT calldata cmtatArgument) public view virtual returns (address cmtatProxy) {
return _computedNextTransparentProxyAddress(deploymentSaltInput, proxyAdminOwner, _initializerData(cmtatArgument));
}

Expand Down
4 changes: 2 additions & 2 deletions contracts/standard/CMTAT_UUPS_FACTORY.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ contract CMTAT_UUPS_FACTORY is CMTATFactoryBase, ReentrancyGuard {
function computedProxyAddress(
bytes32 effectiveDeploymentSalt,
// CMTAT function initialize
CMTAT_ARGUMENT calldata cmtatArgument) public virtual view returns (address cmtatProxy) {
CMTAT_ARGUMENT calldata cmtatArgument) public view virtual returns (address cmtatProxy) {
bytes memory bytecode = _getBytecode(
// CMTAT function initialize
cmtatArgument);
Expand All @@ -76,7 +76,7 @@ contract CMTAT_UUPS_FACTORY is CMTATFactoryBase, ReentrancyGuard {
*/
function computedNextProxyAddress(
bytes32 deploymentSaltInput,
CMTAT_ARGUMENT calldata cmtatArgument) public virtual view returns (address cmtatProxy) {
CMTAT_ARGUMENT calldata cmtatArgument) public view virtual returns (address cmtatProxy) {
return computedProxyAddress(
_computeDeploymentSalt(deploymentSaltInput),
cmtatArgument
Expand Down
Loading