Made private methods internal to allow for overriding (#2027)

* Made private methods internal to allow for overriding

* Revert package.lock changes.

* Make _move private again

* Expose the ERC1820 registry address

* Add changelog entry

Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
pull/2061/head
Mick de Graaf 5 years ago committed by Nicolás Venturo
parent 7d7cbcad14
commit 73abd54cbe
  1. 1
      CHANGELOG.md
  2. 10
      contracts/token/ERC777/ERC777.sol

@ -10,6 +10,7 @@
### Improvements ### Improvements
* `ERC777`: `_burn` is now internal, providing more flexibility and making it easier to create tokens that deflate. ([#1908](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/1908)) * `ERC777`: `_burn` is now internal, providing more flexibility and making it easier to create tokens that deflate. ([#1908](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/1908))
* `ReentrancyGuard`: greatly improved gas efficiency by using the net gas metering mechanism introduced in the Istanbul hardfork. ([#1992](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/1992), [#1996](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/1996)) * `ReentrancyGuard`: greatly improved gas efficiency by using the net gas metering mechanism introduced in the Istanbul hardfork. ([#1992](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/1992), [#1996](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/1996))
* `ERC777`: improve extensibility by making `_send` and related functions `internal`. ([#2027](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2027))
* `ERC721`: improved revert reason when transferring tokens to a non-recipient contract. ([#2018](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2018)) * `ERC721`: improved revert reason when transferring tokens to a non-recipient contract. ([#2018](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2018))
### Breaking changes ### Breaking changes

@ -28,7 +28,7 @@ contract ERC777 is Context, IERC777, IERC20 {
using SafeMath for uint256; using SafeMath for uint256;
using Address for address; using Address for address;
IERC1820Registry constant private ERC1820_REGISTRY = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24); IERC1820Registry constant internal ERC1820_REGISTRY = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24);
mapping(address => uint256) private _balances; mapping(address => uint256) private _balances;
@ -350,7 +350,7 @@ contract ERC777 is Context, IERC777, IERC20 {
bytes memory operatorData, bytes memory operatorData,
bool requireReceptionAck bool requireReceptionAck
) )
private internal
{ {
require(from != address(0), "ERC777: send from the zero address"); require(from != address(0), "ERC777: send from the zero address");
require(to != address(0), "ERC777: send to the zero address"); require(to != address(0), "ERC777: send to the zero address");
@ -408,7 +408,7 @@ contract ERC777 is Context, IERC777, IERC20 {
emit Transfer(from, to, amount); emit Transfer(from, to, amount);
} }
function _approve(address holder, address spender, uint256 value) private { function _approve(address holder, address spender, uint256 value) internal {
// TODO: restore this require statement if this function becomes internal, or is called at a new callsite. It is // TODO: restore this require statement if this function becomes internal, or is called at a new callsite. It is
// currently unnecessary. // currently unnecessary.
//require(holder != address(0), "ERC777: approve from the zero address"); //require(holder != address(0), "ERC777: approve from the zero address");
@ -435,7 +435,7 @@ contract ERC777 is Context, IERC777, IERC20 {
bytes memory userData, bytes memory userData,
bytes memory operatorData bytes memory operatorData
) )
private internal
{ {
address implementer = ERC1820_REGISTRY.getInterfaceImplementer(from, TOKENS_SENDER_INTERFACE_HASH); address implementer = ERC1820_REGISTRY.getInterfaceImplementer(from, TOKENS_SENDER_INTERFACE_HASH);
if (implementer != address(0)) { if (implementer != address(0)) {
@ -463,7 +463,7 @@ contract ERC777 is Context, IERC777, IERC20 {
bytes memory operatorData, bytes memory operatorData,
bool requireReceptionAck bool requireReceptionAck
) )
private internal
{ {
address implementer = ERC1820_REGISTRY.getInterfaceImplementer(to, TOKENS_RECIPIENT_INTERFACE_HASH); address implementer = ERC1820_REGISTRY.getInterfaceImplementer(to, TOKENS_RECIPIENT_INTERFACE_HASH);
if (implementer != address(0)) { if (implementer != address(0)) {

Loading…
Cancel
Save