Skip to content

Commit

Permalink
Carbon Vortex 2.0 - minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanzhelyazkov committed Apr 16, 2024
1 parent e81aa54 commit 306adfc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions contracts/vortex/CarbonVortex.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ contract CarbonVortex is ICarbonVortex, Upgradeable, ReentrancyGuardUpgradeable,
// total target (if no finalTarget token is defined) / finalTarget tokens collected in transferAddress
uint256 private _totalCollected;

// rewards percentage
// rewards ppm (points per million) - used to calculate rewards for the caller
uint32 private _rewardsPPM;

// price reset multiplier - used to reset the price after a trade in special cases
Expand Down Expand Up @@ -350,7 +350,7 @@ contract CarbonVortex is ICarbonVortex, Upgradeable, ReentrancyGuardUpgradeable,
// allocate array for the reward amounts for caller
uint256[] memory rewardAmounts = new uint256[](len);
// cache rewardsPPM to save gas
uint256 rewardsPercentage = _rewardsPPM;
uint256 rewardsPPMValue = _rewardsPPM;

// withdraw fees from carbon, vault and old vortex
for (uint256 i = 0; i < len; i = uncheckedInc(i)) {
Expand All @@ -377,7 +377,7 @@ contract CarbonVortex is ICarbonVortex, Upgradeable, ReentrancyGuardUpgradeable,
feeAmounts[i] = totalFeeAmount;

// get reward amount for token
rewardAmounts[i] = MathEx.mulDivF(totalFeeAmount, rewardsPercentage, PPM_RESOLUTION);
rewardAmounts[i] = MathEx.mulDivF(totalFeeAmount, rewardsPPMValue, PPM_RESOLUTION);
}

// go through all tokens and start / reset dutch auction if necessary
Expand Down Expand Up @@ -842,7 +842,7 @@ contract CarbonVortex is ICarbonVortex, Upgradeable, ReentrancyGuardUpgradeable,
function _setRewardsPPM(uint32 newRewardsPPM) private {
uint32 prevRewardsPPM = _rewardsPPM;

// return if the rewards percentage PPM is the same
// return if the rewards PPM is the same
if (prevRewardsPPM == newRewardsPPM) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/vortex/interfaces/ICarbonVortex.sol
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ interface ICarbonVortex is IUpgradeable {
event MinTokenSaleAmountUpdated(Token indexed token, uint128 prevMinTokenSaleAmount, uint128 newMinTokenSaleAmount);

/**
* @dev returns the rewards percentage ppm
* @dev returns the rewards ppm
*/
function rewardsPPM() external view returns (uint32);

Expand Down

0 comments on commit 306adfc

Please sign in to comment.