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

feat: function type #224

Merged
merged 1 commit into from
Aug 13, 2023
Merged

feat: function type #224

merged 1 commit into from
Aug 13, 2023

Conversation

DaniPopes
Copy link
Member

Motivation

Closes #127

Solution

Adds a Function:

  • a new-type in primitives (bytes24)
  • an enum variant in dyn-abi type and value

and add parsing in sol-macro and sol-types

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

/// Function - `function`
pub struct Function;

impl<T: Borrow<[u8; 24]>> Encodable<Function> for T {
Copy link
Member

Choose a reason for hiding this comment

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

do we want impl Encodable<Function> for (Address, Selector) ?

Copy link
Member Author

Choose a reason for hiding this comment

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

error[E0119]: conflicting implementations of trait `ty::Encodable<data_type::Function>` for type `(alloy_primitives::Address, [u8; 4])`
   --> crates/sol-types/src/types/data_type.rs:226:1
    |
219 | impl<T: Borrow<[u8; 24]>> Encodable<Function> for T {
    | --------------------------------------------------- first implementation here
...
226 | impl Encodable<Function> for (RustAddress, [u8; 4]) {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(alloy_primitives::Address, [u8; 4])`
    |
    = note: upstream crates may add a new impl of trait `std::borrow::Borrow<[u8; 24]>` for type `(alloy_primitives::Address, [u8; 4])` in future versions

@prestwich prestwich merged commit 96a8fe4 into main Aug 13, 2023
@DaniPopes DaniPopes deleted the dani/function-type branch August 13, 2023 22:49
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.

[Feature] Handle function and mapping types
2 participants