↗ Extends: TokenPrice, EtherPrice, BinanceCoinPrice, CreditsTokenPrice, BonusHolder, FinalizableCrowdsale, CustomWhitelist
PreSale
This contract enables contributors to participate in Virtual Rehab Presale.
The Virtual Rehab Pre-Sale provides early investors with an opportunity to take part into the Virtual Rehab token sale ahead of the main sale launch. All early investors are expected to successfully complete KYC and whitelisting to contribute to the Virtual Rehab token sale.
US investors must be accredited investors and must provide all requested documentation to validate their accreditation. We, unfortunately, do not accept contributions from non-accredited investors within the US along with any contribution from China, Republic of Korea, and New Zealand. Any questions or additional information needed can be sought by sending an e-mail to investors@virtualrehab.co.
Accepted Currencies: Ether, Binance Coin, Credits Token.
Creates and constructs this presale contract.
constructor(uint256 _startTime, uint256 _endTime) public
Arguments
Constants & Variables
//public members
contract ERC20 public binanceCoin;
contract ERC20 public creditsToken;
uint256 public totalTokensSold;
uint256 public totalSaleAllocation;
uint256 public minContributionInUSDCents;
uint256[3] public bonusTimestamps;
uint256[3] public bonusPercentages;
bool public initialized;
//private members
uint256 private amountInUSDCents;
Events
event SaleInitialized();
event MinimumContributionChanged(uint256 _newContribution, uint256 _oldContribution);
event ClosingTimeChanged(uint256 _newClosingTime, uint256 _oldClosingTime);
event FundsWithdrawn(address indexed _wallet, uint256 _amount);
event ERC20Withdrawn(address indexed _contract, uint256 _amount);
event TokensAllocatedForSale(uint256 _newAllowance, uint256 _oldAllowance);
Name | Type | Description |
---|---|---|
_startTime | uint256 | The date and time of the presale start. |
_endTime | uint256 | The date and time of the presale end. |
- initializeSale
- contributeInBNB
- contributeInCreditsToken
- setMinimumContribution
- _preValidatePurchase
- _processPurchase
- calculateBonus
- setBonuses
- getBonusPercentage
- convertToCents
- _getTokenAmount
- getTokenAmountForWei
- increaseTokenSaleAllocation
- withdrawToken
- finalizeCrowdsale
- hasClosed
- finalization
- _forwardFunds
- withdrawFunds
- changeClosingTime
- getRemainingTokensForSale
Initializes the presale.
function initializeSale(uint256 _etherPriceInCents, uint256 _tokenPriceInCents, uint256 _binanceCoinPriceInCents, uint256 _creditsTokenPriceInCents, uint256 _minContributionInUSDCents, uint256[] _bonusTimestamps, uint256[] _bonusPercentages) external onlyAdmin
Arguments
Name | Type | Description |
---|---|---|
_etherPriceInCents | uint256 | Ether Price in cents |
_tokenPriceInCents | uint256 | VRHToken Price in cents |
_binanceCoinPriceInCents | uint256 | Binance Coin Price in cents |
_creditsTokenPriceInCents | uint256 | Credits Token Price in cents |
_minContributionInUSDCents | uint256 | The minimum contribution in dollar cent value |
_bonusTimestamps | uint256[] | |
_bonusPercentages | uint256[] |
Enables a contributor to contribute using Binance coin.
function contributeInBNB() external ifWhitelisted whenNotPaused onlyWhileOpen
function contributeInCreditsToken() external ifWhitelisted whenNotPaused onlyWhileOpen
function setMinimumContribution(uint256 _cents) public whenNotPaused onlyAdmin
Arguments
Name | Type | Description |
---|---|---|
_cents | uint256 |
⤾ overrides TimedCrowdsale._preValidatePurchase
Additional validation rules before token contribution is actually allowed.
function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal whenNotPaused ifWhitelisted
Arguments
Name | Type | Description |
---|---|---|
_beneficiary | address | The contributor who wishes to purchase the VRH tokens. |
_weiAmount | uint256 | The amount of Ethers (in wei) wished to contribute. |
⤾ overrides Crowdsale._processPurchase
This function is automatically called when a contribution request passes all validations.
function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal
Arguments
Name | Type | Description |
---|---|---|
_beneficiary | address | The contributor who wishes to purchase the VRH tokens. |
_tokenAmount | uint256 | The amount of tokens wished to purchase. |
Calculates bonus.
function calculateBonus(uint256 _tokenAmount, uint256 _percentage) public pure
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
_tokenAmount | uint256 | The total amount in VRH tokens. |
_percentage | uint256 | bonus percentage. |
Sets the bonus structure. The bonus limits must be in decreasing order.
function setBonuses(uint256[] _bonusTimestamps, uint256[] _bonusPercentages) public onlyAdmin
Arguments
Name | Type | Description |
---|---|---|
_bonusTimestamps | uint256[] | |
_bonusPercentages | uint256[] |
Gets the bonus applicable for the supplied dollar cent value.
function getBonusPercentage(uint256 _timestamp) public view
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
_timestamp | uint256 |
Converts the amount of Ether (wei) or amount of any token having 18 decimal place divisible to cent value based on the cent price supplied.
function convertToCents(uint256 _tokenAmount, uint256 _priceInCents, uint256 _decimals) public pure
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
_tokenAmount | uint256 | |
_priceInCents | uint256 | |
_decimals | uint256 |
⤾ overrides Crowdsale._getTokenAmount
Calculates the number of VRH tokens for the supplied wei value.
function _getTokenAmount(uint256 _weiAmount) internal view
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
_weiAmount | uint256 | The total amount of Ether in wei value. |
Used only for test, drop this function before deployment.
function getTokenAmountForWei(uint256 _weiAmount) external view
returns(uint256)
Arguments
Name | Type | Description |
---|---|---|
_weiAmount | uint256 | The total amount of Ether in wei value. |
Recalculates and/or reassigns the total tokens allocated for the presale.
function increaseTokenSaleAllocation() public whenNotPaused onlyAdmin
Enables the admins to withdraw Binance coin or any ERC20 token accidentally sent to this contract.
function withdrawToken(address _token) external onlyAdmin
Arguments
Name | Type | Description |
---|---|---|
_token | address |
Must be called after crowdsale ends, to do some extra finalization work.
function finalizeCrowdsale() public onlyAdmin
⤾ overrides TimedCrowdsale.hasClosed
Signifies whether or not the presale has ended.
function hasClosed() public view
returns(bool)
Returns
Returns true if the presale has ended.
⤾ overrides FinalizableCrowdsale.finalization
Reverts the finalization logic. Use finalizeCrowdsale instead.
function finalization() internal
⤾ overrides Crowdsale._forwardFunds
Stops the crowdsale contract from sending ethers.
function _forwardFunds() internal
Enables the admins to withdraw Ethers present in this contract.
function withdrawFunds(uint256 _amount) external whenNotPaused onlyAdmin
Arguments
Name | Type | Description |
---|---|---|
_amount | uint256 | Amount of Ether in wei value to withdraw. |
Adjusts the closing time of the crowdsale.
function changeClosingTime(uint256 _closingTime) public whenNotPaused onlyAdmin
Arguments
Name | Type | Description |
---|---|---|
_closingTime | uint256 | The timestamp when the crowdsale is closed. |
function getRemainingTokensForSale() public view
returns(uint256)