Inline _forceSetMostRecentCumulativeRewardEpoch

This commit is contained in:
Amir Bandeali
2019-09-25 11:03:26 -07:00
parent 25cb1c1138
commit 4440075425
3 changed files with 3 additions and 49 deletions

View File

@@ -76,29 +76,8 @@ contract MixinCumulativeRewards is
}
// Update state to reflect the most recent cumulative reward
_forceSetMostRecentCumulativeRewardEpoch(
poolId,
currentMostRecentEpoch,
currentEpoch_
);
}
/// @dev Forcefully sets the epoch of the most recent cumulative reward.
/// @param poolId Unique Id of pool.
/// @param currentMostRecentEpoch Epoch of the most recent cumulative
/// reward.
/// @param newMostRecentEpoch Epoch of the new most recent cumulative
/// reward.
function _forceSetMostRecentCumulativeRewardEpoch(
bytes32 poolId,
uint256 currentMostRecentEpoch,
uint256 newMostRecentEpoch
)
internal
{
// Sanity check that we're not trying to go back in time
assert(newMostRecentEpoch >= currentMostRecentEpoch);
_cumulativeRewardsByPoolLastStored[poolId] = newMostRecentEpoch;
assert(currentEpoch_ > currentMostRecentEpoch);
_cumulativeRewardsByPoolLastStored[poolId] = currentEpoch_;
}
/// @dev Computes a member's reward over a given epoch interval.

View File

@@ -30,11 +30,6 @@ contract TestCumulativeRewardTracking is
uint256 epoch
);
event SetMostRecentCumulativeReward(
bytes32 poolId,
uint256 epoch
);
constructor(
address wethAddress,
address zrxVaultAddress
@@ -61,19 +56,4 @@ contract TestCumulativeRewardTracking is
value
);
}
function _forceSetMostRecentCumulativeRewardEpoch(
bytes32 poolId,
uint256 currentMostRecentEpoch,
uint256 newMostRecentEpoch
)
internal
{
emit SetMostRecentCumulativeReward(poolId, newMostRecentEpoch);
MixinCumulativeRewards._forceSetMostRecentCumulativeRewardEpoch(
poolId,
currentMostRecentEpoch,
newMostRecentEpoch
);
}
}

View File

@@ -36,12 +36,7 @@ export class CumulativeRewardTrackingSimulation {
private static _extractTestLogs(txReceiptLogs: DecodedLogs): TestLog[] {
const logs = [];
for (const log of txReceiptLogs) {
if (log.event === TestCumulativeRewardTrackingEvents.SetMostRecentCumulativeReward) {
logs.push({
event: log.event,
epoch: log.args.epoch.toNumber(),
});
} else if (log.event === TestCumulativeRewardTrackingEvents.SetCumulativeReward) {
if (log.event === TestCumulativeRewardTrackingEvents.SetCumulativeReward) {
logs.push({
event: log.event,
epoch: log.args.epoch.toNumber(),