Skip to content

Commit

Permalink
Merge pull request #80 from bcnmy/remediations/SMA-575-sponsorship-pm
Browse files Browse the repository at this point in the history
update isContract checks
  • Loading branch information
livingrockrises authored Feb 10, 2024
2 parents 2ed359d + 39ecb2f commit 4fd1993
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit 4fd1993

Please sign in to comment.