Blockwell

GAT Token

ERC20

This contract is an ERC20 token.

Name GAT Token
Symbol GAT
Decimals 18
Total Supply 1,000,000,000 GAT

About

Stats

Public Functions 18
Event Types 12
Code Size 17,791 bytes

Library Use

Uses SafeMath for uint256.

Events (12) keyboard_arrow_up

Approval Event

Parameters help
_owner
address help
_spender
address help
_value
uint256 help

BonusAmountUpdated Event

Parameters help
newAmount
uint256 help

ContractTokensReclaimed Event

Parameters help
amount
uint256 help

ContributionMinimumUpdated Event

Parameters help
newAmount
uint256 help

OwnerChanged Event

Parameters help
_newOwner
address help

SaleResumed Event

Parameters help

SaleSuspended Event

Parameters help

TimeWindowUpdated Event

Parameters help
newStartTime
uint256 help
newEndTime
uint256 help

TokenFinalized Event

Parameters help

TokensPerKEtherUpdated Event

Parameters help
newAmount
uint256 help

TokensPurchased Event

Parameters help
beneficiary
address help
cost
uint256 help
tokens
uint256 help

Transfer Event

Parameters help
_from
address help
_to
address help
_value
uint256 help

SYMBOL Constant

string help
GAT

NAME Constant

string help
GAT Token

DECIMALS Constant

uint256 help
18

DECIMALSFACTOR Constant

uint256 help
UNKNOWN VALUE

START_TIME Constant

uint256 help
1513512000

END_TIME Constant

uint256 help
1515326399

CONTRIBUTION_MIN Constant

uint256 help
2 ether

TOKEN_TOTAL_CAP Constant

uint256 help

TOKEN_PRIVATE_SALE_CAP Constant

uint256 help

TOKEN_PRESALE_CAP Constant

uint256 help

TOKEN_PUBLIC_SALE_CAP Constant

uint256 help

TOKEN_FOUNDATION_CAP Constant

uint256 help

TOKEN_RESERVE1_CAP Constant

uint256 help

TOKEN_RESERVE2_CAP Constant

uint256 help

TOKEN_FUTURE_CAP Constant

uint256 help

PRESALE_BONUS Constant

uint256 help
120

TOKENS_PER_KETHER Constant

uint256 help
14800000

finalized Variable

bool help

suspended Variable

bool help

bankAddress Variable

address help

fundingAddress Variable

address help

reserve1Address Variable

address help

reserve2Address Variable

address help

tokensPerKEther Variable

uint256 help

bonus Variable

uint256 help

totalTokensSold Variable

uint256 help

contributionMinimum Variable

uint256 help

startTime Variable

uint256 help

endTime Variable

uint256 help

symbol Variable

string help

name Variable

string help

decimals Variable

uint256 help

totalSupply Variable

uint256 help

owner Variable

address help

newOwner Variable

address help

balances Variable

mapping(address => uint256) help
Internal Variable

allowed Variable

mapping(address => mapping(address => uint256)) help
Internal Variable

Functions Expand All Collapse All

transferOwnership keyboard_arrow_up

Parameters help

Name Type
_newOwner
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function transferOwnership(address _newOwner) public onlyOwner returns (bool) {
  require(_newOwner != address(0));
  require(_newOwner != owner);

  newOwner = _newOwner;

  return true;
}

acceptOwnership keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function acceptOwnership() public returns (bool) {
  require(msg.sender == newOwner);

  owner = msg.sender;

  OwnerChanged(msg.sender);

  return true;
}

Parameters help

Name Type
_owner
address help

Properties

Visibility help public
Mutability help view
Source Code
function balanceOf(address _owner) public view returns (uint256 balance) {
  return balances[_owner];
}

Parameters help

Name Type
_to
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transfer(address _to, uint256 _amount) public returns (bool success) {
  if (!isTransferAllowed(msg.sender, _to)) {
    return false;
  }

  return super.transfer(_to, _amount);
}

Parameters help

Name Type
_from
address help
_to
address help
_amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transferFrom(
  address _from,
  address _to,
  uint256 _amount
) public returns (bool success) {
  if (!isTransferAllowed(_from, _to)) {
    return false;
  }

  return super.transferFrom(_from, _to, _amount);
}

Parameters help

Name Type
_spender
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function approve(address _spender, uint256 _value)
  public
  returns (bool success)
{
  allowed[msg.sender][_spender] = _value;

  Approval(msg.sender, _spender, _value);

  return true;
}

Parameters help

Name Type
_owner
address help
_spender
address help

Properties

Visibility help public
Mutability help view
Source Code
function allowance(address _owner, address _spender)
  public
  view
  returns (uint256 remaining)
{
  return allowed[_owner][_spender];
}

currentTime keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help constant
Source Code
function currentTime() public constant returns (uint256) {
  return now;
}

setTokensPerKEther keyboard_arrow_up

Parameters help

Name Type
_tokensPerKEther
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function setTokensPerKEther(uint256 _tokensPerKEther)
  external
  onlyOwner
  returns (bool)
{
  require(_tokensPerKEther > 0);

  // Set the tokensPerKEther amount for any new sale.
  tokensPerKEther = _tokensPerKEther;

  TokensPerKEtherUpdated(_tokensPerKEther);

  return true;
}

setContributionMinimum keyboard_arrow_up

Parameters help

Name Type
_contributionMinimum
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function setContributionMinimum(uint256 _contributionMinimum)
  external
  onlyOwner
  returns (bool)
{
  require(_contributionMinimum > 0);

  // Set the tokensPerKEther amount for any new sale.
  contributionMinimum = _contributionMinimum;

  ContributionMinimumUpdated(_contributionMinimum);

  return true;
}

setBonus keyboard_arrow_up

Parameters help

Name Type
_bonus
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function setBonus(uint256 _bonus) external onlyOwner returns (bool) {
  // 100 means no bonus
  require(_bonus >= 100);

  // 200 means 100% bonus
  require(_bonus <= 200);

  bonus = _bonus;

  BonusAmountUpdated(_bonus);

  return true;
}

setTimeWindow keyboard_arrow_up

Parameters help

Name Type
_startTime
uint256 help
_endTime
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function setTimeWindow(uint256 _startTime, uint256 _endTime)
  external
  onlyOwner
  returns (bool)
{
  require(_startTime >= START_TIME);
  require(_endTime > _startTime);

  startTime = _startTime;
  endTime = _endTime;

  TimeWindowUpdated(_startTime, _endTime);

  return true;
}

suspend keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function suspend() external onlyOwner returns (bool) {
  if (suspended == true) {
    return false;
  }

  suspended = true;

  SaleSuspended();

  return true;
}

resume keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function resume() external onlyOwner returns (bool) {
  if (suspended == false) {
    return false;
  }

  suspended = false;

  SaleResumed();

  return true;
}

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable

Requirements help

Source Code
function() public payable {
  buyTokens(msg.sender);
}

buyTokens keyboard_arrow_up

Parameters help

Name Type
beneficiary
address help

Properties

Visibility help public
Mutability help payable

Requirements help

Source Code
function buyTokens(address beneficiary) public payable returns (uint256) {
  require(!suspended);
  require(beneficiary != address(0x0));
  require(beneficiary != address(this));
  require(currentTime() >= startTime);
  require(currentTime() <= endTime);
  require(msg.value >= contributionMinimum);
  require(msg.sender != fundingAddress);

  // Check if the sale contract still has tokens for sale.
  uint256 saleBalance = balanceOf(address(this));
  require(saleBalance > 0);

  // Calculate the number of tokens that the ether should convert to.
  uint256 tokens = msg.value.mul(tokensPerKEther).mul(bonus).div(
    10**(18 - DECIMALS + 3 + 2)
  );
  require(tokens > 0);

  uint256 cost = msg.value;
  uint256 refund = 0;

  if (tokens > saleBalance) {
    // Not enough tokens left for sale to fulfill the full order.
    tokens = saleBalance;

    // Calculate the actual cost for the tokens that can be purchased.
    cost = tokens.mul(10**(18 - DECIMALS + 3 + 2)).div(
      tokensPerKEther.mul(bonus)
    );

    // Calculate the amount of ETH refund to the contributor.
    refund = msg.value.sub(cost);
  }

  totalTokensSold = totalTokensSold.add(tokens);

  // Move tokens from the sale contract to the beneficiary
  balances[address(this)] = balances[address(this)].sub(tokens);
  balances[beneficiary] = balances[beneficiary].add(tokens);
  Transfer(address(this), beneficiary, tokens);

  if (refund > 0) {
    msg.sender.transfer(refund);
  }

  // Transfer the contributed ether to the crowdsale wallets.
  uint256 contribution = msg.value.sub(refund);

  fundingAddress.transfer(contribution);

  TokensPurchased(beneficiary, cost, tokens);

  return tokens;
}

reclaimContractTokens keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function reclaimContractTokens() external onlyOwner returns (bool) {
  uint256 tokens = balanceOf(address(this));

  if (tokens == 0) {
    return false;
  }

  balances[address(this)] = balances[address(this)].sub(tokens);
  balances[bankAddress] = balances[bankAddress].add(tokens);
  Transfer(address(this), bankAddress, tokens);

  ContractTokensReclaimed(tokens);

  return true;
}

finalize keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function finalize() external onlyOwner returns (bool) {
  require(!finalized);

  finalized = true;

  TokenFinalized();

  return true;
}

Internal Functions Expand All Collapse All

Internal functions are parts of the contract that can't be used directly, but instead are used by the public functions listed above.

internal GATTokenSale.isTransferAllowed keyboard_arrow_up

Parameters help

Name Type
_from
address help
_to
address help

Properties

Visibility help private
Mutability help view
Source Code
function isTransferAllowed(address _from, address _to)
  private
  view
  returns (bool)
{
  if (finalized) {
    // We allow everybody to transfer tokens once the sale is finalized.
    return true;
  }

  if (_from == bankAddress || _to == bankAddress) {
    // We allow the bank to initiate transfers. We also allow it to be the recipient
    // of transfers before the token is finalized in case a recipient wants to send
    // back tokens. E.g. KYC requirements cannot be met.
    return true;
  }

  return false;
}