Skip to content
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

Unauthorized after deployment #2

Open
eth0izzle opened this issue Feb 9, 2021 · 5 comments
Open

Unauthorized after deployment #2

eth0izzle opened this issue Feb 9, 2021 · 5 comments

Comments

@eth0izzle
Copy link

eth0izzle commented Feb 9, 2021

Hey, I'm pretty new to the smart contract world - a lot of take in for sure. I've deployed your contract to mainnet and I'm trying to execute it but receiving a "execution reverted: Unauthorized" error. It looks like it might be from this line:

  require(msg.sender == UniswapV2Library.pairFor(factory, token0, token1), "Unauthorized"); 

Any ideas what I could be missing? My wallet private key is correct and matches the account that deployed the flash contract.

@egoid
Copy link

egoid commented Feb 17, 2021

I'm getting the same error on my end and have validated the same..

Any guidance is appreciated.

@eth0izzle
Copy link
Author

I've still not figured it out. Did you deploy the migrations?

@cwazy2020
Copy link

cwazy2020 commented Feb 25, 2021

The issue is that the function they included is meant to be called by the pair contract after they transfer tokens to you as part of a swap() call. They did not include the initial call to swap() in this example, so we are left to guess to figure out how to do that on our own.

@eth0izzle
Copy link
Author

Were you able to figure it out @cwazy2020 ?

@6eer
Copy link

6eer commented Apr 19, 2021

Were you able to figure it out @cwazy2020 ?

the issue is the library UniswapV2Library.sol, the method getPair(...) have hard coded some init code that its developer dependant, so if u are using a sushi pair u might be using sushiswap's version of UniswapV2Library.sol, its available in their repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants