Skip to content

Commit

Permalink
Merge pull request #77 from VenusProtocol/chore/ven-2101
Browse files Browse the repository at this point in the history
[VEN-2101] Migrate RiskFund deployments and adjust deployment
  • Loading branch information
0xlucian authored Mar 20, 2024
2 parents ff827ef + 1b73bba commit 80173a7
Show file tree
Hide file tree
Showing 11 changed files with 5,156 additions and 923 deletions.
35 changes: 31 additions & 4 deletions deploy/006-risk-fund-v2.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,42 @@
import { ethers } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async ({ getNamedAccounts, deployments }: HardhatRuntimeEnvironment) => {
import { multisigs } from "../helpers/utils";

const func: DeployFunction = async ({
network: { name, live },
getNamedAccounts,
deployments,
}: HardhatRuntimeEnvironment) => {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();

const proxyAdmin = await ethers.getContract("DefaultProxyAdmin");
const owner = await proxyAdmin.owner();

await deploy("RiskFundV2", {
contract: "RiskFundV2",
from: deployer,
args: [],
log: true,
contract: "RiskFundV2",
proxy: {
owner: owner,
proxyContract: "OpenZeppelinTransparentProxy",
upgradeIndex: 0,
},
autoMine: true,
log: true,
});

if (live) {
const targetOwner = (await ethers.getContractOrNull("NormalTimelock"))?.address || multisigs[name];

const contract = await ethers.getContract("RiskFundV2");
if ((await contract.owner()) !== targetOwner && (await contract.pendingOwner()) !== targetOwner) {
console.log(`Transferring ownership of RiskFundV2 to ${targetOwner}`);
const tx = await contract.transferOwnership(targetOwner);
await tx.wait();
}
}
};

func.tags = ["RiskFundV2"];
Expand Down
Loading

0 comments on commit 80173a7

Please sign in to comment.