I try to transfer ethers from one account to another using my smart contract but the contract doesn't allow me with following functions :
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) /* A contract attempts to get the coins */
{
if (balanceOf[_from] < _value)
{
throw; // Check if the sender has enough
}
if (balanceOf[_to] + _value < balanceOf[_to])
{
throw; // Check for overflows
}
if (_value > allowance[_from][msg.sender])
{
throw; // Check allowance
}
balanceOf[_from] -= _value; // Subtract from the sender
balanceOf[_to] += _value; // Add the same to the recipient
allowance[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
}
function sell(uint256 TokensAmount) afterDeadline
{
uint256 amount = TokensAmount;
if (balanceOf[msg.sender] < amount )
{
throw; // checks if the sender has enough to sell
}
uint256 revenue = amount * sellPrice;
balanceOf[msg.sender] -= amount; // subtracts the amount from seller's balance
balanceOf[Killer] += amount; // adds the amount to owner's balance
KilledTokens[msg.sender] += amount;
KilledTillNow += amount;
address _to = msg.sender;
address _from = owner;
uint256 _value = revenue;
if (!msg.sender.send(revenue))
{ // sends ether to the seller: it's important
throw; // to do this last to prevent recursion attacks
}
else
{
transferFrom(_from, _to, _value)
Transfer(msg.sender, Killer, amount); // executes an event reflecting on the change
return; // ends function and returns
}
}