2021-12-05 20:04:41 +00:00
|
|
|
import { addressesPolygon } from "./polygon/addressesPolygon";
|
|
|
|
import { addresses } from "./mainnet/addresses";
|
2021-12-05 19:10:22 +00:00
|
|
|
import { abis } from "../constant/abis";
|
2021-11-29 17:21:11 +00:00
|
|
|
|
|
|
|
// const { deployContract } = waffle;
|
2021-12-05 19:10:22 +00:00
|
|
|
// import { ethers } from "hardhat";
|
|
|
|
// import { promises as fs } from "fs";
|
|
|
|
// import { deployContract } from "ethereum-waffle";
|
2021-11-29 17:21:11 +00:00
|
|
|
|
2021-12-05 20:04:41 +00:00
|
|
|
function getAddress(network: string | undefined) {
|
|
|
|
if (network === "polygon") return addressesPolygon;
|
|
|
|
// else if (network === "arbitrum") return addressesPolygon;
|
|
|
|
// else if (network === "avalanche") return addressesPolygon;
|
|
|
|
else return addresses;
|
|
|
|
}
|
|
|
|
|
2021-11-29 17:21:11 +00:00
|
|
|
export async function deployAndEnableConnector({
|
|
|
|
connectorName,
|
|
|
|
contractArtifact,
|
|
|
|
signer,
|
|
|
|
connectors,
|
|
|
|
}) {
|
2021-12-05 19:10:22 +00:00
|
|
|
const deployer = new contractArtifact(signer);
|
|
|
|
const connectorInstanace = await deployer.deploy();
|
2021-11-29 17:21:11 +00:00
|
|
|
|
|
|
|
await connectors
|
|
|
|
.connect(signer)
|
|
|
|
.addConnectors([connectorName], [connectorInstanace.address]);
|
|
|
|
|
2021-12-05 20:04:41 +00:00
|
|
|
getAddress(String(process.env.networkType)).connectors[connectorName] =
|
|
|
|
connectorInstanace.address;
|
2021-11-29 17:21:11 +00:00
|
|
|
abis.connectors[connectorName] = contractArtifact.abi;
|
|
|
|
|
|
|
|
return connectorInstanace;
|
|
|
|
}
|