Closed Gypsaman closed 3 years ago
Testing the brownie-config.yaml from the tutorial Solidity, BlockChain, and Smart Contract Course - Beginner to Expert Python timestamp 5:11:02 https://youtu.be/M576WGiDBdQ?t=18662
I got this: Invalid NPM block
brownie-config.yaml dependencies:
FundMe.sol // SPDX-License-Identifier: MIT
pragma solidity ^0.6.6
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
contract FundMe {
using SafeMathChainlink for uint256;
mapping(address => uint256) public addressToAmountFunded;
address[] public funders;
address public owner;
constructor() public {
owner = msg.sender;
}
function fund() public payable {
uint minimumUSD = 50 * 10 ** 18;
require(getConversionRate(msg.value) >= minimumUSD, "You need to spend more ETH! reminder by: Marco Rado");
addressToAmountFunded[msg.sender] += msg.value;
funders.push(msg.sender);
}
function getVersion() public view returns (uint256) {
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x9326BFA02ADD2366b30bacB125260Af641031331);
return priceFeed.version();
}
function getPrice() public view returns(uint256) {
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x9326BFA02ADD2366b30bacB125260Af641031331);
(,int256 answer,,,) = priceFeed.latestRoundData();
return uint256(answer * 10000000000);
//4,143.080000000000000000
}
function getConversionRate(uint256 ethAmount) public view returns (uint256) {
uint ethPrice = getPrice();
uint ethAmountInUsd = (ethPrice * ethAmount) / 1000000000000000000;
return ethAmountInUsd;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function withdraw() payable onlyOwner public {
msg.sender.transfer(address(this).balance);
for (uint256 funderIndex=0; funderIndex < funders.length; funderIndex++) {
address funder = funders[funderIndex];
addressToAmountFunded[funder] = 0;
}
funders = new address[](0);
}
}
Make sure the .yaml is typed in correctly. I didn't have a space between "-" and "smartcontractkit...."
You seem to have the same issues.
dependencies:
On Tue, Oct 26, 2021 at 10:36 PM MarcoRado7 @.***> wrote:
Testing the brownie-config.yaml from the tutorial Solidity, BlockChain, and Smart Contract Course - Beginner to Expert Python timestamp 5:11:02 https://youtu.be/M576WGiDBdQ?t=18662
I got this: Invalid NPM block [image: image] https://user-images.githubusercontent.com/92903574/138990070-b4aa453c-3ee9-49cb-a872-5e27fc006ee7.png
brownie-config.yaml dependencies:
<organization/repo>@
- @.*** compiler: solc: remappings:
- @. https://github.com/chainlink @.'
FundMe.sol // SPDX-License-Identifier: MIT
pragma solidity ^0.6.6
import @./contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; import @./contracts/src/v0.6/vendor/SafeMathChainlink.sol";
contract FundMe {
using SafeMathChainlink for uint256;
mapping(address => uint256) public addressToAmountFunded; address[] public funders; address public owner;
constructor() public { owner = msg.sender; }
function fund() public payable { uint minimumUSD = 50 * 10 ** 18; require(getConversionRate(msg.value) >= minimumUSD, "You need to spend more ETH! reminder by: Marco Rado"); addressToAmountFunded[msg.sender] += msg.value; funders.push(msg.sender); }
function getVersion() public view returns (uint256) { AggregatorV3Interface priceFeed = AggregatorV3Interface(0x9326BFA02ADD2366b30bacB125260Af641031331); return priceFeed.version(); }
function getPrice() public view returns(uint256) { AggregatorV3Interface priceFeed = AggregatorV3Interface(0x9326BFA02ADD2366b30bacB125260Af641031331); (,int256 answer,,,) = priceFeed.latestRoundData(); return uint256(answer * 10000000000); //4,143.080000000000000000 }
function getConversionRate(uint256 ethAmount) public view returns (uint256) { uint ethPrice = getPrice(); uint ethAmountInUsd = (ethPrice * ethAmount) / 1000000000000000000; return ethAmountInUsd; }
modifier onlyOwner { require(msg.sender == owner); _; }
function withdraw() payable onlyOwner public { msg.sender.transfer(address(this).balance); for (uint256 funderIndex=0; funderIndex < funders.length; funderIndex++) { address funder = funders[funderIndex]; addressToAmountFunded[funder] = 0; } funders = new address; }
}
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/smartcontractkit/chainlink-brownie-contracts/issues/6#issuecomment-952485416, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFIFDGE7OZITJFPNYZ76MS3UI5QS5ANCNFSM5GY7AG4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Nice work :) Closing for now.
I'm using this for the brownie fundme.sol example.
dependencies: -smartcontractkit/chainlink-brownie-contracts@0.2.2 compiler: solc: remappings: -'@chainlink=smartcontractkit/chainlink-brownie-contracts@0.2.2
'