0

If I have two external functions in two contracts (A and B), where A calls B, B's called function has an onlyA() modifier, and B's called function sends ETH to an external address, is it logical to check for reentrancy in A and B? Or is it safe enough to check for reentrancy on A only?

1
  • What exactly does the onlyA() modifier do? Only the address of contract A can call that method?
    – red-swan
    Commented Dec 21, 2023 at 1:36

1 Answer 1

1

This is very broad question and I'm not sure what the onlyA() modifier does. Let's say it checks to make sure that Contract B's method (which is external) and can only be called if msg.sender is the address of Contract A. In this case, then yes, you will only need to make sure Contract A checks for reentrancy, because the function is acting as if it were an internal method of A. But if that's the case, then why isn't it part of Contract A?

1
  • You gave me the answer already. Your open questions are open since I left out some context in order to make the question as simple as possible but still direct to the point.
    – dNyrM
    Commented Dec 21, 2023 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.