Skip to content

Commit

Permalink
update udf (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
drethereum authored Jun 27, 2024
1 parent 554550f commit 6709d46
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion macros/core/functions.py.sql
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ def transform_base58_to_hex(base58):
base_count = len(ALPHABET)

num = 0
leading_zeros = 0

for char in base58:
if char == '1':
leading_zeros += 1
else:
break

for char in base58:
num *= base_count
if char in ALPHABET:
Expand All @@ -144,7 +152,9 @@ def transform_base58_to_hex(base58):
if len(hex_string) % 2 != 0:
hex_string = '0' + hex_string

return '0x' + hex_string
hex_leading_zeros = '00' * leading_zeros

return '0x' + hex_leading_zeros + hex_string

{% endmacro %}

Expand Down

0 comments on commit 6709d46

Please sign in to comment.