0

调用 transferFrom 时,它使用地址 0x00000 而不是我传递给它的地址。

我已经确保代币在构建时被铸造,并且总供应量被发送到合约所有者的钱包地址。在调用 transferFrom ownerAddress 和 contractAddress 之前都已定义,但它似乎仍然忽略了发件人地址。

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;
}
}

我希望“发件人”地址是 ownerAddress,而是 0x00000

测试期间发出的事件:----------------------------

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

---------------------------
4

1 回答 1

0

ownerAddress未定义。你的意思是owner

于 2019-07-22T17:31:15.697 回答