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(json-abi): Param.ty is not always a valid TypeSpecifier #386

Merged
merged 5 commits into from
Oct 25, 2023

Conversation

DaniPopes
Copy link
Member

@DaniPopes DaniPopes commented Oct 25, 2023

Closes foundry-rs/foundry#6113

The exact same code, with library instead of contract, produces "type": "Library.Enum" instead of "uint8".

See also ethabi workaround: https://github.com/rust-ethereum/ethabi/blob/b1710adc18f5b771d2d2519c87248b1ba9430778/ethabi/src/param_type/reader.rs#L162-L167

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

contract ContractCounter {
    enum TestEnum {
        NO,
        YES
    }

    function sayYes() external pure returns (TestEnum) {
        return TestEnum.YES;
    }
}

library LibCounter {
    enum TestEnum {
        NO,
        YES
    }

    function sayYes() external pure returns (TestEnum) {
        return TestEnum.YES;
    }
}

image

@DaniPopes DaniPopes merged commit 393f806 into main Oct 25, 2023
20 checks passed
@DaniPopes DaniPopes deleted the dani/json-enum-in-library branch October 25, 2023 21:20
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.

Build error invalid value with Library function that returns Enum
1 participant