Skip to content

In-depth lesson · Business logic

Root causes

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

Back to the lesson 3,251 to 3,300 of 5,700
  1. The function never reset or marked the caller's contribution after migration.

    Seen in 1 report
  2. The function only checked cancelled or finalised state and never recorded that the epoch had been processed.

    Seen in 1 report
  3. The function only checked one direction of the currency pair when verifying whether a feed already existed.

    Seen in 1 report
  4. The function overwrites stored timestamps without checking that new ones are newer and consistent across entries.

    Seen in 1 report
  5. The function passed the current block timestamp to the rate lookup instead of the previous update time.

    Seen in 1 report
  6. The function passes the caller as the permit owner instead of the intended receiver.

    Seen in 1 report
  7. The function passes the contract's own treasury state variable instead of the caller-supplied argument.

    Seen in 1 report
  8. The function read the checkpoint for the delegator token instead of the delegatee token, so it removed the token from its own delegator list rather than the delegatee's.

    Seen in 1 report
  9. The function relies on the difference in token balance before and after claiming, but anyone can trigger the claim so the difference can be zero.

    Seen in 1 report
  10. The function reset the start index to zero when it reached the holder count and pulled the full amount whenever the index was zero.

    Seen in 1 report
  11. The function returns early when the next tier count reaches the maximum, bypassing the threshold check.

    Seen in 1 report
  12. The function returns the uncapped fee while deducting only the capped amount from the user's collateral.

    Seen in 1 report
  13. The function returns the wrong decimals in one branch due to a copy-paste or logic error.

    Seen in 1 report
  14. The function returns zero as soon as the base is zero without checking whether the exponent is also zero.

    Seen in 1 report
  15. The function sends the entire accrued yield without prorating by the amount of yield tokens redeemed.

    Seen in 1 report
  16. The function set the transfer status to cancelled but did not check the previous status, so the same transfer was processed repeatedly in one call.

    Seen in 1 report
  17. The function sets the gauge weight to an absolute value instead of adjusting it relative to existing votes.

    Seen in 1 report
  18. The function subtracts the new approval amount from the internal allowance without accounting for the existing allowance.

    Seen in 1 report
  19. The function sums balances of different share tokens and multiplies by the underlying asset price without converting share amounts to underlying amounts.

    Seen in 1 report
  20. The function swaps the input token order but does not swap the returned amount variables.

    Seen in 1 report
  21. The function that updates the last claimed snapshot ID does not verify that the new snapshot ID is greater than zero, so a zero value overwrites the previous ID.

    Seen in 1 report
  22. The function that updates the rate model does not call the function that recalculates and stores the current interest rate.

    Seen in 1 report
  23. The function trusted a caller-supplied account address instead of msg.sender and let the caller set the slippage limit.

    Seen in 1 report
  24. The function unconditionally appends the current auction ID to an array without checking for duplicates.

    Seen in 1 report
  25. The function updated the cumulative price before performing the slippage check, so a rejected update still permanently modified state.

    Seen in 1 report
  26. The function used the caller address instead of the user field when extracting tokens.

    Seen in 1 report
  27. The function used the global latest timestamp instead of the latest timestamp where both assets have records.

    Seen in 1 report
  28. The function used the wrong account when updating the minted count: it subtracted from the caller's count but read the balance of the account passed as a parameter.

    Seen in 1 report
  29. The function uses the current block timestamp instead of the input timestamp in a conditional check.

    Seen in 1 report
  30. The function uses the loop counter to index the contracts array instead of the user-supplied indices.

    Seen in 1 report
  31. The function verifies post-purchase ownership and balance change but not pre-purchase ownership.

    Seen in 1 report
  32. The function verifyAndAccruePremium returns early when the latest payment timestamp is before the protection start timestamp, without checking whether the protection has actually expired.

    Seen in 1 report
  33. The function was given both an admin modifier and a separate existence modifier even though the admin modifier already checked existence.

    Seen in 1 report
  34. The function was intended to validate the range but the check was omitted, so the value was only used in the revert message.

    Seen in 1 report
  35. The functions did not check the actual amount received before updating the user's accounting.

    Seen in 1 report
  36. The functions only check ETH sufficiency for ETH orders and never reject ETH when the currency is an ERC20.

    Seen in 1 report
  37. The functions rely on oracle prices and total value calculations without allowing users to specify a minimum output or a deadline.

    Seen in 1 report
  38. The fund function has no check preventing funding after the vesting end time.

    Seen in 1 report
  39. The funded amount was added to fee revenue and then passed again to the weight calculation.

    Seen in 1 report
  40. The funded-asset fraction used to reduce the high-water mark can exceed the fraction of Senior shares burned because virtual-offset pricing lets the paid fraction differ from the burned-share fraction.

    Seen in 1 report
  41. The funding fee per-size value was calculated using the total open interest instead of the open interest of positions that can actually pay the fee in the specific collateral token.

    Seen in 1 report
  42. The funding formula uses only the overbalanced value rather than the difference between long and short sides.

    Seen in 1 report
  43. The funding function uses generic token calls that exist on both ERC20 and ERC721 contracts, without checking the token type, while the payout function uses a transfer method that is not available on ERC721.

    Seen in 1 report
  44. The future-epoch check uses only the auction window and omits the maximum possible extension.

    Seen in 1 report
  45. The game ends as soon as one active agent remains without resolving wounded agents or reordering IDs.

    Seen in 1 report
  46. The game identifier is computed from game type, root claim and extra data only, omitting the parent block hash.

    Seen in 1 report
  47. The garbage collection interval was hard-coded as a constant instead of being derived from the sequence number time-to-live.

    Seen in 1 report
  48. The gas check ignores the 1/64 rule and gas spent between the check and the call.

    Seen in 1 report
  49. The gas check runs before storage writes and other work, so the external call receives less gas than the user specified.

    Seen in 1 report
  50. The gas estimation function for withdrawals did not include the gas cost of token swaps that can occur during withdrawal execution.

    Seen in 1 report