Fix build an tests
This commit is contained in:
		@@ -125,7 +125,7 @@ contract MixinParams is
 | 
			
		||||
        internal
 | 
			
		||||
    {
 | 
			
		||||
        // Ensure state is uninitialized.
 | 
			
		||||
        _assertStorageNotInitialized();
 | 
			
		||||
        _assertParamsNotInitialized();
 | 
			
		||||
 | 
			
		||||
        // Set up defaults.
 | 
			
		||||
        // These cannot be set to variables, or we go over the stack variable limit.
 | 
			
		||||
@@ -143,6 +143,30 @@ contract MixinParams is
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// @dev Asserts that upgradable storage has not yet been initialized.
 | 
			
		||||
    function _assertParamsNotInitialized()
 | 
			
		||||
        internal
 | 
			
		||||
        view
 | 
			
		||||
    {
 | 
			
		||||
        if (epochDurationInSeconds != 0 &&
 | 
			
		||||
            rewardDelegatedStakeWeight != 0 &&
 | 
			
		||||
            minimumPoolStake != 0 &&
 | 
			
		||||
            maximumMakersInPool != 0 &&
 | 
			
		||||
            cobbDouglasAlphaNumerator != 0 &&
 | 
			
		||||
            cobbDouglasAlphaDenominator != 0 &&
 | 
			
		||||
            address(wethAssetProxy) != NIL_ADDRESS &&
 | 
			
		||||
            address(ethVault) != NIL_ADDRESS &&
 | 
			
		||||
            address(rewardVault) != NIL_ADDRESS &&
 | 
			
		||||
            address(zrxVault) != NIL_ADDRESS
 | 
			
		||||
        ) {
 | 
			
		||||
            LibRichErrors.rrevert(
 | 
			
		||||
                LibStakingRichErrors.InitializationError(
 | 
			
		||||
                    LibStakingRichErrors.InitializationErrorCode.MixinParamsAlreadyInitialized
 | 
			
		||||
                )
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// @dev Set all configurable parameters at once.
 | 
			
		||||
    /// @param _epochDurationInSeconds Minimum seconds between epochs.
 | 
			
		||||
    /// @param _rewardDelegatedStakeWeight How much delegated stake is weighted vs operator stake, in ppm.
 | 
			
		||||
@@ -207,30 +231,6 @@ contract MixinParams is
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// @dev Asserts that upgradable storage has not yet been initialized.
 | 
			
		||||
    function _assertStorageNotInitialized()
 | 
			
		||||
        private
 | 
			
		||||
        view
 | 
			
		||||
    {
 | 
			
		||||
        if (epochDurationInSeconds != 0 &&
 | 
			
		||||
            rewardDelegatedStakeWeight != 0 &&
 | 
			
		||||
            minimumPoolStake != 0 &&
 | 
			
		||||
            maximumMakersInPool != 0 &&
 | 
			
		||||
            cobbDouglasAlphaNumerator != 0 &&
 | 
			
		||||
            cobbDouglasAlphaDenominator != 0 &&
 | 
			
		||||
            address(wethAssetProxy) != NIL_ADDRESS &&
 | 
			
		||||
            address(ethVault) != NIL_ADDRESS &&
 | 
			
		||||
            address(rewardVault) != NIL_ADDRESS &&
 | 
			
		||||
            address(zrxVault) != NIL_ADDRESS
 | 
			
		||||
        ) {
 | 
			
		||||
            LibRichErrors.rrevert(
 | 
			
		||||
                LibStakingRichErrors.InitializationError(
 | 
			
		||||
                    LibStakingRichErrors.InitializationErrorCode.MixinParamsAlreadyInitialized
 | 
			
		||||
                )
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// @dev Asserts that cobb douglas alpha values are valid.
 | 
			
		||||
    /// @param numerator Numerator for cobb douglas alpha factor.
 | 
			
		||||
    /// @param denominator Denominator for cobb douglas alpha factor.
 | 
			
		||||
 
 | 
			
		||||
@@ -49,27 +49,13 @@ contract MixinScheduler is
 | 
			
		||||
        return currentEpochStartTimeInSeconds.safeAdd(epochDurationInSeconds);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// @dev Assert scheduler state before initializing it.
 | 
			
		||||
    /// This must be updated for each migration.
 | 
			
		||||
    function _assertMixinSchedulerBeforeInit()
 | 
			
		||||
        internal
 | 
			
		||||
    {
 | 
			
		||||
        if (currentEpochStartTimeInSeconds != 0) {
 | 
			
		||||
            LibRichErrors.rrevert(
 | 
			
		||||
                LibStakingRichErrors.InitializationError(
 | 
			
		||||
                    LibStakingRichErrors.InitializationErrorCode.MixinSchedulerAlreadyInitialized
 | 
			
		||||
                )
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// @dev Initializes state owned by this mixin.
 | 
			
		||||
    ///      Fails if state was already initialized.
 | 
			
		||||
    function _initMixinScheduler()
 | 
			
		||||
        internal
 | 
			
		||||
    {
 | 
			
		||||
        // assert the current values before overwriting them.
 | 
			
		||||
        _assertMixinSchedulerBeforeInit();
 | 
			
		||||
        _assertSchedulerNotInitialized();
 | 
			
		||||
 | 
			
		||||
        // solhint-disable-next-line
 | 
			
		||||
        currentEpochStartTimeInSeconds = block.timestamp;
 | 
			
		||||
@@ -109,4 +95,19 @@ contract MixinScheduler is
 | 
			
		||||
            earliestEndTimeInSeconds
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// @dev Assert scheduler state before initializing it.
 | 
			
		||||
    /// This must be updated for each migration.
 | 
			
		||||
    function _assertSchedulerNotInitialized()
 | 
			
		||||
        internal
 | 
			
		||||
        view
 | 
			
		||||
    {
 | 
			
		||||
        if (currentEpochStartTimeInSeconds != 0) {
 | 
			
		||||
            LibRichErrors.rrevert(
 | 
			
		||||
                LibStakingRichErrors.InitializationError(
 | 
			
		||||
                    LibStakingRichErrors.InitializationErrorCode.MixinSchedulerAlreadyInitialized
 | 
			
		||||
                )
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -77,11 +77,13 @@ contract TestCumulativeRewardTracking is
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function _assertMixinParamsBeforeInit()
 | 
			
		||||
    function _assertParamsNotInitialized()
 | 
			
		||||
        internal
 | 
			
		||||
        view
 | 
			
		||||
    {} // solhint-disable-line no-empty-blocks
 | 
			
		||||
 | 
			
		||||
    function _assertMixinSchedulerBeforeInit()
 | 
			
		||||
    function _assertSchedulerNotInitialized()
 | 
			
		||||
        internal
 | 
			
		||||
        view
 | 
			
		||||
    {} // solhint-disable-line no-empty-blocks
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { BlockchainTestsEnvironment, expect, txDefaults } from '@0x/contracts-test-utils';
 | 
			
		||||
import { BlockchainTestsEnvironment, constants, expect, txDefaults } from '@0x/contracts-test-utils';
 | 
			
		||||
import { BigNumber } from '@0x/utils';
 | 
			
		||||
import { DecodedLogArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
 | 
			
		||||
import * as _ from 'lodash';
 | 
			
		||||
@@ -108,6 +108,10 @@ export class CumulativeRewardTrackingSimulation {
 | 
			
		||||
        await this._executeActionsAsync(initActions);
 | 
			
		||||
        await this._stakingApiWrapper.stakingProxyContract.attachStakingContract.awaitTransactionSuccessAsync(
 | 
			
		||||
            this.getTestCumulativeRewardTrackingContract().address,
 | 
			
		||||
            constants.NULL_ADDRESS,
 | 
			
		||||
            constants.NULL_ADDRESS,
 | 
			
		||||
            constants.NULL_ADDRESS,
 | 
			
		||||
            constants.NULL_ADDRESS,
 | 
			
		||||
        );
 | 
			
		||||
        const testLogs = await this._executeActionsAsync(testActions);
 | 
			
		||||
        CumulativeRewardTrackingSimulation._assertTestLogs(expectedTestLogs, testLogs);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user