使用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.