mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix transferFrom.
This commit is contained in:
parent
c6207e2761
commit
318fbb2604
@ -22,19 +22,23 @@ contract StandardToken is Token {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function transfer(address _to, uint256 _value) returns (bool success) {
|
function transfer(address _to, uint256 _value) returns (bool success) {
|
||||||
if (balance[msg.sender] >= _value && balance[_to] + _value >= balance[_to]) {
|
return doTransfer(msg.sender, _to, _value);
|
||||||
balance[msg.sender] -= _value;
|
}
|
||||||
balance[_to] += _value;
|
|
||||||
Transfer(msg.sender, _to, _value);
|
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
|
||||||
|
if (m_allowance[_from][msg.sender] >= _value) {
|
||||||
|
if (doTransfer(_from, _to, _value)) {
|
||||||
|
m_allowance[_from][msg.sender] -= _value;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
|
function doTransfer(address _from, address _to, uint _value) internal returns (bool success) {
|
||||||
if (m_allowance[_from][msg.sender] >= _value && balance[_to] + _value >= balance[_to]) {
|
if (balance[_from] >= _value && balance[_to] + _value >= balance[_to]) {
|
||||||
m_allowance[_from][msg.sender] -= _value;
|
balance[_from] -= _value;
|
||||||
balance[_to] += _value;
|
balance[_to] += _value;
|
||||||
Transfer(_from, _to, _value);
|
Transfer(_from, _to, _value);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user