Skip to content

In-depth lesson · Smart contracts

Tips for beginners

Every point the Smart contracts reports back under this heading, best-backed first, each with the reports it is seen in.

Back to the lesson 1 to 3 of 3
  1. For price dependent code, identify the exact source and ask whether it can be moved inside one transaction. Spot pool prices, pool share weights and pool oracles are the usual suspects. Also check what happens on timeout: a stale or huge but valid price is often worse than a revert.

    Seen in 2 reports
  2. Check the order of operations in every function that makes an external call. If state is written after the call, or if a callback path exists without the guard used on the main path, you have a candidate. Confirm it by tracing what the recipient can do before the write lands.

    Seen in 1 report
  3. Test with unusual tokens rather than the standard one. A token that returns false or no value, one with decimals other than eighteen, one that charges a fee on transfer, and one that rejects non-zero-to-non-zero approvals will each expose a different assumption. Report the specific token behaviour that breaks the contract, not a generic complaint about token support.

    Seen in 1 report