Repository for the contracts deployed for GSTAR Tokens and test scripts. Find out more on our website.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

GSTAR.AI Crowdsale Contracts

This repository explains the technical details regarding GStar's Crowdsale and the crowdsale smart contracts involved.


GSTAR is an ERC-20 compliant cryptocurrency built on the Ethereum blockchain network.


GStar Technologies aims to empower the masses to be able to use AI technologies in the fields of trading, thus leveling the playing field that had largely kept profitable trading out of reach of the masses. This further fuels the gig economy, where people can now earn a living based on their own terms as traditional jobs gets disrupted in this new technological world.

GStar Technologies is holding a crowdsale for GSTAR Tokens which will be used to facilitate transactions on the GStar trading platform. The section below explains some of the technical details with regards to the crowdsale.


The contracts are located in the contracts directory.

Crowdsale Specification

  • GSTAR token is ERC-20 compliant.
  • GSTAR token is hardcapped at 1.6 billion tokens.
  • GSTAR token is non-mintable.
  • Any excess token will be burned off by the owner at the end of the crowdsale.
  • GSTAR tokens will be released only after the crowdsale ends.
  • Contributors are required to be whitelisted.
  • Funding goal is capped at 76,000 ETH.

Token Distribution

Token Distribution Chart

GSTAR Bonus Structure

Period Bonus Tokens
Day 1 8%
Day 2 onwards No Bonus

Development Framework

Smart Contracts Code

Class Diagram

The diagram below shows the inheritance relationship between the contracts used to create the GSTAR Crowdsale contract and the GSTAR Token contract.

Class Diagram

GSTAR Token Functions

function burn(uint256 _value) public onlyOwner

Allows owner to burn GSTAR tokens.

GSTAR Crowdsale Functions

function _preValidatePurchase(address _beneficiary, uint256 _weiAmount) internal isWhitelisted(_beneficiary)

Overrode the function from Crowdsale.sol from OpenZeppelin. Check if the contribution is valid before the actual contribution is made. The following checks are made:

  • Contribution is within crowdsale period.
  • Crowdsale is active.
  • Contributor and beneficiary are the same address.
  • Contribution does not exceed funding goal.
  • Contribution is at least of minimum amount.
  • Contributor is whitelisted.
function _getTokenAmount(uint256 _weiAmount) internal view returns (uint256)

Returns the token amount based on the ETH contributed.

function getRate() public view returns (uint256)

Returns the number of GSTAR tokens per ETH sent. The rate varies accordingly with the mentioned bonus structure.

function _updatePurchasingState(address _beneficiary, uint256 _weiAmount) internal

Updates the token amount attributed to the contributor based on the ETH contributed, then updates funding goal.

function _updateFundingGoal() internal

Updates if the funding goal is reached. If the funding goal is reached, no more purchase of tokens is allowed.

function changePrivateContribution(uint256 etherWeiAmount) external onlyOwner

Allows owner to change the private contribution amount. This amount is included in the calculation of the funding goal.

function startCrowdsale() external onlyOwner

Allows owner to start/unpause crowdsale.

function stopCrowdsale() external onlyOwner

Allows owner to stop/pause crowdsale.

function releaseTokens(address[] contributors) external onlyOwner

Release tokens to the addresses in put based on the recorded tokens amount for each contributor.

function close() external onlyOwner

Allows owner to stop crowdsale, then transfers any remaining tokens in the contract back to the owner. This also prevents any tokens being stuck in the contract.

function addToWhitelist(address _beneficiary) external onlyOwner

Inherited from WhitelistedCrowdsale.sol from OpenZeppelin. Allows owner to whitelist a single address.

function removeFromWhitelist(address _beneficiary) external onlyOwner

Inherited from WhitelistedCrowdsale.sol from OpenZeppelin. Allows owner to remove a single address from the whitelist.

function addManyToWhitelist(address[] _beneficiaries) external onlyOwner

Inherited from WhitelistedCrowdsale.sol from OpenZeppelin. Allows owner to whitelist multiple addresses.

GSTAR Crowdsale Contract Events

event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
event GoalReached(uint256 totalEtherAmountRaised);
event StartCrowdsale();
event StopCrowdsale();
event ReleaseTokens(address[] _beneficiaries);
event Close();


// Install truffle framework and initialize
$ npm install -g truffle

// Install ganache-cli which includes testrpc
$ npm install -g ganache-cli

// Install node dependencies
$ npm install

// Install web3
$ npm install ethereum/web3.js