Separate filled/cancelled errors
This commit is contained in:
@@ -24,7 +24,8 @@ contract LibErrors {
|
||||
// Error Codes
|
||||
enum Errors {
|
||||
ORDER_EXPIRED, // Order has already expired
|
||||
ORDER_FULLY_FILLED_OR_CANCELLED, // Order has already been fully filled or cancelled
|
||||
ORDER_FULLY_FILLED, // Order has already been fully filled
|
||||
ORDER_CANCELLED, // Order has already been cancelled
|
||||
ROUNDING_ERROR_TOO_LARGE, // Rounding error too large
|
||||
INSUFFICIENT_BALANCE_OR_ALLOWANCE // Insufficient balance or allowance for token transfer
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ contract MixinExchangeCore is
|
||||
|
||||
// Check if order has been cancelled
|
||||
if (cancelled[orderHash]) {
|
||||
LogError(uint8(Errors.ORDER_FULLY_FILLED_OR_CANCELLED), orderHash);
|
||||
LogError(uint8(Errors.ORDER_CANCELLED), orderHash);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ contract MixinExchangeCore is
|
||||
}
|
||||
|
||||
if (cancelled[orderHash]) {
|
||||
LogError(uint8(Errors.ORDER_FULLY_FILLED_OR_CANCELLED), orderHash);
|
||||
LogError(uint8(Errors.ORDER_CANCELLED), orderHash);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,8 @@ export interface TokenInfoByNetwork {
|
||||
|
||||
export enum ExchangeContractErrs {
|
||||
ERROR_ORDER_EXPIRED,
|
||||
ERROR_ORDER_FULLY_FILLED_OR_CANCELLED,
|
||||
ERROR_ORDER_FULLY_FILLED,
|
||||
ERROR_ORDER_CANCELLED,
|
||||
ERROR_ROUNDING_ERROR_TOO_LARGE,
|
||||
ERROR_INSUFFICIENT_BALANCE_OR_ALLOWANCE,
|
||||
}
|
||||
|
||||
@@ -601,7 +601,7 @@ describe('Exchange', () => {
|
||||
expect(res.logs).to.have.length(1);
|
||||
const log = logDecoder.decodeLogOrThrow(res.logs[0]) as LogWithDecodedArgs<LogErrorContractEventArgs>;
|
||||
const errCode = log.args.errorId;
|
||||
expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_FULLY_FILLED_OR_CANCELLED);
|
||||
expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_FULLY_FILLED);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -663,7 +663,7 @@ describe('Exchange', () => {
|
||||
expect(res.logs).to.have.length(1);
|
||||
const log = logDecoder.decodeLogOrThrow(res.logs[0]) as LogWithDecodedArgs<LogErrorContractEventArgs>;
|
||||
const errCode = log.args.errorId;
|
||||
expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_FULLY_FILLED_OR_CANCELLED);
|
||||
expect(errCode).to.be.equal(ExchangeContractErrs.ERROR_ORDER_CANCELLED);
|
||||
});
|
||||
|
||||
it('should log error if order is expired', async () => {
|
||||
|
||||
Reference in New Issue
Block a user