Dune SQL represents varbinarys using the varbinary type.To make it simpler to work with varbinarys we have the following helper functions, which work with these two kinds of representation. They simplify interactions with varbinarys, as they automatically account for the 0x-prefix and use byte index instead of character index. For instance, the varbinary_substring methods take indexes by byte, not by character (twice the varbinary length).You can use these function to extract data from undecoded events logs, or calldata. For instance, if you have a function that takes a uint256 as an argument, you can use varbinary_to_uint256 to extract the value from the calldata. You’ll oftentimes need to use varbinary_substring to extract the correct part of the calldata or use other bytearray manipulation functions to get the correct value.
select tx_hash, data, varbinary_substring(data,97,32) as fee, varbinary_to_uint256(varbinary_substring(data,97,32)) as fee_uint256from optimism.logswhere contract_address = 0xa1ace9ce6862e865937939005b1a6c5ac938a11fand topic0 = 0xc9d5ada2ea384fe04826ecd1b258955ac73c3e2e20d755108eafde90bc5588d4-- sample transaction hashand tx_hash IN (0x3e3c558e7f723e3bb7de1d8f5f920ca206e3e878984296a2b8e6af2969003a19, 0xccfd2033adfb1fdd14fdfc047fe554ba7549e396abc6c559e9528a4259295b89)
The varbinary conversion functions throw an overflow exception if the varbinary is larger than the number of bytes supported of the type, even if the most significant bytes are all zero. It is possible to use varbinary_ltrim in order to trim the zero bytes from the left.Here is a dashboard with examples covering all of the below functions. For a more comprehensive look at all special DuneSQL functions, use this dashboard from cryptuschrist.
varbinary_to_integer(varbinary) → integerReturns the INTEGER value of a big-endian varbinary of length <= 4 representing the integer in two’s complement. If the varbinary has length < 4 it is padded with zero bytes.
-- convert bytearray to integer [result will be either 1 or 0]-- if 1 = true, 0 = falseSELECT tx_hash, varbinary_to_integer(varbinary_ltrim(varbinary_substring(data,1,32))) as isQuote_number, CASE WHEN varbinary_to_integer(varbinary_ltrim(varbinary_substring(data,1,32))) = 1 THEN TRUE ELSE FALSE END AS isQuoteFROM arbitrum.logsWHERE contract_address = 0xdaf4ffb05bfcb2c328c19135e3e74e1182c88283AND topic0 = 0xf1bc206c8d659bf05edd19865dbae82643062168ec3970d9d7c5468f900487d9LIMIT 10
varbinary_to_bigint(varbinary) → bigintReturns the BIGINT value of a big-endian varbinary of length <= 8 representing the bigint in two’s complement. If the varbinary has length < 8 it is padded with zero bytes.
-- convert bytearray to integer [result will be either 1 or 0]-- if 1 = true, 0 = falseSELECT tx_hash, varbinary_to_bigint(varbinary_ltrim(varbinary_substring(data,1,32))) as isQuote_number, CASE WHEN varbinary_to_bigint(varbinary_ltrim(varbinary_substring(data,1,32))) = 1 THEN TRUE ELSE FALSE END AS isQuoteFROM arbitrum.logsWHERE contract_address = 0xdaf4ffb05bfcb2c328c19135e3e74e1182c88283AND topic0 = 0xf1bc206c8d659bf05edd19865dbae82643062168ec3970d9d7c5468f900487d9LIMIT 10
varbinary_to_decimal(varbinary) → decimal(38,0)Returns the DECIMAL(38,0) value of a big-endian varbinary of length <= 16 representing the decimal(38,0) in two’s complement. If the varbinary has length < 16 it is padded with zero bytes.
-- using raw table to get usdc transfers amount-- transfer topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef-- usdc contract_address = 0xaf88d065e77c8cc2239327c5edb3a432268e5831SELECT tx_hash, data, varbinary_to_decimal(varbinary_ltrim(data)) as data_decimalFROM arbitrum.logsWHERE topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efAND contract_address = 0xaf88d065e77c8cc2239327c5edb3a432268e5831AND block_time >= NOW() - interval '1' dayLIMIT 50
varbinary_to_uint256(varbinary) → uint256Returns the UINT256 of a big-endian varbinary of length <= 32 representing the unsigned integer. If the varbinary has length < 32 it is padded with zero bytes.
select tx_hash, data, varbinary_substring(data,97,32) as fee, varbinary_to_uint256(varbinary_substring(data,97,32)) as fee_uint256from optimism.logswhere contract_address = 0xa1ace9ce6862e865937939005b1a6c5ac938a11fand topic0 = 0xc9d5ada2ea384fe04826ecd1b258955ac73c3e2e20d755108eafde90bc5588d4-- sample transaction hashand tx_hash IN (0x3e3c558e7f723e3bb7de1d8f5f920ca206e3e878984296a2b8e6af2969003a19, 0xccfd2033adfb1fdd14fdfc047fe554ba7549e396abc6c559e9528a4259295b89)
varbinary_to_int256(varbinary) → int256Returns the INT256 of a big-endian varbinary of length <= 32 representing the signed integer. If the varbinary has length < 32 it is padded with zero bytes.
select tx_hash, data, varbinary_substring(data,65,32) as sizeDelta, varbinary_to_int256(varbinary_substring(data,65,32)) as sizeDelta_int256from optimism.logswhere contract_address = 0xa1ace9ce6862e865937939005b1a6c5ac938a11fand topic0 = 0xc9d5ada2ea384fe04826ecd1b258955ac73c3e2e20d755108eafde90bc5588d4-- sample transaction hashand tx_hash IN (0x3e3c558e7f723e3bb7de1d8f5f920ca206e3e878984296a2b8e6af2969003a19, 0xccfd2033adfb1fdd14fdfc047fe554ba7549e396abc6c559e9528a4259295b89)
You cannot use cast(x as varbinary) in these cases as it will actually encode the string as varbinary which is different from converting the expression to varbinary.
varbinary_concat(varchar, varchar) → varcharConcatenates two varbinarys or strings.
-- concatenate varchar-- using typeof to check the datatypeSELECT varbinary_concat('0xabcd', '0x00ab') as varbinary_varchar_concat, typeof(varbinary_concat('0xabcd', '0x00ab')) as varbinary_varchar_type
varbinary_length(varbinary) → bigintReturns the length of a varbinary.
-- this will return 20SELECT varbinary_length(0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)
varbinary_length(varchar) → bigintReturns the length of a string.
-- this will return 20SELECT typeof('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2') as data_type, varbinary_length('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2') varchar_length
varbinary_ltrim(varbinary) → varbinaryRemoves zero bytes or spaces from the beginning of a varbinary
-- this will remove the zeros at the front, -- returning 0xa2b80f9c09558945800ddf4f8786dcc8b1c44974SELECT varbinary_ltrim(0x000000000000000000000000a2b80f9c09558945800ddf4f8786dcc8b1c44974)
varbinary_ltrim(varchar) → varcharRemoves spaces from the beginning of a string.
-- this will remove the zeros at the front, -- returning 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2SELECT typeof('0x0000000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2') as data_type, varbinary_ltrim('0x0000000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2') varchar_ltrim
varbinary_rtrim(varbinary) or varbinary_rtrim(varchar) → varbinary or varcharRemoves zero bytes or spaces from the end of a varbinary or string.
-- this will remove the zeros at the end, -- returning 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2SELECT varbinary_ltrim(0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000)
varbinary_position(varbinary, varbinary) → bigintReturns the index of the first occurrence of a given bytearray or string (or 0 if not found) within a varbinary or string.
-- get $ARKM claimers SELECT * FROM ethereum.transactionsWHERE block_time >= TIMESTAMP '2023-07-17' -- claim start dateAND varbinary_position(data,0x3d13f874) = 1 -- 0x3d13f874 is the methodIDAND successLIMIT 100
varbinary_position(varchar, varchar) → bigintReturns the index of the first occurrence of a given bytearray or string (or 0 if not found) within a varbinary or string.
-- search for '0x6cc2' and return its positionSELECT varbinary_position('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2','0x6cc2')
varbinary_substring(varbinary, integer) → varbinaryReturns a suffix varbinary or string starting at a given index.
-- using varbinary_substring starting from the 21th index-- this returns 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 SELECT 0x0000000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 as original_bytearray, varbinary_substring(0x0000000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,21) as bytearraysubstring_data
Returns a subvarbinary of a given length starting at an index.
-- getting the sizeDelta using varbinary_substring-- and converting to uint256 using varbinary_to_uint256SELECT tx_hash, varbinary_substring(data,65,32) as sizeDelta, varbinary_to_uint256(varbinary_substring(data,65,32)) as sizeDelta_uint256FROM optimism.logsWHERE contract_address = 0xa1ace9ce6862e865937939005b1a6c5ac938a11fAND topic0 = 0xc9d5ada2ea384fe04826ecd1b258955ac73c3e2e20d755108eafde90bc5588d4-- some sample transaction hashAND tx_hash IN (0x3e3c558e7f723e3bb7de1d8f5f920ca206e3e878984296a2b8e6af2969003a19, 0xccfd2033adfb1fdd14fdfc047fe554ba7549e396abc6c559e9528a4259295b89)
varbinary_substring(varbinary, integer, integer) → varbinaryReturns a subvarbinary of a given length starting at an index. Be aware that the length is in bytes, not characters.
-- returns 0xabcdefSELECT 0xabcdefabcdef as varbinary_data, varbinary_substring(0xabcdefabcdef,1,3) as varbinary_substring
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Dune Docs","description":"Official documentation for building with Dune's data platform, query engine, and API.","colors":{"primary":"#0f0f15","light":"#ffffff","dark":"#0f0f15"},"logo":{"light":"https://mintcdn.com/dune/zh-3B8LgVmyrKOaG/logo/dune-logo-light.svg?fit=max\u0026auto=format\u0026n=zh-3B8LgVmyrKOaG\u0026q=85\u0026s=6fec71d5070d0923eb2924321131b1c2","dark":"https://mintcdn.com/dune/zh-3B8LgVmyrKOaG/logo/dune-logo-dark.svg?fit=max\u0026auto=format\u0026n=zh-3B8LgVmyrKOaG\u0026q=85\u0026s=2501750983cc95aa72d40acc6f005bd9","href":"https://docs.dune.com/"},"navbar":{"links":[{"href":"mailto:support@dune.com","label":"Support"}],"primary":{"type":"button","label":"Start building","href":"https://dune.com"}},"footer":{"socials":{"linkedin":"https://www.linkedin.com/company/dune-analytics","github":"https://github.com/duneanalytics","x":"https://x.com/dune","telegram":"https://t.me/dune_updates","youtube":"https://www.youtube.com/@dunecom"}},"seo":{"metatags":{"title":"Dune Docs","description":"Official documentation for building with Dune's data platform, query engine, and API.","og:site_name":"Dune Docs","twitter:card":"summary_large_image"},"indexing":"navigable"},"fonts":{"family":"Geist"},"integrations":{"amplitude":{"apiKey":"e76ce253e6eaa36e3be8e6872101e33a"},"ga4":{"measurementId":"G-H1G057R0KN"},"gtm":{"tagId":"GTM-P46XP3Z5"}},"contextual":{"options":["chatgpt","claude","copy","view"],"display":"header"},"styling":{"latex":true},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"dune","hasAudioNarration":false,"actualSubdomain":"dune","customDomains":["docs.dune.com"],"gitSource":{"type":"github","owner":"duneanalytics","repo":"dune-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae93935443b04efe6fe7cd6","collectionId":"094bd9fa-3d53-4ad1-8b9d-427df4639dc6","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae93935443b04efe6fe7cd6"},"feedback":{"thumbs":true,"issues":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ae93935443b04efe6fe7cd6","clientVersion":"0.0.4045","searchFilterCounts":[{"language":"default","tag":"Data Catalog","count":1405},{"language":"default","tag":"EVM Networks","count":895},{"language":"default","tag":"Decoded","count":373},{"language":"default","tag":"Raw","count":326},{"language":"default","tag":"Non-EVM Networks","count":270},{"language":"default","tag":"Curated Data","count":156},{"language":"default","tag":"Curated","count":129},{"language":"default","tag":"DEX","count":89},{"language":"default","tag":"THORChain","count":72},{"language":"default","tag":"API Reference","count":67}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":true},"customCss":[{"filePath":"styles.css","content":"#navigation-items .sidebar-group>li>a,#search-bar-entry,#sidebar-group>li>a,#topbar-cta-button>a>span,.chat-assistant-floating-input>div{border-radius:9999px}.dark #topbar-cta-button>a>span{background-color:#fff}.dark #topbar-cta-button>a>span+div>span,.dark #topbar-cta-button>a>span+div>svg{color:#0f0f15}#page-context-menu>button:first-child{border-top-left-radius:9999px;border-bottom-left-radius:9999px}#page-context-menu>button:last-child{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.cta-links a,.cta-links a:active,.cta-links a:hover,.cta-links a:visited,.note-container a,[class*=Note] a,[class*=callout] a,[class*=note] a,aside a,div[class*=admonition] a,div[role=note] a{text-decoration-color:#fff!important;text-decoration-thickness:2px!important;text-decoration-line:underline!important}table a{text-decoration:underline!important;text-underline-offset:2px;transition:opacity .2s ease}table a:hover{opacity:.7}"}],"page":{"pagePath":"query-engine/Functions-and-operators/varbinary","slug":"/query-engine/Functions-and-operators/varbinary","pageMetadata":{"title":"Varbinary functions (DuneSQL)","icon":"code","description":null,"href":"/query-engine/Functions-and-operators/varbinary"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Heading,{level:`2`,id:`varbinary-functions`,children:`Varbinary Functions`}),`\n`,_jsx(_components.p,{children:`Dune SQL represents varbinarys using the varbinary type.`}),`\n`,_jsxs(_components.p,{children:[`To make it simpler to work with varbinarys we have the following helper functions, which work with these two kinds of representation. They simplify interactions with varbinarys, as they automatically account for the `,_jsx(_components.code,{children:`0x`}),`-prefix and use byte index instead of character index. For instance, the varbinary_substring methods take indexes by byte, not by character (twice the varbinary length).`]}),`\n`,_jsxs(_components.p,{children:[`You can use these function to extract data from undecoded events logs, or calldata. For instance, if you have a function that takes a `,_jsx(_components.code,{children:`uint256`}),` as an argument, you can use `,_jsx(_components.code,{children:`varbinary_to_uint256`}),` to extract the value from the calldata. You’ll oftentimes need to use `,_jsx(_components.code,{children:`varbinary_substring`}),` to extract the correct part of the calldata or use other bytearray manipulation functions to get the correct value.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`select`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tx_hash,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_substring(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`97`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` fee,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_to_uint256(varbinary_substring(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`97`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` fee_uint256`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`from`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` optimism`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`logs`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`where`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` contract_address `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xa1ace9ce6862e865937939005b1a6c5ac938a11f`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`and`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` topic0 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xc9d5ada2ea384fe04826ecd1b258955ac73c3e2e20d755108eafde90bc5588d4`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- sample transaction hash`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`and`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tx_hash `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`IN`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (0x3e3c558e7f723e3bb7de1d8f5f920ca206e3e878984296a2b8e6af2969003a19,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xccfd2033adfb1fdd14fdfc047fe554ba7549e396abc6c559e9528a4259295b89)`})}),`\n`]})})}),`\n`,`\n`,_jsx(Heading,{level:`2`,id:`varbinary-to-numeric-functions`,children:`Varbinary to Numeric Functions`}),`\n`,_jsxs(_components.p,{children:[`The varbinary conversion functions throw an overflow exception if the varbinary is larger than the number of bytes supported of the type, even if the most significant bytes are all zero. It is possible to use `,_jsx(_components.code,{children:`varbinary_ltrim`}),` in order to trim the zero bytes from the left.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.a,{href:`https://dune.com/dune/dune-sql-byte-array-functions-uint256-int256-support`,children:`Here is a dashboard`}),` with examples covering all of the below functions. For a more comprehensive look at all special DuneSQL functions, use this `,_jsx(_components.a,{href:`https://dune.com/cryptuschrist/dunesql-functions`,children:`dashboard`}),` from `,_jsx(_components.a,{href:`https://dune.com/cryptuschrist`,children:`cryptuschrist`}),`.`]}),`\n`,_jsx(Heading,{level:`4`,id:`varbinary_to_integer`,children:`varbinary_to_integer()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_to_integer(varbinary)`})}),` → integer`]}),`\n`,_jsxs(_components.p,{children:[`Returns the `,_jsx(_components.code,{children:`INTEGER`}),` value of a big-endian varbinary of length \u003c= 4 representing the integer in two’s complement. If the varbinary has length \u003c 4 it is padded with zero bytes.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`9`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- convert bytearray to integer [result will be either 1 or 0]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- if 1 = true, 0 = false`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tx_hash,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_to_integer(varbinary_ltrim(varbinary_substring(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` isQuote_number,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` CASE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` WHEN`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_to_integer(varbinary_ltrim(varbinary_substring(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` THEN`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` TRUE `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ELSE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` FALSE `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`END`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` isQuote`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` arbitrum`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`logs`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WHERE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` contract_address `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xdaf4ffb05bfcb2c328c19135e3e74e1182c88283`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AND`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` topic0 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xf1bc206c8d659bf05edd19865dbae82643062168ec3970d9d7c5468f900487d9`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`LIMIT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 10`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`varbinary_to_bigint`,children:`varbinary_to_bigint()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_to_bigint(varbinary)`})}),` → bigint`]}),`\n`,_jsxs(_components.p,{children:[`Returns the `,_jsx(_components.code,{children:`BIGINT`}),` value of a big-endian varbinary of length \u003c= 8 representing the bigint in two’s complement. If the varbinary has length \u003c 8 it is padded with zero bytes.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`9`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`9`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- convert bytearray to integer [result will be either 1 or 0]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- if 1 = true, 0 = false`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tx_hash,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_to_bigint(varbinary_ltrim(varbinary_substring(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` isQuote_number,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` CASE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` WHEN`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_to_bigint(varbinary_ltrim(varbinary_substring(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` THEN`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` TRUE `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`ELSE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` FALSE `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`END`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` AS`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` isQuote`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` arbitrum`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`logs`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WHERE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` contract_address `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xdaf4ffb05bfcb2c328c19135e3e74e1182c88283`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AND`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` topic0 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xf1bc206c8d659bf05edd19865dbae82643062168ec3970d9d7c5468f900487d9`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`LIMIT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 10`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`varbinary_to_decimal`,children:`varbinary_to_decimal()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_to_decimal(varbinary)`})}),` → decimal(38,0)`]}),`\n`,_jsxs(_components.p,{children:[`Returns the `,_jsx(_components.code,{children:`DECIMAL(38,0)`}),` value of a big-endian varbinary of length \u003c= 16 representing the decimal(38,0) in two’s complement. If the varbinary has length \u003c 16 it is padded with zero bytes.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`11`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- using raw table to get usdc transfers amount`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- transfer topic0 = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- usdc contract_address = 0xaf88d065e77c8cc2239327c5edb3a432268e5831`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tx_hash,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_to_decimal(varbinary_ltrim(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` data_decimal`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` arbitrum`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`logs`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WHERE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` topic0 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AND`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` contract_address `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xaf88d065e77c8cc2239327c5edb3a432268e5831`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AND`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` block_time `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` NOW`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`-`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` interval `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'1'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` day`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`LIMIT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 50`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`varbinary_to_uint256`,children:`varbinary_to_uint256()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_to_uint256(varbinary)`})}),` → uint256`]}),`\n`,_jsxs(_components.p,{children:[`Returns the `,_jsx(_components.code,{children:`UINT256`}),` of a big-endian varbinary of length \u003c= 32 representing the unsigned integer. If the varbinary has length \u003c 32 it is padded with zero bytes.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`select`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tx_hash,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_substring(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`97`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` fee,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_to_uint256(varbinary_substring(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`97`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` fee_uint256`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`from`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` optimism`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`logs`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`where`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` contract_address `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xa1ace9ce6862e865937939005b1a6c5ac938a11f`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`and`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` topic0 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xc9d5ada2ea384fe04826ecd1b258955ac73c3e2e20d755108eafde90bc5588d4`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- sample transaction hash`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`and`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tx_hash `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`IN`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (0x3e3c558e7f723e3bb7de1d8f5f920ca206e3e878984296a2b8e6af2969003a19,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xccfd2033adfb1fdd14fdfc047fe554ba7549e396abc6c559e9528a4259295b89)`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`varbinary_to_int256`,children:`varbinary_to_int256()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_to_int256(varbinary)`})}),` → int256`]}),`\n`,_jsxs(_components.p,{children:[`Returns the `,_jsx(_components.code,{children:`INT256`}),` of a big-endian varbinary of length \u003c= 32 representing the signed integer. If the varbinary has length \u003c 32 it is padded with zero bytes.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`select`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tx_hash,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_substring(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`65`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sizeDelta,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_to_int256(varbinary_substring(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`65`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sizeDelta_int256`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`from`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` optimism`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`logs`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`where`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` contract_address `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xa1ace9ce6862e865937939005b1a6c5ac938a11f`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`and`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` topic0 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xc9d5ada2ea384fe04826ecd1b258955ac73c3e2e20d755108eafde90bc5588d4`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- sample transaction hash`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`and`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tx_hash `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`IN`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (0x3e3c558e7f723e3bb7de1d8f5f920ca206e3e878984296a2b8e6af2969003a19,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xccfd2033adfb1fdd14fdfc047fe554ba7549e396abc6c559e9528a4259295b89)`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`bytea2numeric`,children:`bytea2numeric()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`bytea2numeric(varbinary)`})}),` → bigint`]}),`\n`,_jsxs(_components.p,{children:[`This function has been deprecated. It is an alias for `,_jsx(_components.code,{children:`varbinary_to_bigint`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`numeric-to-varbinary`,children:`Numeric to Varbinary`}),`\n`,_jsx(Heading,{level:`4`,id:`converting-uint256-to-varbinary`,children:`Converting uint256 to varbinary`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_ltrim(cast(uint256 as varbinary))`})}),` → varbinary`]}),`\n`,_jsx(_components.p,{children:`Converts a uint256 type number into varbinary.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`select`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_ltrim(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` cast`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(UINT256 `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'101691398105299641525402875323276528467270701520'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` as`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` varbinary`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` ) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` vb`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`varbinary-to-text`,children:`Varbinary to text`}),`\n`,_jsx(Heading,{level:`4`,id:`from_utf8`,children:`from_utf8()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`from_utf8(varbinary)`})}),` → varchar`]}),`\n`,_jsx(_components.p,{children:`Converts a varbinary to a string using the UTF-8 encoding.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`Select`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` from_utf8(0x48656c6c6f20576f726c64)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- returns \"Hello World\"`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`most commonly will have to be used like this:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`Select`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` from_utf8(varbinary_ltrim(0x0000000000000000006e66746e657264732e6169))`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`text-to-varbinary`,children:`Text to varbinary`}),`\n`,_jsx(Heading,{level:`4`,id:`from_hex`,children:`from_hex()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`from_hex(varchar)`})}),` → varbinary`]}),`\n`,_jsxs(_components.p,{children:[`Converts a varbinary expression in datatype `,_jsx(_components.code,{children:`string`}),` to `,_jsx(_components.code,{children:`varbinary`}),` datatype`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`Select`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` from_hex(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0x6574686275696c646572'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- returns VARBINARY 0x6574686275696c646572`})}),`\n`]})})}),`\n`,_jsxs(Warning,{children:[` You `,_jsx(_components.strong,{children:`cannot`}),` use `,_jsx(_components.code,{children:`cast(x as varbinary)`}),` in these cases as it will actually encode the string as varbinary which is different from converting the expression to `,_jsx(_components.code,{children:`varbinary`}),`. `]}),`\n`,_jsx(Heading,{level:`2`,id:`varbinary-manipulation-functions`,children:`Varbinary Manipulation Functions`}),`\n`,_jsx(Heading,{level:`4`,id:`varbinary_concat`,children:`varbinary_concat()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_concat(varbinary, varbinary)`})}),` → varbinary`]}),`\n`,_jsx(_components.p,{children:`Concatenates two varbinarys or strings.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_concat(0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48)`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_concat(varchar, varchar)`})}),` → varchar`]}),`\n`,_jsx(_components.p,{children:`Concatenates two varbinarys or strings.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- concatenate varchar`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- using typeof to check the datatype`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_concat(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0xabcd'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0x00ab'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_varchar_concat,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` typeof(varbinary_concat(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0xabcd'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0x00ab'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_varchar_type`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`varbinary_length`,children:`varbinary_length()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_length(varbinary)`})}),` → bigint`]}),`\n`,_jsx(_components.p,{children:`Returns the length of a varbinary.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` -- this will return 20`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_length(0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_length(varchar)`})}),` → bigint`]}),`\n`,_jsx(_components.p,{children:`Returns the length of a string.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` -- this will return 20`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` typeof(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` data_type,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_length(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) varchar_length`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`varbinary_ltrim`,children:`varbinary_ltrim()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_ltrim(varbinary)`})}),` → varbinary`]}),`\n`,_jsx(_components.p,{children:`Removes zero bytes or spaces from the beginning of a varbinary`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` -- this will remove the zeros at the front,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` -- returning 0xa2b80f9c09558945800ddf4f8786dcc8b1c44974`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_ltrim(0x000000000000000000000000a2b80f9c09558945800ddf4f8786dcc8b1c44974)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_ltrim(varchar)`})}),` → varchar`]}),`\n`,_jsx(_components.p,{children:`Removes spaces from the beginning of a string.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` -- this will remove the zeros at the front,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` -- returning 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` typeof(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0x0000000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` data_type,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_ltrim(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0x0000000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) varchar_ltrim`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`varbinary_rtrim`,children:`varbinary_rtrim()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_rtrim(varbinary) or varbinary_rtrim(varchar)`})}),` → varbinary or varchar`]}),`\n`,_jsx(_components.p,{children:`Removes zero bytes or spaces from the end of a varbinary or string.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` -- this will remove the zeros at the end,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` -- returning 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_ltrim(0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`varbinary_position`,children:`varbinary_position()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_position(varbinary, varbinary)`})}),` → bigint`]}),`\n`,_jsx(_components.p,{children:`Returns the index of the first occurrence of a given bytearray or string (or 0 if not found) within a varbinary or string.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- get $ARKM claimers `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` FROM`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` ethereum`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`transactions`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WHERE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` block_time `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TIMESTAMP`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '2023-07-17'`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` -- claim start date`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AND`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_position(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,0x3d13f874) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` -- 0x3d13f874 is the methodID`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AND`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` success`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`LIMIT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 100`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_position(varchar, varchar)`})}),` → bigint`]}),`\n`,_jsx(_components.p,{children:`Returns the index of the first occurrence of a given bytearray or string (or 0 if not found) within a varbinary or string.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- search for '0x6cc2' and return its position`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_position(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0x6cc2'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`varbinary_replace`,children:`varbinary_replace()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_replace(varbinary, varbinary, varbinary)`})}),` → varbinary`]}),`\n`,_jsx(_components.p,{children:`Greedily replaces occurrences of a pattern within a varbinary.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`6`,children:[_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- replacing the blackhole address (ETH)`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- to WETH address`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_replace(0x0000000000000000000000000000000000000000,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0x0000000000000000000000000000000000000000,`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) `})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_replace(varchar, varchar, varchar)`})}),` → varchar`]}),`\n`,_jsx(_components.p,{children:`Greedily replaces occurrences of a pattern within a string.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_replace(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0x0000000000000000000000000000000000000000a2b80f9c09558945800ddf4f8786dcc8b1c44974'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '0x0000000000000000000000000000000000000000'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`varbinary_reverse`,children:`varbinary_reverse()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_reverse(varbinary)`})}),` → varbinary`]}),`\n`,_jsx(_components.p,{children:`Reverses a given varbinary.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_reverse(0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_reverse(varchar)`})}),` → varchar`]}),`\n`,_jsx(_components.p,{children:`Reverses a given string.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- '0xabcdef' as original`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- '0xefcdab' as reversed`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '0xabcdef'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` original,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_reverse(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'0xabcdef'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` reversed`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`varbinary_starts_with`,children:`varbinary_starts_with()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_starts_with(varbinary, varbinary)`})}),` → boolean`]}),`\n`,_jsx(_components.p,{children:`Determines whether a varbinary starts with a prefix.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`10`,children:[_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- get $ARKM claimers `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- varbinary_starts_with checks whether `})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- data starts with 0x3d13f874 (claim methodID)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` *`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` FROM`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` ethereum`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`transactions`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WHERE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` block_time `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` TIMESTAMP`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '2023-07-17'`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AND`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_starts_with(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,0x3d13f874) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- returns true if starts with 0x3d13f874`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AND`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` success`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`LIMIT`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 100`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_starts_with(varbinary, varbinary)`})}),` → boolean`]}),`\n`,_jsx(_components.p,{children:`Determines whether a varbinary starts with a prefix.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- returns true if starts with 0x3d13f874`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_starts_with(0x3d13f874abcd,0x3d13f874) `})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`varbinary_substring`,children:`varbinary_substring()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_substring(varbinary, integer)`})}),` → varbinary`]}),`\n`,_jsx(_components.p,{children:`Returns a suffix varbinary or string starting at a given index.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`4`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- using varbinary_substring starting from the 21th index`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- this returns 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 `})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0x0000000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` original_bytearray,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_substring(0x0000000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`21`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` bytearraysubstring_data`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Returns a subvarbinary of a given length starting at an index.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`11`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- getting the sizeDelta using varbinary_substring`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- and converting to uint256 using varbinary_to_uint256`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tx_hash,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_substring(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`65`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sizeDelta,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_to_uint256(varbinary_substring(`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`65`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` sizeDelta_uint256`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`FROM`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:` optimism`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#D4D4D4`},children:`logs`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`WHERE`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` contract_address `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xa1ace9ce6862e865937939005b1a6c5ac938a11f`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AND`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` topic0 `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xc9d5ada2ea384fe04826ecd1b258955ac73c3e2e20d755108eafde90bc5588d4`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- some sample transaction hash`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`AND`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tx_hash `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`IN`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (0x3e3c558e7f723e3bb7de1d8f5f920ca206e3e878984296a2b8e6af2969003a19, `})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xccfd2033adfb1fdd14fdfc047fe554ba7549e396abc6c559e9528a4259295b89) `})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`varbinary_substring(varbinary, integer, integer)`})}),` → varbinary`]}),`\n`,_jsx(_components.p,{children:`Returns a subvarbinary of a given length starting at an index. Be aware that the length is in bytes, not characters.`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`3`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`-- returns 0xabcdef`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` 0xabcdefabcdef `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_data,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_substring(0xabcdefabcdef,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`as`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` varbinary_substring`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`4`,id:`keccak`,children:`keccak()`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`keccak(varbinary)`})}),` → varbinary`]}),`\n`,_jsxs(_components.p,{children:[`Returns the Keccak-256 hash of `,_jsx(_components.code,{children:`varbinary`}),`.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` SELECT`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` keccak(to_utf8(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Transfer(address,address,uint256)'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`--0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef`})]}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Varbinary functions (DuneSQL)","icon":"code","description":null,"href":"/query-engine/Functions-and-operators/varbinary"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Varbinary Functions","slug":"varbinary-functions","depth":2,"children":[]},{"title":"Varbinary to Numeric Functions","slug":"varbinary-to-numeric-functions","depth":2,"children":[{"title":"varbinary_to_integer()","slug":"varbinary_to_integer","depth":4,"children":[]},{"title":"varbinary_to_bigint()","slug":"varbinary_to_bigint","depth":4,"children":[]},{"title":"varbinary_to_decimal()","slug":"varbinary_to_decimal","depth":4,"children":[]},{"title":"varbinary_to_uint256()","slug":"varbinary_to_uint256","depth":4,"children":[]},{"title":"varbinary_to_int256()","slug":"varbinary_to_int256","depth":4,"children":[]},{"title":"bytea2numeric()","slug":"bytea2numeric","depth":4,"children":[]}]},{"title":"Numeric to Varbinary","slug":"numeric-to-varbinary","depth":2,"children":[{"title":"Converting uint256 to varbinary","slug":"converting-uint256-to-varbinary","depth":4,"children":[]}]},{"title":"Varbinary to text","slug":"varbinary-to-text","depth":2,"children":[{"title":"from_utf8()","slug":"from_utf8","depth":4,"children":[]}]},{"title":"Text to varbinary","slug":"text-to-varbinary","depth":2,"children":[{"title":"from_hex()","slug":"from_hex","depth":4,"children":[]}]},{"title":"Varbinary Manipulation Functions","slug":"varbinary-manipulation-functions","depth":2,"children":[{"title":"varbinary_concat()","slug":"varbinary_concat","depth":4,"children":[]},{"title":"varbinary_length()","slug":"varbinary_length","depth":4,"children":[]},{"title":"varbinary_ltrim()","slug":"varbinary_ltrim","depth":4,"children":[]},{"title":"varbinary_rtrim()","slug":"varbinary_rtrim","depth":4,"children":[]},{"title":"varbinary_position()","slug":"varbinary_position","depth":4,"children":[]},{"title":"varbinary_replace()","slug":"varbinary_replace","depth":4,"children":[]},{"title":"varbinary_reverse()","slug":"varbinary_reverse","depth":4,"children":[]},{"title":"varbinary_starts_with()","slug":"varbinary_starts_with","depth":4,"children":[]},{"title":"varbinary_substring()","slug":"varbinary_substring","depth":4,"children":[]},{"title":"keccak()","slug":"keccak","depth":4,"children":[]}]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/dune/3dc9988ffc23fc85/favicon-switcher.js","/_mintlify/custom/dune/11037b9cc10a9f51/amplitude.js"],"subdomain":"dune","siteName":"Dune Docs","title":"Varbinary functions (DuneSQL) - Dune Docs","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-03T01:31:19.871Z","originalFileLocation":"query-engine/Functions-and-operators/varbinary.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Official documentation for building with Dune\u0026#x27;s data platform, query engine, and API.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Dune Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/dune/_generated/favicon/apple-touch-icon.png?v=3\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/dune/_generated/favicon/favicon-32x32.png?v=3\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/dune/_generated/favicon/favicon-16x16.png?v=3\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"https://mintlify.s3.us-west-1.amazonaws.com/dune/_generated/favicon/favicon.ico?v=3\">\u003cmeta data-mint-head property=\"og:title\" content=\"Varbinary functions (DuneSQL) - Dune Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Official documentation for building with Dune\u0026#x27;s data platform, query engine, and API.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Dune Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.dune.com/query-engine/Functions-and-operators/varbinary\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://dune.mintlify.app/_mintlify/api/og/v2?division=Blockchain+Functions\u0026amp;title=Varbinary+functions+%28DuneSQL%29\u0026amp;theme=d9c0cb23e9b44d10ee46351c\u0026amp;signature=19f4573367cbe796b648be1b52eb73a037c8ea34aa943b9ec22178065c615e97\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Varbinary functions (DuneSQL) - Dune Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Official documentation for building with Dune\u0026#x27;s data platform, query engine, and API.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://dune.mintlify.app/_mintlify/api/og/v2?division=Blockchain+Functions\u0026amp;title=Varbinary+functions+%28DuneSQL%29\u0026amp;theme=d9c0cb23e9b44d10ee46351c\u0026amp;signature=19f4573367cbe796b648be1b52eb73a037c8ea34aa943b9ec22178065c615e97\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"https://mintlify.s3.us-west-1.amazonaws.com/dune/_generated/favicon/browserconfig.xml?v=3\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Dune Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0f0f15\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.dune.com/query-engine/Functions-and-operators/varbinary\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/query-engine/Functions-and-operators/varbinary.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.dune.com/#organization\",\"name\":\"Dune Docs\",\"url\":\"https://docs.dune.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/dune/zh-3B8LgVmyrKOaG/logo/dune-logo-light.svg?fit=max\u0026auto=format\u0026n=zh-3B8LgVmyrKOaG\u0026q=85\u0026s=6fec71d5070d0923eb2924321131b1c2\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.dune.com#website\",\"name\":\"Dune Docs\",\"url\":\"https://docs.dune.com\",\"publisher\":{\"@id\":\"https://docs.dune.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.dune.com/query-engine/Functions-and-operators/varbinary#webpage\",\"url\":\"https://docs.dune.com/query-engine/Functions-and-operators/varbinary\",\"name\":\"Varbinary functions (DuneSQL)\",\"dateModified\":\"2026-11-03T01:31:19.871Z\",\"isPartOf\":{\"@id\":\"https://docs.dune.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.dune.com/query-engine/Functions-and-operators/varbinary#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.dune.com/query-engine/Functions-and-operators/varbinary#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Dune Docs\",\"item\":\"https://docs.dune.com\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Varbinary functions (DuneSQL)\",\"item\":\"https://docs.dune.com/query-engine/Functions-and-operators/varbinary\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.dune.com/query-engine/Functions-and-operators/varbinary#article\",\"headline\":\"Varbinary functions (DuneSQL)\",\"name\":\"Varbinary functions (DuneSQL)\",\"url\":\"https://docs.dune.com/query-engine/Functions-and-operators/varbinary\",\"mainEntityOfPage\":{\"@id\":\"https://docs.dune.com/query-engine/Functions-and-operators/varbinary#webpage\"},\"dateModified\":\"2026-11-03T01:31:19.871Z\",\"publisher\":{\"@id\":\"https://docs.dune.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.dune.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Dune Docs\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Dune Docs","nav":{"global":null,"tabs":[{"tab":"Docs","pages":[{"title":"Docs","href":""}]},{"tab":"Data Catalog","pages":[{"title":"Data Catalog","href":"/data-catalog/overview"}]},{"tab":"API Reference","pages":[{"title":"API Reference","href":"/api-reference/overview/introduction"}]},{"tab":"SQL Query Engine","pages":[{"title":"Query Engine","sidebarTitle":"Query Engine Overview","icon":"star","href":"/query-engine/overview"},{"group":"Functionality","pages":[{"title":"Query Executions","icon":"play","href":"/query-engine/query-executions"},{"title":"Query Views","icon":"layer-group","href":"/query-engine/query-a-query"},{"title":"Materialized Views","icon":"database","href":"/query-engine/materialized-views"},{"title":"Incremental Queries","icon":"forward-step","href":"/query-engine/incremental-queries"}]},{"group":"DuneSQL","pages":[{"title":"DuneSQL Architecture","icon":"sitemap","href":"/query-engine/dunesql-architecture"},{"title":"Writing Efficient Queries","icon":"bolt","href":"/query-engine/writing-efficient-queries"},{"title":"Datatypes","icon":"list","href":"/query-engine/datatypes"},{"title":"Reserved keywords","icon":"lock","href":"/query-engine/reserved-keywords"}]},{"group":"Functions \u0026 Operators","pages":[{"title":"Overview","icon":"star","href":"/query-engine/Functions-and-operators/index"}]},{"group":"Core SQL","pages":[{"title":"Comparisons","icon":"equals","href":"/query-engine/Functions-and-operators/comparison"},{"title":"Logical operators","icon":"code-branch","href":"/query-engine/Functions-and-operators/logical"},{"title":"Conditional expressions","icon":"code-compare","href":"/query-engine/Functions-and-operators/conditional"},{"title":"Conversions","icon":"arrows-rotate","href":"/query-engine/Functions-and-operators/conversion"}]},{"group":"Aggregate \u0026 Window","pages":[{"title":"Aggregate functions","icon":"sigma","href":"/query-engine/Functions-and-operators/aggregate"},{"title":"Window functions","icon":"window-restore","href":"/query-engine/Functions-and-operators/window"},{"title":"ASOF Join","icon":"clock-rotate-left","href":"/query-engine/Functions-and-operators/asof-join"}]},{"group":"Data Types","pages":[{"title":"Array functions and operators","icon":"list","href":"/query-engine/Functions-and-operators/array"},{"title":"Map functions and operators","icon":"key","href":"/query-engine/Functions-and-operators/map"},{"title":"JSON functions","icon":"brackets-curly","href":"/query-engine/Functions-and-operators/json"},{"title":"Binary","icon":"binary","href":"/query-engine/Functions-and-operators/binary"},{"title":"Decimal functions and operators","icon":"hashtag","href":"/query-engine/Functions-and-operators/decimal"}]},{"group":"String \u0026 Text","pages":[{"title":"String functions and operators","icon":"text","href":"/query-engine/Functions-and-operators/string"},{"title":"Regular expression functions","icon":"asterisk","href":"/query-engine/Functions-and-operators/regexp"},{"title":"Lambda expressions","icon":"lambda","href":"/query-engine/Functions-and-operators/lambda"},{"title":"URL functions","icon":"link","href":"/query-engine/Functions-and-operators/url"},{"title":"UUID functions","icon":"fingerprint","href":"/query-engine/Functions-and-operators/uuid"}]},{"group":"Math \u0026 Statistics","pages":[{"title":"Mathematical functions and operators","icon":"square-root-variable","href":"/query-engine/Functions-and-operators/math"},{"title":"Bitwise","icon":"microchip","href":"/query-engine/Functions-and-operators/bitwise"},{"title":"HyperLogLog functions","icon":"chart-scatter","href":"/query-engine/Functions-and-operators/hyperloglog"},{"title":"Quantile digest functions","icon":"chart-histogram","href":"/query-engine/Functions-and-operators/qdigest"},{"title":"T-Digest functions","icon":"chart-bell-curve","href":"/query-engine/Functions-and-operators/tdigest"},{"title":"Set Digest functions","icon":"chart-pie","href":"/query-engine/Functions-and-operators/setdigest"},{"title":"Machine learning functions","icon":"brain","href":"/query-engine/Functions-and-operators/ml"}]},{"group":"Date \u0026 Time","pages":[{"title":"Date and time functions and operators","icon":"clock","description":null,"href":"/query-engine/Functions-and-operators/datetime"}]},{"group":"Blockchain Functions","pages":[{"title":"Varbinary functions (DuneSQL)","icon":"code","href":"/query-engine/Functions-and-operators/varbinary"},{"title":"EVM Decoding Functions","description":"Functions to decode raw EVM events and function calls in DuneSQL.","icon":"file-code","href":"/query-engine/Functions-and-operators/evm-decoding-functions"},{"title":"EIP-8021 calldata table function","icon":"tag","href":"/query-engine/Functions-and-operators/eip-8021"},{"title":"Chain Utility Functions","icon":"cubes","href":"/query-engine/Functions-and-operators/chain-utility-functions"},{"title":"Base58 functions","icon":"bitcoin-sign","href":"/query-engine/Functions-and-operators/base58"},{"title":"SS58 functions","icon":"circle-nodes","href":"/query-engine/Functions-and-operators/ss58"},{"title":"TON address functions","icon":"gem","href":"/query-engine/Functions-and-operators/tonaddress"},{"title":"Tron address functions","icon":"t","href":"/query-engine/Functions-and-operators/tronaddress"},{"title":"Varchar Utility Functions","icon":"spell-check","href":"/query-engine/Functions-and-operators/varchar-utility-functions"}]},{"group":"External Data","pages":[{"title":"LiveFetch functions","icon":"bolt","href":"/query-engine/Functions-and-operators/live-fetch"}]},{"group":"System \u0026 Compatibility","pages":[{"title":"System information","icon":"server","href":"/query-engine/Functions-and-operators/system"},{"title":"Teradata functions","icon":"rotate","href":"/query-engine/Functions-and-operators/teradata"}]}]},{"tab":"Resources","pages":[{"title":"Resources","href":"/resources/credits-billing/overview"}]}]},"basePath":"","title":"Varbinary functions (DuneSQL) - Dune Docs","buildId":"dpl_36EDyZCDfRuoUD9af5CH4M1bqY2h","deploymentId":"dpl_36EDyZCDfRuoUD9af5CH4M1bqY2h","dynamics":[],"chunks":[]}