aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-06-27 03:59:35 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-06-27 04:57:55 +0800
commitb6d8dcb6e11cfe8da6854371029fe1af3f6a68de (patch)
treee57d50e796ea356544eaf38476adfdfba2a8a68a
parent08ee1ab2e636099344cade1c8bff67e9b3da2bb4 (diff)
downloaddexon-0x-contracts-b6d8dcb6e11cfe8da6854371029fe1af3f6a68de.tar.gz
dexon-0x-contracts-b6d8dcb6e11cfe8da6854371029fe1af3f6a68de.tar.zst
dexon-0x-contracts-b6d8dcb6e11cfe8da6854371029fe1af3f6a68de.zip
Make dispatchTransferFrom revert with reason from AssetProxy on failure
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol9
-rw-r--r--packages/contracts/test/exchange/core.ts4
2 files changed, 6 insertions, 7 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol
index 93e752af3..f7086f543 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinAssetProxyDispatcher.sol
@@ -180,13 +180,12 @@ contract MixinAssetProxyDispatcher is
cdStart, // pointer to start of input
sub(cdEnd, cdStart), // length of input
cdStart, // write output over input
- 0 // output size is 0 bytes
+ 512 // reserve 512 bytes for output
)
+ if eq(success, 0) {
+ revert(cdStart, returndatasize())
+ }
}
- require(
- success,
- "TRANSFER_FAILED"
- );
}
}
}
diff --git a/packages/contracts/test/exchange/core.ts b/packages/contracts/test/exchange/core.ts
index 99d2bc157..59756fe9a 100644
--- a/packages/contracts/test/exchange/core.ts
+++ b/packages/contracts/test/exchange/core.ts
@@ -817,7 +817,7 @@ describe('Exchange core', () => {
const takerAssetFillAmount = signedOrder.takerAssetAmount;
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
- RevertReason.TransferFailed,
+ RevertReason.InvalidAmount,
);
});
@@ -840,7 +840,7 @@ describe('Exchange core', () => {
const takerAssetFillAmount = signedOrder.takerAssetAmount;
return expectRevertReasonOrAlwaysFailingTransactionAsync(
exchangeWrapper.fillOrderAsync(signedOrder, takerAddress, { takerAssetFillAmount }),
- RevertReason.TransferFailed,
+ RevertReason.InvalidAmount,
);
});