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 function never reset or marked the caller's contribution after migration.
-
The function only checked cancelled or finalised state and never recorded that the epoch had been processed.
-
The function only checked one direction of the currency pair when verifying whether a feed already existed.
Seen in 1 report
-
The function overwrites stored timestamps without checking that new ones are newer and consistent across entries.
Seen in 1 report
-
The function passed the current block timestamp to the rate lookup instead of the previous update time.
-
The function passes the caller as the permit owner instead of the intended receiver.
Seen in 1 report
-
The function passes the contract's own treasury state variable instead of the caller-supplied argument.
Seen in 1 report
-
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
-
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
-
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
-
The function returns early when the next tier count reaches the maximum, bypassing the threshold check.
-
The function returns the uncapped fee while deducting only the capped amount from the user's collateral.
Seen in 1 report
-
The function returns the wrong decimals in one branch due to a copy-paste or logic error.
Seen in 1 report
-
The function returns zero as soon as the base is zero without checking whether the exponent is also zero.
Seen in 1 report
-
The function sends the entire accrued yield without prorating by the amount of yield tokens redeemed.
Seen in 1 report
-
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
-
The function sets the gauge weight to an absolute value instead of adjusting it relative to existing votes.
Seen in 1 report
-
The function subtracts the new approval amount from the internal allowance without accounting for the existing allowance.
Seen in 1 report
-
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
-
The function swaps the input token order but does not swap the returned amount variables.
Seen in 1 report
-
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.
-
The function that updates the rate model does not call the function that recalculates and stores the current interest rate.
Seen in 1 report
-
The function trusted a caller-supplied account address instead of msg.sender and let the caller set the slippage limit.
Seen in 1 report
-
The function unconditionally appends the current auction ID to an array without checking for duplicates.
Seen in 1 report
-
The function updated the cumulative price before performing the slippage check, so a rejected update still permanently modified state.
Seen in 1 report
-
The function used the caller address instead of the user field when extracting tokens.
-
The function used the global latest timestamp instead of the latest timestamp where both assets have records.
Seen in 1 report
-
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
-
The function uses the current block timestamp instead of the input timestamp in a conditional check.
Seen in 1 report
-
The function uses the loop counter to index the contracts array instead of the user-supplied indices.
Seen in 1 report
-
The function verifies post-purchase ownership and balance change but not pre-purchase ownership.
Seen in 1 report
-
The function verifyAndAccruePremium returns early when the latest payment timestamp is before the protection start timestamp, without checking whether the protection has actually expired.
-
The function was given both an admin modifier and a separate existence modifier even though the admin modifier already checked existence.
-
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
-
The functions did not check the actual amount received before updating the user's accounting.
-
The functions only check ETH sufficiency for ETH orders and never reject ETH when the currency is an ERC20.
-
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
-
The fund function has no check preventing funding after the vesting end time.
Seen in 1 report
-
The funded amount was added to fee revenue and then passed again to the weight calculation.
Seen in 1 report
-
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.
-
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
-
The funding formula uses only the overbalanced value rather than the difference between long and short sides.
Seen in 1 report
-
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.
-
The future-epoch check uses only the auction window and omits the maximum possible extension.
Seen in 1 report
-
The game ends as soon as one active agent remains without resolving wounded agents or reordering IDs.
Seen in 1 report
-
The game identifier is computed from game type, root claim and extra data only, omitting the parent block hash.
-
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
-
The gas check ignores the 1/64 rule and gas spent between the check and the call.
-
The gas check runs before storage writes and other work, so the external call receives less gas than the user specified.
-
The gas estimation function for withdrawals did not include the gas cost of token swaps that can occur during withdrawal execution.