Skip to content

Commit c100474

Browse files
committed
Add support for Fusion and Fusion+
1 parent d7a7932 commit c100474

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

contracts/extensions/ETHOrders.sol

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,21 @@ contract ETHOrders is IPostInteraction, OnlyWethReceiver, EIP712Alien {
5656

5757
mapping(address maker => mapping(bytes32 orderHash => Deposit data)) public deposits;
5858

59-
modifier onlyLimitOrderProtocol {
60-
if (msg.sender != _LIMIT_ORDER_PROTOCOL) revert AccessDenied();
59+
modifier onlyLimitOrderProtocolOrOneOfTails(bytes calldata allowedMsgSenders) {
60+
if (!_onlyLimitOrderProtocolOrOneOfTails(allowedMsgSenders)) revert AccessDenied();
6161
_;
6262
}
6363

64+
function _onlyLimitOrderProtocolOrOneOfTails(bytes calldata allowedMsgSenders) internal view returns (bool) {
65+
bytes10 shortAddress = bytes10(uint80(uint160(msg.sender)));
66+
for (uint256 i = 0; i < allowedMsgSenders.length; i += 10) {
67+
if (shortAddress == bytes10(allowedMsgSenders[i:])) {
68+
return true;
69+
}
70+
}
71+
return (msg.sender == _LIMIT_ORDER_PROTOCOL);
72+
}
73+
6474
modifier onlyResolver {
6575
if (_ACCESS_TOKEN.balanceOf(msg.sender) == 0) revert AccessDenied();
6676
_;
@@ -160,8 +170,8 @@ contract ETHOrders is IPostInteraction, OnlyWethReceiver, EIP712Alien {
160170
uint256 makingAmount,
161171
uint256 /* takingAmount */,
162172
uint256 /* remainingMakingAmount */,
163-
bytes calldata /* extraData */
164-
) external onlyLimitOrderProtocol {
173+
bytes calldata extraData
174+
) external onlyLimitOrderProtocolOrOneOfTails(extraData) {
165175
deposits[order.maker.get()][orderHash].balance -= uint208(makingAmount);
166176
}
167177

0 commit comments

Comments
 (0)