foundry
foundry copied to clipboard
Flatten removes "pragma experimental ABIEncoderV2;"
Component
Forge
Have you ensured that all of these are up to date?
- [X] Foundry
- [X] Foundryup
What version of Foundry are you on?
forge 0.2.0 (44f3a4b 2022-07-18T00:10:06.735136619Z)
What command(s) is the bug in?
forge flatten
Operating System
Linux
Describe the bug
forge flatten
will remove pragma experimental ABIEncoderV2;
from the code and thus break it.
To reproduce I can run cast etherscan-source -d etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0 0x7b2a3cf972c3193f26cdec6217d27379b6417bd0
to download https://etherscan.io/address/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0#code
The ILendingPool.sol
will correctly contain pragma experimental ABIEncoderV2;
.
If you now run:
forge flatten ./etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/AToken/@aave/protocol-v2/contracts/protocol/tokenization/AToken.sol --output ./etherscan/0x7b2a3cf972c3193f26cdec6217d27379b6417bd0/Flattened.sol
The code will be flattened, but pragma experimental ABIEncoderV2;
will be lost, breaking the code.