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.
-
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.
-
The code uses a single constant threshold for the delta check without scaling it to the token's decimals.
Seen in 1 report
-
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
-
The code uses the balance of the uToken instead of the vault token when calculating how much collateral to deposit.
-
The code uses the calculator connector instead of the owner connector when recomputing the holding position id for a swapped position.
-
The code uses the caller address instead of the from parameter when updating withdrawal state.
Seen in 1 report
-
The code uses the caller address instead of the receiver parameter when transferring the fee.
Seen in 1 report
-
The code uses the max-redeem value instead of the balance to determine the redemption amount.
Seen in 1 report
-
The code uses the original transfer amount instead of the actual received balance when approving and swapping.
Seen in 1 report
-
The code uses the post-flash-loan balance instead of the difference between post- and pre-flash-loan balances.
Seen in 1 report
-
The code uses the requested undeploy amount for allocation instead of the actual amount returned by the undeploy call.
Seen in 1 report
-
The code uses the transaction value inside a loop instead of forwarding only each token's fee.
Seen in 1 report
-
Medium
-
-
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
-
The code wrapped the full trade limit for exact-out trades but had no logic to recover the unused excess.
Seen in 1 report
-
The codes have a predictable structure with few unknown characters and there is no rate limiting on entry.
-
The coefficients array was copied into the old array before the difference was computed, so both held the same values.
Seen in 1 report
-
The cohort replacement function lacks a check for ongoing elections.
Seen in 1 report
-
The coinbase field is only defaulted to the sender when empty, so any address can be named as the fee payer.
-
The collateral commit function lacks a check that the loan is still pending.
Seen in 1 report
-
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.
-
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
-
The collateral factor only iterated over the current collateral array, excluding removed assets.
Seen in 1 report
-
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
-
The collateral plugin assumes the cToken exchange rate never decreases, but redemption rounding can lower it.
-
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
-
The collateral ratio is read without first distributing pending rewards, so undistributed rewards count as available collateral.
Seen in 1 report
-
The collateral remainder cap uses the full liquidation ratio instead of the excess over one hundred percent.
Seen in 1 report
-
The collateral split uses integer division with no minimum trade size or rounding guard.
Seen in 1 report
-
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.
-
The collateral valuation function omits the exchange fee that the analogous function in another vault includes.
-
The collateral value function fetches the exchange rate from the debt token's bToken.
Seen in 1 report
-
The collateral value limit check was applied only during borrowing and not during withdrawal of lent tokens.
Seen in 1 report
-
The collateral weight update is capped at the old total locked amount, so payouts above it are not distributed pro rata.
-
The collateralisation check runs before the state-changing operations it should account for.
-
The collect-liquidity function lacks a recipient parameter, forcing tokens to be sent only to the caller.
-
The comment renderer does not handle room join links correctly and errors out the whole view.
Seen in 1 report
-
The commission claim locks the recipient at request time with no way to update or cancel a pending claim.
Seen in 1 report
-
The commission claim validates the token with an active-only check, ignoring the historical-token flag used elsewhere.
Seen in 1 report
-
The commission lookup falls back to the current rate when no checkpoint exists at the requested timestamp.
-
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
-
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
-
The commit function accepts a price for an earlier oracle version that is still valid for the next requested version.
Seen in 1 report
-
The commit function does not require the publish timestamp to be later than the previous commit.
-
The commit function overwrites stored collateral information without checking whether it already exists.
-
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.
-
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
-
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
-
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.
-
The commit-time check only rejects opens once FAD has started and never compares the order's execution deadline with the next FAD start.
-
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.