Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add commission to RewardsDistributer event #192

Merged
merged 1 commit into from
May 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions contracts/RewardsDistributer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ contract RewardsDistributer is IRewardsDistributer, Initializable, OwnableUpgrad

/// @dev ### EVENTS
/// @notice Emitted when rewards are distributed for the earliest pending distributed Era.
event DistributeRewards(address indexed indexer, uint256 indexed eraIdx, uint256 rewards);
event DistributeRewards(address indexed indexer, uint256 indexed eraIdx, uint256 rewards, uint256 commission);
/// @notice Emitted when user claimed rewards.
event ClaimRewards(address indexed indexer, address indexed delegator, uint256 rewards);
/// @notice Emitted when the rewards change, such as when rewards coming from new agreement.
Expand Down Expand Up @@ -289,12 +289,12 @@ contract RewardsDistributer is IRewardsDistributer, Initializable, OwnableUpgrad
uint256 commission = MathUtil.mulDiv(commissionRate, rewardInfo.eraReward, PER_MILL);

info[indexer].accSQTPerStake += MathUtil.mulDiv(rewardInfo.eraReward - commission, PER_TRILL, totalStake);

// add commission to unbonding request
IERC20(settings.getSQToken()).safeTransfer(settings.getStaking(), commission);
IStaking(settings.getStaking()).unbondCommission(indexer, commission);

emit DistributeRewards(indexer, rewardInfo.lastClaimEra, rewardInfo.eraReward);
emit DistributeRewards(indexer, rewardInfo.lastClaimEra, rewardInfo.eraReward, commission);

IPermissionedExchange exchange = IPermissionedExchange(settings.getPermissionedExchange());
exchange.addQuota(settings.getSQToken(), indexer, commission);
Expand Down