evm_pack_uint_be
Packs a UINT256 value into an exact-width big-endian BYTES value for ABI-adjacent byte construction.
Example
Local
{"id":"sample_98ku21","title":"Sample","code":"-- Encode the Uniswap V3 fee tier 3000 as uint24\nSELECT hex(evm_pack_uint_be(3000::UINT256, 3)) AS fee_bytes;\n-- => [{\"fee_bytes\":\"000BB8\"}]"}
Notebook ready in readonly mode.
API reference
Exact signatures with descriptions, requirements, inputs, returns, and examples.
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.
Category and tags
- Category
- EVM utilities
- Tag
- Bytes
- Tag
- EVM
- Tag
- Encoding
- Tag
- Deterministic
- Tag
- Types