Skip to content

Commit

Permalink
fix: renamings
Browse files Browse the repository at this point in the history
  • Loading branch information
ly0va committed Dec 10, 2024
1 parent 11fe9d9 commit d9d7054
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
11 changes: 11 additions & 0 deletions src/SsoBeacon.sol
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) {}
}
25 changes: 7 additions & 18 deletions test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,8 @@ export class ContractFixtures {
return this._webauthnValidatorModule;
}

private _passkeyModuleAddress: string;
async getPasskeyModuleAddress() {
if (!this._passkeyModuleAddress) {
const passkeyModule = await this.getWebAuthnVerifierContract();
this._passkeyModuleAddress = await passkeyModule.getAddress();
}
return this._passkeyModuleAddress;
return (await this.getWebAuthnVerifierContract()).getAddress();
}

private _accountImplContract: SsoAccount;
Expand All @@ -90,14 +85,8 @@ export class ContractFixtures {
return this._accountImplContract;
}

private _accountImplAddress: string;
// deploys the base account for future proxy use
async getAccountImplAddress() {
if (!this._accountImplAddress) {
const accountImpl = await this.getAccountImplContract();
this._accountImplAddress = await accountImpl.getAddress();
}
return this._accountImplAddress;
return (await this.getAccountImplContract()).getAddress();
}

async deployERC20(mintTo: string): Promise<ERC20> {
Expand Down Expand Up @@ -155,15 +144,15 @@ export const getProviderL1 = () => {
return provider;
};

export async function deployFactory(wallet: Wallet, implAddress: string): Promise<AAFactory> {
export async function deployFactory(wallet: Wallet, beaconAddress: string): Promise<AAFactory> {
const factoryArtifact = JSON.parse(await promises.readFile("artifacts-zk/src/AAFactory.sol/AAFactory.json", "utf8"));
const proxyAaArtifact = JSON.parse(await promises.readFile("artifacts-zk/src/AccountProxy.sol/AccountProxy.json", "utf8"));

const deployer = new ContractFactory(factoryArtifact.abi, factoryArtifact.bytecode, wallet);
const bytecodeHash = utils.hashBytecode(proxyAaArtifact.bytecode);
const factory = await deployer.deploy(
bytecodeHash,
implAddress,
beaconAddress,
{ customData: { factoryDeps: [proxyAaArtifact.bytecode] } },
);
const factoryAddress = await factory.getAddress();
Expand All @@ -174,7 +163,7 @@ export async function deployFactory(wallet: Wallet, implAddress: string): Promis
await verifyContract({
address: factoryAddress,
contract: `src/AAFactory.sol:AAFactory`,
constructorArguments: deployer.interface.encodeDeploy([bytecodeHash, implAddress]),
constructorArguments: deployer.interface.encodeDeploy([bytecodeHash, beaconAddress]),
bytecode: factoryArtifact.bytecode,
});
}
Expand All @@ -185,7 +174,7 @@ export async function deployFactory(wallet: Wallet, implAddress: string): Promis
export const getWallet = (privateKey?: string) => {
if (!privateKey) {
// Get wallet private key from .env file
if (!process.env.WALLET_PRIVATE_KEY) throw "⛔️ Wallet private key wasn't found in .env file!";
if (!process.env.WALLET_PRIVATE_KEY) throw "Wallet private key wasn't found in .env file!";
}

const provider = getProvider();
Expand All @@ -200,7 +189,7 @@ export const getWallet = (privateKey?: string) => {
export const verifyEnoughBalance = async (wallet: Wallet, amount: bigint) => {
// Check if the wallet has enough balance
const balance = await wallet.getBalance();
if (balance < amount) throw `⛔️ Wallet balance is too low! Required ${ethers.formatEther(amount)} ETH, but current ${wallet.address} balance is ${ethers.formatEther(balance)} ETH`;
if (balance < amount) throw `Wallet balance is too low! Required ${ethers.formatEther(amount)} ETH, but current ${wallet.address} balance is ${ethers.formatEther(balance)} ETH`;
};

/**
Expand Down

0 comments on commit d9d7054

Please sign in to comment.