This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT; | |
pragma solidity ^0.8.7; | |
contract Counter{ | |
uint public count; | |
uint timer = 0; | |
error timeNotReached(string); | |
bool reached = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8; | |
// create a timer for increement and decreement but they should only work after 30secs | |
contract counter { | |
uint256 count; | |
uint256 lastRun; | |
function add() external { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity ^0.8.4; | |
/// ogbeni | |
error Unauthorized(); | |
/// @custom:experimental This is an experimental contract. | |
contract VendingMachine { | |
address payable owner = payable(msg.sender); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.0; | |
contract Counter { | |
uint256 count; | |
uint256 restrictionTime = block.timestamp + 30; | |
function add() public { | |
require(block.timestamp < restrictionTime, "restriction time reached"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Collect funds in a payable `stake()` function and track individual `balances` with a mapping: | |
// ( Make sure to add a `Stake(address,uint256)` event and emit) | |
// After some `deadline` allow anyone to call an `execute()` function | |
// If the deadline has passed and the threshold is met, it should call `exampleExternalContract.complete{value: address(this).balance}()` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.0; | |
contract Staking { | |
event Stake(address user, uint amount); | |
uint256 deadline = block.timestamp + 5 minutes; | |
mapping(address => uint) balances; |
NewerOlder