1

I have created a contract which has a function like this:

function transfer(address _to, uint256 _value, bytes _data) internal returns (bool) {
    balances[msg.sender] = balances[msg.sender].sub(_value);
    balances[_to] = balances[_to].add(_value);
    emit Transfer(msg.sender, _to, _value, _data);
    return true;
}

but now when I want to test contract in web3 1.0.0 using following code:

var balance = await baxToken.methods.balanceOf(user1).call({from:owner, gas:gasEstimate})
console.log(balance)

await baxToken.methods.transfer(user1, 50000).send({from:owner, gas:gasEstimate}).on('event', console.log)

var balance = await baxToken.methods.balanceOf(user1).call({from:owner, gas:gasEstimate})
console.log('balance')

while the first 2 lines of code works however the code stops then. I realized that if I comment the emit Transfer(...) from my contract it works fine.

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.