Fix build an tests
This commit is contained in:
parent
4705b15188
commit
94738444de
@ -125,7 +125,7 @@ contract MixinParams is
|
|||||||
internal
|
internal
|
||||||
{
|
{
|
||||||
// Ensure state is uninitialized.
|
// Ensure state is uninitialized.
|
||||||
_assertStorageNotInitialized();
|
_assertParamsNotInitialized();
|
||||||
|
|
||||||
// Set up defaults.
|
// Set up defaults.
|
||||||
// These cannot be set to variables, or we go over the stack variable limit.
|
// 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.
|
/// @dev Set all configurable parameters at once.
|
||||||
/// @param _epochDurationInSeconds Minimum seconds between epochs.
|
/// @param _epochDurationInSeconds Minimum seconds between epochs.
|
||||||
/// @param _rewardDelegatedStakeWeight How much delegated stake is weighted vs operator stake, in ppm.
|
/// @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.
|
/// @dev Asserts that cobb douglas alpha values are valid.
|
||||||
/// @param numerator Numerator for cobb douglas alpha factor.
|
/// @param numerator Numerator for cobb douglas alpha factor.
|
||||||
/// @param denominator Denominator for cobb douglas alpha factor.
|
/// @param denominator Denominator for cobb douglas alpha factor.
|
||||||
|
@ -49,27 +49,13 @@ contract MixinScheduler is
|
|||||||
return currentEpochStartTimeInSeconds.safeAdd(epochDurationInSeconds);
|
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.
|
/// @dev Initializes state owned by this mixin.
|
||||||
/// Fails if state was already initialized.
|
/// Fails if state was already initialized.
|
||||||
function _initMixinScheduler()
|
function _initMixinScheduler()
|
||||||
internal
|
internal
|
||||||
{
|
{
|
||||||
// assert the current values before overwriting them.
|
// assert the current values before overwriting them.
|
||||||
_assertMixinSchedulerBeforeInit();
|
_assertSchedulerNotInitialized();
|
||||||
|
|
||||||
// solhint-disable-next-line
|
// solhint-disable-next-line
|
||||||
currentEpochStartTimeInSeconds = block.timestamp;
|
currentEpochStartTimeInSeconds = block.timestamp;
|
||||||
@ -109,4 +95,19 @@ contract MixinScheduler is
|
|||||||
earliestEndTimeInSeconds
|
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
|
internal
|
||||||
|
view
|
||||||
{} // solhint-disable-line no-empty-blocks
|
{} // solhint-disable-line no-empty-blocks
|
||||||
|
|
||||||
function _assertMixinSchedulerBeforeInit()
|
function _assertSchedulerNotInitialized()
|
||||||
internal
|
internal
|
||||||
|
view
|
||||||
{} // solhint-disable-line no-empty-blocks
|
{} // 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 { BigNumber } from '@0x/utils';
|
||||||
import { DecodedLogArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
import { DecodedLogArgs, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
@ -108,6 +108,10 @@ export class CumulativeRewardTrackingSimulation {
|
|||||||
await this._executeActionsAsync(initActions);
|
await this._executeActionsAsync(initActions);
|
||||||
await this._stakingApiWrapper.stakingProxyContract.attachStakingContract.awaitTransactionSuccessAsync(
|
await this._stakingApiWrapper.stakingProxyContract.attachStakingContract.awaitTransactionSuccessAsync(
|
||||||
this.getTestCumulativeRewardTrackingContract().address,
|
this.getTestCumulativeRewardTrackingContract().address,
|
||||||
|
constants.NULL_ADDRESS,
|
||||||
|
constants.NULL_ADDRESS,
|
||||||
|
constants.NULL_ADDRESS,
|
||||||
|
constants.NULL_ADDRESS,
|
||||||
);
|
);
|
||||||
const testLogs = await this._executeActionsAsync(testActions);
|
const testLogs = await this._executeActionsAsync(testActions);
|
||||||
CumulativeRewardTrackingSimulation._assertTestLogs(expectedTestLogs, testLogs);
|
CumulativeRewardTrackingSimulation._assertTestLogs(expectedTestLogs, testLogs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user