Skip to content

Commit

Permalink
Bash script functionSignatures.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
computerphysicslab committed Jul 13, 2021
1 parent b5bd57f commit 94ba02c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/functionSignatures.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# This script extracts all function signatures from contracts on a repo.
# It's meant to run on Linux from the repo base folder like this:
# cd Sovryn-smart-contracts/
# ./scripts/functionSignatures.sh

find . -type f -name '*.sol' ! -path '*node_modules/*' -print0 | xargs -0 sed -z "s/\/\/[^\n]*\n//g" | awk '/function/,/{/' | awk '/function/,/;/' | sed "s/[[:space:]]+function/function/" | sed -z "s/\n[\t ]*//g" | sed -z "s/{/\n/g" | sed -z "s/;/\n/g" | egrep --text "^function " | egrep --text " (public|external) " | sed -E "s/(address|u*int[0-9]+|bytes[0-9]*|bool|string)(\[[0-9]*\])* [^,\)]+/\1/g" | sed "s/function //" | sed -r "s/ (public|external).*$//" | sed -r "s/\s+//g"


0 comments on commit 94ba02c

Please sign in to comment.