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

getting UniswapV2: LOCKED error #159

Open
Samboy76 opened this issue May 23, 2023 · 1 comment
Open

getting UniswapV2: LOCKED error #159

Samboy76 opened this issue May 23, 2023 · 1 comment

Comments

@Samboy76
Copy link

Samboy76 commented May 23, 2023

Hi Uniswap team,

I've encountered an issue when trying to integrate with Uniswap, didn't find anything on google which is similar.

I'm using Hardhat deployment (forking mainnet)
MS Visual Studio IDE

I´ve taken out a flashloan for USDC token0 amount from uniswap_router, let´s say 1 USDC as an example, and then attempted to perform a swap using this 1 USDC flashloan amount to WETH on the same uniswap_router within the same transaction which I was told it is possible to do on the same router without the LOCKED error occuring.

Here´s the following code snippet which illustrates a simple contract which attempts to exchange USDC -> WETH (and erc20 token)

`
address[] memory path = new address;
path[0] = usdc; ()
path[1] = weth; ()

uint[] memory amounts = IUniswapV2Router02(uniswap_router).swapExactTokensForTokens(1, path, address(this), now + 15);
return amounts[1];`

uniswap_router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
USDC = 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48

From that call I get UniswapV2: LOCKED which, after looking around, only appears in UniswapV2Pair.sol (https://github.com/Uniswap/v2-core/blob/master/contracts/UniswapV2Pair.sol)

What did I do wrong here?

@Salah-SH
Copy link

did you solve the issue?

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

2 participants