Closed fubhy closed 6 months ago
could you please provide an example
could you please provide an example
Sure (btw., not sure if this would've better been filed in the foundry
repo). Anyways, for instance running cast interface
with the following abi:
[
{
"type": "constructor",
"inputs": [
{
"name": "_integrationManager",
"type": "address",
"internalType": "address"
},
{
"name": "_addressListRegistry",
"type": "address",
"internalType": "address"
},
{
"name": "_aTokenListId",
"type": "uint256",
"internalType": "uint256"
},
{
"name": "_pool",
"type": "address",
"internalType": "address"
},
{
"name": "_referralCode",
"type": "uint16",
"internalType": "uint16"
}
],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "getIntegrationManager",
"inputs": [],
"outputs": [
{
"name": "integrationManager_",
"type": "address",
"internalType": "address"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "lend",
"inputs": [
{
"name": "_vaultProxy",
"type": "address",
"internalType": "address"
},
{
"name": "",
"type": "bytes",
"internalType": "bytes"
},
{
"name": "_assetData",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [],
"stateMutability": "nonpayable"
},
{
"type": "function",
"name": "parseAssetsForAction",
"inputs": [
{
"name": "",
"type": "address",
"internalType": "address"
},
{
"name": "_selector",
"type": "bytes4",
"internalType": "bytes4"
},
{
"name": "_actionData",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [
{
"name": "spendAssetsHandleType_",
"type": "uint8",
"internalType": "enum IIntegrationManager.SpendAssetsHandleType"
},
{
"name": "spendAssets_",
"type": "address[]",
"internalType": "address[]"
},
{
"name": "spendAssetAmounts_",
"type": "uint256[]",
"internalType": "uint256[]"
},
{
"name": "incomingAssets_",
"type": "address[]",
"internalType": "address[]"
},
{
"name": "minIncomingAssetAmounts_",
"type": "uint256[]",
"internalType": "uint256[]"
}
],
"stateMutability": "view"
},
{
"type": "function",
"name": "redeem",
"inputs": [
{
"name": "_vaultProxy",
"type": "address",
"internalType": "address"
},
{
"name": "",
"type": "bytes",
"internalType": "bytes"
},
{
"name": "_assetData",
"type": "bytes",
"internalType": "bytes"
}
],
"outputs": [],
"stateMutability": "nonpayable"
}
]
... will produce this output:
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
interface Interface {
event BorrowedAssetAdded(address indexed asset);
event BorrowedAssetRemoved(address indexed asset);
event CollateralAssetAdded(address indexed asset);
event CollateralAssetRemoved(address indexed asset);
constructor(address _aaveDataProvider, address _aaveLendingPoolAddressProvider, address _aaveIncentivesController);
function assetIsBorrowed(address _asset) external view returns (bool isBorrowed_);
function assetIsCollateral(address _asset) external view returns (bool isCollateral_);
function getDebtAssets() external returns (address[] memory assets_, uint256[] memory amounts_);
function getDebtTokenForBorrowedAsset(address _borrowedAsset) external view returns (address debtToken_);
function getManagedAssets() external returns (address[] memory assets_, uint256[] memory amounts_);
function init(bytes memory) external;
function receiveCallFromVault(bytes memory _actionData) external;
}
The constructor
should not be generated for the interface output.
This is intended, we use it to pass it onto sol!
internally. This should be documented in to_sol
, maybe we should also provide a way to disable it when not desired, e.g. cast when you always want valid solidity
This is intended, we use it to pass it onto sol! internally. This should be documented in to_sol, maybe we should also provide a way to disable it when not desired, e.g. cast when you always want valid solidity
Yeah, I wasn't sure if it's better to filter it out in cast interface
or add an option for that here. But I see you guys did both now :-D
Component
json-abi
What version of Alloy are you on?
No response
Operating System
macOS (Apple Silicon)
Describe the bug
Currently, when running
cast interface
, the output includes the constructor signature of the source contract.