Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VEN-2330]: Deployment script for VAIController #354

Draft
wants to merge 1 commit into
base: VEN-2329
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions deploy/017-deploy-vai-controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { ethers } from "hardhat";
import { DeployResult } from "hardhat-deploy/dist/types";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import { getConfig } from "../helpers/deploymentConfig";
import { toAddress } from "../helpers/deploymentUtils";

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const deploymentConfig = await getConfig(hre.network.name);
const { preconfiguredAddresses } = deploymentConfig;

const accessControlManagerAddress = await toAddress(
preconfiguredAddresses.AccessControlManager || "AccessControlManager",
hre,
);

// VAIController Beacon
const vaiControllerImp: DeployResult = await deploy("VAIControllerImp", {
Copy link
Collaborator

@kkirka kkirka Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: We use Impl for Comptroller and VToken, maybe we could do the same here for consistency

Suggested change
const vaiControllerImp: DeployResult = await deploy("VAIControllerImp", {
const vaiControllerImp: DeployResult = await deploy("VAIControllerImpl", {

contract: "VAIController",
from: deployer,
args: [],
log: true,
autoMine: true,
});

const vaiControllerBeacon: DeployResult = await deploy("VAIControllerBeacon", {
contract: "UpgradeableBeacon",
from: deployer,
args: [vaiControllerImp.address],
log: true,
autoMine: true,
});

const VAIController = await ethers.getContractFactory("VAIController");
await deploy("VAIController", {
from: deployer,
contract: "BeaconProxy",
args: [
vaiControllerBeacon.address,
VAIController.interface.encodeFunctionData("initialize", [accessControlManagerAddress]),
],
log: true,
autoMine: true,
});
};

func.tags = ["VAIController", "il"];

export default func;