From 9bf08946bdaed4e5dee4dd488f585b7c6857ec71 Mon Sep 17 00:00:00 2001 From: Eloi Manuel Date: Tue, 20 Jun 2023 14:53:36 +0200 Subject: [PATCH] Small type fix --- contracts/core/managed/ManagedOpenfortFactory.sol | 4 ++-- contracts/core/static/StaticOpenfortFactory.sol | 4 ++-- contracts/core/upgradeable/UpgradeableOpenfortFactory.sol | 4 ++-- contracts/interfaces/IBaseOpenfortFactory.sol | 4 ++-- script/deployUpgradeableAccounts.sol | 1 + 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/contracts/core/managed/ManagedOpenfortFactory.sol b/contracts/core/managed/ManagedOpenfortFactory.sol index a6cab7a..eadd280 100644 --- a/contracts/core/managed/ManagedOpenfortFactory.sol +++ b/contracts/core/managed/ManagedOpenfortFactory.sol @@ -31,7 +31,7 @@ contract ManagedOpenfortFactory is IBaseOpenfortFactory { /* * @notice Deploy a new account for _admin with a nonce. */ - function createAccountWithNonce(address _admin, bytes calldata _nonce) external returns (address account) { + function createAccountWithNonce(address _admin, bytes32 _nonce) external returns (address account) { bytes32 salt = keccak256(abi.encode(_admin, _nonce)); account = getAddressWithNonce(_admin, _nonce); @@ -51,7 +51,7 @@ contract ManagedOpenfortFactory is IBaseOpenfortFactory { /* * @notice Return the address of an account that would be deployed with the given admin signer and nonce. */ - function getAddressWithNonce(address _admin, bytes calldata _nonce) public view returns (address) { + function getAddressWithNonce(address _admin, bytes32 _nonce) public view returns (address) { bytes32 salt = keccak256(abi.encode(_admin, _nonce)); return Create2.computeAddress( salt, diff --git a/contracts/core/static/StaticOpenfortFactory.sol b/contracts/core/static/StaticOpenfortFactory.sol index 9705f17..c2ad94f 100644 --- a/contracts/core/static/StaticOpenfortFactory.sol +++ b/contracts/core/static/StaticOpenfortFactory.sol @@ -33,7 +33,7 @@ contract StaticOpenfortFactory is IBaseOpenfortFactory { /* * @notice Deploy a new account for _admin and a given nonce. */ - function createAccountWithNonce(address _admin, bytes calldata _nonce) external returns (address account) { + function createAccountWithNonce(address _admin, bytes32 _nonce) external returns (address account) { address impl = accountImplementation; bytes32 salt = keccak256(abi.encode(_admin, _nonce)); account = Clones.predictDeterministicAddress(impl, salt); @@ -50,7 +50,7 @@ contract StaticOpenfortFactory is IBaseOpenfortFactory { /* * @notice Return the address of an account that would be deployed with the given admin signer and nonce. */ - function getAddressWithNonce(address _admin, bytes calldata _nonce) public view returns (address) { + function getAddressWithNonce(address _admin, bytes32 _nonce) public view returns (address) { bytes32 salt = keccak256(abi.encode(_admin, _nonce)); return Clones.predictDeterministicAddress(accountImplementation, salt); } diff --git a/contracts/core/upgradeable/UpgradeableOpenfortFactory.sol b/contracts/core/upgradeable/UpgradeableOpenfortFactory.sol index ed792f0..70611bd 100644 --- a/contracts/core/upgradeable/UpgradeableOpenfortFactory.sol +++ b/contracts/core/upgradeable/UpgradeableOpenfortFactory.sol @@ -31,7 +31,7 @@ contract UpgradeableOpenfortFactory is IBaseOpenfortFactory { /* * @notice Deploy a new account for _admin with a nonce. */ - function createAccountWithNonce(address _admin, bytes calldata _nonce) external returns (address account) { + function createAccountWithNonce(address _admin, bytes32 _nonce) external returns (address account) { bytes32 salt = keccak256(abi.encode(_admin, _nonce)); account = getAddressWithNonce(_admin, _nonce); @@ -51,7 +51,7 @@ contract UpgradeableOpenfortFactory is IBaseOpenfortFactory { /* * @notice Return the address of an account that would be deployed with the given admin signer and nonce. */ - function getAddressWithNonce(address _admin, bytes calldata _nonce) public view returns (address) { + function getAddressWithNonce(address _admin, bytes32 _nonce) public view returns (address) { bytes32 salt = keccak256(abi.encode(_admin, _nonce)); return Create2.computeAddress( salt, diff --git a/contracts/interfaces/IBaseOpenfortFactory.sol b/contracts/interfaces/IBaseOpenfortFactory.sol index a55fe9a..d434fda 100644 --- a/contracts/interfaces/IBaseOpenfortFactory.sol +++ b/contracts/interfaces/IBaseOpenfortFactory.sol @@ -9,11 +9,11 @@ interface IBaseOpenfortFactory { error ZeroAddressNotAllowed(); /// @notice Deploys a new Account for admin. - function createAccountWithNonce(address _admin, bytes calldata _nonce) external returns (address account); + function createAccountWithNonce(address _admin, bytes32 _nonce) external returns (address account); /// @notice Returns the address of the Account implementation. function accountImplementation() external view returns (address); /// @notice Returns the address of an Account that would be deployed with the given admin and nonce. - function getAddressWithNonce(address _admin, bytes calldata _nonce) external view returns (address); + function getAddressWithNonce(address _admin, bytes32 _nonce) external view returns (address); } diff --git a/script/deployUpgradeableAccounts.sol b/script/deployUpgradeableAccounts.sol index a03059f..4f509e6 100644 --- a/script/deployUpgradeableAccounts.sol +++ b/script/deployUpgradeableAccounts.sol @@ -19,6 +19,7 @@ contract UpgradeableOpenfortDeploy is Script { UpgradeableOpenfortFactory upgradeableOpenfortFactory = new UpgradeableOpenfortFactory{salt: versionSalt}(address(entryPoint), address(upgradeableOpenfortAccount)); + (upgradeableOpenfortFactory); // address account1 = upgradeableOpenfortFactory.accountImplementation(); // The first call should create a new account, while the second will just return the corresponding account address