Skip to content

In-depth lesson · Business logic

Typical fixes

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 1 to 50 of 427
  1. Apply ENSIP-15 normalisation once and use the same canonical name for display, reads, pricing and calldata.

    Seen in 23 reports
  2. Take the balance snapshot before the vault withdrawal and compare it with the post-withdrawal balance.

    Seen in 22 reports
  3. Decrement the deposited-shares ledger on every path that transfers shares out, including forced repay and liquidation.

    Seen in 17 reports
  4. Cap the returned fee to the amount actually deducted from the account's collateral.

    Seen in 12 reports
  5. Do not set the terminal claimed marker on periods that are still open, and clear it when zeroing the slot.

    Seen in 12 reports
  6. Pin the period-start exposure at commitment time instead of reading a mutable timestamp-keyed checkpoint.

    Seen in 12 reports
  7. Reserve refundable VPI as a liability and include the VPI rebate reserve in the NAV used to price Junior deposits and redemptions.

    Seen in 11 reports
  8. Carry refundable charges as a liability in NAV until the position closes.

    Seen in 10 reports
  9. Decrement the global deposited-shares and earmarked counters in the forced-repayment and liquidation paths exactly as the normal repay and burn paths do.

    Seen in 10 reports
  10. Cap the pending recapitalisation against genuinely new unassigned backing and persist the original intent across reconciles.

    Seen in 9 reports
  11. Let the owner amend a protection regardless of whether a permissionless retry has moved it to Triggered, or restrict retry to the owner.

    Seen in 9 reports
  12. Clear the per-period claimed flag on unblock, or use a separate flag for relocated withdrawals, and have the withdrawal request reject a period already marked claimed.

    Seen in 8 reports
  13. Measure the actual balance change after a transfer instead of assuming the transferred amount is received.

    Seen in 8 reports
  14. Pay the liquidator fee based on the amount actually deducted from the borrower, not on the post-seizure remaining balance.

    Seen in 8 reports
  15. Require the named controller to consent before a redemption request is enqueued into their private queue, and do not let a request from another owner become the controller's head.

    Seen in 8 reports
  16. Restrict the retry to the position owner or require consent, and let the owner amend limits regardless of pending retry orders.

    Seen in 8 reports
  17. Send rewards to a recipient that can actually manage them, or add a recovery function to the vault and strategy.

    Seen in 8 reports
  18. Track tokens locked in vesting separately and exclude them from the distributable reward surplus calculation.

    Seen in 8 reports
  19. Carry a signed liability term for refundable positive VPI in the NAV used for LP entry and exit.

    Seen in 7 reports
  20. Check the incoming code against all applied promotions and cap the cumulative discount at the subtotal.

    Seen in 7 reports
  21. Compare each stored feed against its own accepted timestamp, or against the oldest component time, when reusing a cached basket.

    Seen in 7 reports
  22. Pass the original user as the refund receiver through the zapper call chain and add a recovery path for any leftovers.

    Seen in 7 reports
  23. Store the period-open snapshot at a dedicated key that ordinary flows cannot overwrite, or use an exclusive lookup that excludes the boundary second.

    Seen in 7 reports
  24. Authorise the retry entry point through the owner-checked protection lookup rather than the unchecked one, so only the owner can consume the Latched state.

    Seen in 6 reports
  25. Decrement the deposited-shares counter on every path where tokens leave the contract.

    Seen in 6 reports
  26. Implement the reward-claiming hook in each strategy and add a sweep or swap path for external reward tokens.

    Seen in 6 reports
  27. Preserve the larger surviving high-water mark and release the pending residual when its cash is paid out.

    Seen in 6 reports
  28. Reserve or vest positive VPI until the paying position closes, and book the contingent rebate as a liability in LP share pricing.

    Seen in 6 reports
  29. Restrict retry to the owner or add a retry limit or cooldown, and require amended close limits before re-enqueueing.

    Seen in 6 reports
  30. Restrict the retry function or give the owner a guaranteed window to amend limits.

    Seen in 6 reports
  31. Store the recapitalization target separately and keep the larger of the stored and new high-water marks.

    Seen in 6 reports
  32. Subtract the refundable VPI amount from LP net asset value until the position closes, so exits are not priced on money the pool may have to pay back.

    Seen in 6 reports
  33. Treat the ownerless reserve as a fixed reservation clamped only by mark-independent cash, and record any written-down amount for reversal.

    Seen in 6 reports
  34. Validate on the server that quantity is a positive whole number before using it in price calculations, and recalculate totals from stored prices before payment.

    Seen in 6 reports
  35. Apply the frozen-close spread to liquidations during the freeze, or prevent self-triggered liquidation from being a cheaper exit than a voluntary close.

    Seen in 5 reports
  36. Check stored feed coverage against the oldest component publish time.

    Seen in 5 reports
  37. Credit the treasury the assessed execution fee on rebate closes instead of netting it into the rebate.

    Seen in 5 reports
  38. Hold a liability reserve for the potential close-side rebate and exclude it from redemption NAV.

    Seen in 5 reports
  39. Include the signed lifetime impact term and secured rebate reserves in the LP net asset value snapshot.

    Seen in 5 reports
  40. Preserve the original recapitalisation target and high-water mark across partial settlements instead of using the residual bucket as the bootstrap target.

    Seen in 5 reports
  41. Re-evaluate solvency automatically when positions close or unwind, or net offsetting hedged exposure, instead of relying on an owner-only clear.

    Seen in 5 reports
  42. Reserve refundable price impact as a liability in LP NAV and withdrawal calculations.

    Seen in 5 reports
  43. Authorise the named controller on request creation and apply the minimum size check even to full-balance requests.

    Seen in 4 reports
  44. Bind the migration plan to a canonical snapshot and re-check freshness before wallet submission.

    Seen in 4 reports
  45. Clear the locker address, loan status and dirty flag whenever a position is liquidated, redeemed or moved.

    Seen in 4 reports
  46. Compute the maximum views from the remaining asset capacity and apply the same rounding and zero-share checks the deposit and mint paths use.

    Seen in 4 reports
  47. Freeze the margin used for post-trade bounds at commitment time rather than reading live margin at execution.

    Seen in 4 reports
  48. Give the owner a priority window or cooldown before permissionless retries can consume the latched state.

    Seen in 4 reports
  49. Include the guaranteed rebate reserve in the NAV used to price deposits.

    Seen in 4 reports
  50. Keep the larger of the existing Senior high-water mark and the recapitalisation target, and exclude seed-owned principal from covenant exposure.

    Seen in 4 reports