ApeWorX / ApeWorX/web3.py

Events cannot retrieve their ABI if multiple events have the same name

Open
#1,704 0 comments 0 reactions 0 assignees View on GitHub
priority: p2 normal
Dominant language
Python
Stars
5.5k
Forks
1.7k
Avg merge
3d 10h
Merged PRs (30d)
2

Description

* Version: 5.12.0
* Python: 3.7
* OS: osx

### What was wrong?

`_get_event_abi()` doesn't work with overloaded events (same name, but different argument counts).

From [here](https://github.com/ethereum/web3.py/blob/aa30b3bf97d67b8434cb399c659d8b6425a9bec1/web3/contract.py#L1125), we can see that `_get_event_abi()` calls `find_matching_event_abi()`, which has the problem of not working if two events of the same name are found.

In particular, consider the following set of overloaded events (found in the Compound `Comptroller` contract for example):

```
/// @notice Emitted when an action is paused globally
event ActionPaused(string action, bool pauseState);

/// @notice Emitted when an action is paused on a market
event ActionPaused(CToken cToken, string action, bool pauseState);
```

Equally `.abi` is not available for factory generated events.

### How can it be fixed?

Expand `find_matching_event_abi` to find the appropriate event through its signature, not through the event name.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.