2020-11-04 17:09:34 +00:00
|
|
|
const hre = require("hardhat");
|
2020-11-16 16:55:04 +00:00
|
|
|
const { ethers } = hre;
|
|
|
|
const { sleep } = require("@gelatonetwork/core");
|
2020-11-04 12:21:01 +00:00
|
|
|
const InstaConnector = require("../../pre-compiles/InstaConnectors.json");
|
|
|
|
|
|
|
|
module.exports = async (hre) => {
|
|
|
|
if (hre.network.name === "mainnet") {
|
|
|
|
console.log(
|
2020-11-24 07:50:34 +00:00
|
|
|
"Deploying ConnectGelatoDataFullMakerToMaker to mainnet. Hit ctrl + c to abort"
|
2020-11-04 12:21:01 +00:00
|
|
|
);
|
2020-11-16 17:20:34 +00:00
|
|
|
console.log("❗ CONNECTOR DEPLOYMENT: VERIFY & HARDCODE CONNECTOR ID");
|
|
|
|
await sleep(6000);
|
2020-11-04 12:21:01 +00:00
|
|
|
}
|
|
|
|
|
2020-11-16 16:55:04 +00:00
|
|
|
const { deployments } = hre;
|
|
|
|
const { deploy } = deployments;
|
|
|
|
const { deployer } = await hre.getNamedAccounts();
|
2020-11-04 12:21:01 +00:00
|
|
|
|
2020-11-04 17:09:34 +00:00
|
|
|
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()],
|
|
|
|
});
|
|
|
|
|
2020-11-17 07:29:09 +00:00
|
|
|
const instaConnectors = await hre.ethers.getContractAt(
|
|
|
|
InstaConnector.abi,
|
|
|
|
hre.network.config.InstaConnectors
|
|
|
|
);
|
|
|
|
const connectorLength = await instaConnectors.connectorLength();
|
|
|
|
const connectorId = connectorLength.add(1);
|
|
|
|
|
2020-11-24 07:50:34 +00:00
|
|
|
await deploy("ConnectGelatoDataFullMakerToMaker", {
|
2020-11-17 07:29:09 +00:00
|
|
|
from: deployer,
|
|
|
|
args: [
|
|
|
|
connectorId,
|
|
|
|
(await deployments.get("ConnectGelatoProviderPayment")).address,
|
|
|
|
],
|
|
|
|
});
|
|
|
|
|
2020-11-04 17:09:34 +00:00
|
|
|
await instaConnectors
|
|
|
|
.connect(instaMaster)
|
|
|
|
.enable(
|
2020-11-24 07:50:34 +00:00
|
|
|
(await ethers.getContract("ConnectGelatoDataFullMakerToMaker")).address
|
2020-11-04 17:09:34 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
await hre.network.provider.request({
|
|
|
|
method: "hardhat_stopImpersonatingAccount",
|
|
|
|
params: [await instaMaster.getAddress()],
|
|
|
|
});
|
2020-11-17 07:29:09 +00:00
|
|
|
} else {
|
2020-11-24 07:50:34 +00:00
|
|
|
// the following will only deploy "ConnectGelatoDataFullMakerToMaker"
|
2020-11-17 07:29:09 +00:00
|
|
|
// if the contract was never deployed or if the code changed since last deployment
|
2020-11-24 07:50:34 +00:00
|
|
|
await deploy("ConnectGelatoDataFullMakerToMaker", {
|
2020-11-17 07:29:09 +00:00
|
|
|
from: deployer,
|
|
|
|
args: [
|
2020-11-24 07:50:34 +00:00
|
|
|
parseInt(process.env.ConnectGelatoDataFullMakerToMakerId),
|
2020-11-17 07:29:09 +00:00
|
|
|
(await deployments.get("ConnectGelatoProviderPayment")).address,
|
|
|
|
],
|
|
|
|
gasPrice: hre.network.config.gasPrice,
|
|
|
|
log: true,
|
|
|
|
});
|
2020-11-04 17:09:34 +00:00
|
|
|
}
|
2020-11-04 12:21:01 +00:00
|
|
|
};
|
|
|
|
|
2020-11-17 07:29:09 +00:00
|
|
|
module.exports.skip = async (hre) => {
|
|
|
|
if (hre.network.name === "mainnet") return true;
|
|
|
|
if (hre.network.name !== "hardhat")
|
2020-11-24 07:50:34 +00:00
|
|
|
return process.env.ConnectGelatoDataFullMakerToMakerId === undefined;
|
2020-11-17 07:29:09 +00:00
|
|
|
return false;
|
|
|
|
};
|
2020-11-04 12:21:01 +00:00
|
|
|
module.exports.dependencies = ["ConnectGelatoProviderPayment"];
|
2020-11-24 07:50:34 +00:00
|
|
|
module.exports.tags = ["ConnectGelatoDataFullMakerToMaker"];
|