Skip to content

Commit

Permalink
Fix tests?
Browse files Browse the repository at this point in the history
  • Loading branch information
forshtat committed Dec 19, 2024
1 parent afeca9a commit bb137d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions test/simple-wallet.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Wallet } from 'ethers'
import { ethers } from 'hardhat'
import { expect } from 'chai'
import { toHex } from 'hardhat/internal/util/bigint'

import {
ERC1967Proxy__factory,
EntryPoint,
Expand Down Expand Up @@ -166,9 +168,8 @@ describe('SimpleAccount', function () {

// switch deployer contract to an impersonating signer
const senderCreator = await entryPoint.senderCreator()
await (ethersSigner.provider as JsonRpcProvider).send('hardhat_impersonateAccount', [senderCreator])
await (ethersSigner.provider as JsonRpcProvider).send('hardhat_setBalance', [senderCreator, parseEther('100').toHexString()])
const senderCreatorSigner = await ethers.getSigner(senderCreator)
await (ethersSigner.provider as JsonRpcProvider).send('hardhat_setBalance', [senderCreator, toHex(100e18)])
const senderCreatorSigner = await ethers.getImpersonatedSigner(senderCreator)
deployer = deployer.connect(senderCreatorSigner)

const target = await deployer.callStatic.createAccount(ownerAddr, 1234)
Expand Down
6 changes: 3 additions & 3 deletions test/testutils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ethers } from 'hardhat'
import { toHex } from 'hardhat/internal/util/bigint'
import {
arrayify,
hexConcat,
Expand Down Expand Up @@ -302,9 +303,8 @@ export async function createAccount (
const implementation = await accountFactory.accountImplementation()
const entryPointContract = EntryPoint__factory.connect(entryPoint, ethersSigner)
const senderCreator = await entryPointContract.senderCreator()
await (ethersSigner.provider as JsonRpcProvider).send('hardhat_impersonateAccount', [senderCreator])
await (ethersSigner.provider as JsonRpcProvider).send('hardhat_setBalance', [senderCreator, parseEther('100').toHexString()])
const senderCreatorSigner = await ethers.getSigner(senderCreator)
await (ethersSigner.provider as JsonRpcProvider).send('hardhat_setBalance', [senderCreator, toHex(100e18)])
const senderCreatorSigner = await ethers.getImpersonatedSigner(senderCreator)
await accountFactory.connect(senderCreatorSigner).createAccount(accountOwner, 0)
const accountAddress = await accountFactory.getAddress(accountOwner, 0)
const proxy = SimpleAccount__factory.connect(accountAddress, ethersSigner)
Expand Down

0 comments on commit bb137d9

Please sign in to comment.