Skip to content

Commit

Permalink
fix: added types
Browse files Browse the repository at this point in the history
  • Loading branch information
web3rover committed Dec 6, 2023
1 parent 88ece40 commit ac83c2c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions deploy/1-deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@ import testnetDeployments from "@venusprotocol/venus-protocol/networks/testnet.j
import hre, { ethers } from "hardhat";
import { HardhatRuntimeEnvironment } from "hardhat/types";

interface Network {
interface Contracts {
vBNBAddress: string;
comptroller: string;
WBNBAddress: string;
timelock: string;
acm: string;
}

interface Addresses {
[key: string]: Network;
enum NetworkName {
bsctestnet = "bsctestnet",
bscmainnet = "bscmainnet",
sepolia = "sepolia",
}

type Addresses = {
[key in NetworkName]: Contracts; // Note the "in" operator.
};

const ADDRESSES: Addresses = {
bsctestnet: {
vBNBAddress: testnetDeployments.Contracts.vBNB,
Expand Down Expand Up @@ -43,7 +49,7 @@ module.exports = async ({ getNamedAccounts, deployments, network }: HardhatRunti
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();

const networkName = network.name;
const networkName = network.name as NetworkName;

const { vBNBAddress, comptroller, WBNBAddress, timelock, acm } = ADDRESSES[networkName];
const loopsLimit = 20;
Expand Down

0 comments on commit ac83c2c

Please sign in to comment.