evm_pack_uint_be

Packs a UINT256 value into an exact-width big-endian BYTES value for ABI-adjacent byte construction.

Example

Runs locally

-- Encode the Uniswap V3 fee tier 3000 as uint24
SELECT hex(evm_pack_uint_be(3000::UINT256, 3)) AS fee_bytes;
-- => [{"fee_bytes":"000BB8"}]

API reference

evm_pack_uint_be(UINT256, INTEGER) #

Returns exactly byte_width big-endian bytes and rejects values that do not fit in the requested width.

Inputs

Name Type Use
value UINT256

UINT256 value to encode.

required positional
byte_width INTEGER

Exact byte width from 1 through 32. Values that do not fit raise an Invalid Input Error.

required positional

Returns

Name Type
bytes BYTES

Fixed-width big-endian bytes. Returns exactly byte_width BYTES with no 0x prefix or ABI padding beyond that width.