Guest User

Untitled

a guest
Oct 20th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. pragma solidity 0.4.24;
  2.  
  3. contract KoET {
  4. // Highest bidder becomes the Leader.
  5. // Vulnerable to DoS attack by an attacker contract which reverts all transactions to it.
  6.  
  7. address public currentLeader;
  8. uint public highestBid;
  9.  
  10. function () public payable {
  11. require(msg.value > highestBid && msg.value - highestBid < 1000, "Value have to be within 1000 wei above the highest bit" );
  12. currentLeader.transfer(highestBid); // Refund the old leader, if it fails then revert
  13. currentLeader = msg.sender;
  14. highestBid = msg.value;
  15. }
  16. }
Add Comment
Please, Sign In to add comment