diff --git a/test/core/accounts/AccountsAllowance.ts b/test/core/accounts/AccountsAllowance.ts index be5e13062..9e079bea2 100644 --- a/test/core/accounts/AccountsAllowance.ts +++ b/test/core/accounts/AccountsAllowance.ts @@ -1,32 +1,36 @@ +import {FakeContract, smock} from "@defi-wonderland/smock"; +import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect} from "chai"; import hre from "hardhat"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; -import {deployDummyERC20, DEFAULT_CHARITY_ENDOWMENT, DEFAULT_PERMISSIONS_STRUCT} from "test/utils"; +import {deployFacetAsProxy} from "test/core/accounts/utils/deployTestFacet"; +import {DEFAULT_CHARITY_ENDOWMENT} from "test/utils"; import { - TestFacetProxyContract, - AccountsAllowance__factory, AccountsAllowance, + AccountsAllowance__factory, DummyERC20, + DummyERC20__factory, + TestFacetProxyContract, } from "typechain-types"; -import {deployFacetAsProxy} from "test/core/accounts/utils/deployTestFacet"; -import {getSigners} from "utils"; -import {AccountStorage} from "typechain-types/contracts/test/accounts/TestFacetProxyContract"; +import {genWallet, getSigners} from "utils"; describe("AccountsAllowance", function () { const {ethers} = hre; + let owner: SignerWithAddress; let proxyAdmin: SignerWithAddress; let user: SignerWithAddress; - let token: DummyERC20; - let token2: DummyERC20; + + let tokenFake: FakeContract; before(async function () { const signers = await getSigners(hre); owner = signers.deployer; proxyAdmin = signers.proxyAdmin; user = signers.apTeam1; - token = await deployDummyERC20(owner); - token2 = await deployDummyERC20(owner); + }); + + beforeEach(async () => { + tokenFake = await smock.fake(new DummyERC20__factory()); }); describe("Test cases for `manageAllowances`", async function () { @@ -44,9 +48,9 @@ describe("AccountsAllowance", function () { enumData: 0, }); // add an accepted token to endowment #42 - await state.setTokenAccepted(42, token.address, true); + await state.setTokenAccepted(42, tokenFake.address, true); // set a starting balance for Endowment: 100 qty of tokens in liquid - await state.setEndowmentTokenBalance(42, token.address, 0, 100); + await state.setEndowmentTokenBalance(42, tokenFake.address, 0, 100); // setup endowment 42 with minimum needed for testing // Allowlists Beneficiaries set for a user let endowment = DEFAULT_CHARITY_ENDOWMENT; @@ -61,15 +65,15 @@ describe("AccountsAllowance", function () { data: {endowId: 0, fundId: 0, addr: ethers.constants.AddressZero}, enumData: 0, }); - await expect(facet.manageAllowances(42, user.address, token.address, 10)).to.be.revertedWith( - "Endowment is closed" - ); + await expect( + facet.manageAllowances(42, user.address, tokenFake.address, 10) + ).to.be.revertedWith("Endowment is closed"); }); it("reverts when the sender is not the endowment owner or a valid delegate who can control allowlists", async function () { // not the endowment owner sending the message and user is not a delegate await expect( - facet.connect(user).manageAllowances(42, user.address, token.address, 10) + facet.connect(user).manageAllowances(42, user.address, tokenFake.address, 10) ).to.be.revertedWith("Unauthorized"); }); @@ -78,59 +82,59 @@ describe("AccountsAllowance", function () { facet.manageAllowances(42, user.address, ethers.constants.AddressZero, 10) ).to.be.revertedWith("Invalid Token"); - await expect(facet.manageAllowances(42, user.address, token2.address, 10)).to.be.revertedWith( - "Invalid Token" - ); + await expect( + facet.manageAllowances(42, user.address, genWallet().address, 10) + ).to.be.revertedWith("Invalid Token"); }); it("reverts when the spender is not in allowlist", async function () { await expect( - facet.manageAllowances(42, proxyAdmin.address, token.address, 10) + facet.manageAllowances(42, proxyAdmin.address, tokenFake.address, 10) ).to.be.revertedWith("Spender is not in allowlists"); }); it("reverts when there are no adjustments needed (ie. proposed amount == spender balance amount)", async function () { // set allowance for user to 10 tokens of total 10 tokens outstanding - await state.setTokenAllowance(42, user.address, token.address, 10, 10); + await state.setTokenAllowance(42, user.address, tokenFake.address, 10, 10); - await expect(facet.manageAllowances(42, user.address, token.address, 10)).to.be.revertedWith( - "Spender balance equal to amount. No changes needed" - ); + await expect( + facet.manageAllowances(42, user.address, tokenFake.address, 10) + ).to.be.revertedWith("Spender balance equal to amount. No changes needed"); }); it("reverts when try to increase a valid token's allowance beyond liquid balance available", async function () { await expect( - facet.manageAllowances(42, user.address, token.address, 100000) + facet.manageAllowances(42, user.address, tokenFake.address, 100000) ).to.be.revertedWith("Insufficient liquid balance to allocate"); }); it("passes when try to increase a valid token's allowance within range of liquid balance available", async function () { - expect(await facet.manageAllowances(42, user.address, token.address, 10)) + expect(await facet.manageAllowances(42, user.address, tokenFake.address, 10)) .to.emit(facet, "AllowanceUpdated") - .withArgs(42, user.address, token.address, 10, 10, 0); + .withArgs(42, user.address, tokenFake.address, 10, 10, 0); // endowment liquid balance should be 90 now (100 - 10) - const endowBal = await state.getEndowmentTokenBalance(42, token.address); + const endowBal = await state.getEndowmentTokenBalance(42, tokenFake.address); expect(endowBal[1]).to.equal(90); // user allowance should be 10 now - const allowance = await state.getTokenAllowance(42, user.address, token.address); + const allowance = await state.getTokenAllowance(42, user.address, tokenFake.address); expect(allowance).to.equal(10); }); it("passes when try to decrease an existing spender's allowance", async function () { // now we allocate some token allowance to the user address to spend from - await state.setTokenAllowance(42, user.address, token.address, 10, 10); + await state.setTokenAllowance(42, user.address, tokenFake.address, 10, 10); // set a lower total token allowance for the user, returning the delta to liquid balance - expect(await facet.manageAllowances(42, user.address, token.address, 3)) + expect(await facet.manageAllowances(42, user.address, tokenFake.address, 3)) .to.emit(facet, "AllowanceUpdated") - .withArgs(42, user.address, token.address, 3, 0, 7); + .withArgs(42, user.address, tokenFake.address, 3, 0, 7); // endowment liquid balance should be 107 now (100 + 7) - const endowBal = await state.getEndowmentTokenBalance(42, token.address); + const endowBal = await state.getEndowmentTokenBalance(42, tokenFake.address); expect(endowBal[1]).to.equal(107); // user allowance should be 3 now - const allowance = await state.getTokenAllowance(42, user.address, token.address); + const allowance = await state.getTokenAllowance(42, user.address, tokenFake.address); expect(allowance).to.equal(3); }); }); @@ -150,9 +154,9 @@ describe("AccountsAllowance", function () { enumData: 0, }); // add an accepted token to endowment #42 - await state.setTokenAccepted(42, token.address, true); + await state.setTokenAccepted(42, tokenFake.address, true); // set a starting balance for Endowment: 100 qty of tokens in liquid - await state.setEndowmentTokenBalance(42, token.address, 0, 100); + await state.setEndowmentTokenBalance(42, tokenFake.address, 0, 100); }); it("reverts when try to spend token that is invalid(zero address) or dne in allowances", async function () { @@ -162,50 +166,50 @@ describe("AccountsAllowance", function () { ).to.be.revertedWith("Invalid Token"); // try to spend an allowance for a token that dne - await expect(facet.spendAllowance(42, token2.address, 10, user.address)).to.be.revertedWith( - "Invalid Token" - ); + await expect( + facet.spendAllowance(42, genWallet().address, 10, user.address) + ).to.be.revertedWith("Invalid Token"); }); it("reverts when try to spend zero amount of allowance", async function () { // now we allocate some token allowance to the user address to spend from - await state.setTokenAllowance(42, user.address, token.address, 10, 10); + await state.setTokenAllowance(42, user.address, tokenFake.address, 10, 10); // try to spend zero allowance - await expect(facet.spendAllowance(42, token.address, 0, user.address)).to.be.revertedWith( + await expect(facet.spendAllowance(42, tokenFake.address, 0, user.address)).to.be.revertedWith( "Zero Amount" ); }); it("reverts when try to spend more allowance than is available for token", async function () { // now we allocate some token allowance to the user address to spend from - await state.setTokenAllowance(42, user.address, token.address, 10, 10); + await state.setTokenAllowance(42, user.address, tokenFake.address, 10, 10); // try to spend more allowance than user was allocated - await expect(facet.spendAllowance(42, token.address, 1000, user.address)).to.be.revertedWith( - "Amount requested exceeds Allowance balance" - ); + await expect( + facet.spendAllowance(42, tokenFake.address, 1000, user.address) + ).to.be.revertedWith("Amount requested exceeds Allowance balance"); // try to spend more allowance than user was allocated await expect( - facet.spendAllowance(42, token.address, 1, proxyAdmin.address) + facet.spendAllowance(42, tokenFake.address, 1, proxyAdmin.address) ).to.be.revertedWith("Amount requested exceeds Allowance balance"); }); it("passes when spend less than or equal to the allowance available for token", async function () { // now we allocate some token allowance to the user address to spend from - await state.setTokenAllowance(42, user.address, token.address, 10, 10); + await state.setTokenAllowance(42, user.address, tokenFake.address, 10, 10); // mint tokens so that the contract can transfer them to recipient - await token.mint(facet.address, 10); + tokenFake.transfer.returns(true); // user spends less than what was allocated to them (ie. 5 out of 10 available) - expect(await facet.connect(user).spendAllowance(42, token.address, 5, user.address)) + expect(await facet.connect(user).spendAllowance(42, tokenFake.address, 5, user.address)) .to.emit(facet, "AllowanceSpent") - .withArgs(42, user.address, token.address, 5); + .withArgs(42, user.address, tokenFake.address, 5); // user allowance should be 5 now (10 - 5) - let allowance = await state.getTokenAllowance(42, user.address, token.address); + let allowance = await state.getTokenAllowance(42, user.address, tokenFake.address); expect(allowance).to.equal(5); }); }); diff --git a/test/core/accounts/AccountsCreateEndowment.ts b/test/core/accounts/AccountsCreateEndowment.ts index 29c9eab9b..6c572639f 100644 --- a/test/core/accounts/AccountsCreateEndowment.ts +++ b/test/core/accounts/AccountsCreateEndowment.ts @@ -1,11 +1,9 @@ import {FakeContract, smock} from "@defi-wonderland/smock"; import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect, use} from "chai"; -import {deployRegistrar} from "contracts/core/registrar/scripts/deploy"; -import {deployEndowmentMultiSig} from "contracts/normalized_endowment/endowment-multisig/scripts/deploy"; import {BigNumber} from "ethers"; import hre from "hardhat"; -import {deployFacetAsProxy} from "./utils/deployTestFacet"; +import {DEFAULT_REGISTRAR_CONFIG} from "test/utils"; import { AccountsCreateEndowment, AccountsCreateEndowment__factory, @@ -21,8 +19,7 @@ import {AccountMessages} from "typechain-types/contracts/core/accounts/facets/Ac import {LocalRegistrarLib} from "typechain-types/contracts/core/registrar/LocalRegistrar"; import {RegistrarStorage} from "typechain-types/contracts/core/registrar/Registrar"; import {genWallet, getSigners} from "utils"; -import "../../utils/setup"; -import {DEFAULT_REGISTRAR_CONFIG} from "test/utils"; +import {deployFacetAsProxy} from "./utils/deployTestFacet"; use(smock.matchers); @@ -31,19 +28,14 @@ describe("AccountsCreateEndowment", function () { const donationMatchCharitesAddress = genWallet().address; const endowmentOwner = genWallet().address; - const treasuryAddress = genWallet().address; const expectedNextAccountId = 1; let owner: SignerWithAddress; let proxyAdmin: SignerWithAddress; let charityApplications: SignerWithAddress; - let axelarGateway: SignerWithAddress; - let axelarGasService: SignerWithAddress; - let deployer: SignerWithAddress; let facet: AccountsCreateEndowment; let state: TestFacetProxyContract; - let Registrar: Registrar; let createEndowmentRequest: AccountMessages.CreateEndowmentRequestStruct; let registrarFake: FakeContract; let gasFwdFactoryFake: FakeContract; @@ -53,9 +45,6 @@ describe("AccountsCreateEndowment", function () { owner = signers.apTeam1; proxyAdmin = signers.proxyAdmin; charityApplications = signers.deployer; - axelarGateway = signers.apTeam2; - axelarGasService = signers.apTeam3; - deployer = signers.deployer; const defaultSettingsPermissionsStruct = { locked: false, @@ -153,32 +142,6 @@ describe("AccountsCreateEndowment", function () { }); beforeEach(async function () { - const registrarDeployment = await deployRegistrar( - { - axelarGateway: axelarGateway.address, - axelarGasService: axelarGasService.address, - router: ethers.constants.AddressZero, - owner: owner.address, - deployer, - proxyAdmin, - treasuryAddress: treasuryAddress, - }, - hre - ); - const endowDeployments = await deployEndowmentMultiSig(hre); - Registrar = Registrar__factory.connect(registrarDeployment!.address, owner); - const {splitToLiquid, ...curConfig} = await Registrar.queryConfig(); - await Registrar.updateConfig({ - ...curConfig, - splitDefault: splitToLiquid.defaultSplit, - splitMax: splitToLiquid.max, - splitMin: splitToLiquid.min, - charityApplications: charityApplications.address, - multisigFactory: endowDeployments!.factory.address, - multisigEmitter: endowDeployments!.emitter.address, - donationMatchCharitesContract: donationMatchCharitesAddress, - }); - let Facet = new AccountsCreateEndowment__factory(owner); let facetImpl = await Facet.deploy(); state = await deployFacetAsProxy(hre, owner, proxyAdmin, facetImpl.address); @@ -387,7 +350,7 @@ describe("AccountsCreateEndowment", function () { expect(result.name).to.equal(request.name); expect(result.parent).to.equal(request.parent); expect(result.proposalLink).to.equal(request.proposalLink); - expect(result.rebalance).to.equalRebalance(await Registrar.getRebalanceParams()); + expect(result.rebalance).to.equalRebalance(await registrarFake.getRebalanceParams()); expect(result.referralId).to.equal(request.referralId); expect(result.sdgs).to.have.same.deep.members(request.sdgs.map((x) => BigNumber.from(x))); expect(result.settingsController.acceptedTokens).to.equalSettingsPermission( @@ -490,7 +453,7 @@ describe("AccountsCreateEndowment", function () { expect(result.name).to.equal(request.name); expect(result.parent).to.equal(request.parent); expect(result.proposalLink).to.equal(request.proposalLink); - expect(result.rebalance).to.equalRebalance(await Registrar.getRebalanceParams()); + expect(result.rebalance).to.equalRebalance(await registrarFake.getRebalanceParams()); expect(result.referralId).to.equal(request.referralId); expect(result.sdgs).to.have.same.deep.members(request.sdgs.map((x) => BigNumber.from(x))); expect(result.settingsController.acceptedTokens).to.equalSettingsPermission( diff --git a/test/core/accounts/AccountsQueryEndowments.ts b/test/core/accounts/AccountsQueryEndowments.ts index 09c7cb7d4..ee78119da 100644 --- a/test/core/accounts/AccountsQueryEndowments.ts +++ b/test/core/accounts/AccountsQueryEndowments.ts @@ -2,7 +2,6 @@ import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect} from "chai"; import {BigNumber} from "ethers"; import hre from "hardhat"; -import {deployFacetAsProxy} from "./utils/deployTestFacet"; import {DEFAULT_ACCOUNTS_CONFIG, DEFAULT_CHARITY_ENDOWMENT} from "test/utils"; import { AccountsQueryEndowments, @@ -12,6 +11,7 @@ import { import {AccountMessages} from "typechain-types/contracts/core/accounts/facets/AccountsQueryEndowments"; import {AccountStorage} from "typechain-types/contracts/test/accounts/TestFacetProxyContract"; import {getSigners} from "utils"; +import {deployFacetAsProxy} from "./utils/deployTestFacet"; describe("AccountsQueryEndowments", function () { const {ethers} = hre; diff --git a/test/core/accounts/AccountsStrategy.ts b/test/core/accounts/AccountsStrategy.ts index ada34255b..8b2852a1d 100644 --- a/test/core/accounts/AccountsStrategy.ts +++ b/test/core/accounts/AccountsStrategy.ts @@ -1,49 +1,49 @@ -import {expect, use} from "chai"; import {FakeContract, MockContract, smock} from "@defi-wonderland/smock"; -import hre from "hardhat"; import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {expect, use} from "chai"; +import hre from "hardhat"; +import {deployDummyGasService} from "tasks/helpers"; import { - TestFacetProxyContract, - AccountsStrategy, - AccountsStrategy__factory, - Registrar, - Registrar__factory, - Router, - Router__factory, - DummyERC20, - DummyGateway, - DummyGasService, - GasFwd, - GasFwd__factory, - DummyVault, -} from "typechain-types"; -import {genWallet, getSigners} from "utils"; -import {deployFacetAsProxy} from "./utils/deployTestFacet"; -import { - deployDummyERC20, - deployDummyGateway, - DEFAULT_CHARITY_ENDOWMENT, - DEFAULT_STRATEGY_SELECTOR, DEFAULT_ACCOUNTS_CONFIG, - DEFAULT_NETWORK_INFO, + DEFAULT_AP_PARAMS, + DEFAULT_CHARITY_ENDOWMENT, + DEFAULT_INVEST_REQUEST, DEFAULT_METHOD_SELECTOR, + DEFAULT_NETWORK_INFO, DEFAULT_PERMISSIONS_STRUCT, + DEFAULT_REDEEM_ALL_REQUEST, + DEFAULT_REDEEM_REQUEST, DEFAULT_SETTINGS_STRUCT, + DEFAULT_STRATEGY_PARAMS, + DEFAULT_STRATEGY_SELECTOR, NetworkInfoStruct, StrategyApprovalState, VaultActionStatus, - DEFAULT_INVEST_REQUEST, - DEFAULT_REDEEM_REQUEST, - DEFAULT_REDEEM_ALL_REQUEST, - DEFAULT_STRATEGY_PARAMS, - packActionData, VaultActionStructToArray, + deployDummyERC20, + deployDummyGateway, deployDummyVault, - DEFAULT_AP_PARAMS, + packActionData, } from "test/utils"; +import { + AccountsStrategy, + AccountsStrategy__factory, + DummyERC20, + DummyGasService, + DummyGateway, + DummyVault, + GasFwd, + GasFwd__factory, + Registrar, + Registrar__factory, + Router, + Router__factory, + TestFacetProxyContract, +} from "typechain-types"; import {AccountStorage} from "typechain-types/contracts/test/accounts/TestFacetProxyContract"; -import {deployDummyGasService} from "tasks/helpers"; +import {getSigners} from "utils"; +import {deployFacetAsProxy} from "./utils/deployTestFacet"; use(smock.matchers); diff --git a/test/core/accounts/AccountsSwapRouter.ts b/test/core/accounts/AccountsSwapRouter.ts index 48591f1ca..d6917a858 100644 --- a/test/core/accounts/AccountsSwapRouter.ts +++ b/test/core/accounts/AccountsSwapRouter.ts @@ -1,34 +1,31 @@ +import {FakeContract, smock} from "@defi-wonderland/smock"; import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect, use} from "chai"; -import {FakeContract, smock} from "@defi-wonderland/smock"; import hre from "hardhat"; +import {deployDummyERC20} from "tasks/helpers"; import {deployFacetAsProxy} from "test/core/accounts/utils/deployTestFacet"; -import {getSigners, genWallet} from "utils"; import { DEFAULT_ACCOUNTS_CONFIG, DEFAULT_CHARITY_ENDOWMENT, - DEFAULT_REGISTRAR_CONFIG, DEFAULT_PERMISSIONS_STRUCT, + DEFAULT_REGISTRAR_CONFIG, VaultType, } from "test/utils"; import { AccountsSwapRouter, AccountsSwapRouter__factory, - TestFacetProxyContract, - Registrar, - Registrar__factory, + DummyAggregatorV3Interface, + DummyAggregatorV3Interface__factory, + DummyERC20, DummySwapRouter, DummySwapRouter__factory, DummyUniswapV3Factory, DummyUniswapV3Factory__factory, - DummyERC20, - DummyAggregatorV3Interface, - DummyAggregatorV3Interface__factory, + Registrar, + Registrar__factory, + TestFacetProxyContract, } from "typechain-types"; -import "../../utils/setup"; -import {endowmentMultisig} from "typechain-types/contracts/normalized_endowment"; -import {deployDummyERC20} from "tasks/helpers"; -import {token} from "typechain-types/@openzeppelin/contracts"; +import {genWallet, getSigners} from "utils"; use(smock.matchers); diff --git a/test/core/accounts/AccountsUpdate.ts b/test/core/accounts/AccountsUpdate.ts index 2fe5167b3..40d612688 100644 --- a/test/core/accounts/AccountsUpdate.ts +++ b/test/core/accounts/AccountsUpdate.ts @@ -1,18 +1,21 @@ import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect} from "chai"; import hre from "hardhat"; -import {deployFacetAsProxy} from "./utils/deployTestFacet"; import {AccountsUpdate, AccountsUpdate__factory, TestFacetProxyContract} from "typechain-types"; import {LibAccounts} from "typechain-types/contracts/core/accounts/facets/AccountsCreateEndowment"; import {getSigners} from "utils"; +import {deployFacetAsProxy} from "./utils/deployTestFacet"; describe("AccountsUpdate", function () { const {ethers} = hre; + let owner: SignerWithAddress; let proxyAdmin: SignerWithAddress; let user: SignerWithAddress; + let facet: AccountsUpdate; let state: TestFacetProxyContract; + let newRegistrar: string; let maxGeneralCategoryId: number; let earlyLockedWithdrawFee: LibAccounts.FeeSettingStruct; diff --git a/test/core/accounts/AccountsUpdateEndowmentSettingsController.ts b/test/core/accounts/AccountsUpdateEndowmentSettingsController.ts index 22db3958d..0c9a4f4f1 100644 --- a/test/core/accounts/AccountsUpdateEndowmentSettingsController.ts +++ b/test/core/accounts/AccountsUpdateEndowmentSettingsController.ts @@ -15,7 +15,6 @@ import { LibAccounts, } from "typechain-types/contracts/test/accounts/TestFacetProxyContract"; import {genWallet, getSigners} from "utils"; -import "../../utils/setup"; import {updateAllSettings} from "./utils"; use(smock.matchers); @@ -29,8 +28,10 @@ describe("AccountsUpdateEndowmentSettingsController", function () { let owner: SignerWithAddress; let proxyAdmin: SignerWithAddress; let endowOwner: SignerWithAddress; + let facet: AccountsUpdateEndowmentSettingsController; let state: TestFacetProxyContract; + let oldNormalEndow: AccountStorage.EndowmentStruct; let oldCharity: AccountStorage.EndowmentStruct; diff --git a/test/core/accounts/AccountsUpdateEndowments.ts b/test/core/accounts/AccountsUpdateEndowments.ts index 74be2fc76..ddd9718d9 100644 --- a/test/core/accounts/AccountsUpdateEndowments.ts +++ b/test/core/accounts/AccountsUpdateEndowments.ts @@ -3,7 +3,7 @@ import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect, use} from "chai"; import {BigNumberish} from "ethers"; import hre from "hardhat"; -import {DEFAULT_CHARITY_ENDOWMENT} from "test/utils"; +import {ControllerSettingOption, DEFAULT_CHARITY_ENDOWMENT, DelegateAction} from "test/utils"; import { AccountsUpdateEndowments, AccountsUpdateEndowments__factory, @@ -19,34 +19,8 @@ import { LibAccounts, } from "typechain-types/contracts/test/accounts/TestFacetProxyContract"; import {genWallet, getSigners} from "utils"; -import "../../utils/setup"; import {deployFacetAsProxy, updateAllSettings, updateSettings} from "./utils"; -enum ControllerSettingOption { - AcceptedTokens, - LockedInvestmentManagement, - LiquidInvestmentManagement, - AllowlistedBeneficiaries, - AllowlistedContributors, - MaturityAllowlist, - EarlyLockedWithdrawFee, - MaturityTime, - WithdrawFee, - DepositFee, - BalanceFee, - Name, - Image, - Logo, - Sdgs, - SplitToLiquid, - IgnoreUserSplits, -} - -enum DelegateAction { - Set, - Revoke, -} - use(smock.matchers); describe("AccountsUpdateEndowments", function () { @@ -62,6 +36,7 @@ describe("AccountsUpdateEndowments", function () { let facet: AccountsUpdateEndowments; let state: TestFacetProxyContract; + let oldNormalEndow: AccountStorage.EndowmentStruct; let oldCharity: AccountStorage.EndowmentStruct; diff --git a/test/core/accounts/AccountsUpdateStatusEndowments.ts b/test/core/accounts/AccountsUpdateStatusEndowments.ts index 7b01d709c..5411a0fe4 100644 --- a/test/core/accounts/AccountsUpdateStatusEndowments.ts +++ b/test/core/accounts/AccountsUpdateStatusEndowments.ts @@ -3,7 +3,6 @@ import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect, use} from "chai"; import {BigNumber} from "ethers"; import hre from "hardhat"; -import {deployFacetAsProxy} from "./utils/deployTestFacet"; import { DEFAULT_CHARITY_ENDOWMENT, DEFAULT_REGISTRAR_CONFIG, @@ -23,7 +22,7 @@ import {LibAccounts} from "typechain-types/contracts/core/accounts/facets/Accoun import {RegistrarStorage} from "typechain-types/contracts/core/registrar/Registrar"; import {AccountStorage} from "typechain-types/contracts/test/accounts/TestFacetProxyContract"; import {genWallet, getSigners} from "utils"; -import "../../utils/setup"; +import {deployFacetAsProxy} from "./utils/deployTestFacet"; use(smock.matchers); @@ -42,10 +41,13 @@ describe("AccountsUpdateStatusEndowments", function () { let accOwner: SignerWithAddress; let proxyAdmin: SignerWithAddress; let endowOwner: SignerWithAddress; + let facet: AccountsUpdateStatusEndowments; let state: TestFacetProxyContract; + let endowment: AccountStorage.EndowmentStruct; let treasuryAddress: string; + let registrarFake: FakeContract; let indexFundFake: FakeContract; diff --git a/test/utils/helpers/types.ts b/test/utils/helpers/types.ts index f7ca39180..706e12dde 100644 --- a/test/utils/helpers/types.ts +++ b/test/utils/helpers/types.ts @@ -22,3 +22,28 @@ export enum VaultActionStatus { FAIL_TOKENS_RETURNED, // Tokens returned to accounts contract FAIL_TOKENS_FALLBACK, // Tokens failed to be returned to accounts contract } + +export enum ControllerSettingOption { + AcceptedTokens, + LockedInvestmentManagement, + LiquidInvestmentManagement, + AllowlistedBeneficiaries, + AllowlistedContributors, + MaturityAllowlist, + EarlyLockedWithdrawFee, + MaturityTime, + WithdrawFee, + DepositFee, + BalanceFee, + Name, + Image, + Logo, + Sdgs, + SplitToLiquid, + IgnoreUserSplits, +} + +export enum DelegateAction { + Set, + Revoke, +} diff --git a/test/utils/setup/index.ts b/test/utils/setup/index.ts deleted file mode 100644 index dcdc3e6c7..000000000 --- a/test/utils/setup/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./setup"; diff --git a/test/utils/setup/setup.ts b/test/utils/setup/setup.test.ts similarity index 100% rename from test/utils/setup/setup.ts rename to test/utils/setup/setup.test.ts diff --git a/utils/keygen.ts b/utils/keygen.ts index 5a5d4eccb..1707da604 100644 --- a/utils/keygen.ts +++ b/utils/keygen.ts @@ -1,10 +1,8 @@ import * as crypto from "crypto"; import {ethers} from "ethers"; - import {pad} from "./logger"; export function genWallet(printToConsole: Boolean = false) { - pad(1, "Generating a new wallet"); var id = crypto.randomBytes(32).toString("hex"); var privateKey = "0x" + id; var wallet = new ethers.Wallet(privateKey);