I'm currently developing on a simple Naming Service for the Ethereum Blockchain.
msg.sender
has the address of the deployer from the contract and not from the caller.
address public caller;
constructor() {
caller = msg.sender;
}
Using remix.ethereum.org
and pragma solidity >=0.7.0 <0.9.0;
and deployed on the JavaScript VM (London).
Can someone explain me why?
Right now
caller
is going to be equal to the address that deployed the contract because that is whatmsg.sender
will reference. If you are trying to makecaller
be the contract address instead, then you need to docaller = address(this);
.address(this)
is the actual contracts address.