evm
Category
Auto-generated documentation for the evm bag.watch functions.
- divmul Computes (x * d) / y using 512-bit intermediate to avoid overflow. Inverse of muldiv. Useful for price calculations.Scalar#types #evm
- evm_addmod EVM ADDMOD opcode: (a + b) % n without overflow. Returns 0 if n == 0 (EVM behavior). Uses 512-bit intermediate.Scalar#types #evm
- evm_byte EVM BYTE opcode: Extract the nth byte from a 256-bit value. Byte 0 is the most significant byte, byte 31 is the least significant. Returns 0 if n >= 32.Scalar#types #evm
- evm_ceil_div Ceiling division: (x + y - 1) / y. Rounds up to ensure no remainder. Common pattern for distributing amounts without leaving dust.Scalar#types #evm
- evm_clamp Constrains x to the range [lo, hi]. Returns lo if x < lo, hi if x > hi, otherwise x. Equivalent to max(lo, min(hi, x)).Scalar#types #evm
- evm_disassemble Disassembles EVM bytecode into core instruction metadata using evmone's advanced analysis. Returns 22 essential columns: pc, label, mnemonic, opcode, push_value (BYTES32), instruction properties, stack analysis, block structure, and gas costs from evmone. For comprehensive analysis including CFG, function detection, memory tracking, and dominance analysis, use evm_disassemble_full().Table#evm
- evm_iszero EVM ISZERO opcode: Returns 1 if x == 0, otherwise returns 0. Useful for conditional logic on EVM values.Scalar#types #evm
- evm_max Returns the maximum of two UINT256 values. Equivalent to DuckDB's greatest() but with explicit EVM naming.Scalar#types #evm
- evm_min Returns the minimum of two UINT256 values. Equivalent to DuckDB's least() but with explicit EVM naming.Scalar#types #evm
- evm_mulmod EVM MULMOD opcode: (a * b) % n without overflow. Returns 0 if n == 0 (EVM behavior). Uses 512-bit intermediate. Essential for cryptographic operations.Scalar#types #evm
- evm_prepare_deployment Creates deployment payloads by combining bytecode with constructor arguments.Scalar#evm
- evm_prepare_tx Builds an unsigned eth_sendTransaction JSON payload with minimal inputs.Scalar#evm
- evm_sar EVM SAR opcode: Arithmetic right shift x by shift bits. Sign-extends (fills with 1s for negative values). For signed INT256.Scalar#types #evm
- evm_shl EVM SHL opcode: Left shift x by shift bits. Equivalent to x << shift. Returns 0 if shift >= 256.Scalar#types #evm
- evm_shr EVM SHR opcode: Logical right shift x by shift bits. Fills with zeros. Equivalent to x >> shift for unsigned values.Scalar#types #evm
- evm_sqrt Integer square root (floor) using Newton-Raphson iteration. Returns floor(sqrt(x)). Essential for AMM liquidity calculations.Scalar#types #evm
- format_ether Human-readable helper for wei balances. Equivalent to format_units(amount, 18).Scalar#types #evm
- format_units Scales raw EVM integer balances by 10^decimals and returns a DECIMAL(38, decimals) value.Scalar#types #evm
- muldiv Computes (x * y) / z using 512-bit intermediate to avoid overflow. Essential for DeFi calculations like token swaps and price computations.Scalar#types #evm