eth-brownie / brownie

A Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.
https://eth-brownie.readthedocs.io
MIT License
2.65k stars 553 forks source link

Contract.from_explorer("0x561B94454b65614aE3db0897B74303f4aCf7cc75") fails #1246

Open BlinkyStitt opened 3 years ago

BlinkyStitt commented 3 years ago

Environment information

What was wrong?

>>> c = Contract.from_explorer("0x561B94454b65614aE3db0897B74303f4aCf7cc75")
Fetching source of 0x561B94454b65614aE3db0897B74303f4aCf7cc75 from api.etherscan.io...
CompilerError: solc returned the following errors:

/home/cluracan/code/0x-protocol/contracts/zero-ex/contracts/src/liquidity-providers/CurveLiquidityProvider.sol:23:1: ParserError: Source "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol" not found: File outside of allowed directories.
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
^-------------------------------------------------------------------------^

/home/cluracan/code/0x-protocol/contracts/zero-ex/contracts/src/liquidity-providers/CurveLiquidityProvider.sol:24:1: ParserError: Source "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol" not found: File outside of allowed directories.
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
^------------------------------------------------------------------^

/home/cluracan/code/0x-protocol/contracts/zero-ex/contracts/src/liquidity-providers/CurveLiquidityProvider.sol:25:1: ParserError: Source "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol" not found: File outside of allowed directories.
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
^----------------------------------------------------------------^

/home/cluracan/code/0x-protocol/contracts/zero-ex/contracts/src/liquidity-providers/CurveLiquidityProvider.sol:26:1: ParserError: Source "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol" not found: File outside of allowed directories.
import "@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol";
^----------------------------------------------------------------^

/home/cluracan/code/0x-protocol/contracts/zero-ex/contracts/src/transformers/LibERC20Transformer.sol:23:1: ParserError: Source "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol" not found: File outside of allowed directories.
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
^----------------------------------------------------------------^

/home/cluracan/code/0x-protocol/contracts/zero-ex/contracts/src/transformers/LibERC20Transformer.sol:24:1: ParserError: Source "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol" not found: File outside of allowed directories.
import "@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol";
^------------------------------------------------------------------^

/home/cluracan/code/0x-protocol/contracts/zero-ex/contracts/src/vendor/ILiquidityProvider.sol:22:1: ParserError: Source "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol" not found: File outside of allowed directories.
import "@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol";
^----------------------------------------------------------------^

/home/cluracan/code/0x-protocol/contracts/zero-ex/node_modules/@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol:22:1: ParserError: Source "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol" not found: File outside of allowed directories.
import "@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol";
^-------------------------------------------------------------------------^

/home/cluracan/code/0x-protocol/contracts/zero-ex/node_modules/@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol:23:1: ParserError: Source "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol" not found: File outside of allowed directories.
import "@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol";
^-------------------------------------------------------------^

How can it be fixed?

For some reason, it is trying to load contracts out of the original dev's home directory.

AlbertoSinigaglia commented 3 years ago

have you remapped the folder/repos in the brownie config file?

BlinkyStitt commented 3 years ago

No because I'm just pulling contracts from random transactions and I don't have any local configuration for them. The code is pulled out of etherscan and isn't on my system at all.

You are right that remappings are involved though. I think brownie needs to set them automatically based on what comes out of etherscan.

On Sep 15, 2021, at 3:54 AM, Alberto Sinigaglia @.***> wrote:

 have you remapped the folder/repos in the brownie config file?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

gosuto-inzasheru commented 3 years ago

can confirm same behaviour on v1.16.2