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

Support events watching from specific contracts #4

Open
vbaranov opened this issue Jan 25, 2021 · 2 comments
Open

Support events watching from specific contracts #4

vbaranov opened this issue Jan 25, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@vbaranov
Copy link

Is your feature request related to a problem? Please describe.
It is not possible to specify contract addresses which events I would like to subscribe in log_subscriptions command. Am I right?

Describe the solution you'd like
Together with events specification, I would like to indicate in the config at which contracts those events happen.

Describe alternatives you've considered
Though it is possible to filter from the output in the log file, it would be awesome to have pre-filtering before output. Possibly, it is already implemented. However, I didn't find anything regarding this in the docs. If it exists, please point me out.

@vbaranov vbaranov added the enhancement New feature or request label Jan 25, 2021
@rupurt
Copy link
Contributor

rupurt commented Jan 26, 2021

💯 want to have this. Just haven't got around to it yet 😄

PR's welcome if you want to have a stab at it 😉

@rupurt
Copy link
Contributor

rupurt commented Mar 17, 2021

@vbaranov @AwaitFuture

I've added an example of how I think the configuration DSL should work to support specific contract addresses https://github.com/fremantle-industries/slurp/blob/watch-events-from-specific-contract/config/dev.exs#L91

It should look something like this

config :slurp,
  log_subscriptions: %{
    "*" => %{
      {"Approval(address,address,uint256)",
       [
         "0x26CdfbAeD9F97ecBdc76cA5cC544f052Bd9Ac795",
         "0xFc979087305A826c2B2a0056cFAbA50aad3E6439"
       ]} => [
        %{
          enabled: true,
          struct: Examples.Erc20.Events.Approval,
          handler: {Examples.EventHandler, :handle_erc20_specific_address_approval, []},
          abi: [
            %{
              "anonymous" => false,
              "inputs" => [
                %{
                  "indexed" => true,
                  "name" => "owner",
                  "type" => "address"
                },
                %{
                  "indexed" => true,
                  "name" => "spender",
                  "type" => "address"
                },
                %{
                  "indexed" => false,
                  "name" => "value",
                  "type" => "uint256"
                }
              ],
              "name" => "Approval",
              "type" => "event"
            }
          ]
        }
      ],
    }
  }

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

No branches or pull requests

2 participants