Skip to content

vm.startBroadcast();Who is msg.sender at this time? #7948

Answered by thebraveman17
chaoticpunk asked this question in Help
Discussion options

You must be logged in to vote

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:

contract Deploy is Script {
    function run() external {
        vm.startBroadcast();

        Vault vault = new Vault();
        vault.deposit{value: 10 ether}();
        console.log(msg.sender);

        console.log("address:Vault", address(vault));
    }
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by DaniPopes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants