Skip to content
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

Fails to extract #1

Closed
mrx23dot opened this issue Jan 26, 2022 · 6 comments
Closed

Fails to extract #1

mrx23dot opened this issue Jan 26, 2022 · 6 comments

Comments

@mrx23dot
Copy link

Running
solgrep --find="function.name" test.sol

on

contract ReEntrancyGuard {
    bool internal locked;

    modifier noReentrant() {
        require(!locked, "No re-entrancy");
        locked = true;
        _;
        selfdestruct(343434);
        locked = false;
    }
}

contract ReEntrancyGuard2 {
    bool internal locked;
}

gives no results:

� SolGrep v0.0.6 ready!

  Enabled Modules:
    ✔️ GenericGrep          _function.name,test.sol

   ────────────────────────────
cheers �
    @tintinweb
    ConsenSys Diligence @ https://consensys.net/diligence/
    https://github.com/tintinweb/solgrep/
@tintinweb
Copy link
Owner

Hey @mrx23dot,

function.name will currently only work with real functions, not modifiers. If there's a use case for you to extract all modifier names we might be able to make that happen in the same fashion. Otherwise there's an example in the Readme that shows how to find specific modifier names 🙌

tintinweb added a commit that referenced this issue Jan 27, 2022
generic grep: support "modifier.name" matching - fixes #1
@mrx23dot
Copy link
Author

Works great with non-modifiers, thanks!

@tintinweb
Copy link
Owner

the version released today should allow you to extract modifier names too. cheers 🙌

@mrx23dot
Copy link
Author

Could you also release it on npm then I will give it a go.

Is there an option to dump the AST to file from cli for further processing?
thank you

@mrx23dot
Copy link
Author

Should --find="contract.name" return interface names too?
02253dfa1f23e72e2e3e1c6b9cd2b8b0a2fc7bc5_SoEToken.txt

@tintinweb
Copy link
Owner

@mrx23dot, yes, it matches interface contracts too.

image

You can include/exclude interfaces like this:

⇒  ./bin/main.js examples/02253dfa1f23e72e2e3e1c6b9cd2b8b0a2fc7bc5_SoEToken.sol --find="contract.name && contract.kind=='interface'" 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants