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
Constants (17) keyboard_arrow_up
State Variables (20) keyboard_arrow_up
Functions
transferOwnership keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
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
balanceOf keyboard_arrow_up
transfer keyboard_arrow_up
Source Code
function transfer(address _to, uint256 _amount) public returns (bool success) {
if (!isTransferAllowed(msg.sender, _to)) {
return false;
}
return super.transfer(_to, _amount);
}
transferFrom keyboard_arrow_up
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);
}
approve keyboard_arrow_up
Source Code
function approve(address _spender, uint256 _value)
public
returns (bool success)
{
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
allowance keyboard_arrow_up
currentTime keyboard_arrow_up
setTokensPerKEther keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
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
Modifiers help
onlyOwner checks for the following:
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
Modifiers help
onlyOwner checks for the following:
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
Modifiers help
onlyOwner checks for the following:
Requirements help
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
resume keyboard_arrow_up
constructor keyboard_arrow_up
buyTokens keyboard_arrow_up
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.
Modifiers help
onlyOwner checks for the following:
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;
}
Internal Functions
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
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;
}