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 Answer
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?
-
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.– dNyrMCommented Dec 21, 2023 at 12:38
onlyA()
modifier do? Only the address of contract A can call that method?