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 passed the entire amount slice to the community pool fund instead of the single coin being processed.
Seen in 1 report
-
The code passed the EVM chain id instead of the bridge chain id for the refund chain.
Seen in 1 report
-
The code passed the original source amount instead of the amount after settlement when calculating the destination amount.
Seen in 1 report
-
The code passed the stake token address to the transfer helper instead of the sell token address.
Seen in 1 report
-
The code passed the target denom to the multiplier lookup instead of the source coin's denom.
Seen in 1 report
-
The code passed the valid signer count to the threshold change instead of the computed new threshold.
-
The code passes the full withdrawal amount to the redemption function instead of subtracting the contract's existing balance.
Seen in 1 report
-
The code path for amounts above the available maximum does not enforce the minimum implied rate slippage protection.
Seen in 1 report
-
The code path that swaps the remainder through the yield pool does not call the fee extraction logic.
Seen in 1 report
-
The code performed the irreversible on-chain key rotation before persisting the new signer to disk, without atomic write or recovery.
Seen in 1 report
-
The code picked the price with the wrong maximise flag when computing the impact pool value.
-
The code read the caller's deposit instead of the receiver's deposit when computing the remaining lock duration.
-
The code read total token supply instead of virtual supply, inflating the threshold.
Seen in 1 report
-
The code reads the proposer field after it has already been overwritten with the new proposer.
-
The code reduced the saved total underlying by the requested amount rather than the amount actually received, and deducted the minimum pull even when nothing was withdrawn.
Seen in 1 report
-
The code returned early without reversing the transaction list, so transactions were processed newest-first and older ones were permanently bypassed.
Seen in 1 report
-
The code reused the initial token balance as the previous amount for every event inside the transfer loop instead of updating it after each transfer.
Seen in 1 report
-
The code sets the last position's withdrawal amount to the leftover liquidity instead of subtracting the leftover from the original amount.
Seen in 1 report
-
The code sets the output token amount from the auxiliary action's return without verifying the token and recipient match the expected underlying asset.
-
The code size check can be bypassed by self-destructing the listener in the same transaction, leaving a non-contract that makes the try/catch revert.
Seen in 1 report
-
The code stores the zero address but emits the original non-zero parameter.
-
The code subtracted reserved funds from the vault balance when measuring before and after balances.
Seen in 1 report
-
The code subtracts only the filled locked value from the pending locked balance instead of the total locked value of the original quote.
Seen in 1 report
-
The code subtracts the first bid time from the max duration instead of assigning the max duration directly.
Seen in 1 report
-
The code subtracts the refund currency amount from the user's token amount instead of the difference between the previous and new token amounts.
-
The code takes the absolute value of the exponent and always multiplies by a positive power of ten.
Seen in 1 report
-
The code took the api_key value straight from request parameters without checking it was a single string, so an array was passed into the database lookup and turned into a multi-value match.
Seen in 1 report
-
The code transfers only the treasury portion and omits the creator share used to buy governance tokens.
-
The code transfers the locker incentive but then sends the full reward amount to the caller without subtracting it.
-
The code treated a vault as having no collateral based only on the current auction, without checking for another running auction.
Seen in 1 report
-
The code treats all three reasons for being unable to calculate a risk factor as equivalent and assigns the minimum premium, even when low capital should make protection expensive.
-
The code unconditionally calls _setYIntercept after the if-else block even when the else branch sets withdrawReserve to zero.
Seen in 1 report
-
The code unconditionally calls deposit and redeem for all holdings even when the amount is zero.
Seen in 1 report
-
The code unconditionally copied the last nominee into the removed slot even when the removed nominee was itself the last element.
Seen in 1 report
-
The code unconditionally set the queue index to the new queue length after updating an existing rollover.
-
The code updated the tier for the old boundary rank instead of the new boundary rank when the staker count increased without changing the tier 2 count.
Seen in 1 report
-
The code used a default of 0 when no used sequence number was found and could not tell 'nothing used yet' from '0 already used'.
Seen in 1 report
-
The code used a fixed precision constant of 1e18 for collateral amounts without adjusting for the token's actual decimals.
Seen in 1 report
-
The code used a single time segment with the rate at the last update instead of iterating over checkpoints.
-
The code used a strict equality check for the pool creation fee and an 'any' check for token factory fees, mishandling shared denominations.
Seen in 1 report
-
The code used an impossible sentinel value for an unsigned integer index, so zero was ambiguous with not found.
Seen in 1 report
-
The code used block numbers instead of timestamps when calling the gauge controller's relative weight function.
Seen in 1 report
-
The code used block.number (which on Arbitrum is the L1 block number) instead of the L2 block number from Chain.currentBlockNumber() when setting the latest ADL block.
Seen in 1 report
-
The code used loose equality and did not reject a missing or null stored token, so null matched null.
Seen in 1 report
-
The code used the first return value of the deposit-and-fix call instead of the second, which is the principal token count.
Seen in 1 report
-
The code used the new total of tier 1 and tier 2 stakers to find the boundary rank, but when a tier 3 staker exited the current tier 1 and tier 2 counts had not changed, so the boundary rank was wrong.
Seen in 1 report
-
The code used the receiving asset identifier instead of the sending asset identifier when paying the relayer.
Seen in 1 report
-
The code used the wrong variable as the transfer amount instead of the correctly calculated cNote amount.
Seen in 1 report
-
The code used the wrong variable when transferring tokens, so the full-repayment sentinel was not replaced with the actual amount owed.
Seen in 1 report
-
Medium
-
-
The code used transfer instead of transferFrom to collect the swap fee.
Seen in 1 report