fund_me's People
Forkers
aldine1 ackais archon99 pawanchan07 stecava92 plinki alexgonzdev chengzudong orik03 irwingtello kadeembobcombedev offgridauthor blockchain-course chanleyou yepman0620 kamblepratik90 vjogeshwar cywillwill jzohdi hassanmahmud blackstall amadeus-lio samratkar77 knagy3 hansfriese momoclassroom thedanielhui tkhieu nazihkalo docmab23 nipy550 patval7 rachitcloudlendinginc alex067 obtmbaasit kevinshimotakahara shahronak joshemond dcamy niketmittal aviralgoel dabors lkn4wrk omgbbqhaxx cipaterson emrahsariboz glitch-r samik-saha lakshitha1629 szainalie kidofomnia bradystibi wisemoon88 balajeerocks npazymino farshad127 jafd08 sunnymunna akash89 kwizerimana elhadjaoui manuel-capel anibus rookiepython21 ilici-ramirez jmjohnmcgovern707 anaslachheb iluxonchik chase-lipari vaibhav0726 rastin shivanshaggarwal xblue-light junlin525 shashwatm3 combonet-technology darkato42 mlb302 kam0teq mahabaraket chanauria 0xflt marginalfriend armin-seddighi hemant933fund_me's Issues
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
Hi patrick
I dont understand this syntax
There isnt the following formul in the AggregatorV3Interface.sol
AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
what do you make in this code ?
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
and
how can the following code give us version ? This code only include version() function, there no input, where does come from version output?
priceFeed.version()
Sincerely
Verification of contract
Hi there,
I'm at the point of the course where you get the API key token from etherscan.io.
I followed all the steps, but my code breaks here:
fund_me = FundMe.deploy({"from": account}, publish_source=False)
and this is the error I get:
File "eth_brownie-1.19.3-py3.9.egg/brownie/network/contract.py", line 411, in publish_source
data = response.json()
File "requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
JSONDecodeError: Expecting value: line 2 column 1 (char 1)
I saw somewhere online that they said perhaps because I'm passing an empty variable, I've got the api key token in my .env file. I tried with wrap it in single quotes, double quotes and no quotes, still nothing.
Google has not been much use. Anyone can help?
Remove getConversionRate() in require statement for FundMe.sol
Hi,
I was having problems debugging this section as it seems like getConversionRate()
does not need to be in the 'require()' statement; line 21. My code was not acting the same, as in, MetaMask was not opening up immediately after I clicked fund for values that were greater than or equal to the minimumUSD. At time 3:06:36, my Metamask still pops up when my eth is lower than the minimum, but when I remove the getConversionRate()
it works properly. With getConversionRate()
in the logical statement, minimumUSD is comparing to nothing really it seems so that line is not really doing anything, then it goes to the next line.
This will help you understand exactly what I am talking about:
I did different values and after I deployed and tried 4000000000000000 wei for the fund button it still worked (lower values like 0, 10, 50000 worked as in the gas error came up with the string). Only values of 5000000000000000 or higher for the fund button should work (after deploying with 0), and this only worked properly when I took out getConversionRate()
.
function fund() public payable {
uint256 minimumUSD = 5 * 10 ** 15;
require(getConversionRate(msg.value) >= minimumUSD, "You need to spend more ETH!");
addressToAmountFunded[msg.sender] += msg.value;
}
working code with values like 4000000000000000 wei (as in MetaMask should not come up.)
function fund() public payable {
uint256 minimumUSD = 5 * 10 ** 15;
require(msg.value >= minimumUSD, "You need to spend more ETH!");
addressToAmountFunded[msg.sender] += msg.value;
}
ParserError: Source file requires different compiler version
I used the same version in the tutorial and here is what error I am facing. I copied the same compiler
"send" and "transfer" are only available for objects of type "address payable", not "address"
I see the above error while compiling
" ```
function withdraw() payable public {
msg.sender.transfer(address(this).balance);
}
"
However, If I add import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol"; it works fine,
I am not sure this import is helping in rectifying the issue.
Any pointers will be helpful.
Lesson 6 (Brownie FundMe) - FileNotFoundError: Cannot find scripts/deploy.py
I have managed to compile the contract but when I do to deploy it brownie gives this error:
FileNotFoundError: Cannot find scripts/deploy.py
Earlier on it says this too:
"/Users/NAME/.local/pipx/venvs/eth-brownie/lib/python3.10/site-packages/brownie/project/main.py:743: BrownieEnvironmentWarning: Loaded project has a root folder of '/Users/NAME/demos/brownie_fundme' which is different from the current working directory
warnings.warn(
BrownieFundmeProject is the active project."
So im guessing the project has a seperate root folder from the CWD. But I cant find how to address this. Can anyone help
AggregatorV3Interface is not working
`
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
// Get the latest ETH/USD price from chainlink price feed
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
import "@chainlink/contracts/src/v0.6/vendor/SafeMathChainlink.sol";
contract FundMe {
//function to get the version of the chainlink pricefeed
function getVersion() public view returns (uint256){
AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
return priceFeed.version();
}
I used Compiler 6.1.0+commit.e6f7d5a4 its compiled successfully but when I deploy the contract and call getVersion() or getPrice() method I get
call to FundMe.getPrice errored: VM execution error.
Reverted 0x
Checking price/conversion rate no longer works.
"The called function should be payable if you send value and the value you send should be less than your current balance"
"transfer" are only available for objects of type "address payable", not "address".
Hi, can anyone help me, I was trying on this code but whenever I compile it, remix gives me an error saying TypeError: "send" and "transfer" are only available for objects of type "address payable", not "address". I got this error from the function withdraw() public payable onlyOwner {msg.sender.transfer(address(this).balance; for(...) }. I just copied and pasted the code from the github repo and change the import for the aggregatorv3interface to import "https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; and removed the SafeMath import line. I'm also using compiler version 0.8.7. Thanks in advance.
call to FundMe.getPrice errored: execution reverted
i'm getting this error when executing the function ( GET Price ) tried copy pasting your code , im on ropsten test network , coz rinkeby faucet not working for me. Please tell me if i'm getting error because of this ? (that i'm on ropsten network )
Divide instead of multiply for getting right etherium price.
Line number 34
return uint256(answer * 100000000);
to
return uint256(answer / 100000000);
and replace
Line 40
uint256 ethAmountInUsd = (ethPrice * ethAmount) / 1000000000000000000;
to
uint256 ethAmountInUsd = (ethPrice * ethAmount) ;
Fund
I'm having an issue with the Fund function, I've gone through all the issues here but not finding a solution that works. I get the same error for any fund amount, from any wallet, in gwie, and wie. The error I get is the one expected when funding with the wrong amount.
I'm pretty new to all of this so guessing the issue is user error but I am a bit lost here. If I comment out
uint256 minimumUSD = 50 * 10 ** 18;
and require(getConversionRate(msg.value) >= minimumUSD, "You need to spend more ETH!");
Everything works.
Is this user error or.?.My code below for reference
`// SPDX-License-Identifier: MIT
pragma solidity >=0.6.6 <0.9.0;
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 {
//The next two line fail every transaction, need to sort out what is going on here
uint256 minimumUSD = 50 * 10 ** 18;
require(getConversionRate(msg.value) >= minimumUSD, "You need to spend more ETH!");
// found on GitHub... didn't work
// require(getConversionRate(msg.value / 10 ** 9) >= minimumUSD, "You need to spend more ETH!");
addressToAmountFunded[msg.sender] += msg.value;
funders.push(msg.sender);
}
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 uint256(answer * 10000000000);
}
// 1000000000
function getConversionRate(uint256 ethAmount) public view returns (uint256){
uint256 ethPrice = getPrice();
uint256 ethAmountInUsd = (ethPrice * ethAmount) / 1000000000000000000;
return ethAmountInUsd;
}
modifier onlyOwner {
require(msg.sender == owner, "Why you try to take our money? :(");
_;
}
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);
}
}
`
error in withdraw() function
Whenever i run this code msg.sender.transfer(address(this).balance); inside withdraw() function Remix IDE is giving an error
(send and transfer are only available for objects of type "address payable" not address.)
I even copy pasted whole code still getting same error.
Lesson 3: FundMe minimumUSD bug
Thanks for putting these courses together! They've been really helpful in my progress to building decentralized applications.
I think I may have found a bug in Lesson 3 for the FundMe exercise. When trying to specify a minimum $50 USD funding amount, it should take in to account the current price of ETH for the conversion.
Currently, line 20 is:
uint256 minimumUSD = 50 * 10 ** 18;
I think this should be adjusted to
uint256 minimumUSD = (50 / getPrice()) * 10 ** 18;
Code Line 86,87 | withraw function
function withdraw() public payable onlyOwner {
msg.sender.transfer(address(this).balance);
On running this, compiler GPT returns the following -
The error occurred because the `transfer` function is only available for objects of type "address payable", but `msg.sender` is of type "address". To fix the error, you can change the `msg.sender` type to "address payable" by adding the `payable` keyword.
Here is the corrected code:
```solidity
function withdraw() public {
address payable recipient = payable(msg.sender);
recipient.transfer(address(this).balance);
}
By declaring `recipient` as type "address payable" and assigning it the value of `msg.sender`, you can then use `recipient.transfer` to transfer the balance to the sender's address.
From 0.8.0 onwards, explicit conversions between literals and the address type result in an address type rather than address payable. The original code should work without needing to cast msg.sender to a payable type.
However, with compiler set to 0.8.18+ and pragma solidity >= 0.6.6 < 0.9.0, I still see the error. Is there a compilation error or version fix I need to do to make the original code work?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.