Inline _forceSetMostRecentCumulativeRewardEpoch
This commit is contained in:
		@@ -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.
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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(),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user