Skip to content

Commit

Permalink
Remove ToS check on isValidLender
Browse files Browse the repository at this point in the history
We check whenever adding an address, so we do not need to use the cycles
checking here every time
  • Loading branch information
venables committed Oct 28, 2022
1 parent 008ce12 commit 80bfc23
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 15 deletions.
5 changes: 2 additions & 3 deletions contracts/permissioned/PoolAccessControl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ contract PoolAccessControl is
*/
function isValidLender(address addr) external view returns (bool) {
return
_tosRegistry.hasAccepted(addr) &&
(_allowedLenders[addr] ||
_credentialVerifications[addr] > block.timestamp);
_allowedLenders[addr] ||
_credentialVerifications[addr] > block.timestamp;
}

/**
Expand Down
13 changes: 1 addition & 12 deletions test/permissioned/PoolAccessControl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,14 @@ describe("PoolAccessControl", () => {
}

describe("isValidLender()", () => {
it("returns false if the address has not accepted ToS", async () => {
it("returns false if the address is not on the allow list and has not verified via Verite", async () => {
const { poolAccessControl, lender } = await loadFixture(deployFixture);

expect(await poolAccessControl.isValidLender(lender.address)).to.equal(
false
);
});

it("returns false if the address accepted Terms but is not on the allow list and has not verified via Verite", async () => {
const { poolAccessControl, lender, tosAcceptanceRegistry } =
await loadFixture(deployFixture);

await tosAcceptanceRegistry.connect(lender).acceptTermsOfService();

expect(await poolAccessControl.isValidLender(lender.address)).to.equal(
false
);
});

it("returns true if the address is on the allow list", async () => {
const { poolAccessControl, lender, tosAcceptanceRegistry, poolAdmin } =
await loadFixture(deployFixture);
Expand Down

0 comments on commit 80bfc23

Please sign in to comment.