Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/contracts/Staking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,11 @@ contract Staking is OwnableUpgradeable, StakingStorage {
// amount must be non zero
require(_amount > 0, "Must have valid amount");

if (warmUpPeriod > 0) {
// can't stake for someone else if contract is using warmUp period
require(_recipient == msg.sender, "Can't stake for someone else with warmup");
}

uint256 yieldyTotalSupply = IYieldy(YIELDY_TOKEN).totalSupply();
require(
yieldyTotalSupply + _amount <= totalSupplyLimit,
Expand Down
9 changes: 9 additions & 0 deletions test/stakingTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,15 @@ describe("Staking", function () {
const stakingAmount = transferAmount;
const stakingTokenStaker1 = stakingToken.connect(staker1Signer as Signer);
await stakingTokenStaker1.approve(staking.address, stakingAmount);

// can't stake to other addresses with warmup period
await expect(
stakingStaker1.functions["stake(uint256,address)"](
stakingAmount,
staking.address
)
).to.be.revertedWith("Can't stake for someone else with warmup");

await stakingStaker1.functions["stake(uint256)"](stakingAmount);

// balance should still be zero, until we claim the rewardToken.
Expand Down