refactor SafeMath rich errors and use them in staking libs

This commit is contained in:
Michael Zhu
2019-08-23 15:49:17 -07:00
parent cd1fc6a1f0
commit 98e5b26eb7
19 changed files with 371 additions and 174 deletions

View File

@@ -173,8 +173,8 @@ describe('ERC1155Token', () => {
const tokenToTransfer = fungibleToken;
const valueToTransfer = spenderInitialFungibleBalance.plus(1);
// create the expected error (a uint256 underflow)
const expectedError = new SafeMathRevertErrors.SafeMathError(
SafeMathRevertErrors.SafeMathErrorCodes.Uint256SubtractionUnderflow,
const expectedError = new SafeMathRevertErrors.Uint256BinopError(
SafeMathRevertErrors.BinopErrorCodes.SubtractionUnderflow,
spenderInitialFungibleBalance,
valueToTransfer,
);
@@ -349,8 +349,8 @@ describe('ERC1155Token', () => {
const tokensToTransfer = [fungibleToken];
const valuesToTransfer = [spenderInitialFungibleBalance.plus(1)];
// create the expected error (a uint256 underflow)
const expectedError = new SafeMathRevertErrors.SafeMathError(
SafeMathRevertErrors.SafeMathErrorCodes.Uint256SubtractionUnderflow,
const expectedError = new SafeMathRevertErrors.Uint256BinopError(
SafeMathRevertErrors.BinopErrorCodes.SubtractionUnderflow,
spenderInitialFungibleBalance,
valuesToTransfer[0],
);