revert return data

This commit is contained in:
Ricardo Guilherme Schmidt 2019-03-20 22:02:53 -03:00
parent d14c098a4d
commit ce8b9ab5f1
No known key found for this signature in database
GPG Key ID: BFB3F5C8ED618A94
1 changed files with 9 additions and 5 deletions

View File

@ -22,12 +22,16 @@ contract DelegatedCall {
_; //normal execution
} else {
(bool success, bytes memory returnData) = _target.delegatecall(msg.data);
require(success, "Delegated Call failed");
//exit-return delegatecall returnData
assembly {
return(add(returnData, 0x20), returnData)
if(success){
assembly {
return(add(returnData, 0x20), returnData)
}
} else {
assembly {
revert(add(returnData, 0x20), returnData)
}
}
}
}