"EvmError: Revert"报错

使用foundry script 测试getReserve函数,出现报错

// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.6.6;

import "forge-std/Script.sol";
import "src/router/IUniswapV2Router02.sol";
import "src/router/UniswapV2Router02.sol";
import "src/router/IUniswapV2Factory.sol";
import "src/router/UniswapV2Library.sol";

contract CounterScript is Script {
    address coinX = 0x5-----------------;
    address coinY = 0xe7-----------------;
    address router1 = 0x5-----------------;
    address walletAnvil01 = 0xf3-----------------;
    address factory1 = 0xCf-----------------;

    address pair1;

    function setUp() public view {
        (uint reserveA, uint reserveB) = UniswapV2Library.getReserves(
            factory1,
            coinX,
            coinY
        );
        console.log(reserveA);
        console.log(reserveB);
    }

    function run() public {
        vm.broadcast();
    }
}

错误提示

   [⠢] Compiling...
[⠒] Compiling 1 files with 0.6.6
[⠔] Solc 0.6.6 finished in 5.93s
Compiler run successful!
Traces:
  [382206] → new CounterScript@0x5b73C5498c1E3b4dbA84de0F1833c4a029d90519
    └─ ← 1135 bytes of code

  [10182] CounterScript::setUp() 
    └─ ← "EvmError: Revert"

Error: 
Script failed.
请先 登录 后评论

3 个回答

用户_16243 - 新司机
请先 登录 后评论
Tiny熊
  擅长:智能合约,以太坊
请先 登录 后评论
mada
请先 登录 后评论
  • 3 关注
  • 0 收藏,1909 浏览
  • mada 提出于 2023-07-29 15:01