Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity 0.4.24;
- contract KoET {
- // Highest bidder becomes the Leader.
- // Vulnerable to DoS attack by an attacker contract which reverts all transactions to it.
- address public currentLeader;
- uint public highestBid;
- function () public payable {
- require(msg.value > highestBid && msg.value - highestBid < 1000, "Value have to be within 1000 wei above the highest bit" );
- currentLeader.transfer(highestBid); // Refund the old leader, if it fails then revert
- currentLeader = msg.sender;
- highestBid = msg.value;
- }
- }
Add Comment
Please, Sign In to add comment