diff options
author | Greg Hysen <greg.hysen@gmail.com> | 2018-12-05 06:21:07 +0800 |
---|---|---|
committer | Greg Hysen <greg.hysen@gmail.com> | 2018-12-19 05:36:05 +0800 |
commit | dbf1de2e691743672fa4918e7ab0f1e3948401f1 (patch) | |
tree | f63932d9b1b5b7df59f3f29bf5f89e92f0681134 /packages/contracts | |
parent | ba986432eca33ffb4d3c916a78049c6633147b82 (diff) | |
download | dexon-sol-tools-dbf1de2e691743672fa4918e7ab0f1e3948401f1.tar dexon-sol-tools-dbf1de2e691743672fa4918e7ab0f1e3948401f1.tar.gz dexon-sol-tools-dbf1de2e691743672fa4918e7ab0f1e3948401f1.tar.bz2 dexon-sol-tools-dbf1de2e691743672fa4918e7ab0f1e3948401f1.tar.lz dexon-sol-tools-dbf1de2e691743672fa4918e7ab0f1e3948401f1.tar.xz dexon-sol-tools-dbf1de2e691743672fa4918e7ab0f1e3948401f1.tar.zst dexon-sol-tools-dbf1de2e691743672fa4918e7ab0f1e3948401f1.zip |
Revert reasons for balance threshold filter
Diffstat (limited to 'packages/contracts')
-rw-r--r-- | packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol | 41 | ||||
-rw-r--r-- | packages/contracts/test/extensions/compliant_forwarder.ts | 4 |
2 files changed, 35 insertions, 10 deletions
diff --git a/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol b/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol index 71c124292..d33f4f398 100644 --- a/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol +++ b/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol @@ -229,8 +229,18 @@ contract CompliantForwarder is ExchangeSelectors{ case 0x4ac1478200000000000000000000000000000000000000000000000000000000 {} // batchCancelOrders case 0x4f9559b100000000000000000000000000000000000000000000000000000000 {} // cancelOrdersUpTo default { - // @TODO Revert with `Error("INVALID_OR_UNHANDLED_EXCHANGE_SELECTOR")` - revert(0, 100) + // Revert with `Error("INVALID_OR_BLOCKED_EXCHANGE_SELECTOR")` + mstore(0x00, 0x08c379a000000000000000000000000000000000000000000000000000000000) + mstore(0x20, 0x0000002000000000000000000000000000000000000000000000000000000000) + mstore(0x40, 0x00000024494e56414c49445f4f525f424c4f434b45445f45584348414e47455f) + mstore(0x60, 0x53454c4543544f52000000000000000000000000000000000000000000000000) + mstore(0x80, 0x00000000) + // Revert length calculation: + // 4 -- error selector + // 32 -- offset to string + // 32 -- string length field + // 64 -- strlen(INVALID_OR_BLOCKED_EXCHANGE_SELECTOR) rounded up to nearest 32-byte word. + revert(0, 132) } ///// Validate Recorded Addresses ///// @@ -264,19 +274,34 @@ contract CompliantForwarder is ExchangeSelectors{ 0x20 // reserve space for return balance (0x20 bytes) ) if eq(success, 0) { - // @TODO Revert with `Error("BALANCE_CHECK_FAILED")` + // @TODO Revert with `Error("BALANCE_QUERY_FAILED")` + mstore(0x00, 0x08c379a000000000000000000000000000000000000000000000000000000000) + mstore(0x20, 0x0000002000000000000000000000000000000000000000000000000000000000) + mstore(0x40, 0x0000001442414c414e43455f51554552595f4641494c45440000000000000000) + mstore(0x60, 0x00000000) + // Revert length calculation: + // 4 -- error selector + // 32 -- offset to string + // 32 -- string length field + // 32 -- strlen(BALANCE_QUERY_FAILED) rounded up to nearest 32-byte word. revert(0, 100) } // Revert if balance not held let addressBalance := mload(freeMemPtr) if eq(addressBalance, 0) { - // Revert with `Error("AT_LEAST_ONE_ADDRESS_HAS_ZERO_BALANCE")` - mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000) + // Revert with `Error("AT_LEAST_ONE_ADDRESS_DOES_NOT_MEET_BALANCE_THRESHOLD")` + mstore(0x00, 0x08c379a000000000000000000000000000000000000000000000000000000000) mstore(0x20, 0x0000002000000000000000000000000000000000000000000000000000000000) - mstore(0x40, 0x0000002541545f4c454153545f4f4e455f414444524553535f4841535f5a4552) - mstore(0x60, 0x4f5f42414c414e43450000000000000000000000000000000000000000000000) - revert(0, 109) + mstore(0x40, 0x0000003441545f4c454153545f4f4e455f414444524553535f444f45535f4e4f) + mstore(0x60, 0x545f4d4545545f42414c414e43455f5448524553484f4c440000000000000000) + mstore(0x80, 0x00000000) + // Revert length calculation: + // 4 -- error selector + // 32 -- offset to string + // 32 -- string length field + // 64 -- strlen(AT_LEAST_ONE_ADDRESS_DOES_NOT_MEET_BALANCE_THRESHOLD) rounded up to nearest 32-byte word. + revert(0, 132) } } diff --git a/packages/contracts/test/extensions/compliant_forwarder.ts b/packages/contracts/test/extensions/compliant_forwarder.ts index 8fa811936..196167264 100644 --- a/packages/contracts/test/extensions/compliant_forwarder.ts +++ b/packages/contracts/test/extensions/compliant_forwarder.ts @@ -303,7 +303,7 @@ describe.only(ContractName.CompliantForwarder, () => { compliantSignedFillOrderTx.data, compliantSignedFillOrderTx.signature, ), - RevertReason.AtLeastOneAddressHasZeroBalance + RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold ); }); it('should revert if maker address is not compliant (does not hold a Yes Token)', async () => { @@ -331,7 +331,7 @@ describe.only(ContractName.CompliantForwarder, () => { signedFillOrderTx.data, signedFillOrderTx.signature, ), - RevertReason.AtLeastOneAddressHasZeroBalance + RevertReason.AtLeastOneAddressDoesNotMeetBalanceThreshold ); }); }); |