Gimli Token
ERC20
This contract is an ERC20 token.
Name
Gimli Token
Symbol
GIM
Decimals
8
Total Supply
150,000,000 GIM
About
Stats
Public Functions
17
Event Types
6
Code Size
14,905 bytes
Events (6) keyboard_arrow_up
Constants (17) keyboard_arrow_up
State Variables (14) keyboard_arrow_up
Functions
transferOwnership keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function transferOwnership(address _newOwner) onlyOwner {
if (_newOwner != address(0)) {
newOwner = _newOwner;
}
}
acceptOwnership keyboard_arrow_up
addAdministrators keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function addAdministrators(address _adminAddress) onlyOwner {
administrators[_adminAddress] = true;
AdminstratorAdded(_adminAddress);
}
removeAdministrators keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function removeAdministrators(address _adminAddress) onlyOwner {
delete administrators[_adminAddress];
AdminstratorRemoved(_adminAddress);
}
balanceOf keyboard_arrow_up
transfer keyboard_arrow_up
Requirements help
transferable must be true
Source Code
function transfer(address _to, uint256 _value) returns (bool success) {
require(transferable);
require(balances[msg.sender] >= _value && _value >= 0);
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
}
allowance keyboard_arrow_up
transferFrom keyboard_arrow_up
Requirements help
transferable must be true
Source Code
function transferFrom(
address _from,
address _to,
uint256 _value
) returns (bool success) {
require(transferable);
require(
balances[_from] >= _value &&
allowed[_from][msg.sender] >= _value &&
_value >= 0
);
balances[_from] = safeSub(balances[_from], _value);
balances[_to] = safeAdd(balances[_to], _value);
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender], _value);
Transfer(_from, _to, _value);
return true;
}
approve keyboard_arrow_up
Requirements help
One or more of the following:
Source Code
function approve(address _spender, uint256 _value) returns (bool success) {
// To change the approve amount you first have to reduce the addresses`
// allowance to zero by calling `approve(_spender, 0)` if it is not
// already 0 to mitigate the race condition described here:
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
constructor keyboard_arrow_up
Parameters help
This function has no parameters.
Requirements help
Source Code
function() payable {
require(!crowdsaleCanceled);
require(msg.value > 0);
// check date
require(block.timestamp >= START_DATE && block.timestamp <= END_DATE);
// calculate and check quantity
uint256 quantity = safeDiv(
safeMul(msg.value, CROWDSALE_PRICE),
10**(18 - uint256(decimals))
);
require(safeSub(balances[this], quantity) >= 0);
require(MULTISIG_WALLET_ADDRESS.send(msg.value));
// update balances
balances[this] = safeSub(balances[this], quantity);
balances[msg.sender] = safeAdd(balances[msg.sender], quantity);
soldAmount = safeAdd(soldAmount, quantity);
paidAmount = safeAdd(paidAmount, msg.value);
Transfer(this, msg.sender, quantity);
}
closeCrowdsale keyboard_arrow_up
Parameters help
This function has no parameters.
Modifiers help
onlyOwner checks for the following:
Requirements help
One or more of the following:
-
balances for the address for this contract
must be equal to
0
- ORcrowdsaleCanceled must be true - OR
END_DATE
must be less than
block.timestamp
Source Code
function closeCrowdsale() onlyOwner {
// check if closable
require(
block.timestamp > END_DATE || crowdsaleCanceled || balances[this] == 0
);
// enable token transfer
transferable = true;
// update balances
if (balances[this] > 0) {
uint256 amount = balances[this];
balances[MULTISIG_WALLET_ADDRESS] = safeAdd(
balances[MULTISIG_WALLET_ADDRESS],
amount
);
balances[this] = 0;
Transfer(this, MULTISIG_WALLET_ADDRESS, amount);
}
}
cancelCrowdsale keyboard_arrow_up
preAllocate keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Requirements help
Source Code
function preAllocate(
address _to,
uint256 _value,
uint256 _price
) onlyOwner {
require(block.timestamp < START_DATE);
balances[this] = safeSub(balances[this], _value);
balances[_to] = safeAdd(balances[_to], _value);
soldAmount = safeAdd(soldAmount, _value);
paidAmount = safeAdd(paidAmount, _price);
Transfer(this, _to, _value);
}
releaseVesting keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Source Code
function releaseVesting(address _destination) onlyOwner returns (bool success) {
if (block.timestamp > VESTING_1_DATE && vesting1Withdrawn == false) {
balances[LOCKED_ADDRESS] = safeSub(
balances[LOCKED_ADDRESS],
VESTING_1_AMOUNT
);
balances[_destination] = safeAdd(balances[_destination], VESTING_1_AMOUNT);
vesting1Withdrawn = true;
Transfer(LOCKED_ADDRESS, _destination, VESTING_1_AMOUNT);
return true;
}
if (block.timestamp > VESTING_2_DATE && vesting2Withdrawn == false) {
balances[LOCKED_ADDRESS] = safeSub(
balances[LOCKED_ADDRESS],
VESTING_2_AMOUNT
);
balances[_destination] = safeAdd(balances[_destination], VESTING_2_AMOUNT);
vesting2Withdrawn = true;
Transfer(LOCKED_ADDRESS, _destination, VESTING_2_AMOUNT);
return true;
}
return false;
}
transferOtherERC20Token keyboard_arrow_up
Modifiers help
onlyOwner checks for the following:
Requirements help
One or more of the following:
-transferable must be true - OR
tokenAddress
must not be equal to
UNKNOWN VALUE
Source Code
function transferOtherERC20Token(address tokenAddress, uint256 amount)
onlyOwner
returns (bool success)
{
// can't be used for GIM token
require(tokenAddress != address(this) || transferable);
return ERC20(tokenAddress).transfer(owner, amount);
}
setStreamerContract keyboard_arrow_up
Modifiers help
onlyAdministrator checks for the following:
Requirements help
One or more of the following:
-
streamerContractMaxAmount
must be equal to
0
- OR
_maxAmount
must be equal to
0
Source Code
function setStreamerContract(address _contractAddress, uint256 _maxAmount)
onlyAdministrator
{
// To change the maximum amount you first have to reduce it to 0`
require(_maxAmount == 0 || streamerContractMaxAmount == 0);
streamerContract = _contractAddress;
streamerContractMaxAmount = _maxAmount;
StreamerContractChanged(streamerContract, streamerContractMaxAmount);
}
transferGIM keyboard_arrow_up
Requirements help
Source Code
function transferGIM(
address _from,
address _to,
uint256 _amount
) returns (bool success) {
require(msg.sender == streamerContract);
require(tx.origin == _from);
require(_amount <= streamerContractMaxAmount);
if (balances[_from] < _amount || _amount <= 0) return false;
balances[_from] = safeSub(balances[_from], _amount);
balances[_to] = safeAdd(balances[_to], _amount);
Transfer(_from, _to, _amount);
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 SafeMath.safeMul keyboard_arrow_up
Requirements help
Source Code
function safeMul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
internal SafeMath.safeDiv keyboard_arrow_up
Source Code
function safeDiv(uint256 a, uint256 b) internal returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + (a % b));
return c;
}
internal SafeMath.safeSub keyboard_arrow_up
internal SafeMath.safeAdd keyboard_arrow_up
Source Code
function safeAdd(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a + b;
assert(c >= a && c >= b);
return c;
}
internal SafeMath.max64 keyboard_arrow_up
internal SafeMath.min64 keyboard_arrow_up
internal SafeMath.max256 keyboard_arrow_up
internal SafeMath.min256 keyboard_arrow_up
internal SafeMath.safeMul keyboard_arrow_up
Requirements help
Source Code
function safeMul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
internal SafeMath.safeDiv keyboard_arrow_up
Source Code
function safeDiv(uint256 a, uint256 b) internal returns (uint256) {
assert(b > 0);
uint256 c = a / b;
assert(a == b * c + (a % b));
return c;
}
internal SafeMath.safeSub keyboard_arrow_up
internal SafeMath.safeAdd keyboard_arrow_up
Source Code
function safeAdd(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a + b;
assert(c >= a && c >= b);
return c;
}