Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal crowdsales #1439

Merged
merged 2 commits into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion contracts/crowdsale/Crowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ contract Crowdsale {
* @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) public {
constructor(uint256 rate, address wallet, IERC20 token) internal {
require(rate > 0);
require(wallet != address(0));
require(token != address(0));
Expand Down Expand Up @@ -152,6 +152,7 @@ contract Crowdsale {
uint256 weiAmount
)
internal
view
{
require(beneficiary != address(0));
require(weiAmount != 0);
Expand All @@ -167,6 +168,7 @@ contract Crowdsale {
uint256 weiAmount
)
internal
view
{
// optional override
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/distribution/FinalizableCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ contract FinalizableCrowdsale is TimedCrowdsale {

event CrowdsaleFinalized();

constructor() public {
constructor() internal {
_finalized = false;
}

Expand Down
2 changes: 2 additions & 0 deletions contracts/crowdsale/distribution/PostDeliveryCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ 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.
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/distribution/RefundableCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
* @dev Constructor, creates RefundEscrow.
* @param goal Funding goal
*/
constructor(uint256 goal) public {
constructor(uint256 goal) internal {
require(goal > 0);
_escrow = new RefundEscrow(wallet());
_goal = goal;
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/emission/AllowanceCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,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) public {
constructor(address tokenWallet) internal {
require(tokenWallet != address(0));
_tokenWallet = tokenWallet;
}
Expand Down
1 change: 1 addition & 0 deletions contracts/crowdsale/emission/MintedCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ 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.
Expand Down
2 changes: 1 addition & 1 deletion contracts/crowdsale/price/IncreasingPriceCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) public {
constructor(uint256 initialRate, uint256 finalRate) internal {
require(finalRate > 0);
require(initialRate >= finalRate);
_initialRate = initialRate;
Expand Down
3 changes: 2 additions & 1 deletion contracts/crowdsale/validation/CappedCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) public {
constructor(uint256 cap) internal {
require(cap > 0);
_cap = cap;
}
Expand Down Expand Up @@ -46,6 +46,7 @@ contract CappedCrowdsale is Crowdsale {
uint256 weiAmount
)
internal
view
{
super._preValidatePurchase(beneficiary, weiAmount);
require(weiRaised().add(weiAmount) <= _cap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ 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
Expand Down Expand Up @@ -53,6 +55,7 @@ contract IndividuallyCappedCrowdsale is Crowdsale, CapperRole {
uint256 weiAmount
)
internal
view
{
super._preValidatePurchase(beneficiary, weiAmount);
require(
Expand Down
3 changes: 2 additions & 1 deletion contracts/crowdsale/validation/TimedCrowdsale.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ contract TimedCrowdsale is Crowdsale {
* @param openingTime Crowdsale opening time
* @param closingTime Crowdsale closing time
*/
constructor(uint256 openingTime, uint256 closingTime) public {
constructor(uint256 openingTime, uint256 closingTime) internal {
// solium-disable-next-line security/no-block-members
require(openingTime >= block.timestamp);
require(closingTime >= openingTime);
Expand Down Expand Up @@ -77,6 +77,7 @@ contract TimedCrowdsale is Crowdsale {
)
internal
onlyWhileOpen
view
{
super._preValidatePurchase(beneficiary, weiAmount);
}
Expand Down
9 changes: 9 additions & 0 deletions contracts/mocks/CrowdsaleMock.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pragma solidity ^0.4.24;

import "../crowdsale/Crowdsale.sol";

contract CrowdsaleMock is Crowdsale {
constructor(uint256 rate, address wallet, IERC20 token) public
Crowdsale(rate, wallet, token) {
}
}
2 changes: 1 addition & 1 deletion test/crowdsale/Crowdsale.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require('chai')
.use(require('chai-bignumber')(BigNumber))
.should();

const Crowdsale = artifacts.require('Crowdsale');
const Crowdsale = artifacts.require('CrowdsaleMock');
const SimpleToken = artifacts.require('SimpleToken');

contract('Crowdsale', function ([_, investor, wallet, purchaser]) {
Expand Down