Lesson 4 trying to run deploy.py Error, File outside of allowed directories. #677
-
I am trying to run the python file deploy.py which to check and print (compile_sol). However, I keep having the error saying that the source "@chainlink/contracts/src/v0.6/vendor/SafeMathChainLink.sol" is not found and I don't know how to fix the issue My entire error message is:
FYI, my deploy.py file is: `from solcx import compile_standard, install_solc # <- import the install_solc method!
install_solc('0.6.0') # <- Add this line and run it at least once!
with open("SimpleStorage.sol", "r") as file:
simple_storage_file = file.read()
compiled_sol = compile_standard(
{
"language": "Solidity",
"sources": {"simpleStorage.sol": {"content": simple_storage_file}},
"settings": {
"outputSelection": {
"*": {"*": ["abi", "metadata", "evm.bytecode", "evm.sourceMap"]}
}
},
},
solc_version="0.6.0",
)
print(compiled_sol)` and my simpleStorage.sol is : `//SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainLink.sol";
contract FundMe {
mapping(address => uint256) public addressToAmountFunded;
function fund() public payable {
uint min_USD = 50 * 10 ** 18;
addressToAmountFunded[msg.sender] += msg.value;
}
function getVersion() public view returns (uint256) {
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
return priceFeed.version();
}
function getPrice() public view returns (uint256){
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
(, int256 answer, , ,) = priceFeed.latestRoundData();
return uint(answer); //1,234.12345678
}
function getConversionRate(uint256 ethAmount) public view returns (uint256) {
uint256 ethPrice = getPrice();
uint256 ethAmount_USD = (ethPrice * ethAmount) / 1000000000;
return ethAmount_USD;
}
}` Can anyone help to the solve the issue, thank you very much. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hello @Oscar-Chung-CKL Is saying it could not find this: |
Beta Was this translation helpful? Give feedback.
Hello @Oscar-Chung-CKL Is saying it could not find this:
SafeMathChainLink.sol
so I think it depends a lot on the version of chainlink you are using, could you please share yourbrownie-config.yaml
?.