Skip to content

Commit

Permalink
feat(proxy): pre-deterministic address
Browse files Browse the repository at this point in the history
  • Loading branch information
pegahcarter committed Mar 11, 2024
1 parent f515af3 commit 06bf126
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/proxies/Proxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@ contract Proxy is Ownable2StepUpgradeable {
}
}

constructor(address _owner) {
_transferOwnership(_owner);
constructor() {
__Ownable_init(msg.sender);
}

function initialize(address _owner) external initializer onlyOwner {
_transferOwnership(_owner):
}

// slither-disable-next-line locked-ether
Expand Down
3 changes: 1 addition & 2 deletions src/proxies/ProxyHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ contract ProxyHelper {
Proxy proxy = new Proxy{ salt: _salt }({ _owner: msg.sender });
bytes memory data = abi.encode(_functionSignature, _encodedArguments);
proxy.upgradeToAndCall({ _implementation: _implementation, _data: data });
/// @dev: _owner is required to accept before ownership is fully transfered
proxy.transferOwnership(_owner);
proxy.initialize(_owner);

return address(proxy);
}
Expand Down

0 comments on commit 06bf126

Please sign in to comment.