update tests based on new logic; should be marginal changes only
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
parent
85636e8064
commit
566bf34feb
@ -89,6 +89,10 @@ contract GhostBondDepositoryTest is Test {
|
|||||||
address(weth)
|
address(weth)
|
||||||
);
|
);
|
||||||
vm.stopPrank();
|
vm.stopPrank();
|
||||||
|
|
||||||
|
vm.prank(GOVERNOR);
|
||||||
|
staking.setWarmupPeriod(0);
|
||||||
|
|
||||||
_createFirstBond();
|
_createFirstBond();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -76,6 +76,9 @@ contract StakingTest is Test {
|
|||||||
gatekeeper = new Gatekeeper(address(staking), 0, 0, 0, 0, 0);
|
gatekeeper = new Gatekeeper(address(staking), 0, 0, 0, 0, 0);
|
||||||
calculator = new GhostBondingCalculator(address(ftso), 1, 1);
|
calculator = new GhostBondingCalculator(address(ftso), 1, 1);
|
||||||
vm.stopPrank();
|
vm.stopPrank();
|
||||||
|
|
||||||
|
vm.prank(GOVERNOR);
|
||||||
|
staking.setWarmupPeriod(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_correctAfterConstruction() public view {
|
function test_correctAfterConstruction() public view {
|
||||||
@ -139,13 +142,12 @@ contract StakingTest is Test {
|
|||||||
|
|
||||||
vm.prank(ALICE);
|
vm.prank(ALICE);
|
||||||
uint256 rebased = staking.stake(AMOUNT, ALICE, false, false);
|
uint256 rebased = staking.stake(AMOUNT, ALICE, false, false);
|
||||||
|
|
||||||
assertEq(ftso.balanceOf(ALICE), 0);
|
assertEq(ftso.balanceOf(ALICE), 0);
|
||||||
assertEq(staking.sharesInWarmup(), stnk.sharesForBalance(rebased));
|
assertApproxEqAbs(staking.supplyInWarmup(), rebased, 1);
|
||||||
|
|
||||||
(uint256 deposit, uint256 shares, uint48 expiry, bool lock) = staking.warmupInfo(ALICE);
|
(uint256 deposit, uint256 payout, uint48 expiry, bool lock) = staking.warmupInfo(ALICE);
|
||||||
assertEq(deposit, AMOUNT);
|
assertEq(deposit, AMOUNT);
|
||||||
assertEq(shares, stnk.sharesForBalance(AMOUNT));
|
assertEq(payout, ghst.balanceTo(AMOUNT));
|
||||||
assertEq(expiry, 1);
|
assertEq(expiry, 1);
|
||||||
assertEq(lock, false);
|
assertEq(lock, false);
|
||||||
}
|
}
|
||||||
@ -179,11 +181,11 @@ contract StakingTest is Test {
|
|||||||
uint256 rebased = staking.stake(AMOUNT, ALICE, false, true);
|
uint256 rebased = staking.stake(AMOUNT, ALICE, false, true);
|
||||||
|
|
||||||
assertEq(ftso.balanceOf(ALICE), 0);
|
assertEq(ftso.balanceOf(ALICE), 0);
|
||||||
assertEq(staking.sharesInWarmup(), stnk.sharesForBalance(rebased));
|
assertApproxEqAbs(staking.supplyInWarmup(), rebased, 1);
|
||||||
|
|
||||||
(uint256 deposit, uint256 shares, uint48 expiry, bool lock) = staking.warmupInfo(ALICE);
|
(uint256 deposit, uint256 payout, uint48 expiry, bool lock) = staking.warmupInfo(ALICE);
|
||||||
assertEq(deposit, AMOUNT);
|
assertEq(deposit, AMOUNT);
|
||||||
assertEq(shares, stnk.sharesForBalance(AMOUNT));
|
assertEq(payout, ghst.balanceTo(AMOUNT));
|
||||||
assertEq(expiry, 2);
|
assertEq(expiry, 2);
|
||||||
assertEq(lock, false);
|
assertEq(lock, false);
|
||||||
}
|
}
|
||||||
@ -248,6 +250,7 @@ contract StakingTest is Test {
|
|||||||
assertEq(ghst.balanceOf(ALICE), 0);
|
assertEq(ghst.balanceOf(ALICE), 0);
|
||||||
vm.prank(BOB);
|
vm.prank(BOB);
|
||||||
uint256 rebased = staking.claim(ALICE, false);
|
uint256 rebased = staking.claim(ALICE, false);
|
||||||
|
|
||||||
assertEq(ghst.balanceOf(ALICE), rebased);
|
assertEq(ghst.balanceOf(ALICE), rebased);
|
||||||
assertEq(rebased > 0, true);
|
assertEq(rebased > 0, true);
|
||||||
}
|
}
|
||||||
@ -278,13 +281,11 @@ contract StakingTest is Test {
|
|||||||
_prepareAndRoll(ALICE, AMOUNT, false, false);
|
_prepareAndRoll(ALICE, AMOUNT, false, false);
|
||||||
|
|
||||||
assertEq(ftso.balanceOf(ALICE), 0);
|
assertEq(ftso.balanceOf(ALICE), 0);
|
||||||
assertEq(staking.sharesInWarmup(), stnk.sharesForBalance(AMOUNT));
|
|
||||||
|
|
||||||
vm.prank(ALICE);
|
vm.prank(ALICE);
|
||||||
uint256 deposit = staking.forfeit();
|
uint256 deposit = staking.forfeit();
|
||||||
|
|
||||||
assertEq(ftso.balanceOf(ALICE), deposit);
|
assertEq(ftso.balanceOf(ALICE), deposit);
|
||||||
assertEq(staking.sharesInWarmup(), 0);
|
assertEq(staking.supplyInWarmup(), 0);
|
||||||
|
|
||||||
(uint256 depositInWarmup, uint256 shares, uint48 expiry,) = staking.warmupInfo(ALICE);
|
(uint256 depositInWarmup, uint256 shares, uint48 expiry,) = staking.warmupInfo(ALICE);
|
||||||
assertEq(depositInWarmup, 0);
|
assertEq(depositInWarmup, 0);
|
||||||
@ -297,7 +298,7 @@ contract StakingTest is Test {
|
|||||||
uint256 deposit = staking.forfeit();
|
uint256 deposit = staking.forfeit();
|
||||||
assertEq(deposit, 0);
|
assertEq(deposit, 0);
|
||||||
assertEq(ftso.balanceOf(ALICE), 0);
|
assertEq(ftso.balanceOf(ALICE), 0);
|
||||||
assertEq(staking.sharesInWarmup(), 0);
|
assertEq(staking.supplyInWarmup(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_unstake_canRedeemStinkyToFatso() public {
|
function test_unstake_canRedeemStinkyToFatso() public {
|
||||||
|
|||||||
@ -150,7 +150,7 @@ contract StinkyTest is Test, ERC20PermitTest, ERC20AllowanceTest, ERC20TransferT
|
|||||||
staking.stake(AMOUNT, ALICE, true, true);
|
staking.stake(AMOUNT, ALICE, true, true);
|
||||||
vm.stopPrank();
|
vm.stopPrank();
|
||||||
|
|
||||||
assertEq(stnk.circulatingSupply(), AMOUNT);
|
assertApproxEqAbs(stnk.circulatingSupply(), AMOUNT, 1);
|
||||||
assertEq(ftso.totalSupply(), AMOUNT);
|
assertEq(ftso.totalSupply(), AMOUNT);
|
||||||
assertEq(stnk.totalSupply(), TOTAL_INITIAL_SUPPLY);
|
assertEq(stnk.totalSupply(), TOTAL_INITIAL_SUPPLY);
|
||||||
assertEq(stnk.balanceOf(address(staking)), TOTAL_INITIAL_SUPPLY);
|
assertEq(stnk.balanceOf(address(staking)), TOTAL_INITIAL_SUPPLY);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user