Skip to content

Commit

Permalink
Merge pull request #493 from VenusProtocol/add-second-test-token
Browse files Browse the repository at this point in the history
feat: add second mock token
  • Loading branch information
coreyar authored Jun 25, 2024
2 parents 35771a1 + 77ce780 commit 9dc974c
Showing 1 changed file with 18 additions and 22 deletions.
40 changes: 18 additions & 22 deletions helpers/deploymentConfig.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { contracts as governanceBscMainnet } from "@venusprotocol/governance-contracts/deployments/bscmainnet.json";
import { contracts as governanceBscTestnet } from "@venusprotocol/governance-contracts/deployments/bsctestnet.json";
import { ethers } from "hardhat";
import { DeploymentsExtension } from "hardhat-deploy/types";

import { addresses as venusProtocolBscMainnet } from "../deployments/bscmainnet_addresses.json";
Expand All @@ -12,14 +11,18 @@ export enum InterestRateModels {
JumpRate,
}

export type TokenConfig = {
isMock: boolean;
name?: string;
symbol: string;
decimals?: number;
tokenAddress: string;
faucetInitialLiquidity?: boolean;
};
export type TokenConfig =
| {
isMock: true;
name: string;
symbol: string;
decimals: number;
}
| {
isMock: false;
symbol: string;
tokenAddress: string;
};

export type VTokenConfig = {
name: string;
Expand Down Expand Up @@ -77,7 +80,12 @@ export const globalConfig: NetworkConfig = {
name: "First Digital USD",
symbol: "FDUSD",
decimals: 18,
tokenAddress: ethers.constants.AddressZero,
},
{
isMock: true,
name: "Wrapped BNB",
symbol: "WBNB",
decimals: 18,
},
],
marketsConfig: [
Expand Down Expand Up @@ -108,7 +116,6 @@ export const globalConfig: NetworkConfig = {
name: "First Digital USD",
symbol: "FDUSD",
decimals: 18,
tokenAddress: ethers.constants.AddressZero,
},
],
marketsConfig: [
Expand Down Expand Up @@ -136,9 +143,7 @@ export const globalConfig: NetworkConfig = {
tokensConfig: [
{
isMock: false,
name: "First Digital USD",
symbol: "FDUSD",
decimals: 18,
tokenAddress: "0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409",
},
],
Expand Down Expand Up @@ -190,15 +195,6 @@ export function getTokenConfig(tokenSymbol: string, tokens: TokenConfig[]): Toke
}
}

export async function getTokenAddress(tokenConfig: TokenConfig, deployments: DeploymentsExtension) {
if (tokenConfig.isMock) {
const token = await deployments.get(`Mock${tokenConfig.symbol}`);
return token.address;
} else {
return tokenConfig.tokenAddress;
}
}

export const getContractAddressOrNullAddress = async (deployments: DeploymentsExtension, name: string) => {
try {
return (await deployments.get(name)).address;
Expand Down

0 comments on commit 9dc974c

Please sign in to comment.