When you calls function from imported contract the msg.sender is address of caller contract (DappTokenSale is this case) ?
// Buy tokens
function buyTokens(uint256 _numberOfTokens) public payable {
// Require that value is equal to tokens
require(msg.value == multiply(_numberOfTokens, tokenPrice));
// Require that the contract has enough tokens
require(tokenContract.balanceOf(address(this)) >= _numberOfTokens);
// Require that a transfer is successful
require(tokenContract.transfer(msg.sender, _numberOfTokens));
// keep track of tokensSold
tokensSold += _numberOfTokens;
// Trigger Sell Event
emit Sell(msg.sender, _numberOfTokens);
}
I don't understand this part of code:
the msg.sender sold to himself?
When you calls function from imported contract the msg.sender is address of caller contract (DappTokenSale is this case) ?