Skip to content

Commit

Permalink
rouning up when going from shares to staked amount
Browse files Browse the repository at this point in the history
  • Loading branch information
aalavandhan committed Dec 2, 2024
1 parent 07e812b commit e4c5634
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions contracts/TokenGeyser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pragma solidity ^0.8.24;
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { PausableUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import { ReentrancyGuardUpgradeable } from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { Clones } from "@openzeppelin/contracts/proxy/Clones.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { SafeMathCompatibility } from "./_utils/SafeMathCompatibility.sol";
Expand Down Expand Up @@ -37,6 +38,7 @@ contract TokenGeyser is
ReentrancyGuardUpgradeable
{
using SafeMathCompatibility for uint256;
using Math for uint256;
using SafeERC20 for IERC20;

//-------------------------------------------------------------------------
Expand Down Expand Up @@ -360,8 +362,10 @@ contract TokenGeyser is
function totalStakedBy(address addr) public view returns (uint256) {
return
totalStakingShares > 0
? totalStaked().mul(userTotals[addr].stakingShares).div(
totalStakingShares
? totalStaked().mulDiv(
userTotals[addr].stakingShares,
totalStakingShares,
Math.Rounding.Ceil
)
: 0;
}
Expand Down

0 comments on commit e4c5634

Please sign in to comment.