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

Incorrect abi type generated for enum in library #12867

Closed
rjl493456442 opened this issue Mar 28, 2022 · 1 comment
Closed

Incorrect abi type generated for enum in library #12867

rjl493456442 opened this issue Mar 28, 2022 · 1 comment

Comments

@rjl493456442
Copy link
Member

Description

Solidity compiler doesn't generate the correct abi type for library. The enum should be mapped to uint8, it works for contract but not for library. Instead, the type is simply a user-defined value "type": "mycontract.Field".

Environment

  • Compiler version: 0.8.13
  • Target EVM version (as per compiler settings): default
  • Framework/IDE (e.g. Truffle or Remix): Remix
  • EVM execution environment / backend / blockchain client: default
  • Operating system: default

Steps to Reproduce

Compile the following code snippet and obtain the abi output from the remix

// SPDX-License-Identifier: MIT

pragma solidity 0.8.13;

library mycontract {
  enum Field {
    F1
  }  
  function example(Field x) public view {}
}

The abi output I got

[
	{
		"inputs": [
			{
				"internalType": "enum mycontract.Field",
				"name": "x",
				"type": "mycontract.Field"
			}
		],
		"name": "example",
		"outputs": [],
		"stateMutability": "view",
		"type": "function"
	}
]
@chriseth
Copy link
Contributor

This is correct and intentional. The ABI for libraries is differen than it is for contracts. Closing as duplicate of #9278

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

No branches or pull requests

2 participants