Skip to content

Instantly share code, notes, and snippets.

@casweeney
Created August 1, 2022 12:43
Show Gist options
  • Save casweeney/4718797ba14dfd8b247fd47efa932bdc to your computer and use it in GitHub Desktop.
Save casweeney/4718797ba14dfd8b247fd47efa932bdc to your computer and use it in GitHub Desktop.
Assignment given by Kevin at Web3Bridge
// 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