WhitelistCrowdsale.sol 744 B

123456789101112131415161718192021
  1. pragma solidity ^0.5.7;
  2. import "../Crowdsale.sol";
  3. import "../../access/roles/WhitelistedRole.sol";
  4. /**
  5. * @title WhitelistCrowdsale
  6. * @dev Crowdsale in which only whitelisted users can contribute.
  7. */
  8. contract WhitelistCrowdsale is WhitelistedRole, Crowdsale {
  9. /**
  10. * @dev Extend parent behavior requiring beneficiary to be whitelisted. Note that no
  11. * restriction is imposed on the account sending the transaction.
  12. * @param _beneficiary Token beneficiary
  13. * @param _weiAmount Amount of wei contributed
  14. */
  15. function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal view {
  16. require(isWhitelisted(_beneficiary));
  17. super._preValidatePurchase(_beneficiary, _weiAmount);
  18. }
  19. }