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

fix: allow referencing events from interfaces #2852

Closed

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented May 10, 2022

allow the following:

import bar as Bar

@external
def foo():
    log Bar.SomeEvent(...)

What I did

How I did it

allow interfaces to resolve to events in get_type_from_node for interface members.

How to verify it

see usage in ERC20.vy and ERC721.vy

Commit message

Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)

Description for the changelog

Cute Animal Picture

image

allow the following:
```
import bar as Bar

@external
def foo():
    log Bar.SomeEvent(...)
```
@codecov-commenter
Copy link

codecov-commenter commented May 10, 2022

Codecov Report

Merging #2852 (57ca6fe) into master (efe1dbe) will decrease coverage by 35.64%.
The diff coverage is 40.00%.

@@             Coverage Diff             @@
##           master    #2852       +/-   ##
===========================================
- Coverage   87.65%   52.00%   -35.65%     
===========================================
  Files          94       94               
  Lines       10179    10181        +2     
  Branches     2503     2453       -50     
===========================================
- Hits         8922     5295     -3627     
- Misses        791     4275     +3484     
- Partials      466      611      +145     
Impacted Files Coverage Δ
vyper/semantics/validation/annotation.py 55.69% <0.00%> (-36.71%) ⬇️
vyper/semantics/types/user/interface.py 42.85% <37.50%> (-40.48%) ⬇️
vyper/semantics/validation/utils.py 50.86% <100.00%> (-40.44%) ⬇️
vyper/builtin_functions/utils.py 0.00% <0.00%> (-100.00%) ⬇️
vyper/builtin_interfaces/ERC165.py 0.00% <0.00%> (-100.00%) ⬇️
vyper/builtin_interfaces/ERC20Detailed.py 0.00% <0.00%> (-100.00%) ⬇️
vyper/ir/s_expressions.py 5.88% <0.00%> (-88.24%) ⬇️
vyper/ast/natspec.py 12.34% <0.00%> (-86.42%) ⬇️
vyper/codegen/external_call.py 12.74% <0.00%> (-83.34%) ⬇️
vyper/codegen/self_call.py 18.18% <0.00%> (-77.28%) ⬇️
... and 63 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update efe1dbe...57ca6fe. Read the comment docs.

@charles-cooper charles-cooper marked this pull request as ready for review May 13, 2022 14:26
@charles-cooper charles-cooper marked this pull request as draft May 13, 2022 14:30
@charles-cooper
Copy link
Member Author

so this is a bit more complicated, since i removed the requirement to implement all events in an interface:

E           web3.exceptions.ABIEventFunctionNotFound: ("The event 'Transfer' was not found in this contract's abi. ", 'Are you sure you provided the correct contract abi?')

but it seems wasteful to force copy-paste. maybe we should have some kind of exposes ERC20(Transfer, Approval) syntax?

@charles-cooper charles-cooper mentioned this pull request May 13, 2022
5 tasks
@charles-cooper
Copy link
Member Author

meeting notes: export any events that are logged in a contract

@charles-cooper
Copy link
Member Author

superseded by #3663

@charles-cooper charles-cooper deleted the fix/interface_events branch November 7, 2023 23:07
@charles-cooper charles-cooper mentioned this pull request Feb 10, 2024
33 tasks
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

Successfully merging this pull request may close these issues.

2 participants