2020-11-19 09:39:23 +00:00
|
|
|
const hre = require("hardhat");
|
|
|
|
const { ethers } = hre;
|
|
|
|
const { sleep } = require("@gelatonetwork/core");
|
|
|
|
const InstaConnector = require("../../../pre-compiles/InstaConnectors.json");
|
|
|
|
|
|
|
|
module.exports = async (hre) => {
|
|
|
|
if (hre.network.name === "mainnet") {
|
|
|
|
console.log(
|
2020-11-28 14:54:22 +00:00
|
|
|
"Deploying MockConnectGelatoDataFullMakerToMaker to mainnet. Hit ctrl + c to abort"
|
2020-11-19 09:39:23 +00:00
|
|
|
);
|
|
|
|
console.log("❗ CONNECTOR DEPLOYMENT: VERIFY & HARDCODE CONNECTOR ID");
|
|
|
|
await sleep(6000);
|
|
|
|
}
|
|
|
|
|
|
|
|
const { deployments } = hre;
|
|
|
|
const { deploy } = deployments;
|
|
|
|
const { deployer } = await hre.getNamedAccounts();
|
|
|
|
|
|
|
|
if (hre.network.name === "hardhat") {
|
|
|
|
const deployerWallet = await ethers.provider.getSigner(deployer);
|
|
|
|
const instaMaster = await ethers.provider.getSigner(
|
|
|
|
hre.network.config.InstaMaster
|
|
|
|
);
|
|
|
|
|
|
|
|
await deployerWallet.sendTransaction({
|
|
|
|
to: await instaMaster.getAddress(),
|
|
|
|
value: ethers.utils.parseEther("0.1"),
|
|
|
|
});
|
|
|
|
|
|
|
|
await hre.network.provider.request({
|
|
|
|
method: "hardhat_impersonateAccount",
|
|
|
|
params: [await instaMaster.getAddress()],
|
|
|
|
});
|
|
|
|
|
|
|
|
const instaConnectors = await hre.ethers.getContractAt(
|
|
|
|
InstaConnector.abi,
|
|
|
|
hre.network.config.InstaConnectors
|
|
|
|
);
|
|
|
|
const connectorLength = await instaConnectors.connectorLength();
|
|
|
|
const connectorId = connectorLength.add(1);
|
|
|
|
|
2020-11-28 14:54:22 +00:00
|
|
|
await deploy("MockConnectGelatoDataFullMakerToMaker", {
|
2020-11-19 09:39:23 +00:00
|
|
|
from: deployer,
|
|
|
|
args: [
|
|
|
|
connectorId,
|
2020-11-27 12:38:13 +00:00
|
|
|
(await deployments.get("ConnectGelatoExecutorPayment")).address,
|
2020-11-19 09:39:23 +00:00
|
|
|
],
|
|
|
|
});
|
|
|
|
|
|
|
|
await instaConnectors
|
|
|
|
.connect(instaMaster)
|
|
|
|
.enable(
|
2020-11-28 14:54:22 +00:00
|
|
|
(await ethers.getContract("MockConnectGelatoDataFullMakerToMaker"))
|
2020-11-19 09:39:23 +00:00
|
|
|
.address
|
|
|
|
);
|
|
|
|
|
|
|
|
await hre.network.provider.request({
|
|
|
|
method: "hardhat_stopImpersonatingAccount",
|
|
|
|
params: [await instaMaster.getAddress()],
|
|
|
|
});
|
|
|
|
} else {
|
2020-11-28 14:54:22 +00:00
|
|
|
// the following will only deploy "MockConnectGelatoDataFullMakerToMaker"
|
2020-11-19 09:39:23 +00:00
|
|
|
// if the contract was never deployed or if the code changed since last deployment
|
2020-11-28 14:54:22 +00:00
|
|
|
await deploy("MockConnectGelatoDataFullMakerToMaker", {
|
2020-11-19 09:39:23 +00:00
|
|
|
from: deployer,
|
|
|
|
args: [
|
|
|
|
parseInt(process.env.ConnectGelatoDataFullRefinanceMakerId),
|
2020-11-27 12:38:13 +00:00
|
|
|
(await deployments.get("ConnectGelatoExecutorPayment")).address,
|
2020-11-19 09:39:23 +00:00
|
|
|
],
|
|
|
|
gasPrice: hre.network.config.gasPrice,
|
|
|
|
log: true,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports.skip = async (hre) => {
|
|
|
|
if (hre.network.name === "mainnet") return true;
|
|
|
|
if (hre.network.name !== "hardhat")
|
|
|
|
return process.env.ConnectGelatoDataFullRefinanceMakerId === undefined;
|
|
|
|
return false;
|
|
|
|
};
|
2020-11-27 12:38:13 +00:00
|
|
|
module.exports.dependencies = ["ConnectGelatoExecutorPayment"];
|
2020-11-28 14:54:22 +00:00
|
|
|
module.exports.tags = ["MockConnectGelatoDataFullMakerToMaker"];
|