Skip to content

Commit

Permalink
test: replace instances with
Browse files Browse the repository at this point in the history
  • Loading branch information
PARABRAHMAN0 committed Mar 18, 2022
1 parent 7b320e5 commit 704b44a
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 383 deletions.
24 changes: 12 additions & 12 deletions test/allocators/AaveAllocatorV2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
TreasuryExtender,
TreasuryExtender__factory,
OlympusAuthority,
MockERC20,
ERC20,
AaveAllocatorV2,
AaveAllocatorV2__factory,
} from "../../types";
Expand All @@ -36,16 +36,16 @@ describe("AaveAllocatorV2", () => {
let factory: AaveAllocatorV2__factory;

// tokens
let frax: MockERC20;
let dai: MockERC20;
let weth: MockERC20;
let afrax: MockERC20;
let adai: MockERC20;
let aweth: MockERC20;
let usdc: MockERC20;
let usdt: MockERC20;
let tokens: MockERC20[];
let utilTokens: MockERC20[];
let frax: ERC20;
let dai: ERC20;
let weth: ERC20;
let afrax: ERC20;
let adai: ERC20;
let aweth: ERC20;
let usdc: ERC20;
let usdt: ERC20;
let tokens: ERC20[];
let utilTokens: ERC20[];

// network
let url: string = config.networks.hardhat.forking!.url;
Expand Down Expand Up @@ -410,7 +410,7 @@ describe("AaveAllocatorV2", () => {
allocator.address
);

const tempcoin: MockERC20 = utilTokens[i].connect(wallocator);
const tempcoin: ERC20 = utilTokens[i].connect(wallocator);

await helpers.addEth(allocator.address, bne(10, 23));

Expand Down
26 changes: 13 additions & 13 deletions test/allocators/AllocatorTestTemplate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { BigNumber } from "ethers";

/// TYPES
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { MockERC20, OlympusTreasury, TreasuryExtender, OlympusAuthority } from "../../types";
import { ERC20, OlympusTreasury, TreasuryExtender, OlympusAuthority } from "../../types";

/// DATA
import { coins } from "../utils/coins";
Expand Down Expand Up @@ -83,9 +83,9 @@ describe(ALLOCATORN, () => {
let url: string = config.networks.hardhat.forking!.url;

/// TOKENS
let underlying: MockERC20[] = [];
let utility: MockERC20[] = [];
let reward: MockERC20[] = [];
let underlying: ERC20[] = [];
let utility: ERC20[] = [];
let reward: ERC20[] = [];

/////////////////// CUSTOM

Expand Down Expand Up @@ -332,7 +332,7 @@ describe(ALLOCATORN, () => {
for (let i = 0; i < utility.length; i++) {
it(`revert: a foreign address should not be able to withdraw some of utility token under index ${i}`, async () => {
// connected to owner
const uToken: MockERC20 = underlying[i];
const uToken: ERC20 = underlying[i];
const balance: BigNumber = await uToken.balanceOf(allocator.address);

await expect(
Expand All @@ -341,7 +341,7 @@ describe(ALLOCATORN, () => {
});

it(`passing: extender should be able to withdraw some of utility token under index ${i}`, async () => {
const uToken: MockERC20 = underlying[i];
const uToken: ERC20 = underlying[i];
const balance: BigNumber = await uToken.balanceOf(allocator.address);
const amount: BigNumber = balance.div(2);

Expand All @@ -355,7 +355,7 @@ describe(ALLOCATORN, () => {
});

it(`passing: extender should be able to withdraw all of utility token under index ${i}`, async () => {
const uToken: MockERC20 = underlying[i];
const uToken: ERC20 = underlying[i];
const balance: BigNumber = await uToken.balanceOf(allocator.address);

await expect(() =>
Expand All @@ -371,7 +371,7 @@ describe(ALLOCATORN, () => {
for (let i = 0; i < reward.length; i++) {
it(`revert: a foreign address should not be able to withdraw some of reward token under index ${i}`, async () => {
// connected to owner
const rToken: MockERC20 = reward[i];
const rToken: ERC20 = reward[i];
const balance: BigNumber = await rToken.balanceOf(allocator.address);

await expect(
Expand All @@ -380,7 +380,7 @@ describe(ALLOCATORN, () => {
});

it(`passing: extender should be able to withdraw some of reward token under index ${i}`, async () => {
const rToken: MockERC20 = reward[i];
const rToken: ERC20 = reward[i];
const balance: BigNumber = await rToken.balanceOf(allocator.address);
const amount: BigNumber = balance.div(2);

Expand All @@ -394,7 +394,7 @@ describe(ALLOCATORN, () => {
});

it(`passing: extender should be able to withdraw all of reward token under index ${i}`, async () => {
const rToken: MockERC20 = reward[i];
const rToken: ERC20 = reward[i];
const balance: BigNumber = await rToken.balanceOf(allocator.address);

await expect(() =>
Expand Down Expand Up @@ -475,7 +475,7 @@ describe(ALLOCATORN, () => {
for (let i = 0; i < underlying.length; i++) {
it(`revert: a foreign address should not be able to withdraw some of token under index ${i}`, async () => {
// connected to owner
const unToken: MockERC20 = underlying[i];
const unToken: ERC20 = underlying[i];
const balance: BigNumber = await unToken.balanceOf(allocator.address);

await expect(
Expand All @@ -484,7 +484,7 @@ describe(ALLOCATORN, () => {
});

it(`passing: should be able to return some of token under index ${i} to treasury`, async () => {
const unToken: MockERC20 = underlying[i];
const unToken: ERC20 = underlying[i];
const balance: BigNumber = await unToken.balanceOf(allocator.address);
const amount: BigNumber = balance.div(2);

Expand All @@ -494,7 +494,7 @@ describe(ALLOCATORN, () => {
});

it(`passing: should be able to return all of token under index ${i} to treasury`, async () => {
const unToken: MockERC20 = underlying[i];
const unToken: ERC20 = underlying[i];
const balance: BigNumber = await unToken.balanceOf(allocator.address);

await expect(() =>
Expand Down
8 changes: 4 additions & 4 deletions test/allocators/BtrflyAllocator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
TreasuryExtender,
TreasuryExtender__factory,
OlympusAuthority,
MockERC20,
ERC20,
BtrflyAllocator,
BtrflyAllocator__factory,
} from "../../types";
Expand All @@ -34,10 +34,10 @@ describe("BtrflyAllocator", () => {
let factory: BtrflyAllocator__factory;

// tokens
let btrfly: MockERC20;
let btrfly: ERC20;
let xBtrfly: any;

let tokens: MockERC20[];
let tokens: ERC20[];
let utilTokens: any[];

// network
Expand Down Expand Up @@ -275,7 +275,7 @@ describe("BtrflyAllocator", () => {

const wallocator: SignerWithAddress = await helpers.impersonate(allocator.address);

const tempcoin: MockERC20 = utilTokens[0].connect(wallocator);
const tempcoin: ERC20 = utilTokens[0].connect(wallocator);
await helpers.addEth(allocator.address, bne(10, 23));

await tempcoin.transfer(
Expand Down
Loading

0 comments on commit 704b44a

Please sign in to comment.