Skip to content

Commit

Permalink
remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeev committed Sep 12, 2023
1 parent 7ff9eed commit 7326c39
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions omnichain/staking/contracts/Staking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ contract Staking is ERC20, zContract {
uint256 amount
) internal {
stakes[staker] += amount;
require(stakes[staker] >= amount, "Overflow detected"); // Check for overflows
require(stakes[staker] >= amount, "Overflow detected");

if (beneficiaries[staker] == address(0)) {
beneficiaries[staker] = beneficiary;
Expand All @@ -77,13 +77,13 @@ contract Staking is ERC20, zContract {
lastStakeTime[staker] = block.timestamp;
updateRewards(staker);

emit Staked(staker, beneficiary, amount); // Emitting Staked event
emit Staked(staker, beneficiary, amount);
}

function updateRewards(address staker) internal {
uint256 timeDifference = block.timestamp - lastStakeTime[staker];
uint256 rewardAmount = timeDifference * stakes[staker] * rewardRate;
require(rewardAmount >= timeDifference, "Overflow detected"); // Check for overflows
require(rewardAmount >= timeDifference, "Overflow detected");

_mint(beneficiaries[staker], rewardAmount);
lastStakeTime[staker] = block.timestamp;
Expand All @@ -100,7 +100,7 @@ contract Staking is ERC20, zContract {

updateRewards(staker);

emit RewardsClaimed(staker, rewardAmount); // Emitting RewardsClaimed event
emit RewardsClaimed(staker, rewardAmount);
}

function unstakeZRC(uint256 amount) external {
Expand All @@ -126,11 +126,11 @@ contract Staking is ERC20, zContract {

IZRC20(zrc20).withdraw(recipient, amount - gasFee);
stakes[msg.sender] -= amount;
require(stakes[msg.sender] <= amount, "Underflow detected"); // Check for underflows
require(stakes[msg.sender] <= amount, "Underflow detected");

lastStakeTime[msg.sender] = block.timestamp;

emit Unstaked(msg.sender, amount); // Emitting Unstaked event
emit Unstaked(msg.sender, amount);
}

function queryRewards(address account) public view returns (uint256) {
Expand Down

0 comments on commit 7326c39

Please sign in to comment.