指定的输入源无效 [英] Invalid input source specified
本文介绍了指定的输入源无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用ReMix IDE生成智能约定时,使用以下导入获取指定的输入源无效错误
import "https://github.com/aave/flashloan-box/blob/Remix/contracts/aave/FlashLoanReceiverBase.sol";
在ReMix中组合了一个超级基本的智能合约示例。如果我不包括IMPORT语句,它将编译得很好。
pragma solidity ^0.6.6;
import "https://github.com/aave/flashloan-box/blob/Remix/contracts/aave/FlashLoanReceiverBase.sol";
contract Inbox {
string public message;
constructor(string memory initialMessage) public {
message = initialMessage;
}
function setMessage(string memory newMessage) public {
message = newMessage;
}
function getMessage() public view returns (string memory) {
return message;
}
}
推荐答案
发生此问题是因为使用相对路径的嵌套导入。
FlashLoanReceiverBase.sol
正在尝试导入相对路径./IFlashLoanReceiver.sol
(不是绝对路径https://github.com/aave/flashloan-box/blob/Remix/contracts/aave/IFlashLoanReceiver.sol
)。
由于您自己的合同所在的文件夹中没有名为IFlashLoanReceiver.sol
的合同,因此此导入失败。
最佳解决方案是将PR提交到aave/flashloan-box存储库,使所有导入路径成为绝对路径。
这篇关于指定的输入源无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文