The decompilation preserves some ERC-20 storage operations, approval, transfer, initialization, lock checks, and fragments of reserve handling, but most Uniswap V2 pair functionality is substantially missing or incorrect.
transferFrom omits the allowance check, decrement, and infinite-allowance exception; it transfers tokens without authorization.
permit does not accurately reconstruct the EIP-712 digest or ecrecover logic and contains unresolved variables and invalid memory operations, so signature validation behavior is not preserved.
The lock modifier is not correctly completed: functions set the lock storage value to zero but do not restore it to one on successful completion, potentially permanently locking the contract.
mint does not perform the original liquidity calculations, initial minimum-liquidity mint, liquidity minting, total supply and balance updates, reserve updates, kLast updates, Mint event emission, or return the liquidity value.
swap is fundamentally incorrect: it requires amount0Out to be nonzero instead of allowing either output, checks only amount1Out against reserves, omits the token0 invalid-recipient check, does not correctly perform both conditional token transfers, and does not correctly calculate inputs or enforce the invariant.
The swap implementation contains an unconditional failing condition equivalent to require(0 > 0), so valid swaps cannot complete.
The swap implementation does not correctly preserve the callback calldata behavior, balance reads, fee-adjusted invariant calculation, reserve update, or Swap event.
skim only partially represents the token0 transfer and omits the token1 transfer and correct safe-transfer calldata and return validation.
sync does not reliably update both reserves and the timestamp on every call, and its control flow does not match the original _update logic, including cumulative price updates and unconditional Sync emission.
Reserve packing and extraction are represented inconsistently; getReserves returns abi.encodePacked data rather than the original ABI tuple of three independently encoded return values.
The cumulative price update logic from _update is absent or not correctly represented, including UQ112x112 division, elapsed-time handling, and updates to price0CumulativeLast and price1CumulativeLast.
Mint, Burn, and Swap events are missing entirely from the decompiled contract.
Several external token and factory calls are unresolved or represented with incorrect selectors and return handling, so safeTransfer behavior and ERC-20 balance/callback interactions are not reliably preserved.
The decompiled pair functions are declared payable and do not clearly preserve the original external visibility and return signatures, particularly for mint, burn, and getReserves.
Candidate
Score: 12/100
The decompilation preserves only parts of the ERC20 surface logic and some storage mappings. The core Uniswap V2 pair functionality is substantially lost or incorrectly reconstructed, including liquidity minting/burning, swaps, reserve updates, fee accounting, safe transfers, and lock handling.
transferFrom omits the allowance check, decrement, and infinite-allowance exception; it transfers tokens regardless of the caller's allowance.
permit does not accurately reconstruct DOMAIN_SEPARATOR initialization, EIP-712 hashing, ecrecover, or signature validation. The decompiled memory and signature logic is malformed, and DOMAIN_SEPARATOR is absent.
The constructor and its factory assignment and DOMAIN_SEPARATOR initialization are missing.
The lock modifier is not correctly finalized: functions set the lock storage value to zero but generally do not restore it to one after execution, causing subsequent calls to remain locked.
mint does not calculate or mint liquidity, does not handle MINIMUM_LIQUIDITY, does not update reserves, does not update kLast correctly, does not emit Mint, and does not return liquidity.
burn does not calculate withdrawal amounts, burn LP tokens, perform token transfers, update reserves, update kLast, emit Burn, or return the amounts.
swap is fundamentally incorrect: it requires amount0Out to be nonzero instead of accepting either output, checks only one reserve condition, omits the amount1Out liquidity check, does not correctly reject both token addresses as recipients, and does not implement the input calculation, fee-adjusted invariant check, reserve update, or Swap event.
The swap external token transfers and callback are not reconstructed with the correct transfer(address,uint256) calldata or uniswapV2Call(sender, amount0Out, amount1Out, data) handling.
skim only partially reconstructs a token0 operation and omits the token1 balance calculation and transfer. Its external call target and calldata are unresolved and its success/return-data handling is incorrect.
sync does not correctly implement _update: reserve packing and extraction are malformed, cumulative price updates are missing, timestamp handling is incorrect, and the reserve state/event behavior does not match the original.
getReserves returns packed bytes via abi.encodePacked rather than the ABI-encoded tuple of uint112, uint112, and uint32 expected by callers.
The internal _update logic is absent from mint, burn, swap, and sync, so reserve values, blockTimestampLast, price0CumulativeLast, price1CumulativeLast, and Sync events are not correctly maintained.
The _mintFee logic is substantially corrupted: fee-on detection, square-root calculations, numerator/denominator computation, fee liquidity minting, and kLast clearing do not match the original and contain impossible or inverted conditions.
Mint, Burn, and Swap event declarations/emissions are missing or not emitted, leaving only ERC20 and Sync events represented.
The safe-transfer return-data validation is not faithfully preserved; unresolved calls and inverted success branches can accept or reject token transfers incorrectly.
The decompiled swap function contains impossible unconditional failure conditions such as require(0 > 0), making valid swaps revert.
Diff
Decompiled output is identical between baseline and candidate.