mirror of
https://github.com/status-im/open-bounty.git
synced 2025-01-11 10:06:20 +00:00
support dynamic data return
This commit is contained in:
parent
451984b55c
commit
e43d1c5d78
@ -25,7 +25,7 @@ contract DelegatedCall {
|
||||
(outDataPtr, outSize) = _delegatecall(inDataPtr, inSize);
|
||||
_;
|
||||
assembly {
|
||||
return(0, outSize)
|
||||
return(outDataPtr, outSize)
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,16 +56,17 @@ contract DelegatedCall {
|
||||
internal
|
||||
returns(bytes32 outDataPtr, uint256 outSize)
|
||||
{
|
||||
outSize = 0x20;
|
||||
address target = _getDelegatedContract();
|
||||
outDataPtr = _malloc(outSize);
|
||||
bool failed;
|
||||
|
||||
assembly {
|
||||
failed := iszero(delegatecall(sub(gas, 10000), target, inDataPtr, inSize, outDataPtr, outSize))
|
||||
failed := iszero(delegatecall(sub(gas, 10000), target, inDataPtr, inSize, 0, 0))
|
||||
outSize := returndatasize
|
||||
}
|
||||
require(!failed);
|
||||
outDataPtr = _malloc(outSize);
|
||||
assembly {
|
||||
returndatacopy(outDataPtr, 0, outSize)
|
||||
}
|
||||
|
||||
assert(!failed);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user