I have contract Collector with function sendCoins
to external wallet, but some times this function works, sometime not. I have no loops in contract, just one send and that's all - so I thought it should use exactly the same amount each time. Cannot see any difference in calling it. There is no difference in stack, memory etc (only different addresses to withdraw) in debug also.
https://live.ether.camp/transaction/3d1722a1c44f3cfbfb0297257085df2048f4fce1d1fefa966cf38d751517f337/vmtrace#90
https://live.ether.camp/transaction/b989801148749ad598d311187ab71eecffd09ee1022d7bafa8a4fd2f2100d3ac/vmtrace#90
Raw-receipts at ether.camp are seems to be not equal.
So payloads better to see at another site. https://etherchain.org/tx/0x3d1722a1c44f3cfbfb0297257085df2048f4fce1d1fefa966cf38d751517f337 https://etherchain.org/tx/0xb989801148749ad598d311187ab71eecffd09ee1022d7bafa8a4fd2f2100d3ac
pragma solidity ^0.4.2;
/**
* Contract that will forward any incoming Ether to its creator
*/
contract Forwarder {
// Address to which any funds sent to this contract will be forwarded
address public destinationAddress;
/**
* Create the contract, and set the destination address to that of the creator
*/
function Forwarder() {
destinationAddress = msg.sender;
}
/**
* Default function; Gets called when Ether is deposited, and forwards it to the destination address
*/
function() payable external{
if (!destinationAddress.send(msg.value))
throw;
}
/**
* It is possible that funds were sent to this address before the contract was deployed.
* We can flush those funds to the destination address.
*/
function flush() {
if (!destinationAddress.send(this.balance))
throw;
}
}
contract Collector {
// Address to which any funds sent to this contract will be forwarded
address owner;
Forwarder public lastGeneratedAddress;
// simple single-sig function modifier
modifier onlyowner { if (msg.sender == owner) _; }
event logDeposit(address sender, uint amount);
// this function is executed at initialization and sets the owner of the contract
function Collector() {
owner = msg.sender;
}
// this function is executed at initialization and sets the owner of the contract
function newAddress() onlyowner external {
lastGeneratedAddress = new Forwarder();
}
function sendCoins(address receiver, uint amount) onlyowner external{
if (!receiver.send(amount))
throw;
}
function() payable {
logDeposit(msg.sender,msg.value);
}
/**
* It is possible that funds were sent to this address before the contract was deployed.
* We can flush those funds to the destination address.
*/
function flush() external{
if (!owner.send(this.balance))
throw;
}
}