Skip to content

Commit

Permalink
test constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
anajuliabit committed Jun 30, 2024
1 parent d47c4ed commit 315616a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Staking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ contract Staking is ERC20VotesUpgradeable, Ownable2StepUpgradeable {
rewardsDistributor = IRewardsDistributor(_rewardsDistributor);
lockPeriod = _lockPeriod;
minStake = _minStake;

nextStakeId = 1;
}

/// @notice Stake SHU
Expand All @@ -199,7 +201,7 @@ contract Staking is ERC20VotesUpgradeable, Ownable2StepUpgradeable {
/// TODO slippage protection
function stake(
uint256 amount
) external onlyKeyper updateRewards returns (uint256) {
) external onlyKeyper updateRewards returns (uint256 stakeId) {
/////////////////////////// CHECKS ///////////////////////////////
require(amount > 0, ZeroAmount());

Expand All @@ -224,7 +226,7 @@ contract Staking is ERC20VotesUpgradeable, Ownable2StepUpgradeable {
_mint(keyper, sharesToMint);

// Get next stake id and increment it
uint256 stakeId = ++nextStakeId;
stakeId = nextStakeId++;

stakes[stakeId] = Stake({
amount: amount,
Expand Down
7 changes: 7 additions & 0 deletions test/RewardsDistributor.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ contract RewardsDistributorTest is Test {
}
}

contract Constructor is RewardsDistributorTest {
function test_SetUp() public {
assertEq(address(rewardsDistributor.rewardToken()), address(govToken));
assertEq(Ownable(address(rewardsDistributor)).owner(), address(this));
}
}

contract OwnableFunctions is RewardsDistributorTest {
function testFuzz_SetRewardConfigurationEmitEvent(
address _receiver,
Expand Down

0 comments on commit 315616a

Please sign in to comment.