-
Notifications
You must be signed in to change notification settings - Fork 33
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
Part 3 and 4 Update to UniswapV2Pair() references #7
base: main
Are you sure you want to change the base?
Conversation
In parts 3 and 4, UniswapV2Pair() does not take arguments, so the references to "pair.***" were broken. I'm not sure how this worked on the live stream, but to get it to compile, I had to change the pair function calls to use abi.encodeWithSignature() using the pair address created by the factory in the initialization. All references to the pair in parts 3 and 4 are updated, so the scripts should now compile out of the box. Since I'm fairly new to Solidity and Echidna, I'd love to get some feedback on this, especially if I missed something in the original implementation.
Ziion seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Hello, |
Update: I'm not sure, but I think my compiler couldn't tell the difference between casting with UniswapV2Pair(address) and calling UniswapV2Pair("constructorArgsHere"). That's what I meant when I said it doesn't take arguments (the constructor expects 0 inputs). I'm not sure how to get it to compile for me without making the changes that I've made because "pair" ends up not being recognized by the compiler in the original version of the code |
Can I see the exact error you are getting and the fixes you have made? |
Sorry about that, I just tried a fresh repo and it works fine. I'm still not sure what the problem was, but being new to solidity and echidna, I must have inadvertently made a mistake and didn't notice (I may have run echidna with the wrong options or from the wrong folder??). You can check out the changes I made in the pull request if you're interested. Instead of casting the pair address to the type UniswapV2Pair, I used the pair address and it's function signatures to create low level calls to the pair. Correct me if I'm wrong, but I think the functionality should be the same. It was a good learning experience for me either way. Thanks for the help |
In parts 3 and 4, UniswapV2Pair() does not take arguments, so the references to " pair.**** " were broken. I'm not sure how this worked on the live stream, but to get it to compile for me, I had to change the pair function calls to use abi.encodeWithSignature() using the pair address created by the factory in the initialization. All references to the pair in parts 3 and 4 are updated, so the scripts should now compile out of the box. Since I'm fairly new to Solidity and Echidna, I'd love to get some feedback on this, especially if I missed something in the original implementation.