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

"cast interface" does not output payable functions as payable #7593

Closed
2 tasks done
maxweisspoker opened this issue Apr 8, 2024 · 3 comments · Fixed by alloy-rs/core#596
Closed
2 tasks done

"cast interface" does not output payable functions as payable #7593

maxweisspoker opened this issue Apr 8, 2024 · 3 comments · Fixed by alloy-rs/core#596
Labels
T-bug Type: bug

Comments

@maxweisspoker
Copy link

maxweisspoker commented Apr 8, 2024

Component

Cast

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (0c961f7 2024-04-07T00:19:23.813560836Z)

What command(s) is the bug in?

cast interface

Operating System

Linux

Describe the bug

Running "cast interface abi.json" does not create an interface with payable functions, even if the functions are marked as payable in the abi. For example, running:

$ cast interface <(curl "https://raw.githubusercontent.com/Uniswap/v1-contracts/master/abi/uniswap_exchange.json" 2>/dev/null) | grep addLiquidity

shows

function addLiquidity(uint256 min_liquidity, uint256 max_tokens, uint256 deadline) external returns (uint256 out);

whereas the abi json file clearly defines it as payable:

{
  "name": "addLiquidity",
  "outputs": [{ "type": "uint256", "name": "out" }],
  "inputs": [
    { "type": "uint256", "name": "min_liquidity" },
    { "type": "uint256", "name": "max_tokens" },
    { "type": "uint256", "name": "deadline" }
  ],
  "constant": false,
  "payable": true,
  "type": "function",
  "gas": 82616
},
@maxweisspoker maxweisspoker added the T-bug Type: bug label Apr 8, 2024
@kamuik16
Copy link
Contributor

kamuik16 commented Apr 8, 2024

I think this error is specific to your case because on doing cast interface 0xE592427A0AEce92De3Edee1F18E0157C05861564 I am getting payable functions.

function exactInput(ExactInputParams memory params) external payable returns (uint256 amountOut);
function exactInputSingle(ExactInputSingleParams memory params) external payable returns (uint256 amountOut);

@klkvr
Copy link
Member

klkvr commented Apr 8, 2024

This is caused by abi items having "payable": true instead of "stateMutability": "payable" in the https://raw.githubusercontent.com/Uniswap/v1-contracts/master/abi/uniswap_exchange.json, this format is used by solc versions before 0.5.0 I believe

@DaniPopes is this something we want to support?

@maxweisspoker
Copy link
Author

This is caused by abi items having "payable": true instead of "stateMutability": "payable" in the https://raw.githubusercontent.com/Uniswap/v1-contracts/master/abi/uniswap_exchange.json, this format is used by solc versions before 0.5.0 I believe

@DaniPopes is this something we want to support?

Ahh, that makes sense. I am doing some challenges that sometimes use older code. Please do close this ticket if that older abi json is unsupported.

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

Successfully merging a pull request may close this issue.

3 participants