aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-03-24 06:33:49 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-04-21 04:56:17 +0800
commit3541f5e1dac692fa12fafd4822dc98aa7afe5c1c (patch)
treeceb98de2233188ac0aad1f04cfa25a1290198290 /packages
parent8f809e3a292c55e0f6440f9cf7c8746ede7ad583 (diff)
downloaddexon-sol-tools-3541f5e1dac692fa12fafd4822dc98aa7afe5c1c.tar
dexon-sol-tools-3541f5e1dac692fa12fafd4822dc98aa7afe5c1c.tar.gz
dexon-sol-tools-3541f5e1dac692fa12fafd4822dc98aa7afe5c1c.tar.bz2
dexon-sol-tools-3541f5e1dac692fa12fafd4822dc98aa7afe5c1c.tar.lz
dexon-sol-tools-3541f5e1dac692fa12fafd4822dc98aa7afe5c1c.tar.xz
dexon-sol-tools-3541f5e1dac692fa12fafd4822dc98aa7afe5c1c.tar.zst
dexon-sol-tools-3541f5e1dac692fa12fafd4822dc98aa7afe5c1c.zip
Separate filled/cancelled errors
Diffstat (limited to 'packages')
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/LibErrors.sol3
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol4
-rw-r--r--packages/contracts/src/utils/types.ts3
-rw-r--r--packages/contracts/test/exchange/core.ts4
4 files changed, 8 insertions, 6 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/LibErrors.sol b/packages/contracts/src/contracts/current/protocol/Exchange/LibErrors.sol
index 08a578c93..7fa9d4860 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/LibErrors.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/LibErrors.sol
@@ -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
}
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol
index a0603ec78..a42519850 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinExchangeCore.sol
@@ -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;
}
diff --git a/packages/contracts/src/utils/types.ts b/packages/contracts/src/utils/types.ts
index 460d0a58a..ce87e9851 100644
--- a/packages/contracts/src/utils/types.ts
+++ b/packages/contracts/src/utils/types.ts
@@ -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,
}
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index 3919d43d8..4dfe3df5d 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -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 () => {