Replies: 1 comment 3 replies
-
Nice approach @n4n0b1t3, also please everyone take in consideration the base price Patrick uses as reference es for ETH to be 2000 USD dollars, if you want a more precise approach please use this links: |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If you wrote your test in Lesson 6 without first checking the repository to see what the final version looks like, you will have come across a strange error:
E AttributeError: 'NoneType' object has no attribute '_with_attr'
I cannot tell from the error message what happened here. Only a look at the repository shows that 100 Wei were added to the entrance_fee as a buffer so that the conversion does not end up below the admission threshold.
I, therefore, suggest extending the test as follows, so that it then becomes quite clear what went wrong. This is especially important if you don't have a working template but write your own code.
Here I add a test for the assumption that the entrance_fee is actually sufficient to clear the participation hurdle. To make this even clearer in the test, I have added two print statements that show the sums to be compared.
The above code will break at the assert and tell me something useful
To be able to read the included print statements in the test, you have to start the test with the -s flag.
(.venv) fund_me>brownie test -s
In real life, of course, I would round the numbers generously to ensure that such a thing could not happen.
disclaimer: my entire codebase in this lesson differs a little from the repository, so you might run into bugs when directly copying it into your code. I am an absolute noob, when it comes to writing tests, I am sure, there is a much more elegant way of doing it. Use the comments to point out better ways of doing this or ask any related questions.
Beta Was this translation helpful? Give feedback.
All reactions