tslint needs to _chill_
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { BlockchainBalanceStore } from '@0x/contracts-exchange';
|
||||
import { StakeInfo, StakeStatus } from '@0x/contracts-staking';
|
||||
import { getRandomInteger } from '@0x/contracts-test-utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import { BigNumber, logUtils } from '@0x/utils';
|
||||
|
||||
import { validStakeAssertion, validUnstakeAssertion } from '../function-assertions';
|
||||
import { AssertionResult } from '../utils/function_assertions';
|
||||
@@ -68,7 +68,7 @@ export function StakerMixin<TBase extends Constructor>(Base: TBase): TBase & Con
|
||||
await balanceStore.updateErc20BalancesAsync();
|
||||
const zrxBalance = balanceStore.balances.erc20[this.actor.address][zrx.address];
|
||||
const amount = getRandomInteger(0, zrxBalance);
|
||||
console.log(`stake(${amount})`);
|
||||
logUtils.log(`stake(${amount})`);
|
||||
yield assertion.executeAsync(amount, { from: this.actor.address });
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ export function StakerMixin<TBase extends Constructor>(Base: TBase): TBase & Con
|
||||
undelegatedStake.nextEpochBalance,
|
||||
);
|
||||
const amount = getRandomInteger(0, withdrawableStake);
|
||||
console.log(`unstake(${amount})`);
|
||||
logUtils.log(`unstake(${amount})`);
|
||||
yield assertion.executeAsync(amount, { from: this.actor.address });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import { expect } from '@0x/contracts-test-utils';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
import { BigNumber, logUtils } from '@0x/utils';
|
||||
|
||||
import { DeploymentManager } from '../utils/deployment_manager';
|
||||
import { FunctionAssertion, FunctionResult } from '../utils/function_assertions';
|
||||
|
||||
// tslint:disable:no-unnecessary-type-assertion
|
||||
|
||||
/**
|
||||
* Returns a FunctionAssertion for `createStakingPool` which assumes valid input is provided. The
|
||||
* FunctionAssertion checks that the new poolId is one more than the last poolId.
|
||||
*/
|
||||
export function validCreateStakingPoolAssertion(
|
||||
deployment: DeploymentManager,
|
||||
context?: any,
|
||||
@@ -24,10 +30,10 @@ export function validCreateStakingPoolAssertion(
|
||||
operatorShare: number,
|
||||
addOperatorAsMaker: boolean,
|
||||
) => {
|
||||
const log = result.receipt!.logs[0];
|
||||
const log = result.receipt!.logs[0]; // tslint:disable-line:no-non-null-assertion
|
||||
const actualPoolId = (log as any).args.poolId;
|
||||
expect(actualPoolId).to.equal(expectedPoolId);
|
||||
console.log(`createStakingPool(${operatorShare}, ${addOperatorAsMaker}) => ${actualPoolId}`);
|
||||
logUtils.log(`createStakingPool(${operatorShare}, ${addOperatorAsMaker}) => ${actualPoolId}`);
|
||||
if (context !== undefined) {
|
||||
context.operatorShares[actualPoolId] = operatorShare;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,24 @@
|
||||
import { expect } from '@0x/contracts-test-utils';
|
||||
import { logUtils } from '@0x/utils';
|
||||
|
||||
import { DeploymentManager } from '../utils/deployment_manager';
|
||||
import { FunctionAssertion, FunctionResult } from '../utils/function_assertions';
|
||||
|
||||
/**
|
||||
* Returns a FunctionAssertion for `decreaseStakingPoolOperatorShare` which assumes valid input is
|
||||
* provided. The FunctionAssertion checks that the operator share actually gets updated.
|
||||
*/
|
||||
export function validDecreaseStakingPoolOperatorShareAssertion(
|
||||
deployment: DeploymentManager,
|
||||
context?: any,
|
||||
): FunctionAssertion<{}> {
|
||||
const { stakingWrapper } = deployment.staking;
|
||||
|
||||
return new FunctionAssertion(stakingWrapper.decreaseStakingPoolOperatorShare, {
|
||||
return new FunctionAssertion<{}>(stakingWrapper.decreaseStakingPoolOperatorShare, {
|
||||
after: async (_beforeInfo, _result: FunctionResult, poolId: string, expectedOperatorShare: number) => {
|
||||
const { operatorShare } = await stakingWrapper.getStakingPool.callAsync(poolId);
|
||||
expect(operatorShare).to.bignumber.equal(expectedOperatorShare);
|
||||
console.log(`decreaseStakingPoolOperatorShare(${poolId}, ${expectedOperatorShare})`);
|
||||
logUtils.log(`decreaseStakingPoolOperatorShare(${poolId}, ${expectedOperatorShare})`);
|
||||
if (context !== undefined) {
|
||||
context.operatorShares[poolId] = operatorShare;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,11 @@ import { TxData } from 'ethereum-types';
|
||||
import { DeploymentManager } from '../utils/deployment_manager';
|
||||
import { FunctionAssertion } from '../utils/function_assertions';
|
||||
|
||||
/**
|
||||
* Returns a FunctionAssertion for `stake` which assumes valid input is provided. The
|
||||
* FunctionAssertion checks that the staker and zrxVault's balances of ZRX decrease and increase,
|
||||
* respectively, by the input amount.
|
||||
*/
|
||||
export function validStakeAssertion(
|
||||
deployment: DeploymentManager,
|
||||
balanceStore: BlockchainBalanceStore,
|
||||
|
||||
@@ -6,6 +6,11 @@ import { TxData } from 'ethereum-types';
|
||||
import { DeploymentManager } from '../utils/deployment_manager';
|
||||
import { FunctionAssertion } from '../utils/function_assertions';
|
||||
|
||||
/**
|
||||
* Returns a FunctionAssertion for `unstake` which assumes valid input is provided. The
|
||||
* FunctionAssertion checks that the staker and zrxVault's balances of ZRX increase and decrease,
|
||||
* respectively, by the input amount.
|
||||
*/
|
||||
export function validUnstakeAssertion(
|
||||
deployment: DeploymentManager,
|
||||
balanceStore: BlockchainBalanceStore,
|
||||
|
||||
@@ -27,7 +27,7 @@ export class PoolManagementSimulation extends Simulation {
|
||||
];
|
||||
while (true) {
|
||||
const action = _.sample(actions);
|
||||
yield (await action!.next()).value;
|
||||
yield (await action!.next()).value; // tslint:disable-line:no-non-null-assertion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export class StakeManagementSimulation extends Simulation {
|
||||
const actions = [staker.simulationActions.validStake, staker.simulationActions.validUnstake];
|
||||
while (true) {
|
||||
const action = _.sample(actions);
|
||||
yield (await action!.next()).value;
|
||||
yield (await action!.next()).value; // tslint:disable-line:no-non-null-assertion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user