You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are trying to follow the lessons but here and there throw in some own ideas on how to write a function etc. You will sooner or later reach a point, where your code doesn't compile and you just don't know why.
compare and isolate
If you are somehow true to the code of the lesson but your code just doesn't compile, you can always download the repository and check if the repo code compiles.
getting the original
Here is in short what I would do to get the original repo:
cd ..
mkdir project_from_repo
cd project_from_repo
brownie init
cd ..
mkdir temp
cd temp
copy the GitHub Cli code and paste it into the terminal
gh repo clone PatrickAlphaC/smartcontract-lottery
Then after the repo is downloaded copy the folders contracts, interfaces, scripts, and tests and paste-overwrite them into the newly created and initialized project_from_repo folder.
Important: Try to compile the original repo. If this doesn't work either, you have to find out why. All the following steps only make sense if you have a running version.
comparing
I am on Windows so notepad++ is a natural choice for me. Here is how to install the right plugin. Open Notepad++ and open Plugins > Plugins Admin. Here search for "compare" and install it.
After installation, you will have in the plugins menu the compare feature. First, open the two files to compare then open the compare menu and add the first file to compare and then the second file to compare with.
Here is a simplified example of how it would look like when I would have omitted one important line.
If your code is structured differently, it makes sense to first structure it in the same order compared to the original. Arrange the import statements, the instantiation of variables, and the function in the same order. Don't care if you have more or fewer variables, this is easy to compare. But if both documents are structurally the same it is much easier to find the differences.
isolating
OK, now that I know the differences and have not yet spotted an error, I can start moving some of my code that is different to the bottom of the file, comment it out, and replace it with the original code.
This is now a cycle of trial and error. Try to find out which part of your code doesn't compile. The circle should get increasingly narrower when replacing your code with the original. At one point (hopefully before both files look identical) the code should start to work. Now it is time to bring back the parts which were yours but which worked.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
If you are trying to follow the lessons but here and there throw in some own ideas on how to write a function etc. You will sooner or later reach a point, where your code doesn't compile and you just don't know why.
compare and isolate
If you are somehow true to the code of the lesson but your code just doesn't compile, you can always download the repository and check if the repo code compiles.
getting the original
Here is in short what I would do to get the original repo:
copy the GitHub Cli code and paste it into the terminal
![image](https://user-images.githubusercontent.com/32838961/158080187-16d773d2-bd84-442f-ba5c-d99d78807fdb.png)
gh repo clone PatrickAlphaC/smartcontract-lottery
Then after the repo is downloaded copy the folders
contracts
,interfaces
,scripts
, andtests
and paste-overwrite them into the newly created and initializedproject_from_repo
folder.Important: Try to compile the original repo. If this doesn't work either, you have to find out why. All the following steps only make sense if you have a running version.
comparing
I am on Windows so notepad++ is a natural choice for me. Here is how to install the right plugin. Open Notepad++ and open Plugins > Plugins Admin. Here search for "compare" and install it.
![image](https://user-images.githubusercontent.com/32838961/158079230-18536a83-d183-481f-adeb-7d25149f140f.png)
After installation, you will have in the plugins menu the compare feature. First, open the two files to compare then open the compare menu and add the first file to compare and then the second file to compare with.
Here is a simplified example of how it would look like when I would have omitted one important line.
![image](https://user-images.githubusercontent.com/32838961/158079624-d7fcebc0-cf26-4de3-bf13-0e47fc729745.png)
If your code is structured differently, it makes sense to first structure it in the same order compared to the original. Arrange the import statements, the instantiation of variables, and the function in the same order. Don't care if you have more or fewer variables, this is easy to compare. But if both documents are structurally the same it is much easier to find the differences.
isolating
OK, now that I know the differences and have not yet spotted an error, I can start moving some of my code that is different to the bottom of the file, comment it out, and replace it with the original code.
This is now a cycle of trial and error. Try to find out which part of your code doesn't compile. The circle should get increasingly narrower when replacing your code with the original. At one point (hopefully before both files look identical) the code should start to work. Now it is time to bring back the parts which were yours but which worked.
Beta Was this translation helpful? Give feedback.
All reactions