I have two ownable functions (I'm using openzeppelin), when I invoke the second function from the first one, I get:

"Ownable: caller is not the owner".

function first() external view onlyOwner returns(address){
    return this.second();

function second() external view onlyOwner returns(address){
    return msg.sender;

I guess the problem is that the first function is invoking a second with a different address. How to make this work?

1 Answer 1


When you call the second function with this it will trigger an internal transaction, therefore msg.sender is the contract itself, which is different from the owner.

You can call the function without this. which will not trigger an internal transaction and just "jump" to the function.

  • Makes total sense, it was easy enough, I was overthinking it. Thank you! Jan 22, 2022 at 21:25

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.