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

[Feature] Native support for smart contract utility functions #214

Open
mwakaba2 opened this issue Sep 30, 2022 · 0 comments
Open

[Feature] Native support for smart contract utility functions #214

mwakaba2 opened this issue Sep 30, 2022 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mwakaba2
Copy link

mwakaba2 commented Sep 30, 2022

Problem

At least 3 detection bots disassemble smart contracts into opcodes:

What if we natively support smart contract utility functions in the Forta SDK? This'll enhance the bot developer experience and simplify bot logic.

For example, @xaler5's DeconstructBot detects new smart contract creations, analyzes bytecode, and output alerts with contract code metadata. These are producing 1MB alerts for every new smart contract creation.

metadata: {
        transaction: // transaction.hash,
        contractAddress: // Contract address provided by the transaction receipt.
        functions: // list of functions signatures that matched with 4byte directory. Their text string is provided.
        unknownFunctions: //list of functions signatures that didn't match with 4byte directory.
        events: // list of event signatures that matched with 4byte directory. Their text string is provided.
        unknownEvents: // list of event signatures that didn't match with 4byte directory.
        bytecode: // The deployed bytecode (without init code).
        disassembled: // List of opcodes and their eventual values.
        analysis: // Output of Yasold tool.
    }

Proposed solution

What if any JS/Python bot could call the following functions for any contract address in their bot logic?

  • disassembleBytecode returns opcodes and deployed bytecode
  • getFunctions returns known and unknown functions signatures
  • getEvents returns known and unknown event signatures

These functions already exist in https://github.com/OpenZeppelin/contract-bots-gang/blob/master/contract-deconstruct/src/agent.ts

@kovart @christian-forta Love to hear your thoughts!
@xaler5 since you created these useful functions, would you be interested in integrating them into the Forta SDK?

@mwakaba2 mwakaba2 added good first issue Good for newcomers enhancement New feature or request labels Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant