File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,9 @@ abstract contract OrderOrigin {
75
75
/// @notice Thrown when an Order is submitted with a deadline that has passed.
76
76
error OrderExpired ();
77
77
78
+ /// @notice Thrown when trying to call `sweep` if not the Builder of the block.
79
+ error OnlyBuilder ();
80
+
78
81
/// @notice Emitted when an Order is submitted for fulfillment.
79
82
event Order (uint256 deadline , Input[] inputs , Output[] outputs );
80
83
@@ -123,10 +126,14 @@ abstract contract OrderOrigin {
123
126
/// @notice Transfer the entire balance of ERC20 tokens to the recipient.
124
127
/// @dev Called by the Builder within the same block as users' `initiate` transactions
125
128
/// to claim the `inputs`.
126
- /// @dev Builder MUST ensure that no other account calls `sweep` before them .
129
+ /// @dev Builder MUST call `sweep` atomically with `fill` (claim Inputs atomically with sending Outputs) .
127
130
/// @param recipient - The address to receive the tokens.
128
131
/// @param token - The token to transfer.
132
+ /// @custom:emits Sweep
133
+ /// @custom:reverts OnlyBuilder if called by non-block builder
129
134
function sweep (address recipient , address token ) public {
135
+ if (msg .sender != block .coinbase ) revert OnlyBuilder ();
136
+ // send ETH or tokens
130
137
uint256 balance;
131
138
if (token == address (0 )) {
132
139
balance = address (this ).balance;
You can’t perform that action at this time.
0 commit comments