|
| 1 | +import { describe, expect, it } from "vitest"; |
| 2 | +import { ANVIL_CHAIN } from "../../../../test/src/chains.js"; |
| 3 | +import { TEST_CLIENT } from "../../../../test/src/test-clients.js"; |
| 4 | +import { TEST_ACCOUNT_A } from "../../../../test/src/test-wallets.js"; |
| 5 | +import { defineChain } from "../../../chains/utils.js"; |
| 6 | +import { |
| 7 | + computeCreate2FactoryAddress, |
| 8 | + deployCreate2Factory, |
| 9 | + getDeployedCreate2Factory, |
| 10 | +} from "./create-2-factory.js"; |
| 11 | + |
| 12 | +describe.runIf(process.env.TW_SECRET_KEY)("create2 factory tests", () => { |
| 13 | + it("should compute create2 factory address", async () => { |
| 14 | + const addr = await computeCreate2FactoryAddress({ |
| 15 | + client: TEST_CLIENT, |
| 16 | + chain: defineChain(1), |
| 17 | + }); |
| 18 | + |
| 19 | + expect(addr).to.eq("0x4e59b44847b379578588920cA78FbF26c0B4956C"); |
| 20 | + }); |
| 21 | + |
| 22 | + it("should compute create2 factory address with custom gas", async () => { |
| 23 | + const addr = await computeCreate2FactoryAddress({ |
| 24 | + client: TEST_CLIENT, |
| 25 | + chain: defineChain(1564830818), |
| 26 | + }); |
| 27 | + |
| 28 | + expect(addr).to.eq("0x50620b64D9524aC7dC8c967123E87e5b6dB98f0c"); |
| 29 | + }); |
| 30 | + |
| 31 | + it("should deploy create2 factory", async () => { |
| 32 | + await deployCreate2Factory({ |
| 33 | + client: TEST_CLIENT, |
| 34 | + account: TEST_ACCOUNT_A, |
| 35 | + chain: ANVIL_CHAIN, |
| 36 | + }); |
| 37 | + |
| 38 | + const create2Factory = await getDeployedCreate2Factory({ |
| 39 | + chain: ANVIL_CHAIN, |
| 40 | + client: TEST_CLIENT, |
| 41 | + }); |
| 42 | + expect(create2Factory).not.toBeNull(); |
| 43 | + }); |
| 44 | +}); |
0 commit comments