Solidity theorytheory 0/50 · 0%
Projects · hard

50. Capstone: reviewing a full protocol

Putting every topic together.

Take the staking contract you built: draw the state machine, list every external call, name the invariants, and write tests that try to violate each one. Then check the operational side — who holds the keys, how rewards are funded, what happens if the oracle stops, and how users exit if the team disappears.

invariant: address(this).balance >= totalStaked
invariant: sum(positions[i].amount) == totalStaked

A protocol is finished when its failure modes are documented, not when it compiles.

Check your understanding

  1. 1. What defines a finished protocol here?

  2. 2. Which invariant fits a staking pool?

  3. 3. What operational question matters most?