42 lines
1.4 KiB
TypeScript
42 lines
1.4 KiB
TypeScript
import { HardhatRuntimeEnvironment } from "hardhat/types";
|
|
import { DeployFunction } from "hardhat-deploy/types";
|
|
import { updateArray } from "../scripts/utils"
|
|
|
|
const ONE_DAY = 3600 * 24
|
|
|
|
const deployCECDistributor: DeployFunction =
|
|
async function (hre: HardhatRuntimeEnvironment) {
|
|
const provider = hre.ethers.provider;
|
|
const from = await (await provider.getSigner()).getAddress();
|
|
const config = require(`../config/config_${hre.network.name}`);
|
|
const { admin, proposers, executors } = config.admins
|
|
const { cec } = config.staking
|
|
// update distributor wallet
|
|
const wallet = admin;
|
|
const start = (Date.now() / 1000 + 3600) | 0 // one hour later
|
|
const params: any[] = [ 'first', cec, start]
|
|
// const params: any[] = [ 'first', cec, wallet, 0, 10, 500000]
|
|
const ret = await hre.deployments.deploy("CECDistributor", {
|
|
from,
|
|
args: params,
|
|
log: true,
|
|
});
|
|
console.log("==CECDistributor addr=", ret.address);
|
|
updateArray({
|
|
name: "CECDistributor",
|
|
type: "logic",
|
|
json: "assets/contracts/CECDistributor.json",
|
|
address: ret.address,
|
|
network: hre.network.name,
|
|
});
|
|
// verify the contract
|
|
await hre.run("verify:verify", {
|
|
address: ret.address,
|
|
constructorArguments: params,
|
|
});
|
|
};
|
|
|
|
deployCECDistributor.tags = ["CECDistributor"];
|
|
|
|
export default deployCECDistributor;
|