diff --git a/CHANGELOG.md b/CHANGELOG.md index f63d7684f52..02033d0b79d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * `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)) * `ERC721`: added `_burn(uint256 tokenId)`, replacing the similar deprecated function (see below). ([#1550](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1550)) * `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)) + * 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)) * `SafeMath`: added overflow-safe operations for signed integers (`int256`). ([#1559](https://github.com/OpenZeppelin/openzeppelin-solidity/pull/1559)) ### Improvements: diff --git a/contracts/crowdsale/Crowdsale.sol b/contracts/crowdsale/Crowdsale.sol index 451f902de26..f03a0a38363 100644 --- a/contracts/crowdsale/Crowdsale.sol +++ b/contracts/crowdsale/Crowdsale.sol @@ -53,7 +53,7 @@ contract Crowdsale is ReentrancyGuard { * @param wallet Address where collected funds will be forwarded to * @param token Address of the token being sold */ - constructor (uint256 rate, address wallet, IERC20 token) internal { + constructor (uint256 rate, address wallet, IERC20 token) public { require(rate > 0); require(wallet != address(0)); require(token != address(0)); diff --git a/contracts/crowdsale/distribution/PostDeliveryCrowdsale.sol b/contracts/crowdsale/distribution/PostDeliveryCrowdsale.sol index 9d4de3b097e..1e5ff74945f 100644 --- a/contracts/crowdsale/distribution/PostDeliveryCrowdsale.sol +++ b/contracts/crowdsale/distribution/PostDeliveryCrowdsale.sol @@ -12,8 +12,6 @@ contract PostDeliveryCrowdsale is TimedCrowdsale { mapping(address => uint256) private _balances; - constructor () internal {} - /** * @dev Withdraw tokens only after crowdsale ends. * @param beneficiary Whose tokens will be withdrawn. diff --git a/contracts/crowdsale/distribution/RefundableCrowdsale.sol b/contracts/crowdsale/distribution/RefundableCrowdsale.sol index 4ef5dffd49e..ad12a60758e 100644 --- a/contracts/crowdsale/distribution/RefundableCrowdsale.sol +++ b/contracts/crowdsale/distribution/RefundableCrowdsale.sol @@ -27,7 +27,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale { * @dev Constructor, creates RefundEscrow. * @param goal Funding goal */ - constructor (uint256 goal) internal { + constructor (uint256 goal) public { require(goal > 0); _escrow = new RefundEscrow(wallet()); _goal = goal; diff --git a/contracts/crowdsale/emission/AllowanceCrowdsale.sol b/contracts/crowdsale/emission/AllowanceCrowdsale.sol index b0c09c7447f..adb4036edfa 100644 --- a/contracts/crowdsale/emission/AllowanceCrowdsale.sol +++ b/contracts/crowdsale/emission/AllowanceCrowdsale.sol @@ -20,7 +20,7 @@ contract AllowanceCrowdsale is Crowdsale { * @dev Constructor, takes token wallet address. * @param tokenWallet Address holding the tokens, which has approved allowance to the crowdsale */ - constructor (address tokenWallet) internal { + constructor (address tokenWallet) public { require(tokenWallet != address(0)); _tokenWallet = tokenWallet; } diff --git a/contracts/crowdsale/emission/MintedCrowdsale.sol b/contracts/crowdsale/emission/MintedCrowdsale.sol index 1f346a819fb..ba42131e580 100644 --- a/contracts/crowdsale/emission/MintedCrowdsale.sol +++ b/contracts/crowdsale/emission/MintedCrowdsale.sol @@ -9,8 +9,6 @@ import "../../token/ERC20/ERC20Mintable.sol"; * Token ownership should be transferred to MintedCrowdsale for minting. */ contract MintedCrowdsale is Crowdsale { - constructor () internal {} - /** * @dev Overrides delivery by minting tokens upon purchase. * @param beneficiary Token purchaser diff --git a/contracts/crowdsale/price/IncreasingPriceCrowdsale.sol b/contracts/crowdsale/price/IncreasingPriceCrowdsale.sol index 5ac7731a548..72da45c472e 100644 --- a/contracts/crowdsale/price/IncreasingPriceCrowdsale.sol +++ b/contracts/crowdsale/price/IncreasingPriceCrowdsale.sol @@ -20,7 +20,7 @@ contract IncreasingPriceCrowdsale is TimedCrowdsale { * @param initialRate Number of tokens a buyer gets per wei at the start of the crowdsale * @param finalRate Number of tokens a buyer gets per wei at the end of the crowdsale */ - constructor (uint256 initialRate, uint256 finalRate) internal { + constructor (uint256 initialRate, uint256 finalRate) public { require(finalRate > 0); require(initialRate > finalRate); _initialRate = initialRate; diff --git a/contracts/crowdsale/validation/CappedCrowdsale.sol b/contracts/crowdsale/validation/CappedCrowdsale.sol index 2b49362c232..1429ea162f1 100644 --- a/contracts/crowdsale/validation/CappedCrowdsale.sol +++ b/contracts/crowdsale/validation/CappedCrowdsale.sol @@ -16,7 +16,7 @@ contract CappedCrowdsale is Crowdsale { * @dev Constructor, takes maximum amount of wei accepted in the crowdsale. * @param cap Max amount of wei to be contributed */ - constructor (uint256 cap) internal { + constructor (uint256 cap) public { require(cap > 0); _cap = cap; } diff --git a/contracts/crowdsale/validation/IndividuallyCappedCrowdsale.sol b/contracts/crowdsale/validation/IndividuallyCappedCrowdsale.sol index 1bae0f96bae..289ca1f3ad5 100644 --- a/contracts/crowdsale/validation/IndividuallyCappedCrowdsale.sol +++ b/contracts/crowdsale/validation/IndividuallyCappedCrowdsale.sol @@ -14,8 +14,6 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole { mapping(address => uint256) private _contributions; mapping(address => uint256) private _caps; - constructor () internal {} - /** * @dev Sets a specific beneficiary's maximum contribution. * @param beneficiary Address to be capped diff --git a/contracts/crowdsale/validation/TimedCrowdsale.sol b/contracts/crowdsale/validation/TimedCrowdsale.sol index 244220034b6..cf6806398a1 100644 --- a/contracts/crowdsale/validation/TimedCrowdsale.sol +++ b/contracts/crowdsale/validation/TimedCrowdsale.sol @@ -26,7 +26,7 @@ contract TimedCrowdsale is Crowdsale { * @param openingTime Crowdsale opening time * @param closingTime Crowdsale closing time */ - constructor (uint256 openingTime, uint256 closingTime) internal { + constructor (uint256 openingTime, uint256 closingTime) public { // solium-disable-next-line security/no-block-members require(openingTime >= block.timestamp); require(closingTime > openingTime);