Skip to content

Commit 54ceedb

Browse files
authored
Made the Crowdsale's constructor public again. (#1564)
* Made the Crowdsale's constructor public again. * Added changelog entry. * Made all but Finalizable public.
1 parent d17ae0b commit 54ceedb

10 files changed

+7
-12
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* `ERC20`: `transferFrom` and `_burnFrom ` now emit `Approval` events, to represent the token's state comprehensively through events. ([#1524](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1524))
1010
* `ERC721`: added `_burn(uint256 tokenId)`, replacing the similar deprecated function (see below). ([#1550](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1550))
1111
* `ERC721`: added `_tokensOfOwner(address owner)`, allowing to internally retrieve the array of an account's owned tokens. ([#1522](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1522))
12+
* Crowdsales: all constructors are now `public`, meaning it is not necessary to extend these contracts in order to deploy them. The exception is `FinalizableCrowdsale`, since it is meaningless unless extended. ([#1564](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1564))
1213
* `SafeMath`: added overflow-safe operations for signed integers (`int256`). ([#1559](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1559))
1314

1415
### Improvements:

contracts/crowdsale/Crowdsale.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ contract Crowdsale is ReentrancyGuard {
5353
* @param wallet Address where collected funds will be forwarded to
5454
* @param token Address of the token being sold
5555
*/
56-
constructor (uint256 rate, address wallet, IERC20 token) internal {
56+
constructor (uint256 rate, address wallet, IERC20 token) public {
5757
require(rate > 0);
5858
require(wallet != address(0));
5959
require(token != address(0));

contracts/crowdsale/distribution/PostDeliveryCrowdsale.sol

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ contract PostDeliveryCrowdsale is TimedCrowdsale {
1212

1313
mapping(address => uint256) private _balances;
1414

15-
constructor () internal {}
16-
1715
/**
1816
* @dev Withdraw tokens only after crowdsale ends.
1917
* @param beneficiary Whose tokens will be withdrawn.

contracts/crowdsale/distribution/RefundableCrowdsale.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
2727
* @dev Constructor, creates RefundEscrow.
2828
* @param goal Funding goal
2929
*/
30-
constructor (uint256 goal) internal {
30+
constructor (uint256 goal) public {
3131
require(goal > 0);
3232
_escrow = new RefundEscrow(wallet());
3333
_goal = goal;

contracts/crowdsale/emission/AllowanceCrowdsale.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ contract AllowanceCrowdsale is Crowdsale {
2020
* @dev Constructor, takes token wallet address.
2121
* @param tokenWallet Address holding the tokens, which has approved allowance to the crowdsale
2222
*/
23-
constructor (address tokenWallet) internal {
23+
constructor (address tokenWallet) public {
2424
require(tokenWallet != address(0));
2525
_tokenWallet = tokenWallet;
2626
}

contracts/crowdsale/emission/MintedCrowdsale.sol

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import "../../token/ERC20/ERC20Mintable.sol";
99
* Token ownership should be transferred to MintedCrowdsale for minting.
1010
*/
1111
contract MintedCrowdsale is Crowdsale {
12-
constructor () internal {}
13-
1412
/**
1513
* @dev Overrides delivery by minting tokens upon purchase.
1614
* @param beneficiary Token purchaser

contracts/crowdsale/price/IncreasingPriceCrowdsale.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale {
2020
* @param initialRate Number of tokens a buyer gets per wei at the start of the crowdsale
2121
* @param finalRate Number of tokens a buyer gets per wei at the end of the crowdsale
2222
*/
23-
constructor (uint256 initialRate, uint256 finalRate) internal {
23+
constructor (uint256 initialRate, uint256 finalRate) public {
2424
require(finalRate > 0);
2525
require(initialRate > finalRate);
2626
_initialRate = initialRate;

contracts/crowdsale/validation/CappedCrowdsale.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ contract CappedCrowdsale is Crowdsale {
1616
* @dev Constructor, takes maximum amount of wei accepted in the crowdsale.
1717
* @param cap Max amount of wei to be contributed
1818
*/
19-
constructor (uint256 cap) internal {
19+
constructor (uint256 cap) public {
2020
require(cap > 0);
2121
_cap = cap;
2222
}

contracts/crowdsale/validation/IndividuallyCappedCrowdsale.sol

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole {
1414
mapping(address => uint256) private _contributions;
1515
mapping(address => uint256) private _caps;
1616

17-
constructor () internal {}
18-
1917
/**
2018
* @dev Sets a specific beneficiary's maximum contribution.
2119
* @param beneficiary Address to be capped

contracts/crowdsale/validation/TimedCrowdsale.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ contract TimedCrowdsale is Crowdsale {
2626
* @param openingTime Crowdsale opening time
2727
* @param closingTime Crowdsale closing time
2828
*/
29-
constructor (uint256 openingTime, uint256 closingTime) internal {
29+
constructor (uint256 openingTime, uint256 closingTime) public {
3030
// solium-disable-next-line security/no-block-members
3131
require(openingTime >= block.timestamp);
3232
require(closingTime > openingTime);

0 commit comments

Comments
 (0)