address comments

This commit is contained in:
Michael Zhu
2020-01-15 09:47:49 -08:00
parent 089ec35ceb
commit f217840998
5 changed files with 16 additions and 84 deletions

View File

@@ -9,7 +9,6 @@ import {
StoredBalance,
} from '@0x/contracts-staking';
import { expect } from '@0x/contracts-test-utils';
import { SafeMathRevertErrors } from '@0x/contracts-utils';
import { BigNumber } from '@0x/utils';
import { TxData } from 'ethereum-types';
import * as _ from 'lodash';
@@ -221,31 +220,4 @@ export function moveStakeNonexistentPoolAssertion(
},
);
}
/**
* Returns a FunctionAssertion for `moveStake` which assumes the input amount exceeds the moveable
* amount of stake. Checks that the transaction reverts.
*/
export function moveStakeInvalidAmountAssertion(
deployment: DeploymentManager,
): FunctionAssertion<[StakeInfo, StakeInfo, BigNumber], void, void> {
return new FunctionAssertion<[StakeInfo, StakeInfo, BigNumber], void, void>(
deployment.staking.stakingWrapper,
'moveStake',
{
after: async (_beforeInfo: void, result: FunctionResult) => {
// Ensure that the tx reverted.
expect(result.success).to.be.false();
// This isn't ideal but unfortunately there are several different revert errors that
// can be triggered by trying to move more stake than possible.
expect(
result.data instanceof SafeMathRevertErrors.Uint256BinOpError ||
result.data instanceof SafeMathRevertErrors.Uint256DowncastError ||
result.data instanceof StakingRevertErrors.InsufficientBalanceError,
).to.be.true();
},
},
);
}
/* tslint:enable:no-unnecessary-type-assertion */