PatrickAlphaC / hardhat-fund-me-fcc

82 stars 182 forks source link

Update MockV3Aggregator.sol #191

Open BilgeKaanGencdogan opened 2 months ago

BilgeKaanGencdogan commented 2 months ago

I think,

@chainlink/contracts/src/v0.6 

file does not exist anymore, that is why we should use

@chainlink/contracts/src/v0.8 

to import MockV3Aggregator.sol and also pragma version should be

pragma solidity ^0.8.0;

in the end content of MockV3Aggregator.sol is

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@chainlink/contracts/src/v0.8/tests/MockV3Aggregator.sol";
PatrickAlphaC commented 2 months ago

We'd need to update the package.json as well with the new chainlink dependencies if we do this!

BilgeKaanGencdogan commented 2 months ago

We'd need to update the package.json as well with the new chainlink dependencies if we do this! You are right Patrick! I was not able to see versions rather than v0.8 when I looked at node modules in my project, that is why solidity version and import statement kept giving errors. I entered my package.json and looked at chainlink dependencies, it is different than your version of chainlink dependencies. I'll leave the content of both package.json to show the difference for those who have the same issue as me. Patrick's package.json

{
"name": "hardhat-fund-me-fcc",
"devDependencies": {
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13",
"@nomiclabs/hardhat-etherscan": "^3.0.0",
"@nomiclabs/hardhat-waffle": "^2.0.2",
"chai": "^4.3.4",
"ethereum-waffle": "^3.4.0",
"ethers": "^5.5.3",
"hardhat": "^2.8.3",
"hardhat-deploy": "^0.9.29",
"hardhat-gas-reporter": "^1.0.7",
"solidity-coverage": "^0.7.18",
"@chainlink/contracts": "^0.3.1",
"dotenv": "^14.2.0",
"prettier-plugin-solidity": "^1.0.0-beta.19",
"solhint": "^3.3.7"
},
"scripts": {
"test": "hardhat test",
"test:staging": "hardhat test --network sepolia",
"lint": "solhint 'contracts/**/*.sol'",
"lint:fix": "solhint 'contracts/**/*.sol' --fix",
"format": "prettier --write .",
"coverage": "hardhat coverage"
}
}

my package.json

{
"devDependencies": {
"@chainlink/contracts": "^1.1.0",
"@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
"@nomicfoundation/hardhat-ethers": "^3.0.0",
"@nomicfoundation/hardhat-ignition": "^0.15.0",
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.0",
"@nomicfoundation/hardhat-network-helpers": "^1.0.0",
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"@nomicfoundation/hardhat-verify": "^2.0.0",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@typechain/ethers-v6": "^0.5.0",
"@typechain/hardhat": "^9.0.0",
"chai": "^4.2.0",
"ethers": "^6.12.0",
"hardhat": "^2.22.3",
"hardhat-deploy-ethers": "^0.4.2",
"hardhat-gas-reporter": "^1.0.8",
"solidity-coverage": "^0.8.0",
"typechain": "^8.3.0"
},
"dependencies": {
"hardhat-deploy": "^0.12.4"
}
}

Thank you @PatrickAlphaC !