Merge pull request #546 from crytic/dev-printer-function-id-padding

Add padding to function id printer
pull/548/head
Feist Josselin 4 years ago committed by GitHub
commit 5cea11612e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      slither/printers/summary/function_ids.py

@ -27,11 +27,13 @@ class FunctionIds(AbstractPrinter):
table = MyPrettyTable(['Name', 'ID']) table = MyPrettyTable(['Name', 'ID'])
for function in contract.functions: for function in contract.functions:
if function.visibility in ['public', 'external']: if function.visibility in ['public', 'external']:
table.add_row([function.solidity_signature, hex(get_function_id(function.solidity_signature))]) function_id = get_function_id(function.solidity_signature)
table.add_row([function.solidity_signature, f"{function_id:#0{10}x}"])
for variable in contract.state_variables: for variable in contract.state_variables:
if variable.visibility in ['public']: if variable.visibility in ['public']:
sig = variable.function_name sig = variable.function_name
table.add_row([sig, hex(get_function_id(sig))]) function_id = get_function_id(sig)
table.add_row([sig, f"{function_id:#0{10}x}"])
txt += str(table) + '\n' txt += str(table) + '\n'
all_tables.append((contract.name, table)) all_tables.append((contract.name, table))

Loading…
Cancel
Save