0

When calling transferFrom it uses address 0x00000 instead of the address I am passing to it.

I have insured the token is minted when constructed and total supply is sent to contract owner's wallet address. Right before calling transferFrom ownerAddress and contractAddress are both defined but it still seems to ignore the from address.

Token contract {   

address public ownerAddress;
uint256 public initialSupply = 100000000000;

constructor(string memory _name, string memory _symbol, uint8 _decimals) 
ERC20Detailed(_name, _symbol, _decimals)
public {
    ownerAddress = msg.sender;
    _mint(msg.sender, initialSupply);
} 



function createTokenSale(uint256 rate,uint256 cap) public verifyOwner() returns(address) {

    TokenSale newTokenSale = new TokenSale(rate, msg.sender, this, cap );
    address tokenSaleAddress = address(newTokenSale);

    emit LogSaleAndOwnerAddress(tokenSaleAddress, ownerAddress); // both addresses are as expected here

    this.transferFrom(ownerAddress, tokenSaleAddress, initialSupply); //this attempts to transfer from 0x0000 to tokenSaleAddress  ??????

    return tokenSaleAddress;
}
}

I expect "from" address to be ownerAddress but instead its 0x00000

Events emitted during test: ---------------------------

Transfer(from: <indexed> 0x0000000000000000000000000000000000000000 (address), to: <indexed> 0x010F9041ef37816CE5D63BFcAe4bAbDA55E00f4E (address), value: 100000000000 (uint256))

---------------------------

1 Answers1

0

ownerAddress is undefined. Did you mean owner?

Ferit
  • 8,692
  • 8
  • 34
  • 59