aboutsummaryrefslogtreecommitdiffstats
path: root/packages/contracts/src
diff options
context:
space:
mode:
authorAmir Bandeali <abandeali1@gmail.com>2018-08-25 05:06:46 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-08-25 05:06:46 +0800
commit6a9669a409a61c4645af43f39a4e4a0761354e32 (patch)
tree4054f02bf577ea213122cf5ad3694fc6586db85f /packages/contracts/src
parent070eff6f3a2f3775ef72248c3f345c05cd833798 (diff)
downloaddexon-sol-tools-6a9669a409a61c4645af43f39a4e4a0761354e32.tar
dexon-sol-tools-6a9669a409a61c4645af43f39a4e4a0761354e32.tar.gz
dexon-sol-tools-6a9669a409a61c4645af43f39a4e4a0761354e32.tar.bz2
dexon-sol-tools-6a9669a409a61c4645af43f39a4e4a0761354e32.tar.lz
dexon-sol-tools-6a9669a409a61c4645af43f39a4e4a0761354e32.tar.xz
dexon-sol-tools-6a9669a409a61c4645af43f39a4e4a0761354e32.tar.zst
dexon-sol-tools-6a9669a409a61c4645af43f39a4e4a0761354e32.zip
Rethrow Wallet and Validator errors
Diffstat (limited to 'packages/contracts/src')
-rw-r--r--packages/contracts/src/2.0.0/protocol/Exchange/MixinSignatureValidator.sol32
1 files changed, 28 insertions, 4 deletions
diff --git a/packages/contracts/src/2.0.0/protocol/Exchange/MixinSignatureValidator.sol b/packages/contracts/src/2.0.0/protocol/Exchange/MixinSignatureValidator.sol
index 6bfbb5107..017da742e 100644
--- a/packages/contracts/src/2.0.0/protocol/Exchange/MixinSignatureValidator.sol
+++ b/packages/contracts/src/2.0.0/protocol/Exchange/MixinSignatureValidator.sol
@@ -293,8 +293,20 @@ contract MixinSignatureValidator is
cdStart, // write input over output
32 // output size is 32 bytes
)
- // Signature is valid if call did not revert and returned true
- isValid := and(success, mload(cdStart))
+
+ switch success
+ case 0 {
+ // Revert with `Error("WALLET_ERROR")`
+ mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
+ mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)
+ mstore(64, 0x0000000c57414c4c45545f4552524f5200000000000000000000000000000000)
+ mstore(96, 0)
+ revert(0, 100)
+ }
+ case 1 {
+ // Signature is valid if call did not revert and returned true
+ isValid := mload(cdStart)
+ }
}
return isValid;
}
@@ -331,8 +343,20 @@ contract MixinSignatureValidator is
cdStart, // write input over output
32 // output size is 32 bytes
)
- // Signature is valid if call did not revert and returned true
- isValid := and(success, mload(cdStart))
+
+ switch success
+ case 0 {
+ // Revert with `Error("VALIDATOR_ERROR")`
+ mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
+ mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)
+ mstore(64, 0x0000000f56414c494441544f525f4552524f5200000000000000000000000000)
+ mstore(96, 0)
+ revert(0, 100)
+ }
+ case 1 {
+ // Signature is valid if call did not revert and returned true
+ isValid := mload(cdStart)
+ }
}
return isValid;
}