Brownie 导入文件包含带有“@...”的导入内容
我有这个合同:
pragma solidity >=0.8.0;
import "Uniswap/[email protected]/contracts/interfaces/IUniswapV3Pool.sol";
import "Uniswap/[email protected]/contracts/interfaces/ISwapRouter.sol";
contract Test {
}
并且这个 Brownie-config.yaml:
dependencies:
- Uniswap/[email protected]
- Uniswap/[email protected]
使用 browniecompile 抛出以下内容:
ParserError: Source "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol" not found: File outside of allowed directories.
--> C:/Users/username/.brownie/packages/Uniswap/[email protected]/contracts/interfaces/ISwapRouter.sol:5:1:
|
5 | import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
对我来说,此导入无法解析是有道理的,但是无论如何都可以在不修改的情况下修复此问题Uniswap 源代码?
编辑:澄清一下,这就是 ISwapRouter.sol 的开头:
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;
import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';
导入“@uniswap/...”是导致问题的原因
I have this contract:
pragma solidity >=0.8.0;
import "Uniswap/[email protected]/contracts/interfaces/IUniswapV3Pool.sol";
import "Uniswap/[email protected]/contracts/interfaces/ISwapRouter.sol";
contract Test {
}
and this brownie-config.yaml:
dependencies:
- Uniswap/[email protected]
- Uniswap/[email protected]
using brownie compile throws the following:
ParserError: Source "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol" not found: File outside of allowed directories.
--> C:/Users/username/.brownie/packages/Uniswap/[email protected]/contracts/interfaces/ISwapRouter.sol:5:1:
|
5 | import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Makes sense to me that this import can't be resolved, but is there anyway to fix this without modifying the Uniswap source code?
Edit: to clarify, this is what the beginning of ISwapRouter.sol looks like:
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;
import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol';
the import of '@uniswap/..." is what is causing the problem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Brownie-config.yaml 文件中
添加重新映射
in brownie-config.yaml file
add remappings