When I am executing the program on the remix IDE (got from internet), it asks me the address, _wallet, which I am passing in the constructor. Remix IDE shows me 3 addresses: Account, Deploy _wallet and Deployed Contracts. In the code, I am using the only the wallet address retrieved from wallet. What the statement
wallet.transfer(msg.value)
would do? Will it transfer Ether to the Account address. What is the difference between the 3 address and their usage.
pragma solidity 0.5.4;
contract MyContractEtherEvents {
mapping(address => uint256) public balances;
address payable wallet;
event Purchase(
address indexed _buyer,
uint256 _amount
);
constructor(address payable _wallet) public {
wallet = _wallet;
}
function() external payable {
buyToken();
}
function buyToken() public payable {
balances[msg.sender] += 1;
wallet.transfer(msg.value);
emit Purchase(msg.sender, 1);
}
}
Somebody please guide me.
Zulfi.