StoppableBid.sol 507 B

1234567891011121314151617181920212223242526
  1. pragma solidity ^0.4.4;
  2. import '../PullPayment.sol';
  3. import '../Stoppable.sol';
  4. contract StoppableBid is Stoppable, PullPayment {
  5. address public highestBidder;
  6. uint public highestBid;
  7. function bid() external payable stopInEmergency {
  8. if (msg.value <= highestBid) throw;
  9. if (highestBidder != 0) {
  10. asyncSend(highestBidder, highestBid);
  11. }
  12. highestBidder = msg.sender;
  13. highestBid = msg.value;
  14. }
  15. function withdraw() onlyInEmergency {
  16. selfdestruct(owner);
  17. }
  18. }