Removed assertion that protocol fee != 0 from staking contract.
This commit is contained in:
parent
9ac715f99d
commit
c44e16a88f
@ -5,6 +5,14 @@
|
||||
{
|
||||
"note": "Add more overflow safeguards to `LibFixedMath`",
|
||||
"pr": 2255
|
||||
},
|
||||
{
|
||||
"note": "Refactored finalization state.",
|
||||
"pr": 2276
|
||||
},
|
||||
{
|
||||
"note": "Removed protocol fee != 0 assertion.",
|
||||
"pr": 2278
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -166,7 +166,6 @@ contract MixinExchangeFees is
|
||||
if (msg.value != protocolFeePaid && msg.value != 0) {
|
||||
LibRichErrors.rrevert(
|
||||
LibStakingRichErrors.InvalidProtocolFeePaymentError(
|
||||
LibStakingRichErrors.ProtocolFeePaymentErrorCodes.MismatchedFeeAndPayment,
|
||||
protocolFeePaid,
|
||||
msg.value
|
||||
)
|
||||
|
@ -29,10 +29,6 @@ library LibStakingRichErrors {
|
||||
CanOnlyDecreaseOperatorShare
|
||||
}
|
||||
|
||||
enum ProtocolFeePaymentErrorCodes {
|
||||
MismatchedFeeAndPayment
|
||||
}
|
||||
|
||||
enum InitializationErrorCodes {
|
||||
MixinSchedulerAlreadyInitialized,
|
||||
MixinParamsAlreadyInitialized
|
||||
@ -103,9 +99,9 @@ library LibStakingRichErrors {
|
||||
bytes4 internal constant INVALID_PARAM_VALUE_ERROR_SELECTOR =
|
||||
0xfc45bd11;
|
||||
|
||||
// bytes4(keccak256("InvalidProtocolFeePaymentError(uint8,uint256,uint256)"))
|
||||
// bytes4(keccak256("InvalidProtocolFeePaymentError(uint256,uint256)"))
|
||||
bytes4 internal constant INVALID_PROTOCOL_FEE_PAYMENT_ERROR_SELECTOR =
|
||||
0xefd6cb33;
|
||||
0x31d7a505;
|
||||
|
||||
// bytes4(keccak256("PreviousEpochNotFinalizedError(uint256,uint256)"))
|
||||
bytes4 internal constant PREVIOUS_EPOCH_NOT_FINALIZED_ERROR_SELECTOR =
|
||||
@ -251,7 +247,6 @@ library LibStakingRichErrors {
|
||||
}
|
||||
|
||||
function InvalidProtocolFeePaymentError(
|
||||
ProtocolFeePaymentErrorCodes errorCodes,
|
||||
uint256 expectedProtocolFeePaid,
|
||||
uint256 actualProtocolFeePaid
|
||||
)
|
||||
@ -261,7 +256,6 @@ library LibStakingRichErrors {
|
||||
{
|
||||
return abi.encodeWithSelector(
|
||||
INVALID_PROTOCOL_FEE_PAYMENT_ERROR_SELECTOR,
|
||||
errorCodes,
|
||||
expectedProtocolFeePaid,
|
||||
actualProtocolFeePaid
|
||||
);
|
||||
|
@ -90,21 +90,6 @@ blockchainTests('Protocol Fees unit tests', env => {
|
||||
return expect(tx).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
it('should revert if `protocolFeePaid` is zero with zero value sent', async () => {
|
||||
const tx = testContract.payProtocolFee.awaitTransactionSuccessAsync(
|
||||
makerAddress,
|
||||
payerAddress,
|
||||
ZERO_AMOUNT,
|
||||
{ from: exchangeAddress, value: ZERO_AMOUNT },
|
||||
);
|
||||
const expectedError = new StakingRevertErrors.InvalidProtocolFeePaymentError(
|
||||
StakingRevertErrors.ProtocolFeePaymentErrorCodes.ZeroProtocolFeePaid,
|
||||
ZERO_AMOUNT,
|
||||
ZERO_AMOUNT,
|
||||
);
|
||||
return expect(tx).to.revertWith(expectedError);
|
||||
});
|
||||
|
||||
it('should revert if `protocolFeePaid` is zero with non-zero value sent', async () => {
|
||||
const tx = testContract.payProtocolFee.awaitTransactionSuccessAsync(
|
||||
makerAddress,
|
||||
@ -113,7 +98,6 @@ blockchainTests('Protocol Fees unit tests', env => {
|
||||
{ from: exchangeAddress, value: DEFAULT_PROTOCOL_FEE_PAID },
|
||||
);
|
||||
const expectedError = new StakingRevertErrors.InvalidProtocolFeePaymentError(
|
||||
StakingRevertErrors.ProtocolFeePaymentErrorCodes.ZeroProtocolFeePaid,
|
||||
ZERO_AMOUNT,
|
||||
DEFAULT_PROTOCOL_FEE_PAID,
|
||||
);
|
||||
@ -128,7 +112,6 @@ blockchainTests('Protocol Fees unit tests', env => {
|
||||
{ from: exchangeAddress, value: DEFAULT_PROTOCOL_FEE_PAID.minus(1) },
|
||||
);
|
||||
const expectedError = new StakingRevertErrors.InvalidProtocolFeePaymentError(
|
||||
StakingRevertErrors.ProtocolFeePaymentErrorCodes.MismatchedFeeAndPayment,
|
||||
DEFAULT_PROTOCOL_FEE_PAID,
|
||||
DEFAULT_PROTOCOL_FEE_PAID.minus(1),
|
||||
);
|
||||
@ -143,7 +126,6 @@ blockchainTests('Protocol Fees unit tests', env => {
|
||||
{ from: exchangeAddress, value: DEFAULT_PROTOCOL_FEE_PAID.plus(1) },
|
||||
);
|
||||
const expectedError = new StakingRevertErrors.InvalidProtocolFeePaymentError(
|
||||
StakingRevertErrors.ProtocolFeePaymentErrorCodes.MismatchedFeeAndPayment,
|
||||
DEFAULT_PROTOCOL_FEE_PAID,
|
||||
DEFAULT_PROTOCOL_FEE_PAID.plus(1),
|
||||
);
|
||||
|
@ -113,6 +113,10 @@
|
||||
{
|
||||
"note": "Renamed `OnlyCallableByPoolOperatorOrMakerError` to `OnlyCallableByPoolOperatorError`.",
|
||||
"pr": 2250
|
||||
},
|
||||
{
|
||||
"note": "Removed protocol fee != 0 error.",
|
||||
"pr": 2278
|
||||
}
|
||||
],
|
||||
"timestamp": 1570135330
|
||||
|
@ -14,11 +14,6 @@ export enum OperatorShareErrorCodes {
|
||||
CanOnlyDecreaseOperatorShare,
|
||||
}
|
||||
|
||||
export enum ProtocolFeePaymentErrorCodes {
|
||||
ZeroProtocolFeePaid,
|
||||
MismatchedFeeAndPayment,
|
||||
}
|
||||
|
||||
export enum InvalidParamValueErrorCodes {
|
||||
InvalidCobbDouglasAlpha,
|
||||
InvalidRewardDelegatedStakeWeight,
|
||||
@ -144,14 +139,13 @@ export class InvalidParamValueError extends RevertError {
|
||||
|
||||
export class InvalidProtocolFeePaymentError extends RevertError {
|
||||
constructor(
|
||||
errorCode?: ProtocolFeePaymentErrorCodes,
|
||||
expectedProtocolFeePaid?: BigNumber | number | string,
|
||||
actualProtocolFeePaid?: BigNumber | number | string,
|
||||
) {
|
||||
super(
|
||||
'InvalidProtocolFeePaymentError',
|
||||
'InvalidProtocolFeePaymentError(uint8 errorCode, uint256 expectedProtocolFeePaid, uint256 actualProtocolFeePaid)',
|
||||
{ errorCode, expectedProtocolFeePaid, actualProtocolFeePaid },
|
||||
'InvalidProtocolFeePaymentError(uint256 expectedProtocolFeePaid, uint256 actualProtocolFeePaid)',
|
||||
{ expectedProtocolFeePaid, actualProtocolFeePaid },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user