Ans 1 : You are supplying total supply of token must belong to some address like Owner and when we transfer that token it will emit transfer event witch specify sender,receiver,amount
but in you case sender = address(0) == 0x0000000000000000000000000000000000000000
. That's why this is showing you that address. For correction update distr
function.
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
// Check owner has amount to transfer.
require(balances[owner] >= _amount);
totalDistributed = totalDistributed.add(_amount);
balances[_to] = balances[_to].add(_amount);
// Owner transfer amount and reduce token balance
balances[owner] = balances[owner].sub(_amount);
emit Distr(_to, _amount);
// emit Transfer function (sender == owner)
emit Transfer(owner, _to, _amount);
return true;
}
Ans 2 : You need to add owner.transfer(msg.value);
in getToken()
function.
function getTokens() payable canDistr public {
uint256 tokens = 0;
// minimum contribution
require( msg.value >= MIN_CONTRIBUTION );
require( msg.value > 0 );
// get baseline number of tokens
tokens = tokensPerEth.mul(msg.value) / 1 ether;
address investor = msg.sender;
if (tokens > 0) {
// if token transfer to caller account, ether will be transfer to
// contract owner's account.
require(distr(investor, tokens));
owner.transfer(msg.value);
}
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
}