vm.startBroadcast();Who is msg.sender at this time? #7948
Answered
by
urosognjenovic
chaoticpunk
asked this question in
Help
-
function broadcast() external;
function broadcast(address who) external;
function broadcast(uint256 privateKey) external; https://book.getfoundry.sh/cheatcodes/broadcast contract Deploy is Script {
function run() external {
vm.startBroadcast();
Vault vault = new Vault();
vault.deposit{value: 10 ether}();
console.log("address:Vault", address(vault));
}
} In this example, in this Deploy contract, when deploying the Vault contract,Who is msg.sender? |
Beta Was this translation helpful? Give feedback.
Answered by
urosognjenovic
May 29, 2024
Replies: 1 comment
-
When deploying the Vault contract, msg.sender is the account that you used to deploy the contract (the one that you specified either using You can check the msg.sender by adding a console log inside of your contract like this:
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
DaniPopes
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When deploying the Vault contract, msg.sender is the account that you used to deploy the contract (the one that you specified either using
--private-key yourPrivateKey
or using--account yourEncryptedAccount
).You can check the msg.sender by adding a console log inside of your contract like this: