I have a question about proxy contracts. Let's say that the implementation of the proxy (i.e. logic contract) contains the code address(this)
and msg.sender
in its function A(). When an EOA calls proxyContract.A(), would the address(this)
be the address of the proxy contract or the logic contract? Would msg.sender
be the EOA or the proxy contract address?
Environment
Solidity ^0.8.0
Address(this) would be the created proxy address. While msg.sender is used to set the caller to created that proxy as the admin or as owner of the proxy
I think @Larrrry is asking about functions in general, not only the constructor.
address(this)
will be the proxy address. msg.sender
will be the EOA.
1 Like
Thanks guys. Very helpful. The reason I asked is that I saw the following code in what I referred to as function A() above. It seems like this check will never pass then? Unless the proxy contract contains address(this).A()
somewhere in its code, or a low level call that enables the proxy contract to call itself with an arbitrary calldata? Just trying to make sense of this require()
statement...
require(msg.sender == address(this), "FORBIDDEN");
Yeah this is exactly right.