Skip to content

Commit

Permalink
fix: remove unused function
Browse files Browse the repository at this point in the history
  • Loading branch information
idea404 committed Nov 10, 2023
1 parent da290a9 commit e42c3b3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 50 deletions.
1 change: 0 additions & 1 deletion test/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ describe("Account Abstraction Tests", function () {
ownerWallet2 = zks.Wallet.createRandom();
accountContract = await deployMultisig(firstRichWallet, factoryContract.address, ownerWallet1, ownerWallet2);
await fundAccount(firstRichWallet, accountContract.address);
// await signMultiSigTx(firstRichWallet, accountContract.address, factoryContract.address, ownerWallet1, ownerWallet2);
});

it("Should have a tx hash that starts from 0x", async function () {
Expand Down
49 changes: 0 additions & 49 deletions test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,55 +41,6 @@ export async function deployMultisig(wallet: Wallet, factoryAddress: string, own
return accountContract;
}

export async function signMultiSigTx(wallet: Wallet, multiSigAddress: string, factoryAddress: string, owner1: Wallet, owner2: Wallet) {
const factoryArtifact = await hre.artifacts.readArtifact("AAFactory");
const aaFactory = new ethers.Contract(factoryAddress, factoryArtifact.abi, wallet);
const provider = wallet.provider;
const salt = ethers.constants.HashZero;
// Transaction to deploy a new account using the multisig we just deployed
let aaTx = await aaFactory.populateTransaction.deployAccount(
salt,
// These are accounts that will own the newly deployed account
Wallet.createRandom().address,
Wallet.createRandom().address
);

const gasLimit = await provider.estimateGas(aaTx);
const gasPrice = await provider.getGasPrice();

aaTx = {
...aaTx,
// deploy a new account using the multisig
from: multiSigAddress,
gasLimit: gasLimit,
gasPrice: gasPrice,
chainId: (await provider.getNetwork()).chainId,
nonce: await provider.getTransactionCount(multiSigAddress),
type: 113,
customData: {
gasPerPubdata: utils.DEFAULT_GAS_PER_PUBDATA_LIMIT,
} as types.Eip712Meta,
value: ethers.BigNumber.from(0),
};
const signedTxHash = EIP712Signer.getSignedDigest(aaTx);

const signature = ethers.utils.concat([
// Note, that `signMessage` wouldn't work here, since we don't want
// the signed hash to be prefixed with `\x19Ethereum Signed Message:\n`
ethers.utils.joinSignature(owner1._signingKey().signDigest(signedTxHash)),
ethers.utils.joinSignature(owner2._signingKey().signDigest(signedTxHash)),
]);

aaTx.customData = {
...aaTx.customData,
customSignature: signature,
};

const sentTx = await provider.sendTransaction(utils.serialize(aaTx));
await sentTx.wait();
return sentTx;
}

export async function deployAccount(wallet: Wallet, factoryAddress: string, accountOwnerPublicKey: string) {
const paFactoryArtifact = await hre.artifacts.readArtifact("PensionAccountFactory");
const paFactory = new ethers.Contract(factoryAddress, paFactoryArtifact.abi, wallet);
Expand Down

0 comments on commit e42c3b3

Please sign in to comment.