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

update isContract checks #80

Merged
merged 2 commits into from
Feb 10, 2024
Merged
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
5 changes: 5 additions & 0 deletions contracts/common/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ contract SponsorshipPaymasterErrors {
*/
error FeeCollectorCannotBeContract();

/**
* @notice Throws when the fee collector address provided is a deployed contract
*/
error VerifyingSignerCannotBeContract();

/**
* @notice Throws when the fee collector address provided is address(0)
*/
Expand Down
3 changes: 1 addition & 2 deletions contracts/sponsorship/SponsorshipPaymaster.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ contract SponsorshipPaymaster is
* @param paymasterId dapp identifier for which deposit is being made
*/
function depositFor(address paymasterId) external payable nonReentrant {
if(paymasterId.isContract()) revert PaymasterIdCannotBeContract();
if (paymasterId == address(0)) revert PaymasterIdCannotBeZero();
if (msg.value == 0) revert DepositCanNotBeZero();
paymasterIdBalances[paymasterId] += msg.value;
Expand All @@ -87,6 +86,7 @@ contract SponsorshipPaymaster is
function setSigner(
address _newVerifyingSigner
) external payable override onlyOwner {
if(_newVerifyingSigner.isContract()) revert VerifyingSignerCannotBeContract();
if (_newVerifyingSigner == address(0))
revert VerifyingSignerCannotBeZero();
address oldSigner = verifyingSigner;
Expand All @@ -106,7 +106,6 @@ contract SponsorshipPaymaster is
function setFeeCollector(
address _newFeeCollector
) external payable onlyOwner {
if(_newFeeCollector.isContract()) revert FeeCollectorCannotBeContract();
if (_newFeeCollector == address(0)) revert FeeCollectorCannotBeZero();
address oldFeeCollector = feeCollector;
assembly {
Expand Down
Loading