"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const hardhat_1 = require("hardhat");
const func = function (hre) {
    return __awaiter(this, void 0, void 0, function* () {
        const { deployments, getNamedAccounts } = hre;
        const { deploy } = deployments;
        const { deployer } = yield getNamedAccounts();
        yield deploy("GovernorBravoDelegate", {
            from: deployer,
            args: [],
            log: true,
            autoMine: true,
            skipIfAlreadyDeployed: true,
        });
        const GovernorBravoDelegate = yield hardhat_1.ethers.getContract("GovernorBravoDelegate");
        const GovernorBravoDelegator = yield hardhat_1.ethers.getContract("GovernorBravoDelegator");
        if (GovernorBravoDelegator.admin() == deployer) {
            const tx = yield GovernorBravoDelegator._setImplementation(GovernorBravoDelegate.address);
            yield tx.wait();
        }
    });
};
func.skip = (hre) => __awaiter(void 0, void 0, void 0, function* () { return !(hre.network.name === "bsctestnet" || hre.network.name === "bscmainnet"); });
func.tags = ["governor-bravo"];
exports.default = func;
//# sourceMappingURL=011-deploy-governor-bravo.js.map