-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
functionSelectors.js #318
Comments
In order to quickly update current function and event selectors, I used this recipe, pending yet to develop a complete js script to do all the job by itself. To get signatures from selectors, use keccak256.js script found at: f830aa9#diff-35603448485527fb547e0033f6c899e63235d8834924bbe3af371e548df6b73d find . -type f -name '.sol' ! -path 'node_modules/' -print0 | xargs -0 sed -z "s///[^\n]\n//g" | awk '/event/,/;/' | sed "s/[[:space:]]+event/event/" | sed -z "s/\n[\t ]//g" | sed -z "s/;/;\n/g" | egrep "^event " | sed "s/ indexed / /g" | sed -E "s/(address|uint[0-9]+|bytes[0-9]|bool|string)([]) [^,\)]+/\1/g" | sed "s/event //" | sed -r "s/\s+//g" | xargs -0 node scripts/keccak256.js > eventSignatures.txt Pipeline code to get function signatures: 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|uint[0-9]+|bytes[0-9]|bool|string)([[0-9]])* [^,\)]+/\1/g" | sed "s/function //" | sed -r "s/ (public|external).*$//" | sed -r "s/\s+//g" | xargs -0 node scripts/keccak256.js > functionSignatures.txt |
Script is done! Updated event topics and function selector spreadsheet, now including AMM contracts as well: |
Pending to fix 3 issues: |
Script in python or js to extend functionSignatures.sh, add params as needed, compute selectors (four bytes of the Keccak-256 or SHA-3 hash of the signature of the function)
The text was updated successfully, but these errors were encountered: