Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ERC165Storage #3880

Merged
merged 13 commits into from
Dec 19, 2022
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* `TransparentUpgradeableProxy`: Removed `admin` and `implementation` getters, which were only callable by the proxy owner and thus not very useful. ([#3820](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3820))
* `ProxyAdmin`: Removed `getProxyAdmin` and `getProxyImplementation` getters. ([#3820](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3820))
* `ERC20`: Deleted `_beforeTokenTransfer` and `_afterTokenTransfer` hooks, added a new internal `_update` function for customizations, and refactored all extensions using those hooks to use `_update` instead. ([#3838](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3838))
* `ERC165Storage`: Removed this contract in favor of inheritance based approach. ([#3880](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3880))

### How to upgrade from 4.x

Expand All @@ -33,6 +34,16 @@ For example, a contract using `ERC20`'s `_beforeTokenTransfer` hook would have t
}
```

#### ERC165Storage
JulissaDantes marked this conversation as resolved.
Show resolved Hide resolved

Users that were registering EIP-165 interfaces with `_registerInterface` from `ERC165Storage` should instead do so so by overriding the `supportsInterface` function as seen below:

```solidity
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
}
```

## Unreleased

* `ReentrancyGuard`: Add a `_reentrancyGuardEntered` function to expose the guard status. ([#3714](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3714))
Expand Down
11 changes: 0 additions & 11 deletions contracts/mocks/ERC165StorageMock.sol

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/token/ERC721/extensions/ERC721Consecutive.sol
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,4 @@ abstract contract ERC721Consecutive is IERC2309, ERC721 {
(bool exists, uint96 latestId, ) = _sequentialOwnership.latestCheckpoint();
return exists ? latestId + 1 : 0;
}
}
}
2 changes: 0 additions & 2 deletions contracts/utils/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ Note that, in all cases, accounts simply _declare_ their interfaces, but they ar

{{ERC165}}

{{ERC165Storage}}

{{ERC165Checker}}

{{IERC1820Registry}}
Expand Down
2 changes: 0 additions & 2 deletions contracts/utils/introspection/ERC165.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import "./IERC165.sol";
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
Expand Down
42 changes: 0 additions & 42 deletions contracts/utils/introspection/ERC165Storage.sol

This file was deleted.

25 changes: 0 additions & 25 deletions test/utils/introspection/ERC165Storage.test.js

This file was deleted.