LiqMan WIP

This commit is contained in:
JulesCrown 2024-03-14 17:31:16 +01:00
parent e51f49c612
commit 4e895f57e9
4 changed files with 106 additions and 116 deletions

View file

@ -9,7 +9,7 @@ import "@uniswap-v3-core/interfaces/IUniswapV3Factory.sol";
import "@uniswap-v3-core/interfaces/IUniswapV3Pool.sol";
import "./interfaces/IWETH9.sol";
import "../src/Harb.sol";
import "../src/Stake.sol";
import {Stake, ExceededAvailableStake} from "../src/Stake.sol";
address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address constant V3_FACTORY = 0x1F98431c8aD98523631AE4a59f267346ea31F984;
@ -32,7 +32,7 @@ contract HarbTest is Test {
TwabController tc = new TwabController(60 * 60 * 24, uint32(block.timestamp));
harb = new Harb("HARB", "HARB", V3_FACTORY, WETH, tc);
factory = IUniswapV3Factory(V3_FACTORY);
IUniswapV3Pool(factory.createPool(address(weth), address(harb), FEE));
factory.createPool(address(weth), address(harb), FEE);
stake = new Stake(address(harb));
harb.setStakingPool(address(stake));
liquidityManager = new LiquidityManager(V3_FACTORY, WETH, address(harb));
@ -95,6 +95,14 @@ contract HarbTest is Test {
assertEq(taxRate, 1, "tax rate should match");
}
// test stake when stake full
{
uint256[] memory empty;
vm.prank(account);
vm.expectRevert(ExceededAvailableStake.selector);
stake.snatch(amount, account, 2, empty);
}
// test unstake
{
// advance the time