more explicit sanity checks for computing balance in interval (previously all failed with div-by-zero)

typos
This commit is contained in:
Greg Hysen
2019-09-16 17:04:16 -07:00
parent e224e6cde5
commit 43d1d0b217
8 changed files with 106 additions and 13 deletions

View File

@@ -30,6 +30,12 @@ export enum InitializationErrorCode {
MixinParamsAlreadyInitialized,
}
export enum CumulativeRewardIntervalErrorCode {
BeginEpochMustBeLessThanEndEpoch,
BeginEpochDoesNotHaveReward,
EndEpochDoesNotHaveReward,
}
export class MiscalculatedRewardsError extends RevertError {
constructor(totalRewardsPaid?: BigNumber | number | string, initialContractBalance?: BigNumber | number | string) {
super(
@@ -225,6 +231,21 @@ export class ProxyDestinationCannotBeNilError extends RevertError {
}
}
export class CumulativeRewardIntervalError extends RevertError {
constructor(
errorCode?: CumulativeRewardIntervalErrorCode,
poolId?: string,
beginEpoch?: BigNumber | number | string,
endEpoch?: BigNumber | number | string,
) {
super(
'CumulativeRewardIntervalError',
'CumulativeRewardIntervalError(uint8 errorCode, bytes32 poolId, uint256 beginEpoch, uint256 endEpoch)',
{ errorCode, poolId, beginEpoch, endEpoch },
);
}
}
const types = [
AmountExceedsBalanceOfPoolError,
BlockTimestampTooLowError,
@@ -249,6 +270,7 @@ const types = [
RewardVaultNotSetError,
WithdrawAmountExceedsMemberBalanceError,
ProxyDestinationCannotBeNilError,
CumulativeRewardIntervalError,
];
// Register the types we've defined.