Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Debugger022 committed Sep 2, 2023
1 parent dc60a00 commit 51b66c9
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 28 deletions.
3 changes: 1 addition & 2 deletions tests/hardhat/Fork/RewardsForkTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ const { expect } = chai;
chai.use(smock.matchers);

const FORKING = process.env.FORKING === "true";
let network = process.env.NETWORK_NAME;
if (network == "") network = "bsc";
const network = process.env.NETWORK_NAME || "bsc";

const {
ACM,
Expand Down
6 changes: 2 additions & 4 deletions tests/hardhat/Fork/RiskFund.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import {
import { deployVTokenBeacon, makeVToken } from "../util/TokenTestHelpers";
import { getContractAddresses, setForkBlock } from "./utils";

let network = process.env.NETWORK_NAME;
if (network == "") network = "bsc";
const FORKING = process.env.FORKING === "true";
const network = process.env.NETWORK_NAME || "bsc";

const { PANCAKE_SWAP_ROUTER, BUSD_HOLDER, USDC_HOLDER, USDT_HOLDER, BLOCK_NUMBER } = getContractAddresses(
network as string,
Expand Down Expand Up @@ -59,8 +59,6 @@ let busdUser: SignerWithAddress;
let usdcUser: SignerWithAddress;
let usdtUser: SignerWithAddress;
const maxLoopsLimit = 150;

const FORKING = process.env.FORKING === "true";
const someNonzeroAddress = "0x0000000000000000000000000000000000000001";

const initPancakeSwapRouter = async (
Expand Down
5 changes: 2 additions & 3 deletions tests/hardhat/Fork/RiskFundSwap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import {
import { deployVTokenBeacon, makeVToken } from "../util/TokenTestHelpers";
import { getContractAddresses, initMainnetUser, setForkBlock } from "./utils";

let network = process.env.NETWORK_NAME;
if (network == "") network = "bsc";
const FORKING = process.env.FORKING === "true";
const network = process.env.NETWORK_NAME || "bsc";

const { PANCAKE_SWAP_ROUTER, BUSD_HOLDER, USDT_HOLDER, BLOCK_NUMBER } = getContractAddresses(network as string);

Expand All @@ -45,7 +45,6 @@ let busdUser: SignerWithAddress;
let usdtUser: SignerWithAddress;
const maxLoopsLimit = 150;

const FORKING = process.env.FORKING === "true";
const ADD_RESERVE_AMOUNT = parseUnits("100", 18);
const REDUCE_RESERVE_AMOUNT = parseUnits("50", 18);

Expand Down
3 changes: 1 addition & 2 deletions tests/hardhat/Fork/Shortfall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ import {
import { getContractAddresses, initMainnetUser, setForkBlock } from "./utils";

const FORKING = process.env.FORKING === "true";
let network = process.env.NETWORK_NAME;
if (network == "") network = "bsc";
const network = process.env.NETWORK_NAME || "bsc";

const {
ADMIN,
Expand Down
5 changes: 2 additions & 3 deletions tests/hardhat/Fork/borrowAndRepayTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ const { expect } = chai;
chai.use(smock.matchers);

const FORKING = process.env.FORKING === "true";
let network = process.env.NETWORK_NAME;
if (network == "") network = "bsc";

const network = process.env.NETWORK_NAME || "bsc";
console.log(network);
const {
ACM,
ACC1,
Expand Down
3 changes: 1 addition & 2 deletions tests/hardhat/Fork/liquidation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ const { expect } = chai;
chai.use(smock.matchers);

const FORKING = process.env.FORKING === "true";
let network = process.env.NETWORK_NAME;
if (network == "") network = "bsc";
const network = process.env.NETWORK_NAME || "bsc";

const {
ACM,
Expand Down
3 changes: 1 addition & 2 deletions tests/hardhat/Fork/reduceReservesTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ const { expect } = chai;
chai.use(smock.matchers);

const FORKING = process.env.FORKING === "true";
let network = process.env.NETWORK_NAME;
if (network == "") network = "bsc";
const network = process.env.NETWORK_NAME || "bsc";

const { ACM, ACC1, ACC2, ADMIN, TOKEN1, VTOKEN1, TOKEN1_HOLDER, COMPTROLLER, BLOCK_NUMBER } = getContractAddresses(
network as string,
Expand Down
3 changes: 1 addition & 2 deletions tests/hardhat/Fork/supply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ const { expect } = chai;
chai.use(smock.matchers);

const FORKING = process.env.FORKING === "true";
let network = process.env.NETWORK_NAME;
if (network == "") network = "bsc";
const network = process.env.NETWORK_NAME || "bsc";

const {
ACM,
Expand Down
10 changes: 2 additions & 8 deletions tests/hardhat/Fork/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@ import { ethers, network } from "hardhat";
import { archiveNodes, contractAddreseses } from "./constants";

function getArchieveNode(name: string) {
if (name != "") {
return archiveNodes[name];
}
return archiveNodes["bsc"];
return archiveNodes[name];
}

export function getContractAddresses(name: string) {
if (name != "") {
return contractAddreseses[name];
}
return contractAddreseses["bsc"];
return contractAddreseses[name];
}

export const forking = (blockNumber: number, fn: () => void) => {
Expand Down

0 comments on commit 51b66c9

Please sign in to comment.