From 647e8721cc9bca8cd760255ec3ac2fb4b86d2c0c Mon Sep 17 00:00:00 2001 From: Nenad Date: Wed, 4 Oct 2023 10:51:51 +0200 Subject: [PATCH 1/8] Add slither analysis step --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b401fe4a0..9a9be06e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,6 +44,11 @@ jobs: with: cmd: "tsc" + - name: "Slither Analysis" + uses: crytic/slither-action@v0.3.0 + with: + ignore-compile: true + - name: "Test the contracts" uses: "borales/actions-yarn@v4" with: From c3a4a9a0be1eea87ecba2ed172febcc9918faabe Mon Sep 17 00:00:00 2001 From: Nenad Date: Wed, 4 Oct 2023 11:17:10 +0200 Subject: [PATCH 2/8] Extract mature endow. set to 'before' hook in AccountsDepositWithdrawEndowments.ts > from Mature endowments --- .../AccountsDepositWithdrawEndowments.ts | 50 +++++++++---------- types/enums.ts | 6 +++ 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/test/core/accounts/AccountsDepositWithdrawEndowments.ts b/test/core/accounts/AccountsDepositWithdrawEndowments.ts index 34d404636..45482e055 100644 --- a/test/core/accounts/AccountsDepositWithdrawEndowments.ts +++ b/test/core/accounts/AccountsDepositWithdrawEndowments.ts @@ -25,7 +25,7 @@ import { import {AccountMessages} from "typechain-types/contracts/core/accounts/facets/AccountsDepositWithdrawEndowments"; import {RegistrarStorage} from "typechain-types/contracts/core/registrar/Registrar"; import {AccountStorage} from "typechain-types/contracts/test/accounts/TestFacetProxyContract"; -import {VaultType} from "types"; +import {AllowlistType, VaultType} from "types"; import {genWallet, getProxyAdminOwner, getSigners} from "utils"; import {deployFacetAsProxy} from "./utils"; @@ -1309,15 +1309,27 @@ describe("AccountsDepositWithdrawEndowments", function () { }); describe("from Mature endowments", () => { - it("reverts if beneficiary address is not listed in maturityAllowlist", async () => { + let rootSnapshot: SnapshotRestorer; + + before(async () => { + rootSnapshot = await takeSnapshot(); + const currTime = await time.latest(); + const endowment = await state.getEndowmentDetails(normalEndowId); const matureEndowment: AccountStorage.EndowmentStruct = { - ...normalEndow, + ...endowment, maturityTime: currTime, }; await wait(state.setEndowmentDetails(normalEndowId, matureEndowment)); - await wait(state.setAllowlist(normalEndowId, 2, [genWallet().address])); + }); + + after(async () => { + await rootSnapshot.restore(); + }); + + it("reverts if beneficiary address is not listed in maturityAllowlist", async () => { + await wait(state.setAllowlist(normalEndowId, VaultType.LIQUID, [genWallet().address])); const acctType = VaultType.LIQUID; const beneficiaryId = 0; @@ -1327,25 +1339,18 @@ describe("AccountsDepositWithdrawEndowments", function () { await expect( facet.withdraw(normalEndowId, acctType, beneficiaryAddress, beneficiaryId, tokens) - ).to.be.revertedWith("Unauthorized"); + ).to.be.revertedWith("Beneficiary address is not listed in maturityAllowlist"); }); describe("LOCKED withdrawals", () => { it("passes: Normal to Address (protocol-level normal fee only)", async () => { - const currTime = await time.latest(); - registrarFake.getFeeSettingsByFeeType.returns({bps: 200, payoutAddress: treasury}); - const matureEndowment: AccountStorage.EndowmentStruct = { - ...normalEndow, - maturityTime: currTime, - }; - await wait(state.setEndowmentDetails(normalEndowId, matureEndowment)); - const beneficiarySigner = new ethers.Wallet( - genWallet().privateKey, - hre.ethers.provider - ); - await accOwner.sendTransaction({value: ethers.utils.parseEther("1"), to: beneficiarySigner.address}) + const beneficiarySigner = new ethers.Wallet(genWallet().privateKey, hre.ethers.provider); + await accOwner.sendTransaction({ + value: ethers.utils.parseEther("1"), + to: beneficiarySigner.address, + }); await wait(state.setAllowlist(normalEndowId, 2, [beneficiarySigner.address])); @@ -1359,7 +1364,9 @@ describe("AccountsDepositWithdrawEndowments", function () { const finalAmountLeftover = amount.sub(expectedFeeAp); await expect( - facet.connect(beneficiarySigner).withdraw(normalEndowId, acctType, beneficiarySigner.address, beneficiaryId, tokens) + facet + .connect(beneficiarySigner) + .withdraw(normalEndowId, acctType, beneficiarySigner.address, beneficiaryId, tokens) ) .to.emit(facet, "EndowmentWithdraw") .withArgs( @@ -1385,13 +1392,6 @@ describe("AccountsDepositWithdrawEndowments", function () { }); it("passes: Normal to a Charity Endowment transfer", async () => { - const currTime = await time.latest(); - - const matureEndowment: AccountStorage.EndowmentStruct = { - ...normalEndow, - maturityTime: currTime, - }; - await wait(state.setEndowmentDetails(normalEndowId, matureEndowment)); await wait(state.setAllowlist(normalEndowId, 2, [await indexFund.getAddress()])); const acctType = VaultType.LOCKED; diff --git a/types/enums.ts b/types/enums.ts index 437563829..4afaa90c4 100644 --- a/types/enums.ts +++ b/types/enums.ts @@ -14,6 +14,12 @@ export enum StrategyApprovalState { DEPRECATED, } +export enum AllowlistType { + AllowlistedBeneficiaries, + AllowlistedContributors, + MaturityAllowlist, +} + export enum VaultType { LOCKED, LIQUID, From 9de34a238e1ceda6b23474c0ea6817bd93422dd6 Mon Sep 17 00:00:00 2001 From: Nenad Date: Wed, 4 Oct 2023 11:18:44 +0200 Subject: [PATCH 3/8] Add 'upon withdraw from non-mature endowments reverts if sender is not owner' test --- .../AccountsDepositWithdrawEndowments.ts | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/test/core/accounts/AccountsDepositWithdrawEndowments.ts b/test/core/accounts/AccountsDepositWithdrawEndowments.ts index 45482e055..0bf315c02 100644 --- a/test/core/accounts/AccountsDepositWithdrawEndowments.ts +++ b/test/core/accounts/AccountsDepositWithdrawEndowments.ts @@ -768,6 +768,16 @@ describe("AccountsDepositWithdrawEndowments", function () { }); describe("from Non-Mature endowments", () => { + it("reverts if sender is not owner", async () => { + await expect( + facet + .connect(accOwner) + .withdraw(charityId, VaultType.LIQUID, genWallet().address, 0, [ + {addr: tokenFake.address, amnt: 1}, + ]) + ).to.be.revertedWith("Unauthorized"); + }); + it("reverts if beneficiary address is not listed in allowlistedBeneficiaries nor is it the Endowment Owner", async () => { await wait(state.setAllowlist(normalEndowId, 0, [genWallet().address])); @@ -1342,6 +1352,42 @@ describe("AccountsDepositWithdrawEndowments", function () { ).to.be.revertedWith("Beneficiary address is not listed in maturityAllowlist"); }); + // it("reverts if maturity allowlist is empty", async () => { + // await expect( + // facet.withdraw(normalEndowId, VaultType.LIQUID, genWallet().address, 0, [ + // {addr: tokenFake.address, amnt: 1}, + // ]) + // ).to.be.revertedWith("Unauthorized"); + // }); + + // it("reverts if owner is not in maturity allowlist", async () => { + // await wait( + // state.setAllowlist(normalEndowId, AllowlistType.MaturityAllowlist, [ + // await accOwner.getAddress(), + // ]) + // ); + // await expect( + // facet.withdraw(normalEndowId, VaultType.LIQUID, genWallet().address, 0, [ + // {addr: tokenFake.address, amnt: 1}, + // ]) + // ).to.be.revertedWith("Unauthorized"); + // }); + + // it("reverts if sender is not in maturity allowlist", async () => { + // await wait( + // state.setAllowlist(charityId, AllowlistType.MaturityAllowlist, [ + // await endowOwner.getAddress(), + // ]) + // ); + // await expect( + // facet + // .connect(accOwner) + // .withdraw(charityId, VaultType.LIQUID, genWallet().address, 0, [ + // {addr: tokenFake.address, amnt: 1}, + // ]) + // ).to.be.revertedWith("Unauthorized"); + // }); + describe("LOCKED withdrawals", () => { it("passes: Normal to Address (protocol-level normal fee only)", async () => { registrarFake.getFeeSettingsByFeeType.returns({bps: 200, payoutAddress: treasury}); From 94f1ccd9f018beba52aa199bec2f2b7c8a555522 Mon Sep 17 00:00:00 2001 From: Nenad Date: Wed, 4 Oct 2023 11:23:51 +0200 Subject: [PATCH 4/8] Remove slither from ci.yml --- .github/workflows/ci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a9be06e7..b401fe4a0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,11 +44,6 @@ jobs: with: cmd: "tsc" - - name: "Slither Analysis" - uses: crytic/slither-action@v0.3.0 - with: - ignore-compile: true - - name: "Test the contracts" uses: "borales/actions-yarn@v4" with: From 21e94839671b02a0bcd889a5ef49be5bdecd4540 Mon Sep 17 00:00:00 2001 From: Nenad Date: Wed, 4 Oct 2023 11:31:18 +0200 Subject: [PATCH 5/8] Add 'passes: Charity to a Charity Endowment transfer' test --- .../AccountsDepositWithdrawEndowments.ts | 130 ++++++++++++------ 1 file changed, 88 insertions(+), 42 deletions(-) diff --git a/test/core/accounts/AccountsDepositWithdrawEndowments.ts b/test/core/accounts/AccountsDepositWithdrawEndowments.ts index 0bf315c02..5f19e5476 100644 --- a/test/core/accounts/AccountsDepositWithdrawEndowments.ts +++ b/test/core/accounts/AccountsDepositWithdrawEndowments.ts @@ -1339,7 +1339,11 @@ describe("AccountsDepositWithdrawEndowments", function () { }); it("reverts if beneficiary address is not listed in maturityAllowlist", async () => { - await wait(state.setAllowlist(normalEndowId, VaultType.LIQUID, [genWallet().address])); + await wait( + state.setAllowlist(normalEndowId, AllowlistType.MaturityAllowlist, [ + await endowOwner.getAddress(), + ]) + ); const acctType = VaultType.LIQUID; const beneficiaryId = 0; @@ -1352,41 +1356,37 @@ describe("AccountsDepositWithdrawEndowments", function () { ).to.be.revertedWith("Beneficiary address is not listed in maturityAllowlist"); }); - // it("reverts if maturity allowlist is empty", async () => { - // await expect( - // facet.withdraw(normalEndowId, VaultType.LIQUID, genWallet().address, 0, [ - // {addr: tokenFake.address, amnt: 1}, - // ]) - // ).to.be.revertedWith("Unauthorized"); - // }); - - // it("reverts if owner is not in maturity allowlist", async () => { - // await wait( - // state.setAllowlist(normalEndowId, AllowlistType.MaturityAllowlist, [ - // await accOwner.getAddress(), - // ]) - // ); - // await expect( - // facet.withdraw(normalEndowId, VaultType.LIQUID, genWallet().address, 0, [ - // {addr: tokenFake.address, amnt: 1}, - // ]) - // ).to.be.revertedWith("Unauthorized"); - // }); - - // it("reverts if sender is not in maturity allowlist", async () => { - // await wait( - // state.setAllowlist(charityId, AllowlistType.MaturityAllowlist, [ - // await endowOwner.getAddress(), - // ]) - // ); - // await expect( - // facet - // .connect(accOwner) - // .withdraw(charityId, VaultType.LIQUID, genWallet().address, 0, [ - // {addr: tokenFake.address, amnt: 1}, - // ]) - // ).to.be.revertedWith("Unauthorized"); - // }); + it("reverts if maturity allowlist is empty", async () => { + await expect( + facet.withdraw(normalEndowId, VaultType.LIQUID, genWallet().address, 0, [ + {addr: tokenFake.address, amnt: 1}, + ]) + ).to.be.revertedWith("Unauthorized"); + }); + + it("reverts if owner is not in maturity allowlist", async () => { + await wait( + state.setAllowlist(normalEndowId, AllowlistType.MaturityAllowlist, [genWallet().address]) + ); + await expect( + facet.withdraw(normalEndowId, VaultType.LIQUID, genWallet().address, 0, [ + {addr: tokenFake.address, amnt: 1}, + ]) + ).to.be.revertedWith("Unauthorized"); + }); + + it("reverts if sender is not in maturity allowlist", async () => { + await wait( + state.setAllowlist(charityId, AllowlistType.MaturityAllowlist, [genWallet().address]) + ); + await expect( + facet + .connect(accOwner) + .withdraw(charityId, VaultType.LIQUID, genWallet().address, 0, [ + {addr: tokenFake.address, amnt: 1}, + ]) + ).to.be.revertedWith("Unauthorized"); + }); describe("LOCKED withdrawals", () => { it("passes: Normal to Address (protocol-level normal fee only)", async () => { @@ -1398,7 +1398,11 @@ describe("AccountsDepositWithdrawEndowments", function () { to: beneficiarySigner.address, }); - await wait(state.setAllowlist(normalEndowId, 2, [beneficiarySigner.address])); + await wait( + state.setAllowlist(normalEndowId, AllowlistType.MaturityAllowlist, [ + beneficiarySigner.address, + ]) + ); const acctType = VaultType.LOCKED; const beneficiaryId = 0; @@ -1438,7 +1442,11 @@ describe("AccountsDepositWithdrawEndowments", function () { }); it("passes: Normal to a Charity Endowment transfer", async () => { - await wait(state.setAllowlist(normalEndowId, 2, [await indexFund.getAddress()])); + await wait( + state.setAllowlist(normalEndowId, AllowlistType.MaturityAllowlist, [ + await endowOwner.getAddress(), + ]) + ); const acctType = VaultType.LOCKED; const beneficiaryAddress = ethers.constants.AddressZero; @@ -1446,13 +1454,10 @@ describe("AccountsDepositWithdrawEndowments", function () { const tokens: IAccountsDepositWithdrawEndowments.TokenInfoStruct[] = [ {addr: tokenFake.address, amnt: 5000}, ]; - const regConfig = await registrarFake.queryConfig(); const amount = BigNumber.from(tokens[0].amnt); await expect( - facet - .connect(indexFund) - .withdraw(normalEndowId, acctType, beneficiaryAddress, beneficiaryId, tokens) + facet.withdraw(normalEndowId, acctType, beneficiaryAddress, beneficiaryId, tokens) ) .to.emit(facet, "EndowmentWithdraw") .withArgs( @@ -1477,6 +1482,47 @@ describe("AccountsDepositWithdrawEndowments", function () { expect(lockBalBen).to.equal(lockBal.add(amount)); expect(liqBalBen).to.equal(liqBal); }); + + it("passes: Charity to a Charity Endowment transfer", async () => { + const acctType = VaultType.LOCKED; + const beneficiaryAddress = ethers.constants.AddressZero; + const beneficiaryId = 11; + const tokens: IAccountsDepositWithdrawEndowments.TokenInfoStruct[] = [ + {addr: tokenFake.address, amnt: 5000}, + ]; + const amount = BigNumber.from(tokens[0].amnt); + + // create charity endowment to act as beneficiary + await wait(state.setEndowmentDetails(beneficiaryId, charity)); + await wait( + state.setAllowlist(charityId, AllowlistType.MaturityAllowlist, [ + await endowOwner.getAddress(), + ]) + ); + + await expect( + facet.withdraw(charityId, acctType, beneficiaryAddress, beneficiaryId, tokens) + ) + .to.emit(facet, "EndowmentWithdraw") + .withArgs( + charityId, + tokens[0].addr, + tokens[0].amnt, + acctType, + beneficiaryAddress, + beneficiaryId + ); + + const [lockedBalance] = await state.getEndowmentTokenBalance(charityId, tokens[0].addr); + expect(lockedBalance).to.equal(lockBal.sub(amount)); + + const [lockBalBen, liqBalBen] = await state.getEndowmentTokenBalance( + beneficiaryId, + tokens[0].addr + ); + expect(lockBalBen).to.equal(amount); + expect(liqBalBen).to.equal(0); + }); }); }); From a583be679288bda7f370aeefcde6d48d60aec21d Mon Sep 17 00:00:00 2001 From: Nenad Date: Wed, 4 Oct 2023 11:52:21 +0200 Subject: [PATCH 6/8] Extract temp charity in 'from Mature endowments' --- .../accounts/AccountsDepositWithdrawEndowments.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/test/core/accounts/AccountsDepositWithdrawEndowments.ts b/test/core/accounts/AccountsDepositWithdrawEndowments.ts index 5f19e5476..14de3f84f 100644 --- a/test/core/accounts/AccountsDepositWithdrawEndowments.ts +++ b/test/core/accounts/AccountsDepositWithdrawEndowments.ts @@ -1319,6 +1319,8 @@ describe("AccountsDepositWithdrawEndowments", function () { }); describe("from Mature endowments", () => { + const tempCharityId = 11; + let rootSnapshot: SnapshotRestorer; before(async () => { @@ -1327,11 +1329,20 @@ describe("AccountsDepositWithdrawEndowments", function () { const currTime = await time.latest(); const endowment = await state.getEndowmentDetails(normalEndowId); + const charity = await state.getEndowmentDetails(charityId); const matureEndowment: AccountStorage.EndowmentStruct = { ...endowment, maturityTime: currTime, }; + const charityEndowment: AccountStorage.EndowmentStruct = { + ...charity, + maturityTime: currTime, + }; await wait(state.setEndowmentDetails(normalEndowId, matureEndowment)); + await wait(state.setEndowmentDetails(charityId, charityEndowment)); + + // temp charity + await wait(state.setEndowmentDetails(tempCharityId, charity)); }); after(async () => { @@ -1486,14 +1497,13 @@ describe("AccountsDepositWithdrawEndowments", function () { it("passes: Charity to a Charity Endowment transfer", async () => { const acctType = VaultType.LOCKED; const beneficiaryAddress = ethers.constants.AddressZero; - const beneficiaryId = 11; + const beneficiaryId = tempCharityId; const tokens: IAccountsDepositWithdrawEndowments.TokenInfoStruct[] = [ {addr: tokenFake.address, amnt: 5000}, ]; const amount = BigNumber.from(tokens[0].amnt); // create charity endowment to act as beneficiary - await wait(state.setEndowmentDetails(beneficiaryId, charity)); await wait( state.setAllowlist(charityId, AllowlistType.MaturityAllowlist, [ await endowOwner.getAddress(), From c1ff29f0fbdaadaf19fe5d06cb3cdf236d0b6048 Mon Sep 17 00:00:00 2001 From: Nenad Date: Wed, 4 Oct 2023 12:34:06 +0200 Subject: [PATCH 7/8] target es2020 --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 21618704a..3cc148bf6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "baseUrl": ".", - "target": "es2018", + "target": "ES2020", "module": "commonjs", "strict": true, "esModuleInterop": true, From 20dfb7bd7cb9b09a0d3bce07e6bcd703f7b8b253 Mon Sep 17 00:00:00 2001 From: Nenad Date: Wed, 4 Oct 2023 12:34:06 +0200 Subject: [PATCH 8/8] Use Allowlist enum in tests --- test/core/accounts/AccountsAllowance.ts | 11 +++++-- .../AccountsDepositWithdrawEndowments.ts | 32 ++++++++++++++----- ...countsUpdateEndowmentSettingsController.ts | 9 ++++-- 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/test/core/accounts/AccountsAllowance.ts b/test/core/accounts/AccountsAllowance.ts index 7cc4887b1..e6abc323f 100644 --- a/test/core/accounts/AccountsAllowance.ts +++ b/test/core/accounts/AccountsAllowance.ts @@ -13,6 +13,7 @@ import { } from "typechain-types"; import {genWallet, getProxyAdminOwner, getSigners} from "utils"; import {deployFacetAsProxy} from "./utils"; +import {AllowlistType} from "types"; describe("AccountsAllowance", function () { const {ethers} = hre; @@ -66,8 +67,14 @@ describe("AccountsAllowance", function () { ); // Beneficiaries & Maturity Allowlists set for endowment user - await wait(state.setAllowlist(ACCOUNT_ID, 0, [await user.getAddress()])); // beneficiaries - await wait(state.setAllowlist(ACCOUNT_ID, 2, [await user.getAddress()])); // maturity + await wait( + state.setAllowlist(ACCOUNT_ID, AllowlistType.AllowlistedBeneficiaries, [ + await user.getAddress(), + ]) + ); + await wait( + state.setAllowlist(ACCOUNT_ID, AllowlistType.MaturityAllowlist, [await user.getAddress()]) + ); }); let snapshot: SnapshotRestorer; diff --git a/test/core/accounts/AccountsDepositWithdrawEndowments.ts b/test/core/accounts/AccountsDepositWithdrawEndowments.ts index 14de3f84f..54b73983b 100644 --- a/test/core/accounts/AccountsDepositWithdrawEndowments.ts +++ b/test/core/accounts/AccountsDepositWithdrawEndowments.ts @@ -512,10 +512,14 @@ describe("AccountsDepositWithdrawEndowments", function () { // setup an allowed contributor wallet to sign/send const allowedContributor = await genWallet().address; await impersonateAccount(allowedContributor); - await setBalance(allowedContributor, 1000000000000000000); // give it some gas money, as impersonateAccount does not + await setBalance(allowedContributor, 1000000000000000000n); // give it some gas money, as impersonateAccount does not const acctSigner = await ethers.getSigner(allowedContributor); // set a different wallet in allowlist - await wait(state.setAllowlist(normalEndowId, 1, [genWallet().address])); + await wait( + state.setAllowlist(normalEndowId, AllowlistType.AllowlistedContributors, [ + genWallet().address, + ]) + ); await expect( facet @@ -528,10 +532,14 @@ describe("AccountsDepositWithdrawEndowments", function () { // setup an allowed contributor wallet to sign/send and setup in allowlist const allowedContributor = await genWallet().address; await impersonateAccount(allowedContributor); - await setBalance(allowedContributor, 1000000000000000000); // give it some gas money, as impersonateAccount does not + await setBalance(allowedContributor, 1000000000000000000n); // give it some gas money, as impersonateAccount does not const acctSigner = await ethers.getSigner(allowedContributor); // set new signer's wallet in allowlist - await wait(state.setAllowlist(normalEndowId, 1, [allowedContributor])); + await wait( + state.setAllowlist(normalEndowId, AllowlistType.AllowlistedContributors, [ + allowedContributor, + ]) + ); const expectedLockedAmt = BigNumber.from(4000); const expectedLiquidAmt = BigNumber.from(6000); @@ -779,7 +787,11 @@ describe("AccountsDepositWithdrawEndowments", function () { }); it("reverts if beneficiary address is not listed in allowlistedBeneficiaries nor is it the Endowment Owner", async () => { - await wait(state.setAllowlist(normalEndowId, 0, [genWallet().address])); + await wait( + state.setAllowlist(normalEndowId, AllowlistType.AllowlistedBeneficiaries, [ + genWallet().address, + ]) + ); await expect( facet.withdraw(normalEndowId, VaultType.LIQUID, genWallet().address, 0, [ @@ -814,7 +826,7 @@ describe("AccountsDepositWithdrawEndowments", function () { it("reverts for a closed endowment (endow beneficiary) when a wallet that is not the beneficiary endowment owner tries to withdraw", async () => { const beneficiaryAddress = genWallet().address; await impersonateAccount(beneficiaryAddress); - await setBalance(beneficiaryAddress, 1000000000000000000); // give it some gas money, as impersonateAccount does not + await setBalance(beneficiaryAddress, 1000000000000000000n); // give it some gas money, as impersonateAccount does not const acctSigner = await ethers.getSigner(beneficiaryAddress); // setup new charity-type endow @@ -844,7 +856,7 @@ describe("AccountsDepositWithdrawEndowments", function () { it("passes: closed endowment with beneficiary address set, sender is beneficiary wallet, no fees applied ", async () => { const beneficiaryAddress = genWallet().address; await impersonateAccount(beneficiaryAddress); - await setBalance(beneficiaryAddress, 1000000000000000000); // give it some gas money, as impersonateAccount does not + await setBalance(beneficiaryAddress, 1000000000000000000n); // give it some gas money, as impersonateAccount does not const acctSigner = await ethers.getSigner(beneficiaryAddress); const beneficiaryId = 0; const acctType = VaultType.LIQUID; @@ -1154,7 +1166,11 @@ describe("AccountsDepositWithdrawEndowments", function () { withdrawFee: {payoutAddress: await endowOwner.getAddress(), bps: 10}, // 0.1% }; await wait(state.setEndowmentDetails(normalEndowId, normalWithAllowlist)); - await wait(state.setAllowlist(normalEndowId, 0, [beneficiaryAddress])); + await wait( + state.setAllowlist(normalEndowId, AllowlistType.AllowlistedBeneficiaries, [ + beneficiaryAddress, + ]) + ); await expect( facet diff --git a/test/core/accounts/AccountsUpdateEndowmentSettingsController.ts b/test/core/accounts/AccountsUpdateEndowmentSettingsController.ts index 6b4bc63bd..507c4b842 100644 --- a/test/core/accounts/AccountsUpdateEndowmentSettingsController.ts +++ b/test/core/accounts/AccountsUpdateEndowmentSettingsController.ts @@ -16,6 +16,7 @@ import { } from "typechain-types/contracts/test/accounts/TestFacetProxyContract"; import {genWallet, getProxyAdminOwner, getSigners} from "utils"; import {deployFacetAsProxy, updateAllSettings} from "./utils"; +import {AllowlistType} from "types"; use(smock.matchers); @@ -227,7 +228,9 @@ describe("AccountsUpdateEndowmentSettingsController", function () { it("returns same members in starting allowlist if only pre-existing addresses are passed in add", async () => { // set starting allowlist const wallet = await genWallet().address; - await wait(state.setAllowlist(normalEndowId, 0, [wallet])); + await wait( + state.setAllowlist(normalEndowId, AllowlistType.AllowlistedBeneficiaries, [wallet]) + ); const remove: any[] = []; const add: any[] = [wallet]; @@ -245,7 +248,9 @@ describe("AccountsUpdateEndowmentSettingsController", function () { const wallet3 = await genWallet().address; // set starting allowlist - await wait(state.setAllowlist(normalEndowId, 0, [wallet])); + await wait( + state.setAllowlist(normalEndowId, AllowlistType.AllowlistedBeneficiaries, [wallet]) + ); const remove: any[] = [wallet2]; const add: any[] = [wallet, wallet2, wallet3];