aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorRemco Bloemen <remco@wicked.ventures>2018-02-22 08:36:13 +0800
committerAmir Bandeali <abandeali1@gmail.com>2018-04-21 04:56:16 +0800
commitf7dd6f7a7e2fdeeaa62cae6a98288c8ffb22e7a8 (patch)
tree8683385265392936a686ec9f382d052a161d004d /packages
parent655c1eb90fb4da08a2374280e2fd5fb786f67f3b (diff)
downloaddexon-sol-tools-f7dd6f7a7e2fdeeaa62cae6a98288c8ffb22e7a8.tar
dexon-sol-tools-f7dd6f7a7e2fdeeaa62cae6a98288c8ffb22e7a8.tar.gz
dexon-sol-tools-f7dd6f7a7e2fdeeaa62cae6a98288c8ffb22e7a8.tar.bz2
dexon-sol-tools-f7dd6f7a7e2fdeeaa62cae6a98288c8ffb22e7a8.tar.lz
dexon-sol-tools-f7dd6f7a7e2fdeeaa62cae6a98288c8ffb22e7a8.tar.xz
dexon-sol-tools-f7dd6f7a7e2fdeeaa62cae6a98288c8ffb22e7a8.tar.zst
dexon-sol-tools-f7dd6f7a7e2fdeeaa62cae6a98288c8ffb22e7a8.zip
Fix input length in fillOrderNoThrow
Diffstat (limited to 'packages')
-rw-r--r--packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol17
1 files changed, 11 insertions, 6 deletions
diff --git a/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol b/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol
index 81a82eeec..b4ef88363 100644
--- a/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol
+++ b/packages/contracts/src/contracts/current/protocol/Exchange/MixinWrapperFunctions.sol
@@ -59,6 +59,10 @@ contract MixinWrapperFunctions is
{
bytes4 FILL_ORDER_FUNCTION_SIGNATURE = bytes4(keccak256("fillOrder(address[5],uint256[6],uint256,uint8,bytes32,bytes32)"));
+ // Input size is padded to a 4 + n * 32 byte boundary
+ uint256 mask = 0x1F;
+ uint256 inputSize = 388 + (signature.length + mask) & ~mask;
+
assembly {
let x := mload(0x40) // free memory pointer
mstore(x, FILL_ORDER_FUNCTION_SIGNATURE)
@@ -85,15 +89,16 @@ contract MixinWrapperFunctions is
dst := add(dst, 32)
} {
mstore(dst, mload(src))
+ // TODO: zero the padding
}
success := delegatecall(
- gas, // TODO: don't send all gas, save some for returning is case of throw
- address, // call this contract
- x, // inputs start at x
- 484, // inputs are 484 bytes long (4 + 15 * 32)
- x, // store output over input
- 32 // output is 32 bytes
+ gas, // TODO: don't send all gas, save some for returning in case of throw
+ address, // call this contract
+ x, // inputs start at x
+ inputSize, // input are size
+ x, // store output over input
+ 32 // output is 32 bytes
)
takerTokenFilledAmount := mload(x)