Last active
July 30, 2022 19:27
-
-
Save codeWhizperer/cb336cfce0a85038ddc15c2ba6970d6c to your computer and use it in GitHub Desktop.
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}()` | |
| // If the `threshold` was not met, allow everyone to call a `withdraw()` function | |
| // Add a `withdraw()` function to let users withdraw their balance | |
| // Add a `timeLeft()` view function that returns the time left before the deadline for the frontend | |
| // Add the `receive()` special function that receives eth and calls stake() | |
| // receive() payable external { | |
| // stake(); | |
| // } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment