Browse Source

Made the Crowdsale's constructor public again. (#1564)

* Made the Crowdsale's constructor public again.

* Added changelog entry.

* Made all but Finalizable public.
Nicolás Venturo 6 years ago
parent
commit
54ceedbb1f

+ 1 - 0
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:

+ 1 - 1
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));

+ 0 - 2
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.

+ 1 - 1
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;

+ 1 - 1
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;
     }

+ 0 - 2
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

+ 1 - 1
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;

+ 1 - 1
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;
     }

+ 0 - 2
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

+ 1 - 1
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);