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

refactor: move FunctionReference type to IPluginManager #100

Conversation

jaypaik
Copy link
Collaborator

@jaypaik jaypaik commented Jan 22, 2024

This allows a clean separation between CC0 interfaces and types (as defined in ERC-6900) and implementation-specific code.

@jaypaik jaypaik force-pushed the 01-22-refactor_move_FunctionReference_type_to_IPluginManager branch from 331c483 to 071e649 Compare January 22, 2024 23:58
@jaypaik jaypaik requested a review from adam-alchemy January 23, 2024 00:01
return FunctionReference.unwrap(a) == FunctionReference.unwrap(b);
}
function isEmpty(FunctionReference fr) internal pure returns (bool) {
return FunctionReference.unwrap(fr) == bytes21(0);
Copy link
Collaborator

@fangting-alchemy fangting-alchemy Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is Line 10 still necessary?

If so, we can refactor this line to use it to save a few wraps.

return fr == _EMPTY_FUNCTION_REFERENCE;

Copy link
Collaborator Author

@jaypaik jaypaik Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, FunctionReferenceLib._EMPTY_FUNCTION_REFERENCE is still being used in some places. Unfortunately can't use == to compare between these custom types since we no longer have the magic: using {eq as ==, notEq as !=} for FunctionReference global; being applied. :(

Copy link
Collaborator

@fangting-alchemy fangting-alchemy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. A minor comment.

@jaypaik jaypaik merged commit 2c99fcd into audit-2023-11-20 Jan 23, 2024
3 checks passed
@jaypaik jaypaik deleted the 01-22-refactor_move_FunctionReference_type_to_IPluginManager branch January 23, 2024 00:32
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