// npx hardhat deploy --network astar --tags INIT
// npx hardhat deploy --network fantom_testnet --tags INIT
import { ethers } from "hardhat";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import fs from "fs";
export async function mydeploy(
hre: HardhatRuntimeEnvironment,
contractName: string,
from: string,
args: any,
log: boolean,
gasLimit: number
) {
console.log("mydeploy: " + contractName + "\\n");
await ethers.getContractFactory(contractName);
const ret = await hre.deployments.deploy(contractName, {
from: from,
args: args,
log: log,
gasLimit: gasLimit,
});
return await ethers.getContractAt(ret.abi, ret.address);
}
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log("\\n\\n\\n\\n\\n\\n\\n start .... deployment \\n\\n\\n\\n\\n ");
console.log("hre.network.name = " + hre.network.name);
const nullAddress = "0x0000000000000000000000000000000000000000";
const signers = await ethers.getSigners();
const deployer = signers[0].address;
const gasLimit1 = 3000000;
const gasLimit2 = 3500000;
const gasLimit3 = 5000000;
// const deadline = Math.floor(Date.now() / 1000) + 100;
console.log("deployer = " + deployer);
console.log("\\n\\n\\n\\n");
const Presale = await mydeploy(hre, "Presale", deployer, [], true, gasLimit3);
console.log("#Presale");
console.log(
"npx hardhat verify --network " +
hre.network.name +
" " +
Presale.address +
" "
);
};
func.tags = ["INIT"];
func.skip = async (hre) => {
return (
hre.network.name !== "hardhat" &&
hre.network.name !== "astar" &&
hre.network.name !== "shiden" &&
hre.network.name !== "fantomtest" &&
hre.network.name !== "localhost" &&
hre.network.name !== "mumbai" &&
hre.network.name !== "fantom" &&
hre.network.name !== "harmony" &&
hre.network.name !== "harmonytest" &&
hre.network.name !== "fantom_testnet" &&
hre.network.name !== "shibuya"
);
};
export default func;
https://hardhat.org/tutorial/deploying-to-a-live-network
ここでやってる!