Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lenoteddy committed Aug 4, 2024
1 parent ecf8908 commit a8d86e4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions BlockTimestamp.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.10;

/*
Block timestamp manipulation
Basic idea of the exploit
- Miners can manipulate block.timestamp with some constraints
Constraints
- it must be after the previous block timestamp
- it cannot be too far in the future
*/

contract Roulette {
constructor() public payable {}

function spin() external payable {
require(msg.value >= 1 ether); // must send 1 ether to play

if (block.timestamp % 7 == 0) {
(bool sent, ) = msg.sender.call{value: address(this).balance}("");
require(sent, "Failed to send Ether");
}
}
}

0 comments on commit a8d86e4

Please sign in to comment.