Remove Address.toPayable (#2133)
* Remove Address.toPayable * Add changelog entry
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
||||
@ -32,16 +32,6 @@ library Address {
|
||||
return (codehash != accountHash && codehash != 0x0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @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.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user