2021-11-28 17:53:16 +00:00
|
|
|
import { ethers } from "hardhat";
|
|
|
|
|
|
|
|
import { addresses } from "./constant/addresses";
|
|
|
|
import { abis } from "./constant/abis";
|
2021-11-28 19:04:32 +00:00
|
|
|
import { abi } from "../deployements/mainnet/Implementation_m1.sol/InstaImplementationM1.json";
|
2021-11-28 17:53:16 +00:00
|
|
|
|
2021-11-29 17:21:11 +00:00
|
|
|
export async function buildDSAv2(owner: any) {
|
2021-11-28 19:04:32 +00:00
|
|
|
const instaIndex = await ethers.getContractAt(
|
|
|
|
abis.core.instaIndex,
|
|
|
|
addresses.core.instaIndex
|
|
|
|
);
|
2021-11-28 17:53:16 +00:00
|
|
|
|
2021-11-28 19:04:32 +00:00
|
|
|
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);
|
|
|
|
}
|