Skip to content

Commit

Permalink
Change constant for fee calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaStebaev committed Sep 30, 2024
1 parent 74552f5 commit bdb72d7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions contracts/delegation/Distributor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ import { MathUtils } from "./../utils/MathUtils.sol";
contract Distributor is Permissions, IERC777Recipient, IDistributor {
using MathUtils for uint;

uint256 constant public MAX_CALCULATION_PERIOD_MONTHS = 120;

IERC1820Registry private _erc1820;

mapping(uint256 validatorId => mapping(uint256 month => uint256 amount)) private _bountyPaid;
Expand Down Expand Up @@ -226,8 +228,8 @@ contract Distributor is Permissions, IERC777Recipient, IDistributor {

earned = 0;
endMonth = currentMonth;
if (endMonth > startMonth + 120) {
endMonth = startMonth + 120;
if (endMonth > startMonth + MAX_CALCULATION_PERIOD_MONTHS) {
endMonth = startMonth + MAX_CALCULATION_PERIOD_MONTHS;

Check warning on line 232 in contracts/delegation/Distributor.sol

View check run for this annotation

Codecov / codecov/patch

contracts/delegation/Distributor.sol#L232

Added line #L232 was not covered by tests
}
for (uint256 i = startMonth; i < endMonth; ++i) {
uint256 effectiveDelegatedToValidator = delegationController
Expand Down Expand Up @@ -266,8 +268,8 @@ contract Distributor is Permissions, IERC777Recipient, IDistributor {

earned = 0;
endMonth = currentMonth;
if (endMonth > startMonth + 12) {
endMonth = startMonth + 12;
if (endMonth > startMonth + MAX_CALCULATION_PERIOD_MONTHS) {
endMonth = startMonth + MAX_CALCULATION_PERIOD_MONTHS;

Check warning on line 272 in contracts/delegation/Distributor.sol

View check run for this annotation

Codecov / codecov/patch

contracts/delegation/Distributor.sol#L272

Added line #L272 was not covered by tests
}
for (uint256 i = startMonth; i < endMonth; ++i) {
earned = earned + _feePaid[validatorId][i];
Expand Down

0 comments on commit bdb72d7

Please sign in to comment.