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 2,401 to 2,450 of 5,700
  1. The code uses a sender field to identify the token provider, but only the owner field is set, leaving the sender as the zero address.

    Seen in 1 report
  2. The code uses a single constant threshold for the delta check without scaling it to the token's decimals.

    Seen in 1 report
  3. The code uses an interest update call that does not guarantee an update, leading to an incorrect share calculation that becomes insufficient after repayment accrues interest.

    Seen in 1 report
  4. The code uses the balance of the uToken instead of the vault token when calculating how much collateral to deposit.

    Seen in 1 report
  5. The code uses the calculator connector instead of the owner connector when recomputing the holding position id for a swapped position.

    Seen in 1 report
  6. The code uses the caller address instead of the from parameter when updating withdrawal state.

    Seen in 1 report
  7. The code uses the caller address instead of the receiver parameter when transferring the fee.

    Seen in 1 report
  8. The code uses the max-redeem value instead of the balance to determine the redemption amount.

    Seen in 1 report
  9. The code uses the original transfer amount instead of the actual received balance when approving and swapping.

    Seen in 1 report
  10. The code uses the post-flash-loan balance instead of the difference between post- and pre-flash-loan balances.

    Seen in 1 report
  11. The code uses the requested undeploy amount for allocation instead of the actual amount returned by the undeploy call.

    Seen in 1 report
  12. The code uses the transaction value inside a loop instead of forwarding only each token's fee.

    Seen in 1 report
  13. The code uses the underlying token instead of the vault token when burning collateral, which does not match the token deposited.

    Seen in 1 report
  14. The code wrapped the full trade limit for exact-out trades but had no logic to recover the unused excess.

    Seen in 1 report
  15. The codes have a predictable structure with few unknown characters and there is no rate limiting on entry.

    Seen in 1 report
  16. The coefficients array was copied into the old array before the difference was computed, so both held the same values.

    Seen in 1 report
  17. The cohort replacement function lacks a check for ongoing elections.

    Seen in 1 report
  18. The coinbase field is only defaulted to the sender when empty, so any address can be named as the fee payer.

    Seen in 1 report
  19. The collateral commit function lacks a check that the loan is still pending.

    Seen in 1 report
  20. The collateral decay calculation uses a per-user checkpoint updated only on sync, so the amount removed depends on sync timing rather than elapsed time.

    Seen in 1 report
  21. The collateral discount is applied before subtracting the used amount, so available margin is not reduced correctly after opening a position.

    Seen in 1 report
  22. The collateral factor only iterated over the current collateral array, excluding removed assets.

    Seen in 1 report
  23. The collateral opt-in function does not check for a nonzero balance and does not enforce the maximum number of reserves.

    Seen in 1 report
  24. The collateral plugin assumes the cToken exchange rate never decreases, but redemption rounding can lower it.

    Seen in 1 report
  25. The collateral pool's enter function did not check that the agent was not in the DESTROYING state, allowing new tokens to be issued during shutdown.

    Seen in 1 report
  26. The collateral ratio is read without first distributing pending rewards, so undistributed rewards count as available collateral.

    Seen in 1 report
  27. The collateral remainder cap uses the full liquidation ratio instead of the excess over one hundred percent.

    Seen in 1 report
  28. The collateral split uses integer division with no minimum trade size or rounding guard.

    Seen in 1 report
  29. The collateral top-up uses the short order's original collateral ratio and price instead of the asset's initial ratio and current oracle price.

    Seen in 1 report
  30. The collateral valuation function omits the exchange fee that the analogous function in another vault includes.

    Seen in 1 report
  31. The collateral value function fetches the exchange rate from the debt token's bToken.

    Seen in 1 report
  32. The collateral value limit check was applied only during borrowing and not during withdrawal of lent tokens.

    Seen in 1 report
  33. The collateral weight update is capped at the old total locked amount, so payouts above it are not distributed pro rata.

    Seen in 1 report
  34. The collateralisation check runs before the state-changing operations it should account for.

    Seen in 1 report
  35. The collect-liquidity function lacks a recipient parameter, forcing tokens to be sent only to the caller.

    Seen in 1 report
  36. The comment renderer does not handle room join links correctly and errors out the whole view.

    Seen in 1 report
  37. The commission claim locks the recipient at request time with no way to update or cancel a pending claim.

    Seen in 1 report
  38. The commission claim validates the token with an active-only check, ignoring the historical-token flag used elsewhere.

    Seen in 1 report
  39. The commission lookup falls back to the current rate when no checkpoint exists at the requested timestamp.

    Seen in 1 report
  40. The commission was implemented as a share burn reducing total supply without reducing assets, so the uplift went to current holders.

    Seen in 1 report
  41. The commission was the minimum of a premium fee and a notional fee that is zero in one call path, and the calculation was skipped when realised premium was zero.

    Seen in 1 report
  42. The commit function accepts a price for an earlier oracle version that is still valid for the next requested version.

    Seen in 1 report
  43. The commit function overwrites stored collateral information without checking whether it already exists.

    Seen in 1 report
  44. The commit only reserves the order's margin and bounty, not the free settlement a skew-reducing open relies on to fund its rebate reserve.

    Seen in 1 report
  45. The commit path used the on-chain sequence number rather than the transaction's own sequence number, so the next expected value was tracked wrongly.

    Seen in 1 report
  46. The commit validation compares the seal count to F instead of 2F+1, so a block can finalise with only F+1 seals.

    Seen in 1 report
  47. The commit-time admission check evaluates minimum notional and initial margin at the unshifted mark, while execution applies the oracle's adverse confidence shift before re-running the same floors.

    Seen in 1 report
  48. The commit-time check only rejects opens once FAD has started and never compares the order's execution deadline with the next FAD start.

    Seen in 1 report
  49. The commit-time reservation does not lock the free settlement cash that a pending skew-reducing open's rebate reserve depends on, so a withdrawal can defund the queued order.

    Seen in 1 report