Search code examples
constructorsoliditysmartcontracts

What would be the value of msg.sender in a function called inside a contract constructor?


I have read that during a contract deployment, inside the constructor, the contract address is not defined yet. So if this constructor was calling a function of another contract, what would this function get as the msg.sender ?

Thanks!


Solution

  • So I tested my question on a virtual network and it seems that during the deployment of a contract, functions called inside the constructor will receive a different address than the final address after deployment, and this deployment address cannot be detected as a being a contract's address contrary to the final address.