-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lesson 6 VM Exception Running fund and withdraw #901
Comments
Hello @strudelPie Based on the error I have 2 hypothesis, meanwhile I do more research on this plz check the following:
|
@cromewar thank you. So adjusting gas price (added a whole bunch of zeros) didn't make a difference. I agree the issue must be with the mocks, but I have no idea why. In case it helps, I have noticed that if there are already existing build files then running deploy.py looks like it doesn't run correctly and I only get the output below. As above, I still get the error either way, but I add it in case it might help(?) |
Try deleting the build folder and try again I'll do more research on this meanwhile. |
Yeh no joy with deleting the build folder I'm afraid. That's what I was attempting when I discovered the issue with deploy.py (my most recent comment)... |
I think the problem is most likely here: you've commented the getEntranceFee,r the minimum entrance fee is $50, use this page and you'll get something like this: which is this amount of ETH I suggest you to use the actual function to get the entrance fee and here:
Also if you are going to use a fixed amount is better to use |
Hello again. Thanks but I think you slightly mis-read my original. Commenting out as I did the getEntranceFee() call made the code work fine. Hence I was showing it to highlight where the issue is. I have just tried using the original line: As you can see below, this does work, but the entrance fee variable is still being brought in as zero. But, as with me replacing the entrance_fee variable, this is really just a bit of a fix and still doesn't tell me why the function call isn't working. I m happy at this point to move onto Lesson 7, but still a little puzzled. |
Oh, dont' worry about it, this happens as we are using Chainlink, is normal for it to return zero, this is asynchronous function, you don't have to worry about it, if you want to wait, you could manually set the script to wait maybe 5 minutes. |
Sorry- I don't quite understand. You're saying it's normal for getEntranceFee() to return zero? But this gives me the VM error. Why even have the function? It also seems to work fine for Patrick in the tutorial. |
As normal I'm saying that if you don't wait enough it will give you that, I strongly suggest you to test this on Rinkeby and you'll see the entrance fee will work just gine. |
Posting as a new issue as requested here: https://github.com/smartcontractkit/full-blockchain-solidity-course-py/discussions/422#discussioncomment-2066946. However this is a follow-on from #422.
I'm getting a VM error when calling fund_me.getEntranceFee() within fund_and_withdraw.py. I have been using ganache-local but it replicates. Here's the walkthrough:
deploy.py working fine:
VM error when running fund_and_withdraw.py
You can see that the entrance fee is pulled in as zero and the code errors (as with #422 linked above). Now, when I set the variable 'entrance_fee' manually as immediately below, the script works:
The main fix suggested in #422 was to change the hardfork within ganache, however I am already on MUIRGLACIER:
So my code: it differs from the code available in the course repo for this lesson in three ways:
(1) MockAggregatorV3.sol: I've made minor changes to my code in line with #875. However I have tried reverting it back to the the lesson 6 code available in the course repo and that doesn't make any difference to the error as above.
(2) FundMe.sol: my code now matches the suggestion from this stack post: https://ethereum.stackexchange.com/a/120224/92713 This was in an attempt to see if the fix works for me. It does not. Again, reverting back the the course repo code still produces the error.
(3) helpful_scripts.py now includes this suggsted fix: https://github.com/smartcontractkit/full-blockchain-solidity-course-py/discussions/422#discussioncomment-1723728
In case it's easier to review, here's the code as is:
helpful_scripts.py
fund_and_withdraw.py
deploy.py
The text was updated successfully, but these errors were encountered: