Skip to content

Commit

Permalink
Fix indent
Browse files Browse the repository at this point in the history
  • Loading branch information
izqui committed Mar 14, 2018
1 parent 9561d2e commit aecd6f7
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions contracts/common/DelegateProxy.sol
Expand Up @@ -18,26 +18,26 @@ contract DelegateProxy {
* @param _minReturnSize Minimum size the call needs to return, if less than that it will revert
*/
function delegateFwd(address _dst, bytes _calldata, uint256 _minReturnSize) internal {
require(isContract(_dst));
uint256 size;
uint256 result;

assembly {
result := delegatecall(sub(gas, 10000), _dst, add(_calldata, 0x20), mload(_calldata), 0, 0)
size := returndatasize
}

require(size >= _minReturnSize);

assembly {
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)

// revert instead of invalid() bc if the underlying call failed with invalid() it already wasted gas.
// if the call returned error data, forward it
switch result case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
require(isContract(_dst));
uint256 size;
uint256 result;

assembly {
result := delegatecall(sub(gas, 10000), _dst, add(_calldata, 0x20), mload(_calldata), 0, 0)
size := returndatasize
}

require(size >= _minReturnSize);

assembly {
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)

// revert instead of invalid() bc if the underlying call failed with invalid() it already wasted gas.
// if the call returned error data, forward it
switch result case 0 { revert(ptr, size) }
default { return(ptr, size) }
}
}

function isContract(address _target) internal view returns (bool) {
Expand Down

0 comments on commit aecd6f7

Please sign in to comment.