Unverified Commit 9975a1a0 by Nicolás Venturo Committed by GitHub

Remove Address.toPayable (#2133)

* Remove Address.toPayable

* Add changelog entry
parent eb34ae67
......@@ -21,6 +21,7 @@
* `Secondary`: removed from the library, use `Ownable` instead. ([#2120](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2120))
* `Escrow`, `ConditionalEscrow`, `RefundEscrow`: these now use `Ownable` instead of `Secondary`, their external API changed accordingly. ([#2120](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2120))
* `ERC20`: removed `_burnFrom`. ([#2119](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2119))
* `Address`: removed `toPayable`, use `payable(address)` instead. ([#2133](https://github.com/OpenZeppelin/openzeppelin-contracts/pull/2133))
## 2.5.0 (2020-02-04)
......
......@@ -7,10 +7,6 @@ contract AddressImpl {
return Address.isContract(account);
}
function toPayable(address account) external pure returns (address payable) {
return Address.toPayable(account);
}
function sendValue(address payable receiver, uint256 amount) external {
Address.sendValue(receiver, amount);
}
......
......@@ -33,16 +33,6 @@ library Address {
}
/**
* @dev Converts an `address` into `address payable`. Note that this is
* simply a type cast: the actual underlying value is not changed.
*
* _Available since v2.4.0._
*/
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
......
const { accounts, contract } = require('@openzeppelin/test-environment');
const { balance, constants, ether, expectRevert, send } = require('@openzeppelin/test-helpers');
const { balance, ether, expectRevert, send } = require('@openzeppelin/test-helpers');
const { expect } = require('chai');
const AddressImpl = contract.fromArtifact('AddressImpl');
......@@ -9,8 +9,6 @@ const EtherReceiver = contract.fromArtifact('EtherReceiverMock');
describe('Address', function () {
const [ recipient, other ] = accounts;
const ALL_ONES_ADDRESS = '0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF';
beforeEach(async function () {
this.mock = await AddressImpl.new();
});
......@@ -26,20 +24,6 @@ describe('Address', function () {
});
});
describe('toPayable', function () {
it('should return a payable address when the account is the zero address', async function () {
expect(await this.mock.toPayable(constants.ZERO_ADDRESS)).to.equal(constants.ZERO_ADDRESS);
});
it('should return a payable address when the account is an arbitrary address', async function () {
expect(await this.mock.toPayable(other)).to.equal(other);
});
it('should return a payable address when the account is the all ones address', async function () {
expect(await this.mock.toPayable(ALL_ONES_ADDRESS)).to.equal(ALL_ONES_ADDRESS);
});
});
describe('sendValue', function () {
beforeEach(async function () {
this.recipientTracker = await balance.tracker(recipient);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment