dsa-connectors/scripts/buildDSAv2.ts
2021-12-11 13:37:44 +05:30

20 lines
637 B
TypeScript

import { ethers } from "hardhat";
import { addresses } from "./constant/addresses";
import { abis } from "./constant/abis";
import { abi } from "../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json";
export async function buildDSAv2(owner: any) {
const instaIndex = await ethers.getContractAt(
abis.core.instaIndex,
addresses.core.instaIndex
);
const tx = await instaIndex.build(owner, 2, owner);
const receipt = await tx.wait();
const event = receipt.events.find(
(a: { event: string }) => a.event === "LogAccountCreated"
);
return await ethers.getContractAt(abi, event.args.account);
}