Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent someone unwhitelisting the escrow #5

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/escrow/increasing/Lock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ contract Lock is ILock, ERC721Enumerable, UUPSUpgradeable, DaoAuthorizable {

/// @notice Transfers disabled by default, only whitelisted addresses can receive transfers
function setWhitelisted(address _account, bool _isWhitelisted) external auth(LOCK_ADMIN_ROLE) {
if (_account == escrow) revert ForbiddenWhitelistAddress();
whitelisted[_account] = _isWhitelisted;
emit WhitelistSet(_account, _isWhitelisted);
}
Expand Down
1 change: 1 addition & 0 deletions src/escrow/increasing/interfaces/ILock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface IWhitelistEvents {

interface IWhitelistErrors {
error NotWhitelisted();
error ForbiddenWhitelistAddress();
}

interface IWhitelist is IWhitelistEvents, IWhitelistErrors {
Expand Down
7 changes: 7 additions & 0 deletions test/escrow/escrow/EscrowAdmin.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,11 @@ contract TestEscrowAdmin is EscrowBase {
vm.expectRevert(err);
nftLock.upgradeTo(newImpl);
}

// hal-16 should not be possible to unwhitelist the escrow
function testUnwhitelistEscrow() public {
address escrowAddr = nftLock.escrow();
vm.expectRevert(ForbiddenWhitelistAddress.selector);
nftLock.setWhitelisted(escrowAddr, false);
}
}