Skip to content

Commit

Permalink
generalize gpPerBdv
Browse files Browse the repository at this point in the history
  • Loading branch information
Brean0 committed Dec 14, 2023
1 parent 7bdd8b0 commit 017a1b7
Showing 1 changed file with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,37 @@ contract SeasonGettersFacet {
return uint256(s.seedGauge.lastStalkGrowthUpdate).add(ONE_WEEK);
}

/**
* @notice returns the Gauge Points per BDV for a given token.
* @param token The token to get the Gauge Points per BDV for.
*/
function getGaugePointsPerBdvForToken(address token) public view returns (uint256) {
if (token == C.BEAN) {
return getBeanGaugePointsPerBdv();
} else {
return getGaugePointsPerBdvForWell(token);
}
}

/**
* gets the Gauge Points per BDV for a given well.
* @param well
*/
function getGaugePointsPerBdvForWell(address well) public view returns (uint256) {
if(LibWell.isWell(well)) {
uint256 wellGaugePoints = s.ss[well].gaugePoints;
uint256 wellDepositedBdv = s.siloBalances[well].depositedBdv;
return wellGaugePoints.mul(LibGauge.BDV_PRECISION).div(wellDepositedBdv);
} else {
revert ("Token not supported");
}
}

/**
* @notice calculates the BEANETH Gauge Points (GP) per BDV.
*/
function getBeanEthGaugePointsPerBdv() public view returns (uint256) {
uint256 beanEthGaugePoints = s.ss[C.BEAN_ETH_WELL].gaugePoints;
uint256 beanEthDepositedBdv = s.siloBalances[C.BEAN_ETH_WELL].depositedBdv;
return beanEthGaugePoints.mul(LibGauge.BDV_PRECISION).div(beanEthDepositedBdv);
return getGaugePointsPerBdvForWell(C.BEAN_ETH_WELL);
}

/**
Expand Down

0 comments on commit 017a1b7

Please sign in to comment.