Skip to content

Commit

Permalink
fix: gas saving (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra authored Mar 4, 2024
1 parent b0fe903 commit 5346765
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/contracts/StakeToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -349,21 +349,8 @@ contract StakeToken is ERC20Permit, AaveDistributionManager, RoleManager, IStake
require(!inPostSlashingPeriod, 'SLASHING_ONGOING');
require(amount != 0, 'INVALID_ZERO_AMOUNT');

uint256 balanceOfTo = balanceOf(to);

uint256 accruedRewards = _updateUserAssetInternal(
to,
address(this),
balanceOfTo,
totalSupply()
);

if (accruedRewards != 0) {
stakerRewardsToClaim[to] = stakerRewardsToClaim[to] + accruedRewards;
emit RewardsAccrued(to, accruedRewards);
}

uint256 sharesToMint = previewStake(amount);
require(sharesToMint != 0, 'INVALID_ZERO_AMOUNT_AFTER_CONVERSION');

_mint(to, sharesToMint.toUint104());

Expand Down

0 comments on commit 5346765

Please sign in to comment.