Skip to content

Commit c014c8f

Browse files
Amxxfrangio
andauthored
Use ERC721Holder & ERC1155Holder in the TimelockController (#4284)
Co-authored-by: Francisco <fg@frang.io>
1 parent ff85c7b commit c014c8f

File tree

2 files changed

+8
-33
lines changed

2 files changed

+8
-33
lines changed

contracts/governance/TimelockController.sol

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
pragma solidity ^0.8.19;
55

66
import "../access/AccessControl.sol";
7-
import "../token/ERC721/IERC721Receiver.sol";
8-
import "../token/ERC1155/IERC1155Receiver.sol";
7+
import "../token/ERC721/utils/ERC721Holder.sol";
8+
import "../token/ERC1155/utils/ERC1155Holder.sol";
99
import "../utils/Address.sol";
1010

1111
/**
@@ -23,7 +23,7 @@ import "../utils/Address.sol";
2323
*
2424
* _Available since v3.3._
2525
*/
26-
contract TimelockController is AccessControl, IERC721Receiver, IERC1155Receiver {
26+
contract TimelockController is AccessControl, ERC721Holder, ERC1155Holder {
2727
bytes32 public constant PROPOSER_ROLE = keccak256("PROPOSER_ROLE");
2828
bytes32 public constant EXECUTOR_ROLE = keccak256("EXECUTOR_ROLE");
2929
bytes32 public constant CANCELLER_ROLE = keccak256("CANCELLER_ROLE");
@@ -155,8 +155,10 @@ contract TimelockController is AccessControl, IERC721Receiver, IERC1155Receiver
155155
/**
156156
* @dev See {IERC165-supportsInterface}.
157157
*/
158-
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, AccessControl) returns (bool) {
159-
return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
158+
function supportsInterface(
159+
bytes4 interfaceId
160+
) public view virtual override(AccessControl, ERC1155Receiver) returns (bool) {
161+
return super.supportsInterface(interfaceId);
160162
}
161163

162164
/**
@@ -430,31 +432,4 @@ contract TimelockController is AccessControl, IERC721Receiver, IERC1155Receiver
430432
emit MinDelayChange(_minDelay, newDelay);
431433
_minDelay = newDelay;
432434
}
433-
434-
/**
435-
* @dev See {IERC721Receiver-onERC721Received}.
436-
*/
437-
function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {
438-
return this.onERC721Received.selector;
439-
}
440-
441-
/**
442-
* @dev See {IERC1155Receiver-onERC1155Received}.
443-
*/
444-
function onERC1155Received(address, address, uint256, uint256, bytes memory) public virtual returns (bytes4) {
445-
return this.onERC1155Received.selector;
446-
}
447-
448-
/**
449-
* @dev See {IERC1155Receiver-onERC1155BatchReceived}.
450-
*/
451-
function onERC1155BatchReceived(
452-
address,
453-
address,
454-
uint256[] memory,
455-
uint256[] memory,
456-
bytes memory
457-
) public virtual returns (bytes4) {
458-
return this.onERC1155BatchReceived.selector;
459-
}
460435
}

scripts/checks/inheritance-ordering.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ for (const artifact of artifacts) {
1313
const linearized = [];
1414

1515
for (const source in solcOutput.contracts) {
16-
if (source.includes('/mocks/')) {
16+
if (['contracts-exposed/', 'contracts/mocks/'].some(pattern => source.startsWith(pattern))) {
1717
continue;
1818
}
1919

0 commit comments

Comments
 (0)