* Error handling in ERC20 and ERC721 * Added message string for require. * Fixed solhint errors. * Updated PR as per issue #1709 * changes as per #1709 and openzeppelin forum. * Changes in require statement * Changes in require statement * build pipeline fix * Changes as per @nventuro's comment. * Update revert reason strings. * Fianal update of revert reason strings. * WIP: Updating reason strings in test cases * WIP: Added changes to ERC20 and ERC721 * Fixes linting errors in *.tes.js files * Achieved 100% code coverage * Updated the test cases with shouldFail.reverting.withMessage() * Fix package-lock. * address review comments * fix linter issues * fix remaining revert reasons
22 lines
813 B
Solidity
22 lines
813 B
Solidity
pragma solidity ^0.5.7;
|
|
import "../Crowdsale.sol";
|
|
import "../../access/roles/WhitelistedRole.sol";
|
|
|
|
|
|
/**
|
|
* @title WhitelistCrowdsale
|
|
* @dev Crowdsale in which only whitelisted users can contribute.
|
|
*/
|
|
contract WhitelistCrowdsale is WhitelistedRole, Crowdsale {
|
|
/**
|
|
* @dev Extend parent behavior requiring beneficiary to be whitelisted. Note that no
|
|
* restriction is imposed on the account sending the transaction.
|
|
* @param _beneficiary Token beneficiary
|
|
* @param _weiAmount Amount of wei contributed
|
|
*/
|
|
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal view {
|
|
require(isWhitelisted(_beneficiary), "WhitelistCrowdsale: beneficiary doesn't have the Whitelisted role");
|
|
super._preValidatePurchase(_beneficiary, _weiAmount);
|
|
}
|
|
}
|