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

Emit event declared in (non inherited) interfaces #14206

Closed
Amxx opened this issue May 10, 2023 · 0 comments · Fixed by #14274
Closed

Emit event declared in (non inherited) interfaces #14206

Amxx opened this issue May 10, 2023 · 0 comments · Fixed by #14274
Labels

Comments

@Amxx
Copy link

Amxx commented May 10, 2023

Abstract

Allow a library, or a contract, to emit an event declared in a interface using the following syntax

emit I.EventName();

Motivation

Since 0.8.20, if a libraries emits an event, the contract that uses the library should include the event in its ABI

#10996 includes the following test:

library L {
    event e1(uint b);
}

function f() {
    emit L.e1(5);
}

contract C /* is L ? */ {
    event e1(uint indexed a);
    function g() public {
        f();
    }
}

However, one may want to use events from an interface rather then defining them in a library

interface I {
    event e1(uint b);
}

library L {
    function f() internal {
        emit I.e1(5);
    }
}

contract C {
    event e1(uint indexed a);
    function g() public {
        L.f();
    }
}

Unfortunatelly, this is not accepted:

TypeError: Member "e1" not found or not visible after argument-dependent lookup in type(contract I).
|         emit I.e1(5);
|              ^^^^

Backwards Compatibility

I don't see any backward compatibility issue.

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

Successfully merging a pull request may close this issue.

2 participants
@Amxx and others