Skip to content

In-depth lesson · Smart contracts

Typical fixes

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 11 of 11
  1. Add a non-reentrancy modifier and update state before external calls.

    Seen in 18 reports
  2. Update state before external calls and apply a reentrancy guard across all entry points including callbacks.

    Seen in 11 reports
  3. Use a safe transfer helper that checks the return value and reverts on failure.

    Seen in 6 reports
  4. Require a caller-supplied minimum output, maximum input and deadline on every swap, mint, redeem and liquidity operation.

    Seen in 5 reports
  5. Enforce a minimum output or slippage bound on every strategy allocation and redemption.

    Seen in 5 reports
  6. Use a manipulation-resistant price feed with a freshness check and avoid single-block spot prices.

    Seen in 5 reports
  7. Revert on oracle timeout instead of returning a stale or huge price, and update accumulators in every state changing function.

    Seen in 3 reports
  8. Restrict initialise functions to the deployer or use an initializer modifier that prevents nested calls.

    Seen in 2 reports
  9. Use safe transfer and safe approve wrappers that handle tokens returning false or no value.

    Seen in 1 report
  10. Measure the balance before and after a transfer and use the difference rather than the requested amount.

    Seen in 1 report
  11. Add a reentrancy guard to the recover-ERC20 function.

    Seen in 1 report