diff --git a/README.md b/README.md index 513f012..b53ebaf 100644 --- a/README.md +++ b/README.md @@ -233,6 +233,18 @@ autoflake --in-place --remove-unused-variables --remove-all-unused-imports -r . black . ``` +If you're using [vscode](https://code.visualstudio.com/) and the [solidity extension](https://github.com/juanfranblanco/vscode-solidity), you can create a folder called `.vscode` at the root folder of this project, and create a file called `settings.json`, and add the following content: + +```json +{ + "solidity.remappings": [ + "@chainlink/=[YOUR_HOME_DIR]/.brownie/packages/smartcontractkit/chainlink-brownie-contracts@0.2.2", + "@openzeppelin/=[YOUR_HOME_DIR]/.brownie/packages/OpenZeppelin/openzeppelin-contracts@4.3.2" + ] +} +``` +This will quiet the linting errors it gives you. + ## Resources To get started with Brownie: diff --git a/brownie-config.yaml b/brownie-config.yaml index 0713d04..da5c8ef 100644 --- a/brownie-config.yaml +++ b/brownie-config.yaml @@ -4,13 +4,13 @@ reports: exclude_contracts: - SafeMath dependencies: - - smartcontractkit/chainlink-brownie-contracts@0.2.1 - - OpenZeppelin/openzeppelin-contracts@3.4.0 + - smartcontractkit/chainlink-brownie-contracts@0.2.2 + - OpenZeppelin/openzeppelin-contracts@4.3.2 compiler: solc: remappings: - - '@chainlink=smartcontractkit/chainlink-brownie-contracts@0.2.1' - - '@openzeppelin=OpenZeppelin/openzeppelin-contracts@3.4.0' + - '@chainlink=smartcontractkit/chainlink-brownie-contracts@0.2.2' + - '@openzeppelin=OpenZeppelin/openzeppelin-contracts@4.3.2' # automatically fetch contract sources from Etherscan autofetch_sources: True # Uncomment to use the .env file @@ -29,8 +29,8 @@ networks: link_token: '0xa36085F69e2889c224210F603D836748e7dC0088' keyhash: '0x6c3699283bda56ad74f6b855546325b68d482e983852a7a82979cc4807b641f4' fee: 100000000000000000 - oracle: '0x2f90A6D021db21e1B2A077c5a37B3C7E75D15b7e' - jobId: '29fa9aa13bf1468788b7cc4a500a45b8' + oracle: '0xc57b33452b4f7bb189bb5afae9cc4aba1f7a4fd8' + jobId: 'd5270d1c311941d0b08bead21fea7747' eth_usd_price_feed: '0x9326BFA02ADD2366b30bacB125260Af641031331' # Change to True if you have an Etherscan API key and want to verify verify: False @@ -46,8 +46,8 @@ networks: link_token: '0x01be23585060835e02b77ef475b0cc51aa1e0709' keyhash: '0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311' fee: 100000000000000000 - oracle: '0x7AFe1118Ea78C1eae84ca8feE5C65Bc76CcF879e' - jobId: '6d1bfe27e7034b1d87b5270556b17277' + oracle: '0xc57b33452b4f7bb189bb5afae9cc4aba1f7a4fd8' + jobId: '6b88e0402e5d415eb946e528b8e0c7ba' eth_usd_price_feed: '0x8A753747A1Fa494EC906cE90E9f37563A8AF630e' # Change to True if you have an Etherscan API key and want to verify verify: False diff --git a/contracts/APIConsumer.sol b/contracts/APIConsumer.sol index 4933f68..d396883 100644 --- a/contracts/APIConsumer.sol +++ b/contracts/APIConsumer.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.6.6; +pragma solidity ^0.8.0; -import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol"; +import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol"; contract APIConsumer is ChainlinkClient { - + using Chainlink for Chainlink.Request; uint256 public volume; address private oracle; @@ -17,7 +17,7 @@ contract APIConsumer is ChainlinkClient { * Job ID: 29fa9aa13bf1468788b7cc4a500a45b8 * Fee: 0.1 LINK */ - constructor(address _oracle, string memory _jobId, uint256 _fee, address _link) public { + constructor(address _oracle, string memory _jobId, uint256 _fee, address _link) { if (_link == address(0)) { setPublicChainlinkToken(); } else { diff --git a/contracts/Counter.sol b/contracts/Counter.sol index 470cc92..73de0ad 100644 --- a/contracts/Counter.sol +++ b/contracts/Counter.sol @@ -1,10 +1,7 @@ -pragma solidity ^0.6.7; +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; - -interface KeeperCompatibleInterface { - function checkUpkeep(bytes calldata checkData) external returns (bool upkeepNeeded, bytes memory performData); - function performUpkeep(bytes calldata performData) external; -} +import "@chainlink/contracts/src/v0.8/interfaces/KeeperCompatibleInterface.sol"; contract Counter is KeeperCompatibleInterface { /** @@ -20,7 +17,7 @@ contract Counter is KeeperCompatibleInterface { uint public lastTimeStamp; - constructor(uint updateInterval) public { + constructor(uint updateInterval) { interval = updateInterval; lastTimeStamp = block.timestamp; diff --git a/contracts/PriceFeedConsumer.sol b/contracts/PriceFeedConsumer.sol index c897abf..ab05d2b 100644 --- a/contracts/PriceFeedConsumer.sol +++ b/contracts/PriceFeedConsumer.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.6.6; +pragma solidity ^0.8.0; -import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; +import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; contract PriceFeedConsumer { @@ -18,7 +18,7 @@ contract PriceFeedConsumer { * Aggregator: ETH/USD * Address: 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419 */ - constructor(address AggregatorAddress) public { + constructor(address AggregatorAddress) { priceFeed = AggregatorV3Interface(AggregatorAddress); } diff --git a/contracts/VRFConsumer.sol b/contracts/VRFConsumer.sol index c4ebadd..ffa708b 100644 --- a/contracts/VRFConsumer.sol +++ b/contracts/VRFConsumer.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT -pragma solidity 0.6.6; +pragma solidity ^0.8.0; -import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol"; +import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol"; contract VRFConsumer is VRFConsumerBase { @@ -22,7 +22,7 @@ contract VRFConsumer is VRFConsumerBase { VRFConsumerBase( _vrfCoordinator, // VRF Coordinator _linkToken // LINK Token - ) public + ) { keyHash = _keyhash; // fee = 0.1 * 10 ** 18; // 0.1 LINK diff --git a/tests/test_vrf.py b/tests/test_vrf.py index 7937f17..026ff02 100644 --- a/tests/test_vrf.py +++ b/tests/test_vrf.py @@ -72,7 +72,7 @@ def test_returns_random_number_testnet( transaction_receipt = vrf_consumer.getRandomNumber({"from": get_account()}) assert isinstance(transaction_receipt.txid, str) transaction_receipt.wait(1) - time.sleep(35) + time.sleep(90) # Assert assert vrf_consumer.randomResult() > 0 assert isinstance(vrf_consumer.randomResult(), int)