function transferFrom(address from, address to, uint value) public returns (bool) {
require(balanceOf(from) => value, 'balance too low');
require(allowance)[from][msg.sender] >= value, 'allowance too low');
balances[to] += value;
balances[from] -= value;
emit Transfer(from, to, value);
return true;
}
Add a comment
|
1 Answer
There are some syntax error. I fixed them in this way:
Smart contract modified:
// your logic
function transferFrom(address from, address to, uint value) public returns (bool) {
require(balanceOf(from) >= value, "balance too low");
require(allowance[from][msg.sender] >= value, "allowance too low");
balances[to] += value; balances[from] -= value;
emit Transfer(from, to, value);
return true;
}
// your logic