aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-12-05 06:21:07 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-12-19 05:36:05 +0800
commitdbf1de2e691743672fa4918e7ab0f1e3948401f1 (patch)
treef63932d9b1b5b7df59f3f29bf5f89e92f0681134 /packages
parentba986432eca33ffb4d3c916a78049c6633147b82 (diff)
downloaddexon-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')
-rw-r--r--packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol41
-rw-r--r--packages/contracts/test/extensions/compliant_forwarder.ts4
-rw-r--r--packages/types/src/index.ts7
3 files changed, 39 insertions, 13 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
);
});
});
diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts
index 022b24e70..4d5b6e1f2 100644
--- a/packages/types/src/index.ts
+++ b/packages/types/src/index.ts
@@ -243,9 +243,10 @@ export enum RevertReason {
AuctionNotStarted = 'AUCTION_NOT_STARTED',
AuctionInvalidBeginTime = 'INVALID_BEGIN_TIME',
InvalidAssetData = 'INVALID_ASSET_DATA',
- MakerUnverified = 'MAKER_UNVERIFED',
- TakerUnverified = 'TAKER_UNVERIFIED',
- AtLeastOneAddressHasZeroBalance = 'AT_LEAST_ONE_ADDRESS_HAS_ZERO_BALANCE',
+ // Balance Threshold Filter
+ InvalidOrBlockedExchangeSelector = 'INVALID_OR_BLOCKED_EXCHANGE_SELECTOR',
+ BalanceQueryFailed = 'BALANCE_QUERY_FAILED',
+ AtLeastOneAddressDoesNotMeetBalanceThreshold= 'AT_LEAST_ONE_ADDRESS_DOES_NOT_MEET_BALANCE_THRESHOLD',
}
export enum StatusCodes {