1

I fiddled with code formatting in the original question. The first issue is this line: bal+n; It should be bal = bal + n; to do something, or the shorthand, bal += n; but we will still have a problem. What is n? That's the complaint. In C you send(n). n has meaning in that context but the variable name is not transmitted. It's an amount of ether ...


1

I believe this was a bug before which is fixed now. Current version i'm using is: $ truffle version Truffle v5.0.20 (core: 5.0.20) Solidity v0.5.0 (solc-js) Node v10.15.3 Web3.js v1.0.0-beta.37 Simple smart contract to reproduce the issue pragma solidity ^0.5.6; contract TruffleDebug { function Deposit (uint256 timeout, bytes32 hash, address ...


1

This is not a solution, rather a bug. You should not remove the line require(_value <= allowance[_from][msg.sender]); without knowing its impact. If you remove this line, anyone can move tokens other address, which is huge vulnerability. I can spend tokens from your account without your concent. The allowance is there to verify that if you have allowed me ...


1

Chriseth's solution looks good and clean and would work in an implementation using signed ints instead of unsigned ones. However you would need to change the line j--; to if (j > 0) j--; if you want to avoid getting an integer underflow.


Only top voted, non community-wiki answers of a minimum length are eligible