ERC20
This contract is an ERC20 token.
Name
Gifto
Symbol
GTO
Decimals
5
Total Supply
1,000,000,000 GTO
About
Stats
Public Functions
19
Event Types
2
Code Size
11,321 bytes
State Variables (14) keyboard_arrow_up
Functions
totalSupply keyboard_arrow_up
balanceOf keyboard_arrow_up
transfer keyboard_arrow_up
Modifiers help
isTradable checks for the following:
One or more of the following:
-
owner
must be equal to
the sender's address
- OR
tradable
must be equal to
true
Source Code
function transfer(address _to, uint256 _amount)
public
isTradable
returns (bool)
{
// if sender's balance has enough unit and amount >= 0,
// and the sum is not overflow,
// then do transfer
if (
(balances[msg.sender] >= _amount) &&
(_amount >= 0) &&
(balances[_to] + _amount > balances[_to])
) {
balances[msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(msg.sender, _to, _amount);
return true;
} else {
return false;
}
}
transferFrom keyboard_arrow_up
Modifiers help
isTradable checks for the following:
One or more of the following:
-
owner
must be equal to
the sender's address
- OR
tradable
must be equal to
true
Source Code
function transferFrom(
address _from,
address _to,
uint256 _amount
) public isTradable returns (bool success) {
if (
balances[_from] >= _amount &&
allowed[_from][msg.sender] >= _amount &&
_amount > 0 &&
balances[_to] + _amount > balances[_to]
) {
balances[_from] -= _amount;
allowed[_from][msg.sender] -= _amount;
balances[_to] += _amount;
Transfer(_from, _to, _amount);
return true;
} else {
return false;
}
}
approve keyboard_arrow_up
Modifiers help
isTradable checks for the following:
One or more of the following:
-
owner
must be equal to
the sender's address
- OR
tradable
must be equal to
true
Source Code
function approve(address _spender, uint256 _amount)
public
isTradable
returns (bool success)
{
allowed[msg.sender][_spender] = _amount;
Approval(msg.sender, _spender, _amount);
return true;
}
allowance keyboard_arrow_up
constructor keyboard_arrow_up
buyGifto keyboard_arrow_up
Parameters help
This function has no parameters.
Modifiers help
onSale checks for the following:
_selling must be true
validValue checks for the following:
validInvestor checks for the following:
Requirements help
Source Code
function buyGifto() public payable onSale validValue validInvestor {
uint256 requestedUnits = (msg.value * _originalBuyPrice) / 10**18;
require(balances[owner] >= requestedUnits);
// prepare transfer data
balances[owner] -= requestedUnits;
balances[msg.sender] += requestedUnits;
// increase total deposit amount
deposit[msg.sender] += msg.value;
// check total and auto turnOffSale
totalTokenSold += requestedUnits;
if (totalTokenSold >= _icoSupply) {
_selling = false;
}
// submit transfer
Transfer(owner, msg.sender, requestedUnits);
owner.transfer(msg.value);
}
turnOnSale keyboard_arrow_up
turnOffSale keyboard_arrow_up
turnOnTradable keyboard_arrow_up
setIcoPercent keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function setIcoPercent(uint256 newIcoPercent) public onlyOwner {
_icoPercent = newIcoPercent;
_icoSupply = (_totalSupply * _icoPercent) / 100;
}
setMaximumBuy keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function setMaximumBuy(uint256 newMaximumBuy) public onlyOwner {
_maximumBuy = newMaximumBuy;
}
setBuyPrice keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Requirements help
Source Code
function setBuyPrice(uint256 newBuyPrice) public onlyOwner {
require(newBuyPrice > 0);
_originalBuyPrice = newBuyPrice; // 3000 Gifto = 3000 00000 unit
// control _maximumBuy_USD = 10,000 USD, Gifto price is 0.1USD
// maximumBuy_Gifto = 100,000 Gifto = 100,000,00000 unit
// 3000 Gifto = 1ETH => maximumETH = 100,000,00000 / _originalBuyPrice
// 100,000,00000/3000 0000 ~ 33ETH => change to wei
_maximumBuy = (10**18 * 10000000000) / _originalBuyPrice;
}
isApprovedInvestor keyboard_arrow_up
getDeposit keyboard_arrow_up
addInvestorList keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function addInvestorList(address[] newInvestorList) public onlyOwner {
for (uint256 i = 0; i < newInvestorList.length; i++) {
approvedInvestorList[newInvestorList[i]] = true;
}
}
removeInvestorList keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function removeInvestorList(address[] investorList) public onlyOwner {
for (uint256 i = 0; i < investorList.length; i++) {
approvedInvestorList[investorList[i]] = false;
}
}
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.