Use ERC721Holder & ERC1155Holder in the TimelockController (#4284)

Co-authored-by: Francisco <fg@frang.io>
This commit is contained in:
Hadrien Croubois
2023-06-15 23:27:36 +02:00
committed by GitHub
parent ff85c7b0eb
commit c014c8f148
2 changed files with 8 additions and 33 deletions

View File

@ -4,8 +4,8 @@
pragma solidity ^0.8.19; pragma solidity ^0.8.19;
import "../access/AccessControl.sol"; import "../access/AccessControl.sol";
import "../token/ERC721/IERC721Receiver.sol"; import "../token/ERC721/utils/ERC721Holder.sol";
import "../token/ERC1155/IERC1155Receiver.sol"; import "../token/ERC1155/utils/ERC1155Holder.sol";
import "../utils/Address.sol"; import "../utils/Address.sol";
/** /**
@ -23,7 +23,7 @@ import "../utils/Address.sol";
* *
* _Available since v3.3._ * _Available since v3.3._
*/ */
contract TimelockController is AccessControl, IERC721Receiver, IERC1155Receiver { contract TimelockController is AccessControl, ERC721Holder, ERC1155Holder {
bytes32 public constant PROPOSER_ROLE = keccak256("PROPOSER_ROLE"); bytes32 public constant PROPOSER_ROLE = keccak256("PROPOSER_ROLE");
bytes32 public constant EXECUTOR_ROLE = keccak256("EXECUTOR_ROLE"); bytes32 public constant EXECUTOR_ROLE = keccak256("EXECUTOR_ROLE");
bytes32 public constant CANCELLER_ROLE = keccak256("CANCELLER_ROLE"); bytes32 public constant CANCELLER_ROLE = keccak256("CANCELLER_ROLE");
@ -155,8 +155,10 @@ contract TimelockController is AccessControl, IERC721Receiver, IERC1155Receiver
/** /**
* @dev See {IERC165-supportsInterface}. * @dev See {IERC165-supportsInterface}.
*/ */
function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, AccessControl) returns (bool) { function supportsInterface(
return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId); bytes4 interfaceId
) public view virtual override(AccessControl, ERC1155Receiver) returns (bool) {
return super.supportsInterface(interfaceId);
} }
/** /**
@ -430,31 +432,4 @@ contract TimelockController is AccessControl, IERC721Receiver, IERC1155Receiver
emit MinDelayChange(_minDelay, newDelay); emit MinDelayChange(_minDelay, newDelay);
_minDelay = newDelay; _minDelay = newDelay;
} }
/**
* @dev See {IERC721Receiver-onERC721Received}.
*/
function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {
return this.onERC721Received.selector;
}
/**
* @dev See {IERC1155Receiver-onERC1155Received}.
*/
function onERC1155Received(address, address, uint256, uint256, bytes memory) public virtual returns (bytes4) {
return this.onERC1155Received.selector;
}
/**
* @dev See {IERC1155Receiver-onERC1155BatchReceived}.
*/
function onERC1155BatchReceived(
address,
address,
uint256[] memory,
uint256[] memory,
bytes memory
) public virtual returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
} }

View File

@ -13,7 +13,7 @@ for (const artifact of artifacts) {
const linearized = []; const linearized = [];
for (const source in solcOutput.contracts) { for (const source in solcOutput.contracts) {
if (source.includes('/mocks/')) { if (['contracts-exposed/', 'contracts/mocks/'].some(pattern => source.startsWith(pattern))) {
continue; continue;
} }