mirror of
https://github.com/luxfi/bundler.git
synced 2026-10-30 17:01:04 +00:00
26 lines
1.0 KiB
TypeScript
26 lines
1.0 KiB
TypeScript
import { expect } from 'chai'
|
|
import { DeterministicDeployer, SampleRecipient__factory } from '@account-abstraction/utils'
|
|
import { ethers } from 'hardhat'
|
|
import { hexValue } from 'ethers/lib/utils'
|
|
|
|
const deployer = new DeterministicDeployer(ethers.provider)
|
|
|
|
describe('#deterministicDeployer', () => {
|
|
it('deploy deployer', async () => {
|
|
expect(await deployer.isDeployerDeployed()).to.equal(false)
|
|
await deployer.deployFactory()
|
|
expect(await deployer.isDeployerDeployed()).to.equal(true)
|
|
})
|
|
it('should ignore deploy again of deployer', async () => {
|
|
await deployer.deployFactory()
|
|
})
|
|
it('should deploy at given address', async () => {
|
|
const ctr = hexValue(new SampleRecipient__factory(ethers.provider.getSigner()).getDeployTransaction().data!)
|
|
DeterministicDeployer.init(ethers.provider)
|
|
const addr = DeterministicDeployer.getAddress(ctr)
|
|
expect(await deployer.isContractDeployed(addr)).to.equal(false)
|
|
await DeterministicDeployer.deploy(ctr)
|
|
expect(await deployer.isContractDeployed(addr)).to.equal(true)
|
|
})
|
|
})
|