The Dead Man's Switch challenge was completed before we had this style guide and custom error requirements. This issue is for updating the challenge to use the new styling and custom errors (testing the custom errors will need to be added as well).
// Layout of Contract:
// version
// imports
// errors
// interfaces, libraries, contracts
// Type declarations
// State variables
// Events
// Modifiers
// Functions
// Layout of Functions:
// constructor
// receive function (if exists)
// fallback function (if exists)
// external
// public
// internal
// private
// internal & private view & pure functions
// external & public view & pure functions
Let's also designate the different sections with large block comments like this:
///////////////////
// Public Functions
///////////////////
Lastly, let's use custom errors. For several contracts we have been doing generic reverts with strings but in the tests we can only expect any revert. By using custom errors and informing challengers about them in the requirements we are able to test that a contract reverts for a specific reason. This is also generally better practice for gas efficiency.
Look at almost any other completed challenge to get a visual idea about what it should look like.
The Dead Man's Switch challenge was completed before we had this style guide and custom error requirements. This issue is for updating the challenge to use the new styling and custom errors (testing the custom errors will need to be added as well).
Let's also designate the different sections with large block comments like this:
Lastly, let's use custom errors. For several contracts we have been doing generic reverts with strings but in the tests we can only expect any revert. By using custom errors and informing challengers about them in the requirements we are able to test that a contract reverts for a specific reason. This is also generally better practice for gas efficiency.
Look at almost any other completed challenge to get a visual idea about what it should look like.