implemented minStake

This commit is contained in:
JulesCrown 2024-06-13 10:50:09 +02:00
parent 72abf097df
commit b94f5559dd
4 changed files with 38 additions and 32 deletions

View file

@ -99,7 +99,7 @@ contract HarbTest is Test {
assertEq(harb.balanceOf(account), amount * 4, "balance should match after stake");
assertEq(harb.balanceOf(address(stake)), amount, "balance should match after stake");
// check stake position
(uint256 share, address owner, uint32 creationTime, uint32 lastTaxTime, uint32 taxRate) = stake.positions(0);
(uint256 share, address owner, uint32 creationTime, uint32 lastTaxTime, uint32 taxRate) = stake.positions(654321);
assertEq(share, stake.totalSupply() / 5, "share should match");
assertEq(owner, account, "owners should match");
assertEq(creationTime, block.timestamp, "time should match");
@ -122,11 +122,11 @@ contract HarbTest is Test {
// advance the time
uint256 timeBefore = block.timestamp;
vm.warp(timeBefore + (60 * 60 * 24 * 4));
uint256 taxDue = stake.taxDue(0, 60 * 60 * 24 * 3);
uint256 taxDue = stake.taxDue(654321, 60 * 60 * 24 * 3);
uint256 sumTaxCollectedBefore = harb.sumTaxCollected();
vm.prank(account);
stake.exitPosition(0);
stake.exitPosition(654321);
assertApproxEqRel(harb.balanceOf(account), amount * 5 - taxDue, 1e14, "account balance should match");
assertEq(harb.balanceOf(TAX_POOL), taxDue, "tax pool balance should match");
assertEq(sumTaxCollectedBefore + taxDue, harb.sumTaxCollected(), "collected tax should have increased");