diff --git a/test/shared/mocks.ts b/test/shared/mocks.ts index fd805b9..7cb2cd7 100644 --- a/test/shared/mocks.ts +++ b/test/shared/mocks.ts @@ -1,4 +1,4 @@ -import { StrategyArgs } from "../../src/types"; +import { StrategyArgs, StrategyName } from "../../src/types"; import { BaseStrategy } from "../../src//strategies/base"; import type { BigNumber, ContractReceipt, Signer } from "ethers"; @@ -11,7 +11,7 @@ const { deployMockContract } = hre.waffle; export class MockStrategy extends BaseStrategy { constructor(args: StrategyArgs) { - super({ ...args, strategyName: "uniswap-v3" }); + super({ ...args, strategyName: null as unknown as StrategyName }); } protected async liquidate( _account: string, diff --git a/test/shared/utils.ts b/test/shared/utils.ts index ee4f22e..5bce713 100644 --- a/test/shared/utils.ts +++ b/test/shared/utils.ts @@ -15,12 +15,10 @@ export class StrategyTester { // @ts-ignore return this.strategy.isUnderwater(account); } - public htokens(): Htokens { // @ts-ignore return this.strategy.htokens(); } - public vaults(): Vaults { // @ts-ignore return this.strategy.vaults(); @@ -31,12 +29,10 @@ export class StrategyTester { // @ts-ignore return this.strategy.cacheHtoken(htoken); } - public async clearHtoken(htoken: string): Promise { // @ts-ignore return this.strategy.clearHtoken(htoken); } - public liquidate( _account: string, _bond: string, @@ -47,22 +43,18 @@ export class StrategyTester { // @ts-ignore return this.strategy.liquidate(_account, _bond, _collateral, _underlyingAmount, _underlying); } - public async liquidateAllMature(_latestBlock: number): Promise { // @ts-ignore return this.strategy.liquidateAllMature(_latestBlock); } - public async liquidateAllUnderwater(): Promise { // @ts-ignore return this.strategy.liquidateAllUnderwater(); } - public async syncAll(_latestBlock?: number): Promise { // @ts-ignore return this.strategy.syncAll(_latestBlock); } - public async updateVaults(account: string, type: "pop" | "push", fragment: { [key: string]: string }): Promise { // @ts-ignore return this.strategy.updateVaults(account, type, fragment); diff --git a/test/unit/base/base.ts b/test/unit/base/base.ts index 249dbf9..125a39f 100644 --- a/test/unit/base/base.ts +++ b/test/unit/base/base.ts @@ -1,4 +1,4 @@ -import { Provider } from "../../../src/types"; +import { NetworkConfig, Provider } from "../../../src/types"; import { unitFixtureBase } from "../../shared/fixtures"; import { MockStrategy } from "../../shared/mocks"; import { StrategyTester } from "../../shared/utils"; @@ -13,13 +13,10 @@ export function unitTestBase(): void { this.mocks.usdc = usdc; this.mocks.weth = weth; this.liquidator = new StrategyTester(MockStrategy, { - networkConfig: { + networkConfig: { contracts: { balanceSheet: balanceSheet.address, - strategies: {}, }, - flashbotsEnabled: false, - startBlock: 0, }, persistenceEnabled: false, provider: this.signers.runner.provider as Provider, diff --git a/test/unit/base/write/cacheHtoken.ts b/test/unit/base/write/cacheHtoken.ts index 6f1e647..1551105 100644 --- a/test/unit/base/write/cacheHtoken.ts +++ b/test/unit/base/write/cacheHtoken.ts @@ -7,7 +7,7 @@ export function shouldBehaveLikeCacheHtoken(): void { }); it("does nothing", async function () { - const htokensBefore = await this.liquidator.htokens(); + const htokensBefore = this.liquidator.htokens(); expect(htokensBefore).to.not.be.empty; const htoken = htokensBefore[this.mocks.bond.address]; expect(htoken).to.have.keys("maturity", "underlying", "underlyingPrecisionScalar"); @@ -15,17 +15,17 @@ export function shouldBehaveLikeCacheHtoken(): void { expect(htoken.underlying).to.be.eq(await this.mocks.bond.underlying()); expect(htoken.underlyingPrecisionScalar).to.be.eq(await this.mocks.bond.underlyingPrecisionScalar()); await this.liquidator.cacheHtoken(this.mocks.bond.address); - const htokensAfter = await this.liquidator.htokens(); + const htokensAfter = this.liquidator.htokens(); expect(htokensBefore).to.deep.equal(htokensAfter); }); }); context("when the hToken is not cached", function () { it("caches the hToken", async function () { - const htokensBefore = await this.liquidator.htokens(); + const htokensBefore = this.liquidator.htokens(); expect(htokensBefore).to.be.empty; await this.liquidator.cacheHtoken(this.mocks.bond.address); - const htokensAfter = await this.liquidator.htokens(); + const htokensAfter = this.liquidator.htokens(); expect(htokensAfter).to.not.be.empty; expect(htokensAfter).to.have.keys(this.mocks.bond.address); const htoken = htokensAfter[this.mocks.bond.address]; diff --git a/test/unit/base/write/clearHtoken.ts b/test/unit/base/write/clearHtoken.ts index 92e7114..5c49fc2 100644 --- a/test/unit/base/write/clearHtoken.ts +++ b/test/unit/base/write/clearHtoken.ts @@ -3,10 +3,10 @@ import { expect } from "chai"; export function shouldBehaveLikeClearHtoken(): void { context("when the hToken is not cached", function () { it("does nothing", async function () { - const htokensBefore = await this.liquidator.htokens(); + const htokensBefore = this.liquidator.htokens(); expect(htokensBefore).to.be.empty; await this.liquidator.clearHtoken(this.mocks.bond.address); - const htokensAfter = await this.liquidator.htokens(); + const htokensAfter = this.liquidator.htokens(); expect(htokensAfter).to.be.empty; }); }); @@ -17,7 +17,7 @@ export function shouldBehaveLikeClearHtoken(): void { }); it("clears the hToken", async function () { - const htokensBefore = await this.liquidator.htokens(); + const htokensBefore = this.liquidator.htokens(); expect(htokensBefore).to.not.be.empty; const htoken = htokensBefore[this.mocks.bond.address]; expect(htoken).to.have.keys("maturity", "underlying", "underlyingPrecisionScalar"); @@ -25,7 +25,7 @@ export function shouldBehaveLikeClearHtoken(): void { expect(htoken.underlying).to.be.eq(await this.mocks.bond.underlying()); expect(htoken.underlyingPrecisionScalar).to.be.eq(await this.mocks.bond.underlyingPrecisionScalar()); await this.liquidator.clearHtoken(this.mocks.bond.address); - const htokensAfter = await this.liquidator.htokens(); + const htokensAfter = this.liquidator.htokens(); expect(htokensAfter).to.be.empty; }); });