File tree 1 file changed +14
-3
lines changed
contracts/prebuilts/unaudited/checkout
1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -52,17 +52,28 @@ contract TargetCheckout is IPluginCheckout {
52
52
53
53
function _execute (UserOp memory op ) internal {
54
54
bool success;
55
+ bytes memory response;
55
56
if (op.currency == CurrencyTransferLib.NATIVE_TOKEN) {
56
- (success, ) = op.target.call { value: op.valueToSend }(op.data);
57
+ (success, response ) = op.target.call { value: op.valueToSend }(op.data);
57
58
} else {
58
59
if (op.valueToSend != 0 && op.approvalRequired) {
59
60
IERC20 (op.currency).approve (op.target, op.valueToSend);
60
61
}
61
62
62
- (success, ) = op.target.call (op.data);
63
+ (success, response ) = op.target.call (op.data);
63
64
}
64
65
65
- require (success, "Execution failed " );
66
+ if (! success) {
67
+ // If there is return data, the delegate call reverted with a reason or a custom error, which we bubble up.
68
+ if (response.length > 0 ) {
69
+ assembly {
70
+ let returndata_size := mload (response)
71
+ revert (add (32 , response), returndata_size)
72
+ }
73
+ } else {
74
+ revert ("Checkout: Execution Failed " );
75
+ }
76
+ }
66
77
}
67
78
68
79
function _canExecute (UserOp memory op , address caller ) internal view returns (bool ) {
You can’t perform that action at this time.
0 commit comments