diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index b4a99315..12da2b98 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -14,8 +14,11 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: + node-version: 16 cache: "npm" - run: npm install + - run: npx hardhat compile - run: npm run format:check - run: npm run lint + - run: npm run type-check - run: npm test diff --git a/.solhint.json b/.solhint.json index b74b5782..d3a59be4 100644 --- a/.solhint.json +++ b/.solhint.json @@ -2,6 +2,10 @@ "extends": "solhint:recommended", "rules": { "compiler-version": ["error", "^0.8.16"], - "func-visibility": ["warn", { "ignoreConstructors": true }] + "func-name-mixedcase": "off", + "func-visibility": ["warn", { "ignoreConstructors": true }], + "no-empty-blocks": "off", + "not-rely-on-time": "off", + "reason-string": ["warn", { "maxLength": 50 }] } } diff --git a/contracts/Loan.sol b/contracts/Loan.sol index f3600eec..c83c0280 100644 --- a/contracts/Loan.sol +++ b/contracts/Loan.sol @@ -17,7 +17,6 @@ import "./upgrades/BeaconImplementation.sol"; */ contract Loan is ILoan, BeaconImplementation { using SafeMath for uint256; - uint256 constant RAY = 10**27; IServiceConfiguration private _serviceConfiguration; address private _factory; @@ -153,10 +152,12 @@ contract Loan is ILoan, BeaconImplementation { uint256 paymentsTotal = settings .principal .mul(settings.apr) - .mul(settings.duration.mul(RAY).div(360)) - .div(RAY) + .mul(settings.duration.mul(LoanLib.RAY).div(360)) + .div(LoanLib.RAY) .div(10000); - payment = paymentsTotal.mul(RAY).div(paymentsRemaining).div(RAY); + payment = paymentsTotal.mul(LoanLib.RAY).div(paymentsRemaining).div( + LoanLib.RAY + ); } /** @@ -393,7 +394,7 @@ contract Loan is ILoan, BeaconImplementation { IPool(_pool).serviceFeeBps(), block.timestamp, paymentDueDate, - RAY + LoanLib.RAY ); LoanLib.payFees( @@ -430,7 +431,7 @@ contract Loan is ILoan, BeaconImplementation { IPool(_pool).serviceFeeBps(), block.timestamp, paymentDueDate, - RAY + LoanLib.RAY ); } @@ -445,23 +446,23 @@ contract Loan is ILoan, BeaconImplementation { atState(ILoanLifeCycleState.Active) returns (uint256) { - uint256 scalingValue = RAY; + uint256 scalingValue = LoanLib.RAY; if (settings.loanType == ILoanType.Open) { // If an open term loan payment is not overdue, we will prorate the // payment if (paymentDueDate > block.timestamp) { // Calculate the scaling value - // RAY - ((paymentDueDate - blocktimestamp) * RAY / paymentPeriod (seconds)) - scalingValue = RAY.sub( - (paymentDueDate - block.timestamp).mul(RAY).div( + // LoanLib.RAY - ((paymentDueDate - blocktimestamp) * LoanLib.RAY / paymentPeriod (seconds)) + scalingValue = LoanLib.RAY.sub( + (paymentDueDate - block.timestamp).mul(LoanLib.RAY).div( settings.paymentPeriod * 1 days ) ); } } else { // Fixed term loans must pay all outstanding interest payments and fees. - scalingValue = RAY.mul(paymentsRemaining); + scalingValue = LoanLib.RAY.mul(paymentsRemaining); } ILoanFees memory _fees = LoanLib.previewFees( diff --git a/contracts/libraries/LoanLib.sol b/contracts/libraries/LoanLib.sol index 87142b52..7f4bcd9a 100644 --- a/contracts/libraries/LoanLib.sol +++ b/contracts/libraries/LoanLib.sol @@ -15,7 +15,7 @@ library LoanLib { using SafeERC20 for IERC20; using SafeMath for uint256; - uint256 constant RAY = 10**27; + uint256 public constant RAY = 10**27; /** * @dev Emitted when loan is funded. diff --git a/package.json b/package.json index 8be60732..14167766 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "lint:solidity": "solhint contracts/**/*.sol", "test": "npx hardhat test", "test:coverage": "npx hardhat coverage", - "test:gas": "REPORT_GAS=true npx hardhat test" + "test:gas": "REPORT_GAS=true npx hardhat test", + "type-check": "tsc --pretty --noEmit" }, "devDependencies": { "@nomicfoundation/hardhat-toolbox": "^2.0.0", diff --git a/scripts/deploy-permissionless.ts b/scripts/deploy-permissionless.ts index 4cb6d598..5a024940 100644 --- a/scripts/deploy-permissionless.ts +++ b/scripts/deploy-permissionless.ts @@ -1,9 +1,15 @@ import { ethers } from "hardhat"; import hre from "hardhat"; +type ExtendedHreNetworkConfig = typeof hre.network.config & { + usdcAddress: string | undefined; +}; + async function main() { // The token we use for the liquidity asset must exist. If it is not defined, we'll deploy a mock token. - let usdcAddress = hre.network.config.usdcAddress; + let usdcAddress = (hre.network.config as ExtendedHreNetworkConfig) + .usdcAddress; + if (!usdcAddress) { const Usdc = await ethers.getContractFactory("MockERC20"); const usdc = await Usdc.deploy("USD Coin", "USDC", 6); diff --git a/scripts/deploy.ts b/scripts/deploy.ts index c5c224d3..f2a73db8 100644 --- a/scripts/deploy.ts +++ b/scripts/deploy.ts @@ -1,9 +1,15 @@ import { ethers } from "hardhat"; import hre from "hardhat"; +type ExtendedHreNetworkConfig = typeof hre.network.config & { + usdcAddress: string | undefined; +}; + async function main() { // The token we use for the liquidity asset must exist. If it is not defined, we'll deploy a mock token. - let usdcAddress = hre.network.config.usdcAddress; + let usdcAddress = (hre.network.config as ExtendedHreNetworkConfig) + .usdcAddress; + if (!usdcAddress) { const Usdc = await ethers.getContractFactory("MockERC20"); const usdc = await Usdc.deploy("USD Coin", "USDC", 6); @@ -31,6 +37,8 @@ async function main() { "ToSAcceptanceRegistry" ); const toSAcceptanceRegistry = await ToSAcceptanceRegistry.deploy( + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore serviceConfiguration.address ); await toSAcceptanceRegistry.deployed(); @@ -60,6 +68,8 @@ async function main() { "PoolAdminAccessControl" ); const poolAdminAccessControl = await PoolAdminAccessControl.deploy( + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore serviceConfiguration.address ); await poolAdminAccessControl.deployed(); diff --git a/test/FirstLossVault.test.ts b/test/FirstLossVault.test.ts index 278527d0..c8d34915 100644 --- a/test/FirstLossVault.test.ts +++ b/test/FirstLossVault.test.ts @@ -1,7 +1,6 @@ import { loadFixture } from "@nomicfoundation/hardhat-network-helpers"; import { expect } from "chai"; import { ethers } from "hardhat"; -import { deployServiceConfiguration } from "./support/serviceconfiguration"; describe("FirstLossVault", () => { const VAULT_BALANCE = ethers.BigNumber.from(100); diff --git a/test/controllers/PoolController.test.ts b/test/controllers/PoolController.test.ts index 98c47ee5..1b52113c 100644 --- a/test/controllers/PoolController.test.ts +++ b/test/controllers/PoolController.test.ts @@ -905,7 +905,7 @@ describe("PoolController", () => { // double check that the funds are now available for withdraw expect(await pool.maxRedeem(otherAccount.address)).to.equal( - redeemAmount - 2 + redeemAmount.sub(2) ); // check that totalAvailableAssets is dust diff --git a/test/permissioned/PermissionedLoan.test.ts b/test/permissioned/PermissionedLoan.test.ts index 652bc470..4753c265 100644 --- a/test/permissioned/PermissionedLoan.test.ts +++ b/test/permissioned/PermissionedLoan.test.ts @@ -19,7 +19,7 @@ import { getCommonSigners } from "../support/utils"; describe("PermissionedLoan", () => { async function loadLoanFixture() { - const { operator, poolAdmin, borrower, lender } = await getCommonSigners(); + const { poolAdmin, borrower, lender } = await getCommonSigners(); const { mockERC20: liquidityAsset } = await deployMockERC20(); const NftAsset = await ethers.getContractFactory("MockERC721"); diff --git a/test/permissioned/PermissionedLoanFactory.test.ts b/test/permissioned/PermissionedLoanFactory.test.ts index 1428714e..0aaa4795 100644 --- a/test/permissioned/PermissionedLoanFactory.test.ts +++ b/test/permissioned/PermissionedLoanFactory.test.ts @@ -3,15 +3,13 @@ import { expect } from "chai"; import { ethers } from "hardhat"; import { deployMockERC20 } from "../support/erc20"; import { deployPermissionedPool, DEFAULT_POOL_SETTINGS } from "../support/pool"; -import { DEFAULT_LOAN_SETTINGS, deployPermissionedLoan } from "../support/loan"; -import { deployPermissionedServiceConfiguration } from "../support/serviceconfiguration"; -import { deployToSAcceptanceRegistry } from "../support/tosacceptanceregistry"; +import { DEFAULT_LOAN_SETTINGS } from "../support/loan"; import { findEventByName, getCommonSigners } from "../support/utils"; describe("PermissionedLoanFactory", () => { async function deployFixture() { // Contracts are deployed using the first signer/account by default - const { operator, poolAdmin, borrower, otherAccounts, deployer } = + const { operator, poolAdmin, borrower, deployer } = await getCommonSigners(); // Deploy the liquidity asset diff --git a/test/permissioned/PermissionedPool.test.ts b/test/permissioned/PermissionedPool.test.ts index 0ebfe1d9..276726de 100644 --- a/test/permissioned/PermissionedPool.test.ts +++ b/test/permissioned/PermissionedPool.test.ts @@ -11,14 +11,8 @@ import { describe("PermissionedPool", () => { async function loadPoolFixture() { - const [ - operator, - protocolAdmin, - poolAdmin, - otherAccount, - thirdAccount, - allowedLender - ] = await ethers.getSigners(); + const [poolAdmin, otherAccount, thirdAccount, allowedLender] = + await ethers.getSigners(); const { pool, liquidityAsset, @@ -26,9 +20,7 @@ describe("PermissionedPool", () => { tosAcceptanceRegistry, poolController } = await deployPermissionedPool({ - operator, - poolAdmin: poolAdmin, - protocolAdmin: protocolAdmin + poolAdmin: poolAdmin }); // allow allowedLender diff --git a/test/scenarios/business/1.test.ts b/test/scenarios/business/1.test.ts index cca0925f..5845b38f 100644 --- a/test/scenarios/business/1.test.ts +++ b/test/scenarios/business/1.test.ts @@ -51,7 +51,7 @@ describe("Business Scenario 1", () => { } async function loadFixtures() { - const [operator, poolAdmin, lenderA, lenderB, borrowerOne, borrowerTwo] = + const [poolAdmin, lenderA, lenderB, borrowerOne, borrowerTwo] = await ethers.getSigners(); const startTime = await time.latest(); @@ -66,7 +66,6 @@ describe("Business Scenario 1", () => { 6 ); const { pool, serviceConfiguration, poolController } = await deployPool({ - operator, poolAdmin: poolAdmin, settings: poolSettings, liquidityAsset: mockUSDC diff --git a/test/scenarios/business/3.test.ts b/test/scenarios/business/3.test.ts index bd9d1858..b0996331 100644 --- a/test/scenarios/business/3.test.ts +++ b/test/scenarios/business/3.test.ts @@ -39,8 +39,7 @@ describe("Business Scenario 3", () => { } async function fixtures() { - const [operator, poolAdmin, lenderA, lenderB, borrower] = - await ethers.getSigners(); + const [poolAdmin, lenderA, lenderB, borrower] = await ethers.getSigners(); const endTime = (await time.latest()) + 5_184_000; // 60 days. const poolSettings = { endDate: endTime, // Jan 1, 2050 @@ -52,7 +51,6 @@ describe("Business Scenario 3", () => { 6 ); const { pool, serviceConfiguration, poolController } = await deployPool({ - operator, poolAdmin: poolAdmin, settings: poolSettings, liquidityAsset: mockUSDC diff --git a/test/scenarios/business/4.test.ts b/test/scenarios/business/4.test.ts index a56330ff..6be5a16b 100644 --- a/test/scenarios/business/4.test.ts +++ b/test/scenarios/business/4.test.ts @@ -39,8 +39,7 @@ describe("Business Scenario 4", () => { } async function fixtures() { - const [operator, poolAdmin, lenderA, lenderB, borrower] = - await ethers.getSigners(); + const [poolAdmin, lenderA, lenderB, borrower] = await ethers.getSigners(); const endTime = (await time.latest()) + 5_184_000; // 60 days. const poolSettings = { endDate: endTime, // Jan 1, 2050 @@ -52,7 +51,6 @@ describe("Business Scenario 4", () => { 6 ); const { pool, serviceConfiguration, poolController } = await deployPool({ - operator, poolAdmin: poolAdmin, settings: poolSettings, liquidityAsset: mockUSDC diff --git a/test/scenarios/business/permissioned/1.test.ts b/test/scenarios/business/permissioned/1.test.ts index 083811bf..9079bca1 100644 --- a/test/scenarios/business/permissioned/1.test.ts +++ b/test/scenarios/business/permissioned/1.test.ts @@ -54,7 +54,7 @@ describe("Permissioned Business Scenario 1", () => { } async function loadFixtures() { - const [operator, poolAdmin, lenderA, lenderB, borrowerOne, borrowerTwo] = + const [poolAdmin, lenderA, lenderB, borrowerOne, borrowerTwo] = await ethers.getSigners(); const startTime = await time.latest(); @@ -75,7 +75,6 @@ describe("Permissioned Business Scenario 1", () => { poolAccessControl, tosAcceptanceRegistry } = await deployPermissionedPool({ - operator, poolAdmin: poolAdmin, settings: poolSettings, liquidityAsset: mockUSDC diff --git a/test/scenarios/business/permissioned/2.test.ts b/test/scenarios/business/permissioned/2.test.ts index a6758300..2a9bf221 100644 --- a/test/scenarios/business/permissioned/2.test.ts +++ b/test/scenarios/business/permissioned/2.test.ts @@ -40,8 +40,7 @@ describe("Permissioned Business Scenario 2", () => { } async function fixtures() { - const [operator, poolAdmin, lenderA, lenderB, borrower] = - await ethers.getSigners(); + const [poolAdmin, lenderA, lenderB, borrower] = await ethers.getSigners(); const endTime = (await time.latest()) + 5_184_000; // 60 days. const poolSettings = { endDate: endTime, // Jan 1, 2050 @@ -60,7 +59,6 @@ describe("Permissioned Business Scenario 2", () => { poolAccessControl, tosAcceptanceRegistry } = await deployPermissionedPool({ - operator, poolAdmin: poolAdmin, settings: poolSettings, liquidityAsset: mockUSDC diff --git a/test/scenarios/business/permissioned/3.test.ts b/test/scenarios/business/permissioned/3.test.ts index e42f3978..2136830a 100644 --- a/test/scenarios/business/permissioned/3.test.ts +++ b/test/scenarios/business/permissioned/3.test.ts @@ -40,8 +40,7 @@ describe("Permissioned Business Scenario 3", () => { } async function fixtures() { - const [operator, poolAdmin, lenderA, lenderB, borrower] = - await ethers.getSigners(); + const [poolAdmin, lenderA, lenderB, borrower] = await ethers.getSigners(); const endTime = (await time.latest()) + 5_184_000; // 60 days. const poolSettings = { endDate: endTime, // Jan 1, 2050 @@ -59,7 +58,6 @@ describe("Permissioned Business Scenario 3", () => { poolAccessControl, tosAcceptanceRegistry } = await deployPermissionedPool({ - operator, poolAdmin: poolAdmin, settings: poolSettings, liquidityAsset: mockUSDC diff --git a/test/scenarios/business/permissioned/4.test.ts b/test/scenarios/business/permissioned/4.test.ts index 57b3035f..f8c01b80 100644 --- a/test/scenarios/business/permissioned/4.test.ts +++ b/test/scenarios/business/permissioned/4.test.ts @@ -40,8 +40,7 @@ describe("Permissioned Business Scenario 4", () => { } async function fixtures() { - const [operator, poolAdmin, lenderA, lenderB, borrower] = - await ethers.getSigners(); + const [poolAdmin, lenderA, lenderB, borrower] = await ethers.getSigners(); const endTime = (await time.latest()) + 5_184_000; // 60 days. const poolSettings = { endDate: endTime, // Jan 1, 2050 @@ -59,7 +58,6 @@ describe("Permissioned Business Scenario 4", () => { poolAccessControl, tosAcceptanceRegistry } = await deployPermissionedPool({ - operator, poolAdmin: poolAdmin, settings: poolSettings, liquidityAsset: mockUSDC diff --git a/test/scenarios/pool/crank-variations.test.ts b/test/scenarios/pool/crank-variations.test.ts index 5ed0a6fc..b0f6d516 100644 --- a/test/scenarios/pool/crank-variations.test.ts +++ b/test/scenarios/pool/crank-variations.test.ts @@ -7,12 +7,10 @@ describe("Crank Variations", () => { const DEPOSIT_AMOUNT = 1_000_000; async function loadPoolFixture() { - const [operator, poolAdmin, aliceLender, bobLender] = - await ethers.getSigners(); + const [poolAdmin, aliceLender, bobLender] = await ethers.getSigners(); const { pool, liquidityAsset, withdrawController, poolController } = await deployPool({ - operator, poolAdmin: poolAdmin }); @@ -264,10 +262,8 @@ describe("Crank Variations", () => { const { pool, aliceLender, - bobLender, liquidityAsset, poolAdmin, - withdrawRequestPeriodDuration, withdrawController, poolController } = await loadFixture(loadPoolFixture); diff --git a/test/scenarios/pool/direct-deposit.test.ts b/test/scenarios/pool/direct-deposit.test.ts index a59fe586..d6fa90dd 100644 --- a/test/scenarios/pool/direct-deposit.test.ts +++ b/test/scenarios/pool/direct-deposit.test.ts @@ -1,6 +1,5 @@ import { loadFixture } from "@nomicfoundation/hardhat-network-helpers"; import { expect } from "chai"; -import { ethers } from "hardhat"; import { deployLoan, fundLoan } from "../../support/loan"; import { activatePool, deployPool } from "../../support/pool"; import { getCommonSigners } from "../../support/utils"; diff --git a/test/scenarios/pool/fixed-term-defaulted.test.ts b/test/scenarios/pool/fixed-term-defaulted.test.ts index bd4cc70f..1e51eb4c 100644 --- a/test/scenarios/pool/fixed-term-defaulted.test.ts +++ b/test/scenarios/pool/fixed-term-defaulted.test.ts @@ -21,7 +21,7 @@ describe("Fixed Term Defaulted Loan Scenario", () => { }; async function loadFixtures() { - const [operator, poolAdmin, lender, borrower] = await ethers.getSigners(); + const [poolAdmin, lender, borrower] = await ethers.getSigners(); const poolSettings = { ...DEFAULT_POOL_SETTINGS, @@ -29,7 +29,6 @@ describe("Fixed Term Defaulted Loan Scenario", () => { }; const { mockERC20 } = await deployMockERC20(); const { pool, serviceConfiguration, poolController } = await deployPool({ - operator, poolAdmin: poolAdmin, settings: poolSettings, liquidityAsset: mockERC20 @@ -74,15 +73,8 @@ describe("Fixed Term Defaulted Loan Scenario", () => { } it("Calculates outstanding loan principal", async () => { - const { - pool, - poolController, - lender, - mockERC20, - poolAdmin, - borrower, - loan - } = await loadFixture(loadFixtures); + const { pool, poolController, lender, poolAdmin, borrower, loan } = + await loadFixture(loadFixtures); await pool.connect(lender).deposit(INPUTS.lenderDeposit, lender.address); diff --git a/test/scenarios/pool/fixed-term-matured.test.ts b/test/scenarios/pool/fixed-term-matured.test.ts index 6ee48155..ef61dfe4 100644 --- a/test/scenarios/pool/fixed-term-matured.test.ts +++ b/test/scenarios/pool/fixed-term-matured.test.ts @@ -21,7 +21,7 @@ describe("Fixed Term Matured Loan Scenario", () => { }; async function loadFixtures() { - const [operator, poolAdmin, lender, borrower] = await ethers.getSigners(); + const [poolAdmin, lender, borrower] = await ethers.getSigners(); const poolSettings = { ...DEFAULT_POOL_SETTINGS, @@ -29,7 +29,6 @@ describe("Fixed Term Matured Loan Scenario", () => { }; const { mockERC20 } = await deployMockERC20(); const { pool, serviceConfiguration, poolController } = await deployPool({ - operator, poolAdmin: poolAdmin, settings: poolSettings, liquidityAsset: mockERC20 diff --git a/test/scenarios/pool/open-term-defaulted.test.ts b/test/scenarios/pool/open-term-defaulted.test.ts index eda163d4..c95811af 100644 --- a/test/scenarios/pool/open-term-defaulted.test.ts +++ b/test/scenarios/pool/open-term-defaulted.test.ts @@ -21,7 +21,7 @@ describe("Open Term Defaulted Loan Scenario", () => { }; async function loadFixtures() { - const [operator, poolAdmin, lender, borrower] = await ethers.getSigners(); + const [poolAdmin, lender, borrower] = await ethers.getSigners(); const poolSettings = { ...DEFAULT_POOL_SETTINGS, @@ -29,7 +29,6 @@ describe("Open Term Defaulted Loan Scenario", () => { }; const { mockERC20 } = await deployMockERC20(); const { pool, serviceConfiguration, poolController } = await deployPool({ - operator, poolAdmin: poolAdmin, settings: poolSettings, liquidityAsset: mockERC20 @@ -74,15 +73,8 @@ describe("Open Term Defaulted Loan Scenario", () => { } it("Calculates outstanding loan principal", async () => { - const { - pool, - poolController, - lender, - mockERC20, - poolAdmin, - borrower, - loan - } = await loadFixture(loadFixtures); + const { pool, poolController, lender, poolAdmin, borrower, loan } = + await loadFixture(loadFixtures); await pool.connect(lender).deposit(INPUTS.lenderDeposit, lender.address); @@ -94,9 +86,7 @@ describe("Open Term Defaulted Loan Scenario", () => { // default loan await loan.connect(borrower).drawdown((await loan.principal()).div(2)); // drawdown half - const txn = await poolController - .connect(poolAdmin) - .defaultLoan(loan.address); + await poolController.connect(poolAdmin).defaultLoan(loan.address); // check that outstanding principal goes down to 500k expect((await pool.accountings()).outstandingLoanPrincipals).to.equal( diff --git a/test/scenarios/pool/open-term-matured.test.ts b/test/scenarios/pool/open-term-matured.test.ts index b7e7ea71..7dd9ed16 100644 --- a/test/scenarios/pool/open-term-matured.test.ts +++ b/test/scenarios/pool/open-term-matured.test.ts @@ -21,7 +21,7 @@ describe("Open Term Matured Loan Scenario", () => { }; async function loadFixtures() { - const [operator, poolAdmin, lender, borrower] = await ethers.getSigners(); + const [poolAdmin, lender, borrower] = await ethers.getSigners(); const endTime = (await time.latest()) + 5_184_000; // 60 days. const poolSettings = { @@ -30,7 +30,6 @@ describe("Open Term Matured Loan Scenario", () => { }; const { mockERC20 } = await deployMockERC20(); const { pool, serviceConfiguration, poolController } = await deployPool({ - operator, poolAdmin: poolAdmin, settings: poolSettings, liquidityAsset: mockERC20 diff --git a/test/scenarios/pool/withdraw-request.test.ts b/test/scenarios/pool/withdraw-request.test.ts index 0ecd4ebf..889a8939 100644 --- a/test/scenarios/pool/withdraw-request.test.ts +++ b/test/scenarios/pool/withdraw-request.test.ts @@ -5,11 +5,9 @@ import { deployPool, depositToPool, activatePool } from "../../support/pool"; describe("Withdraw Requests", () => { async function loadPoolFixture() { - const [operator, poolAdmin, aliceLender, bobLender] = - await ethers.getSigners(); + const [poolAdmin, aliceLender, bobLender] = await ethers.getSigners(); const { pool, liquidityAsset, poolController, withdrawController } = await deployPool({ - operator, poolAdmin: poolAdmin }); diff --git a/test/support/pool.ts b/test/support/pool.ts index d67b6ecb..cc30a0c6 100644 --- a/test/support/pool.ts +++ b/test/support/pool.ts @@ -1,6 +1,6 @@ import { ethers } from "hardhat"; import { time } from "@nomicfoundation/hardhat-network-helpers"; -import { MockERC20, Pool } from "../../typechain-types"; +import { MockERC20, PermissionedPool, Pool } from "../../typechain-types"; import { deployMockERC20 } from "./erc20"; import { deployPermissionedServiceConfiguration, @@ -257,7 +257,7 @@ export async function deployPermissionedPool({ * Deploy an "Active" Pool */ export async function activatePool( - pool: Pool, + pool: Pool | PermissionedPool, poolAdmin: any, liquidityAsset: MockERC20 ) { @@ -284,7 +284,7 @@ export async function activatePool( * */ export async function depositToPool( - pool: Pool, + pool: Pool | PermissionedPool, depositorAccount: any, asset: MockERC20, amount: any @@ -307,6 +307,8 @@ type WithdrawState = { latestRequestPeriod: number; redeemableShares: number; withdrawableAssets: number; + latestCrankPeriod: number; + crankOffsetPeriod: number; }; /** diff --git a/test/upgrades/BeaconImplementation.test.ts b/test/upgrades/BeaconImplementation.test.ts index f5a0f3e8..2f593b07 100644 --- a/test/upgrades/BeaconImplementation.test.ts +++ b/test/upgrades/BeaconImplementation.test.ts @@ -1,4 +1,4 @@ -import { loadFixture, time } from "@nomicfoundation/hardhat-network-helpers"; +import { loadFixture } from "@nomicfoundation/hardhat-network-helpers"; import { expect } from "chai"; import { ethers } from "hardhat"; diff --git a/test/upgrades/BeaconProxyFactory.test.ts b/test/upgrades/BeaconProxyFactory.test.ts index ee5fa783..856a70aa 100644 --- a/test/upgrades/BeaconProxyFactory.test.ts +++ b/test/upgrades/BeaconProxyFactory.test.ts @@ -1,4 +1,4 @@ -import { loadFixture, time } from "@nomicfoundation/hardhat-network-helpers"; +import { loadFixture } from "@nomicfoundation/hardhat-network-helpers"; import { expect } from "chai"; import { ethers } from "hardhat"; import { deployServiceConfiguration } from "../support/serviceconfiguration"; diff --git a/test/upgrades/DeployerUUPSUpgradeable.test.ts b/test/upgrades/DeployerUUPSUpgradeable.test.ts index f24478b2..1bc7da78 100644 --- a/test/upgrades/DeployerUUPSUpgradeable.test.ts +++ b/test/upgrades/DeployerUUPSUpgradeable.test.ts @@ -1,4 +1,4 @@ -import { loadFixture, time } from "@nomicfoundation/hardhat-network-helpers"; +import { loadFixture } from "@nomicfoundation/hardhat-network-helpers"; import { expect } from "chai"; import { ethers, upgrades } from "hardhat"; import { deployServiceConfiguration } from "../support/serviceconfiguration"; @@ -50,8 +50,9 @@ describe("DeployerUUPSUpgradeable", () => { describe("Permissions", () => { it("only deployer can upgrade", async () => { - const { deployerUUPSUpgradeableMock, deployer, other } = - await loadFixture(deployFixture); + const { deployerUUPSUpgradeableMock, other } = await loadFixture( + deployFixture + ); const V2 = await ethers.getContractFactory( "DeployerUUPSUpgradeableMockV2",