-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: make factory proxy work * fix: renamings * fix: make tests runnable multiple times in a row
- Loading branch information
Showing
5 changed files
with
88 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import { UpgradeableBeacon } from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; | ||
import { DEPLOYER_SYSTEM_CONTRACT, IContractDeployer } from "@matterlabs/zksync-contracts/l2/system-contracts/Constants.sol"; | ||
import { SystemContractsCaller } from "@matterlabs/zksync-contracts/l2/system-contracts/libraries/SystemContractsCaller.sol"; | ||
|
||
|
@@ -11,23 +10,25 @@ import { ISsoAccount } from "./interfaces/ISsoAccount.sol"; | |
/// @author Matter Labs | ||
/// @custom:security-contact [email protected] | ||
/// @dev This contract is used to deploy SSO accounts as beacon proxies. | ||
contract AAFactory is UpgradeableBeacon { | ||
contract AAFactory { | ||
/// @notice Emitted when a new account is successfully created. | ||
/// @param accountAddress The address of the newly created account. | ||
/// @param uniqueAccountId A unique identifier for the account. | ||
event AccountCreated(address indexed accountAddress, string uniqueAccountId); | ||
|
||
/// @dev The bytecode hash of the beacon proxy, used for deploying proxy accounts. | ||
bytes32 private immutable beaconProxyBytecodeHash; | ||
address private immutable beacon; | ||
|
||
/// @notice A mapping from unique account IDs to their corresponding deployed account addresses. | ||
mapping(string => address) public accountMappings; | ||
|
||
/// @notice Constructor that initializes the factory with a beacon proxy bytecode hash and implementation contract address. | ||
/// @param _beaconProxyBytecodeHash The bytecode hash of the beacon proxy. | ||
/// @param _implementation The address of the implementation contract used by the beacon. | ||
constructor(bytes32 _beaconProxyBytecodeHash, address _implementation) UpgradeableBeacon(_implementation) { | ||
/// @param _beacon The address of the UpgradeableBeacon contract used for the SSO accounts' beacon proxies. | ||
constructor(bytes32 _beaconProxyBytecodeHash, address _beacon) { | ||
beaconProxyBytecodeHash = _beaconProxyBytecodeHash; | ||
beacon = _beacon; | ||
} | ||
|
||
/// @notice Deploys a new SSO account as a beacon proxy with the specified parameters. | ||
|
@@ -51,12 +52,7 @@ contract AAFactory is UpgradeableBeacon { | |
uint128(0), | ||
abi.encodeCall( | ||
DEPLOYER_SYSTEM_CONTRACT.create2Account, | ||
( | ||
_salt, | ||
beaconProxyBytecodeHash, | ||
abi.encode(address(this)), | ||
IContractDeployer.AccountAbstractionVersion.Version1 | ||
) | ||
(_salt, beaconProxyBytecodeHash, abi.encode(beacon), IContractDeployer.AccountAbstractionVersion.Version1) | ||
) | ||
); | ||
require(success, "Deployment failed"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.24; | ||
|
||
import { UpgradeableBeacon } from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol"; | ||
|
||
/// @title SsoBeacon | ||
/// @author Matter Labs | ||
/// @custom:security-contact [email protected] | ||
contract SsoBeacon is UpgradeableBeacon { | ||
constructor(address _implementation) UpgradeableBeacon(_implementation) {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters