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

Enhancement: minimize diagnostic output #1538

Open
bkushigian opened this issue Sep 16, 2023 · 1 comment
Open

Enhancement: minimize diagnostic output #1538

bkushigian opened this issue Sep 16, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@bkushigian
Copy link

I've been digging through a lot of parser diagnostics, and some relatively minor errors can cause huge outputs (thousands of lines for a single bug).

The mechanism that causes the blowup is:

  1. File A file has an error. This adds an error to diagnostics
  2. File B tries to import file A, but fails due to error from (1)
  3. Rather than stop visiting B, solang tries to finish resolution of B
  4. All references to things from A generate new diagnostics
  5. File C imports B ... (and so on)

While this isn't strictly a bug, I think minimizing this output is crucial for giving users good feedback.

@xermicus
Copy link
Contributor

Yes this is a very valid bug report. The compiler sometimes creates many spurious diagnostics in this situation. Thanks for reporting. The general idea is to continue analysing the code even if there are errors. While this might be useful sometimes, it is not implement correct currently, leading to many spurious errors.

For example, compiling the uniswap v2 route UniswapV2Router02.sol, where there is only a single problem in one of its imports. It should just report this, because it's the only problem:

error: 'foo' not found
   ┌─ /home/cyrill/mess/sub0/lib/contracts/libraries/TransferHelper.sol:12:3
   │
12 │         foo = 0;
   │         ^^^
Instead, I get this diagnostics output
error: 'IUniswapV2Router02' not found
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:12:31
   │
12 │ contract UniswapV2Router02 is IUniswapV2Router02 {
   │                               ^^^^^^^^^^^^^^^^^^

error: 'factory' does not override anything
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:15:39
   │
15 │     address public immutable override factory;
   │                                       ^^^^^^^

error: 'WETH' does not override anything
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:16:39
   │
16 │     address public immutable override WETH;
   │                                       ^^^^

warning: 'public': visibility for constructors is ignored
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:23:50
   │
23 │     constructor(address _factory, address _WETH) public {
   │                                                  ^^^^^^

error: 'UniswapV2Library' not found
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:45:42
   │
45 │         (uint reserveA, uint reserveB) = UniswapV2Library.getReserves(factory, tokenA, tokenB);
   │                                          ^^^^^^^^^^^^^^^^

error: 'addLiquidity' does not override anything
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:61:5
   │  
61 │ ╭     function addLiquidity(
62 │ │         address tokenA,
63 │ │         address tokenB,
64 │ │         uint amountADesired,
   · │
69 │ │         uint deadline
70 │ │     ) external virtual override ensure(deadline) returns (uint amountA, uint amountB, uint liquidity) {
   │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:72:24
   │
72 │         address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
   │                        ^^^^^^^^^^^^^^^^

error: 'addLiquidityETH' does not override anything
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:77:5
   │  
77 │ ╭     function addLiquidityETH(
78 │ │         address token,
79 │ │         uint amountTokenDesired,
80 │ │         uint amountTokenMin,
   · │
83 │ │         uint deadline
84 │ │     ) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) {
   │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:93:24
   │
93 │         address pair = UniswapV2Library.pairFor(factory, token, WETH);
   │                        ^^^^^^^^^^^^^^^^

error: 'removeLiquidity' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:103:5
    │  
103 │ ╭     function removeLiquidity(
104 │ │         address tokenA,
105 │ │         address tokenB,
106 │ │         uint liquidity,
    · │
110 │ │         uint deadline
111 │ │     ) public virtual override ensure(deadline) returns (uint amountA, uint amountB) {
    │ ╰───────────────────────────────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:112:24
    │
112 │         address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
    │                        ^^^^^^^^^^^^^^^^

error: 'removeLiquidityETH' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:120:5
    │  
120 │ ╭     function removeLiquidityETH(
121 │ │         address token,
122 │ │         uint liquidity,
123 │ │         uint amountTokenMin,
    · │
126 │ │         uint deadline
127 │ │     ) public virtual override ensure(deadline) returns (uint amountToken, uint amountETH) {
    │ ╰─────────────────────────────────────────────────────────────────────────────────────────^

error: unknown function or type 'removeLiquidity'
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:128:36
    │
128 │         (amountToken, amountETH) = removeLiquidity(
    │                                    ^^^^^^^^^^^^^^^

error: 'removeLiquidityWithPermit' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:141:5
    │  
141 │ ╭     function removeLiquidityWithPermit(
142 │ │         address tokenA,
143 │ │         address tokenB,
144 │ │         uint liquidity,
    · │
149 │ │         bool approveMax, uint8 v, bytes32 r, bytes32 s
150 │ │     ) external virtual override returns (uint amountA, uint amountB) {
    │ ╰────────────────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:151:24
    │
151 │         address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
    │                        ^^^^^^^^^^^^^^^^

error: 'removeLiquidityETHWithPermit' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:156:5
    │  
156 │ ╭     function removeLiquidityETHWithPermit(
157 │ │         address token,
158 │ │         uint liquidity,
159 │ │         uint amountTokenMin,
    · │
163 │ │         bool approveMax, uint8 v, bytes32 r, bytes32 s
164 │ │     ) external virtual override returns (uint amountToken, uint amountETH) {
    │ ╰──────────────────────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:165:24
    │
165 │         address pair = UniswapV2Library.pairFor(factory, token, WETH);
    │                        ^^^^^^^^^^^^^^^^

error: 'removeLiquidityETHSupportingFeeOnTransferTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:172:5
    │  
172 │ ╭     function removeLiquidityETHSupportingFeeOnTransferTokens(
173 │ │         address token,
174 │ │         uint liquidity,
175 │ │         uint amountTokenMin,
    · │
178 │ │         uint deadline
179 │ │     ) public virtual override ensure(deadline) returns (uint amountETH) {
    │ ╰───────────────────────────────────────────────────────────────────────^

error: unknown function or type 'removeLiquidity'
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:180:25
    │
180 │         (, amountETH) = removeLiquidity(
    │                         ^^^^^^^^^^^^^^^

error: 'removeLiquidityETHWithPermitSupportingFeeOnTransferTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:193:5
    │  
193 │ ╭     function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
194 │ │         address token,
195 │ │         uint liquidity,
196 │ │         uint amountTokenMin,
    · │
200 │ │         bool approveMax, uint8 v, bytes32 r, bytes32 s
201 │ │     ) external virtual override returns (uint amountETH) {
    │ ╰────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:202:24
    │
202 │         address pair = UniswapV2Library.pairFor(factory, token, WETH);
    │                        ^^^^^^^^^^^^^^^^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:215:33
    │
215 │             (address token0,) = UniswapV2Library.sortTokens(input, output);
    │                                 ^^^^^^^^^^^^^^^^

error: 'swapExactTokensForTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:224:5
    │  
224 │ ╭     function swapExactTokensForTokens(
225 │ │         uint amountIn,
226 │ │         uint amountOutMin,
227 │ │         address[] calldata path,
228 │ │         address to,
229 │ │         uint deadline
230 │ │     ) external virtual override ensure(deadline) returns (uint[] memory amounts) {
    │ ╰────────────────────────────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:231:19
    │
231 │         amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);
    │                   ^^^^^^^^^^^^^^^^

error: 'swapTokensForExactTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:238:5
    │  
238 │ ╭     function swapTokensForExactTokens(
239 │ │         uint amountOut,
240 │ │         uint amountInMax,
241 │ │         address[] calldata path,
242 │ │         address to,
243 │ │         uint deadline
244 │ │     ) external virtual override ensure(deadline) returns (uint[] memory amounts) {
    │ ╰────────────────────────────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:245:19
    │
245 │         amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
    │                   ^^^^^^^^^^^^^^^^

error: 'swapExactETHForTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:252:5
    │  
252 │ ╭     function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
253 │ │         external
254 │ │         virtual
255 │ │         override
256 │ │         payable
257 │ │         ensure(deadline)
258 │ │         returns (uint[] memory amounts)
    │ ╰───────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:261:19
    │
261 │         amounts = UniswapV2Library.getAmountsOut(factory, msg.value, path);
    │                   ^^^^^^^^^^^^^^^^

error: 'swapTokensForExactETH' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:267:5
    │  
267 │ ╭     function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
268 │ │         external
269 │ │         virtual
270 │ │         override
271 │ │         ensure(deadline)
272 │ │         returns (uint[] memory amounts)
    │ ╰───────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:275:19
    │
275 │         amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
    │                   ^^^^^^^^^^^^^^^^

error: 'swapExactTokensForETH' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:284:5
    │  
284 │ ╭     function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
285 │ │         external
286 │ │         virtual
287 │ │         override
288 │ │         ensure(deadline)
289 │ │         returns (uint[] memory amounts)
    │ ╰───────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:292:19
    │
292 │         amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);
    │                   ^^^^^^^^^^^^^^^^

error: 'swapETHForExactTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:301:5
    │  
301 │ ╭     function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
302 │ │         external
303 │ │         virtual
304 │ │         override
305 │ │         payable
306 │ │         ensure(deadline)
307 │ │         returns (uint[] memory amounts)
    │ ╰───────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:310:19
    │
310 │         amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
    │                   ^^^^^^^^^^^^^^^^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:324:33
    │
324 │             (address token0,) = UniswapV2Library.sortTokens(input, output);
    │                                 ^^^^^^^^^^^^^^^^

error: 'swapExactTokensForTokensSupportingFeeOnTransferTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:339:5
    │  
339 │ ╭     function swapExactTokensForTokensSupportingFeeOnTransferTokens(
340 │ │         uint amountIn,
341 │ │         uint amountOutMin,
342 │ │         address[] calldata path,
343 │ │         address to,
344 │ │         uint deadline
345 │ │     ) external virtual override ensure(deadline) {
    │ ╰────────────────────────────────────────────────^

error: 'TransferHelper' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:346:9
    │
346 │         TransferHelper.safeTransferFrom(
    │         ^^^^^^^^^^^^^^

error: 'swapExactETHForTokensSupportingFeeOnTransferTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:356:5
    │  
356 │ ╭     function swapExactETHForTokensSupportingFeeOnTransferTokens(
357 │ │         uint amountOutMin,
358 │ │         address[] calldata path,
359 │ │         address to,
    · │
365 │ │         payable
366 │ │         ensure(deadline)
    │ ╰────────────────────────^

error: unknown function or type 'IWETH'
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:370:9
    │
370 │         IWETH(WETH).deposit{value: amountIn}();
    │         ^^^^^

error: 'swapExactTokensForETHSupportingFeeOnTransferTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:379:5
    │  
379 │ ╭     function swapExactTokensForETHSupportingFeeOnTransferTokens(
380 │ │         uint amountIn,
381 │ │         uint amountOutMin,
382 │ │         address[] calldata path,
    · │
388 │ │         override
389 │ │         ensure(deadline)
    │ ╰────────────────────────^

error: 'TransferHelper' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:392:9
    │
392 │         TransferHelper.safeTransferFrom(
    │         ^^^^^^^^^^^^^^

error: 'quote' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:403:5
    │
403 │     function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
    │     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:404:16
    │
404 │         return UniswapV2Library.quote(amountA, reserveA, reserveB);
    │                ^^^^^^^^^^^^^^^^

error: 'getAmountOut' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:407:5
    │  
407 │ ╭     function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut)
408 │ │         public
409 │ │         pure
410 │ │         virtual
411 │ │         override
412 │ │         returns (uint amountOut)
    │ ╰────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:414:16
    │
414 │         return UniswapV2Library.getAmountOut(amountIn, reserveIn, reserveOut);
    │                ^^^^^^^^^^^^^^^^

error: 'getAmountIn' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:417:5
    │  
417 │ ╭     function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut)
418 │ │         public
419 │ │         pure
420 │ │         virtual
421 │ │         override
422 │ │         returns (uint amountIn)
    │ ╰───────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:424:16
    │
424 │         return UniswapV2Library.getAmountIn(amountOut, reserveIn, reserveOut);
    │                ^^^^^^^^^^^^^^^^

error: 'getAmountsOut' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:427:5
    │  
427 │ ╭     function getAmountsOut(uint amountIn, address[] memory path)
428 │ │         public
429 │ │         view
430 │ │         virtual
431 │ │         override
432 │ │         returns (uint[] memory amounts)
    │ ╰───────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:434:16
    │
434 │         return UniswapV2Library.getAmountsOut(factory, amountIn, path);
    │                ^^^^^^^^^^^^^^^^

error: 'getAmountsIn' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:437:5
    │  
437 │ ╭     function getAmountsIn(uint amountOut, address[] memory path)
438 │ │         public
439 │ │         view
440 │ │         virtual
441 │ │         override
442 │ │         returns (uint[] memory amounts)
    │ ╰───────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:444:16
    │
444 │         return UniswapV2Library.getAmountsIn(factory, amountOut, path);
    │                ^^^^^^^^^^^^^^^^

error: 'foo' not found
   ┌─ /home/cyrill/mess/sub0/lib/contracts/libraries/TransferHelper.sol:12:3
   │
12 │         foo = 0;
   │         ^^^

warning: conversion truncates uint256 to uint128, as value is type uint128 on target Polkadot
   ┌─ /home/cyrill/mess/sub0/lib/contracts/libraries/TransferHelper.sol:49:43
   │
49 │         (bool success, ) = to.call{value: value}(new bytes(0));
   │                                           ^^^^^

error: 'IUniswapV2Router01' not found
  ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol:5:33
  │
5 │ interface IUniswapV2Router02 is IUniswapV2Router01 {
  │                                 ^^^^^^^^^^^^^^^^^^

error: 'SafeMath' not found
  ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/libraries/UniswapV2Library.sol:8:11
  │
8 │     using SafeMath for uint;
  │           ^^^^^^^^

error: unknown function or type 'IUniswapV2Pair'
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/libraries/UniswapV2Library.sol:31:43
   │
31 │         (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
   │                                           ^^^^^^^^^^^^^^

error: method 'mul' does not exist
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/libraries/UniswapV2Library.sol:39:27
   │
39 │         amountB = amountA.mul(reserveB) / reserveA;
   │                           ^^^

error: method 'mul' does not exist
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/libraries/UniswapV2Library.sol:46:41
   │
46 │         uint amountInWithFee = amountIn.mul(997);
   │                                         ^^^

error: method 'mul' does not exist
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/libraries/UniswapV2Library.sol:56:36
   │
56 │         uint numerator = reserveIn.mul(amountOut).mul(1000);
   │                                    ^^^
Full diagnostics output
error: 'IUniswapV2Router02' not found
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:12:31
   │
12 │ contract UniswapV2Router02 is IUniswapV2Router02 {
   │                               ^^^^^^^^^^^^^^^^^^

error: 'factory' does not override anything
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:15:39
   │
15 │     address public immutable override factory;
   │                                       ^^^^^^^

error: 'WETH' does not override anything
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:16:39
   │
16 │     address public immutable override WETH;
   │                                       ^^^^

warning: 'public': visibility for constructors is ignored
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:23:50
   │
23 │     constructor(address _factory, address _WETH) public {
   │                                                  ^^^^^^

error: 'UniswapV2Library' not found
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:45:42
   │
45 │         (uint reserveA, uint reserveB) = UniswapV2Library.getReserves(factory, tokenA, tokenB);
   │                                          ^^^^^^^^^^^^^^^^

error: 'addLiquidity' does not override anything
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:61:5
   │  
61 │ ╭     function addLiquidity(
62 │ │         address tokenA,
63 │ │         address tokenB,
64 │ │         uint amountADesired,
   · │
69 │ │         uint deadline
70 │ │     ) external virtual override ensure(deadline) returns (uint amountA, uint amountB, uint liquidity) {
   │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:72:24
   │
72 │         address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
   │                        ^^^^^^^^^^^^^^^^

error: 'addLiquidityETH' does not override anything
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:77:5
   │  
77 │ ╭     function addLiquidityETH(
78 │ │         address token,
79 │ │         uint amountTokenDesired,
80 │ │         uint amountTokenMin,
   · │
83 │ │         uint deadline
84 │ │     ) external virtual override payable ensure(deadline) returns (uint amountToken, uint amountETH, uint liquidity) {
   │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:93:24
   │
93 │         address pair = UniswapV2Library.pairFor(factory, token, WETH);
   │                        ^^^^^^^^^^^^^^^^

error: 'removeLiquidity' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:103:5
    │  
103 │ ╭     function removeLiquidity(
104 │ │         address tokenA,
105 │ │         address tokenB,
106 │ │         uint liquidity,
    · │
110 │ │         uint deadline
111 │ │     ) public virtual override ensure(deadline) returns (uint amountA, uint amountB) {
    │ ╰───────────────────────────────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:112:24
    │
112 │         address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
    │                        ^^^^^^^^^^^^^^^^

error: 'removeLiquidityETH' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:120:5
    │  
120 │ ╭     function removeLiquidityETH(
121 │ │         address token,
122 │ │         uint liquidity,
123 │ │         uint amountTokenMin,
    · │
126 │ │         uint deadline
127 │ │     ) public virtual override ensure(deadline) returns (uint amountToken, uint amountETH) {
    │ ╰─────────────────────────────────────────────────────────────────────────────────────────^

error: unknown function or type 'removeLiquidity'
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:128:36
    │
128 │         (amountToken, amountETH) = removeLiquidity(
    │                                    ^^^^^^^^^^^^^^^

error: 'removeLiquidityWithPermit' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:141:5
    │  
141 │ ╭     function removeLiquidityWithPermit(
142 │ │         address tokenA,
143 │ │         address tokenB,
144 │ │         uint liquidity,
    · │
149 │ │         bool approveMax, uint8 v, bytes32 r, bytes32 s
150 │ │     ) external virtual override returns (uint amountA, uint amountB) {
    │ ╰────────────────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:151:24
    │
151 │         address pair = UniswapV2Library.pairFor(factory, tokenA, tokenB);
    │                        ^^^^^^^^^^^^^^^^

error: 'removeLiquidityETHWithPermit' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:156:5
    │  
156 │ ╭     function removeLiquidityETHWithPermit(
157 │ │         address token,
158 │ │         uint liquidity,
159 │ │         uint amountTokenMin,
    · │
163 │ │         bool approveMax, uint8 v, bytes32 r, bytes32 s
164 │ │     ) external virtual override returns (uint amountToken, uint amountETH) {
    │ ╰──────────────────────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:165:24
    │
165 │         address pair = UniswapV2Library.pairFor(factory, token, WETH);
    │                        ^^^^^^^^^^^^^^^^

error: 'removeLiquidityETHSupportingFeeOnTransferTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:172:5
    │  
172 │ ╭     function removeLiquidityETHSupportingFeeOnTransferTokens(
173 │ │         address token,
174 │ │         uint liquidity,
175 │ │         uint amountTokenMin,
    · │
178 │ │         uint deadline
179 │ │     ) public virtual override ensure(deadline) returns (uint amountETH) {
    │ ╰───────────────────────────────────────────────────────────────────────^

error: unknown function or type 'removeLiquidity'
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:180:25
    │
180 │         (, amountETH) = removeLiquidity(
    │                         ^^^^^^^^^^^^^^^

error: 'removeLiquidityETHWithPermitSupportingFeeOnTransferTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:193:5
    │  
193 │ ╭     function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
194 │ │         address token,
195 │ │         uint liquidity,
196 │ │         uint amountTokenMin,
    · │
200 │ │         bool approveMax, uint8 v, bytes32 r, bytes32 s
201 │ │     ) external virtual override returns (uint amountETH) {
    │ ╰────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:202:24
    │
202 │         address pair = UniswapV2Library.pairFor(factory, token, WETH);
    │                        ^^^^^^^^^^^^^^^^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:215:33
    │
215 │             (address token0,) = UniswapV2Library.sortTokens(input, output);
    │                                 ^^^^^^^^^^^^^^^^

error: 'swapExactTokensForTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:224:5
    │  
224 │ ╭     function swapExactTokensForTokens(
225 │ │         uint amountIn,
226 │ │         uint amountOutMin,
227 │ │         address[] calldata path,
228 │ │         address to,
229 │ │         uint deadline
230 │ │     ) external virtual override ensure(deadline) returns (uint[] memory amounts) {
    │ ╰────────────────────────────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:231:19
    │
231 │         amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);
    │                   ^^^^^^^^^^^^^^^^

error: 'swapTokensForExactTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:238:5
    │  
238 │ ╭     function swapTokensForExactTokens(
239 │ │         uint amountOut,
240 │ │         uint amountInMax,
241 │ │         address[] calldata path,
242 │ │         address to,
243 │ │         uint deadline
244 │ │     ) external virtual override ensure(deadline) returns (uint[] memory amounts) {
    │ ╰────────────────────────────────────────────────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:245:19
    │
245 │         amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
    │                   ^^^^^^^^^^^^^^^^

error: 'swapExactETHForTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:252:5
    │  
252 │ ╭     function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
253 │ │         external
254 │ │         virtual
255 │ │         override
256 │ │         payable
257 │ │         ensure(deadline)
258 │ │         returns (uint[] memory amounts)
    │ ╰───────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:261:19
    │
261 │         amounts = UniswapV2Library.getAmountsOut(factory, msg.value, path);
    │                   ^^^^^^^^^^^^^^^^

error: 'swapTokensForExactETH' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:267:5
    │  
267 │ ╭     function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
268 │ │         external
269 │ │         virtual
270 │ │         override
271 │ │         ensure(deadline)
272 │ │         returns (uint[] memory amounts)
    │ ╰───────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:275:19
    │
275 │         amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
    │                   ^^^^^^^^^^^^^^^^

error: 'swapExactTokensForETH' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:284:5
    │  
284 │ ╭     function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
285 │ │         external
286 │ │         virtual
287 │ │         override
288 │ │         ensure(deadline)
289 │ │         returns (uint[] memory amounts)
    │ ╰───────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:292:19
    │
292 │         amounts = UniswapV2Library.getAmountsOut(factory, amountIn, path);
    │                   ^^^^^^^^^^^^^^^^

error: 'swapETHForExactTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:301:5
    │  
301 │ ╭     function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
302 │ │         external
303 │ │         virtual
304 │ │         override
305 │ │         payable
306 │ │         ensure(deadline)
307 │ │         returns (uint[] memory amounts)
    │ ╰───────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:310:19
    │
310 │         amounts = UniswapV2Library.getAmountsIn(factory, amountOut, path);
    │                   ^^^^^^^^^^^^^^^^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:324:33
    │
324 │             (address token0,) = UniswapV2Library.sortTokens(input, output);
    │                                 ^^^^^^^^^^^^^^^^

error: 'swapExactTokensForTokensSupportingFeeOnTransferTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:339:5
    │  
339 │ ╭     function swapExactTokensForTokensSupportingFeeOnTransferTokens(
340 │ │         uint amountIn,
341 │ │         uint amountOutMin,
342 │ │         address[] calldata path,
343 │ │         address to,
344 │ │         uint deadline
345 │ │     ) external virtual override ensure(deadline) {
    │ ╰────────────────────────────────────────────────^

error: 'TransferHelper' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:346:9
    │
346 │         TransferHelper.safeTransferFrom(
    │         ^^^^^^^^^^^^^^

error: 'swapExactETHForTokensSupportingFeeOnTransferTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:356:5
    │  
356 │ ╭     function swapExactETHForTokensSupportingFeeOnTransferTokens(
357 │ │         uint amountOutMin,
358 │ │         address[] calldata path,
359 │ │         address to,
    · │
365 │ │         payable
366 │ │         ensure(deadline)
    │ ╰────────────────────────^

error: unknown function or type 'IWETH'
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:370:9
    │
370 │         IWETH(WETH).deposit{value: amountIn}();
    │         ^^^^^

error: 'swapExactTokensForETHSupportingFeeOnTransferTokens' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:379:5
    │  
379 │ ╭     function swapExactTokensForETHSupportingFeeOnTransferTokens(
380 │ │         uint amountIn,
381 │ │         uint amountOutMin,
382 │ │         address[] calldata path,
    · │
388 │ │         override
389 │ │         ensure(deadline)
    │ ╰────────────────────────^

error: 'TransferHelper' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:392:9
    │
392 │         TransferHelper.safeTransferFrom(
    │         ^^^^^^^^^^^^^^

error: 'quote' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:403:5
    │
403 │     function quote(uint amountA, uint reserveA, uint reserveB) public pure virtual override returns (uint amountB) {
    │     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:404:16
    │
404 │         return UniswapV2Library.quote(amountA, reserveA, reserveB);
    │                ^^^^^^^^^^^^^^^^

error: 'getAmountOut' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:407:5
    │  
407 │ ╭     function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut)
408 │ │         public
409 │ │         pure
410 │ │         virtual
411 │ │         override
412 │ │         returns (uint amountOut)
    │ ╰────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:414:16
    │
414 │         return UniswapV2Library.getAmountOut(amountIn, reserveIn, reserveOut);
    │                ^^^^^^^^^^^^^^^^

error: 'getAmountIn' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:417:5
    │  
417 │ ╭     function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut)
418 │ │         public
419 │ │         pure
420 │ │         virtual
421 │ │         override
422 │ │         returns (uint amountIn)
    │ ╰───────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:424:16
    │
424 │         return UniswapV2Library.getAmountIn(amountOut, reserveIn, reserveOut);
    │                ^^^^^^^^^^^^^^^^

error: 'getAmountsOut' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:427:5
    │  
427 │ ╭     function getAmountsOut(uint amountIn, address[] memory path)
428 │ │         public
429 │ │         view
430 │ │         virtual
431 │ │         override
432 │ │         returns (uint[] memory amounts)
    │ ╰───────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:434:16
    │
434 │         return UniswapV2Library.getAmountsOut(factory, amountIn, path);
    │                ^^^^^^^^^^^^^^^^

error: 'getAmountsIn' does not override anything
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:437:5
    │  
437 │ ╭     function getAmountsIn(uint amountOut, address[] memory path)
438 │ │         public
439 │ │         view
440 │ │         virtual
441 │ │         override
442 │ │         returns (uint[] memory amounts)
    │ ╰───────────────────────────────────────^

error: 'UniswapV2Library' not found
    ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/UniswapV2Router02.sol:444:16
    │
444 │         return UniswapV2Library.getAmountsIn(factory, amountOut, path);
    │                ^^^^^^^^^^^^^^^^

error: 'foo' not found
   ┌─ /home/cyrill/mess/sub0/lib/contracts/libraries/TransferHelper.sol:12:3
   │
12 │         foo = 0;
   │         ^^^

warning: conversion truncates uint256 to uint128, as value is type uint128 on target Polkadot
   ┌─ /home/cyrill/mess/sub0/lib/contracts/libraries/TransferHelper.sol:49:43
   │
49 │         (bool success, ) = to.call{value: value}(new bytes(0));
   │                                           ^^^^^

error: 'IUniswapV2Router01' not found
  ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol:5:33
  │
5 │ interface IUniswapV2Router02 is IUniswapV2Router01 {
  │                                 ^^^^^^^^^^^^^^^^^^

error: 'SafeMath' not found
  ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/libraries/UniswapV2Library.sol:8:11
  │
8 │     using SafeMath for uint;
  │           ^^^^^^^^

error: unknown function or type 'IUniswapV2Pair'
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/libraries/UniswapV2Library.sol:31:43
   │
31 │         (uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
   │                                           ^^^^^^^^^^^^^^

error: method 'mul' does not exist
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/libraries/UniswapV2Library.sol:39:27
   │
39 │         amountB = amountA.mul(reserveB) / reserveA;
   │                           ^^^

error: method 'mul' does not exist
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/libraries/UniswapV2Library.sol:46:41
   │
46 │         uint amountInWithFee = amountIn.mul(997);
   │                                         ^^^

error: method 'mul' does not exist
   ┌─ /home/cyrill/mess/sub0/v2-periphery/contracts/libraries/UniswapV2Library.sol:56:36
   │
56 │         uint numerator = reserveIn.mul(amountOut).mul(1000);
   │                                    ^^^

@xermicus xermicus added the bug Something isn't working label Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants
@bkushigian @xermicus and others