Skip to content

Commit

Permalink
Add immutable to properties
Browse files Browse the repository at this point in the history
  • Loading branch information
cag committed Dec 28, 2020
1 parent 2284603 commit a642d32
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
23 changes: 10 additions & 13 deletions contracts/solc-0.8/CPKFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,23 @@ contract CPKFactory {
);

uint256 public constant version = 2;
ProxyImplSetter public proxyImplSetter;
IGnosisSafeProxyFactory public gnosisSafeProxyFactory;
ProxyImplSetter public immutable proxyImplSetter;
IGnosisSafeProxyFactory public immutable gnosisSafeProxyFactory;
address public immutable proxyExtCodeHash;

constructor(IGnosisSafeProxyFactory _gnosisSafeProxyFactory) {
proxyImplSetter = new ProxyImplSetter(address(this));
gnosisSafeProxyFactory = _gnosisSafeProxyFactory;
proxyExtCodeHash = keccak256(gnosisSafeProxyFactory.proxyRuntimeCode());
}

// Accessors removed until something is figured out about the fact that these depend on the compiler
// but really should depend instead on the specific gnosisSafeProxyFactory instance used

// function proxyCreationCode() external pure returns (bytes memory) {
// return type(GnosisSafeProxy).creationCode;
// }

// function proxyRuntimeCode() external pure returns (bytes memory) {
// return type(GnosisSafeProxy).runtimeCode;
// }
function proxyCreationCode() external pure returns (bytes memory) {
return gnosisSafeProxyFactory.proxyCreationCode();
}

// bytes32 public constant proxyExtCodeHash = keccak256(type(GnosisSafeProxy).runtimeCode);
function proxyRuntimeCode() external pure returns (bytes memory) {
return gnosisSafeProxyFactory.proxyRuntimeCode();
}

function createProxyAndExecTransaction(
address owner,
Expand Down
8 changes: 4 additions & 4 deletions contracts/solc-0.8/CPKFactoryFacade.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { Enum } from "./dep-ports/Enum.sol";
import { CPKFactory, CPKFactoryTx } from "./CPKFactory.sol";

contract CPKFactoryFacade {
CPKFactory cpkFactory;
address safeVersion;
uint256 salt;
address fallbackHandler;
CPKFactory immutable cpkFactory;
address immutable safeVersion;
uint256 immutable salt;
address immutable fallbackHandler;

constructor(
CPKFactory _cpkFactory,
Expand Down
4 changes: 2 additions & 2 deletions contracts/solc-0.8/ProxyImplSetter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
pragma solidity >=0.8.0;

contract ProxyImplSetter {
address public immutable initialSetter;

address implementation;
// KLUDGE: make this immutable after solc versions get fixed
address public initialSetter;

constructor(address _initialSetter) {
initialSetter = _initialSetter;
Expand Down

0 comments on commit a642d32

Please sign in to comment.