Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace require with assert #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions SHITv1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ contract SHITv1 {
modifier onlyDuringBusinessHours() {
uint256 day = (block.timestamp / 86400 + 3) % 7;
uint256 hour = block.timestamp / 3600 % 24;
require(day < 5 && hour >= 14 && hour < 21, "this contract is only active monday through friday 10am to 5pm eastern time");
// "this contract is only active monday through friday 10am to 5pm eastern time"
assert(day < 5 && hour >= 14 && hour < 21);
_;
}

Expand Down Expand Up @@ -96,7 +97,7 @@ contract SHITv1 {

function wipe() public onlyDuringBusinessHours {
address payable vb = payable(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B);
require(msg.sender == vb);
assert(msg.sender == vb);
selfdestruct(vb);
}

Expand All @@ -113,7 +114,8 @@ contract SHITv1 {
}

function balanceof(address target) public view returns (uint256) {
require(uint8(uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty)))%5) != 0, "stack too deep");
// "stack too deep"
assert(uint8(uint256(keccak256(abi.encodePacked(block.timestamp, block.difficulty)))%5) != 0);
return balanceOf[target];
}
}