Stats
Public Functions
9
Event Types
3
Code Size
11,646 bytes
Events (3)
keyboard_arrow_up
Migrate
Event
Parameters
help
Event parameters list the data that an event contains.
_from |
address help
The type of this value is address, which means it stores an Ethereum address, such as a wallet address.
|
_to |
address help
The type of this value is address, which means it stores an Ethereum address, such as a wallet address.
|
_value |
uint256 help
The type of this value is uint, which stands for unsigned integer. Integer means it's a whole number (such as 1, 12, 52) without fractions or decimals. Unsigned means it can't have a negative or positive sign, so it's always a positive number.
|
Refund
Event
Parameters
help
Event parameters list the data that an event contains.
_from |
address help
The type of this value is address, which means it stores an Ethereum address, such as a wallet address.
|
_value |
uint256 help
The type of this value is uint, which stands for unsigned integer. Integer means it's a whole number (such as 1, 12, 52) without fractions or decimals. Unsigned means it can't have a negative or positive sign, so it's always a positive number.
|
Transfer
Event
Parameters
help
Event parameters list the data that an event contains.
_from |
address help
The type of this value is address, which means it stores an Ethereum address, such as a wallet address.
|
_to |
address help
The type of this value is address, which means it stores an Ethereum address, such as a wallet address.
|
_value |
uint256 help
The type of this value is uint, which stands for unsigned integer. Integer means it's a whole number (such as 1, 12, 52) without fractions or decimals. Unsigned means it can't have a negative or positive sign, so it's always a positive number.
|
Constants (6)
keyboard_arrow_up
name
Constant
string
help
The type of this value is string, which is basically just plain text. It's called a string because it is a 'string' of letters.
Golem Network Token
symbol
Constant
string
help
The type of this value is string, which is basically just plain text. It's called a string because it is a 'string' of letters.
GNT
decimals
Constant
uint8
help
The type of this value is uint, which stands for unsigned integer. Integer means it's a whole number (such as 1, 12, 52) without fractions or decimals. Unsigned means it can't have a negative or positive sign, so it's always a positive number.
18
tokenCreationRate
Constant
uint256
help
The type of this value is uint, which stands for unsigned integer. Integer means it's a whole number (such as 1, 12, 52) without fractions or decimals. Unsigned means it can't have a negative or positive sign, so it's always a positive number.
1000
tokenCreationCap
Constant
uint256
help
The type of this value is uint, which stands for unsigned integer. Integer means it's a whole number (such as 1, 12, 52) without fractions or decimals. Unsigned means it can't have a negative or positive sign, so it's always a positive number.
tokenCreationMin
Constant
uint256
help
The type of this value is uint, which stands for unsigned integer. Integer means it's a whole number (such as 1, 12, 52) without fractions or decimals. Unsigned means it can't have a negative or positive sign, so it's always a positive number.
State Variables (10)
keyboard_arrow_up
fundingStartBlock
Variable
uint256
help
The type of this value is uint, which stands for unsigned integer. Integer means it's a whole number (such as 1, 12, 52) without fractions or decimals. Unsigned means it can't have a negative or positive sign, so it's always a positive number.
fundingEndBlock
Variable
uint256
help
The type of this value is uint, which stands for unsigned integer. Integer means it's a whole number (such as 1, 12, 52) without fractions or decimals. Unsigned means it can't have a negative or positive sign, so it's always a positive number.
funding
Variable
bool
help
The type of this value is other.
golemFactory
Variable
address
help
The type of this value is address, which means it stores an Ethereum address, such as a wallet address.
migrationMaster
Variable
address
help
The type of this value is address, which means it stores an Ethereum address, such as a wallet address.
migrationAgent
Variable
address
help
The type of this value is address, which means it stores an Ethereum address, such as a wallet address.
totalMigrated
Variable
uint256
help
The type of this value is uint, which stands for unsigned integer. Integer means it's a whole number (such as 1, 12, 52) without fractions or decimals. Unsigned means it can't have a negative or positive sign, so it's always a positive number.
lockedAllocation
Variable
GNTAllocation
help
The type of this value is other.
totalTokens
Variable
uint256
help
The type of this value is uint, which stands for unsigned integer. Integer means it's a whole number (such as 1, 12, 52) without fractions or decimals. Unsigned means it can't have a negative or positive sign, so it's always a positive number.
balances
Variable
mapping(address => uint256)
help
The type of this value is other.
transfer
keyboard_arrow_up
Parameters
help
Function parameters list what input the function expects from the user. Each
parameter must be given a value.
Name |
Type |
_to |
address help
The type of this value is address, which means it stores an Ethereum address, such as a wallet address.
|
_value |
uint256 help
The type of this value is uint, which stands for unsigned integer. Integer means it's a whole number (such as 1, 12, 52) without fractions or decimals. Unsigned means it can't have a negative or positive sign, so it's always a positive number.
|
Properties
Visibility
help
Visibility determines if the function is visible to users and other contracts.
Only functions that are public can be used.
public
Mutability
help
Mutability tells you if a function can make changes on the blockchain.
View means the function can be called by anyone without
a wallet and without submitting a transaction.
transaction
Requirements
help
Requirements are checks that the function makes when it runs, and give you
insight on what conditions are required for the function to succeed.
Source Code
function transfer(address _to, uint256 _value) returns (bool) {
// Abort if not in Operational state.
if (funding) throw;
var senderBalance = balances[msg.sender];
if (senderBalance >= _value && _value > 0) {
senderBalance -= _value;
balances[msg.sender] = senderBalance;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
}
return false;
}
totalSupply
keyboard_arrow_up
Parameters
help
Function parameters list what input the function expects from the user. Each
parameter must be given a value.
This function has no parameters.
Properties
Visibility
help
Visibility determines if the function is visible to users and other contracts.
Only functions that are public can be used.
public
Mutability
help
Mutability tells you if a function can make changes on the blockchain.
View means the function can be called by anyone without
a wallet and without submitting a transaction.
constant
Source Code
function totalSupply() external constant returns (uint256) {
return totalTokens;
}
balanceOf
keyboard_arrow_up
Parameters
help
Function parameters list what input the function expects from the user. Each
parameter must be given a value.
Name |
Type |
_owner |
address help
The type of this value is address, which means it stores an Ethereum address, such as a wallet address.
|
Properties
Visibility
help
Visibility determines if the function is visible to users and other contracts.
Only functions that are public can be used.
public
Mutability
help
Mutability tells you if a function can make changes on the blockchain.
View means the function can be called by anyone without
a wallet and without submitting a transaction.
constant
Source Code
function balanceOf(address _owner) external constant returns (uint256) {
return balances[_owner];
}
migrate
keyboard_arrow_up
Parameters
help
Function parameters list what input the function expects from the user. Each
parameter must be given a value.
Name |
Type |
_value |
uint256 help
The type of this value is uint, which stands for unsigned integer. Integer means it's a whole number (such as 1, 12, 52) without fractions or decimals. Unsigned means it can't have a negative or positive sign, so it's always a positive number.
|
Properties
Visibility
help
Visibility determines if the function is visible to users and other contracts.
Only functions that are public can be used.
public
Mutability
help
Mutability tells you if a function can make changes on the blockchain.
View means the function can be called by anyone without
a wallet and without submitting a transaction.
transaction
Requirements
help
Requirements are checks that the function makes when it runs, and give you
insight on what conditions are required for the function to succeed.
Source Code
function migrate(uint256 _value) external {
// Abort if not in Operational Migration state.
if (funding) throw;
if (migrationAgent == 0) throw;
// Validate input value.
if (_value == 0) throw;
if (_value > balances[msg.sender]) throw;
balances[msg.sender] -= _value;
totalTokens -= _value;
totalMigrated += _value;
MigrationAgent(migrationAgent).migrateFrom(msg.sender, _value);
Migrate(msg.sender, migrationAgent, _value);
}
setMigrationAgent
keyboard_arrow_up
Parameters
help
Function parameters list what input the function expects from the user. Each
parameter must be given a value.
Name |
Type |
_agent |
address help
The type of this value is address, which means it stores an Ethereum address, such as a wallet address.
|
Properties
Visibility
help
Visibility determines if the function is visible to users and other contracts.
Only functions that are public can be used.
public
Mutability
help
Mutability tells you if a function can make changes on the blockchain.
View means the function can be called by anyone without
a wallet and without submitting a transaction.
transaction
Requirements
help
Requirements are checks that the function makes when it runs, and give you
insight on what conditions are required for the function to succeed.
Source Code
function setMigrationAgent(address _agent) external {
// Abort if not in Operational Normal state.
if (funding) throw;
if (migrationAgent != 0) throw;
if (msg.sender != migrationMaster) throw;
migrationAgent = _agent;
}
setMigrationMaster
keyboard_arrow_up
Parameters
help
Function parameters list what input the function expects from the user. Each
parameter must be given a value.
Name |
Type |
_master |
address help
The type of this value is address, which means it stores an Ethereum address, such as a wallet address.
|
Properties
Visibility
help
Visibility determines if the function is visible to users and other contracts.
Only functions that are public can be used.
public
Mutability
help
Mutability tells you if a function can make changes on the blockchain.
View means the function can be called by anyone without
a wallet and without submitting a transaction.
transaction
Requirements
help
Requirements are checks that the function makes when it runs, and give you
insight on what conditions are required for the function to succeed.
Source Code
function setMigrationMaster(address _master) external {
if (msg.sender != migrationMaster) throw;
if (_master == 0) throw;
migrationMaster = _master;
}
create
keyboard_arrow_up
Parameters
help
Function parameters list what input the function expects from the user. Each
parameter must be given a value.
This function has no parameters.
Properties
Visibility
help
Visibility determines if the function is visible to users and other contracts.
Only functions that are public can be used.
public
Mutability
help
Mutability tells you if a function can make changes on the blockchain.
View means the function can be called by anyone without
a wallet and without submitting a transaction.
payable
Requirements
help
Requirements are checks that the function makes when it runs, and give you
insight on what conditions are required for the function to succeed.
Source Code
function create() external payable {
// Abort if not in Funding Active state.
// The checks are split (instead of using or operator) because it is
// cheaper this way.
if (!funding) throw;
if (block.number < fundingStartBlock) throw;
if (block.number > fundingEndBlock) throw;
// Do not allow creating 0 or more than the cap tokens.
if (msg.value == 0) throw;
if (msg.value > (tokenCreationCap - totalTokens) / tokenCreationRate) throw;
var numTokens = msg.value * tokenCreationRate;
totalTokens += numTokens;
// Assign new tokens to the sender
balances[msg.sender] += numTokens;
// Log token creation event
Transfer(0, msg.sender, numTokens);
}
finalize
keyboard_arrow_up
Parameters
help
Function parameters list what input the function expects from the user. Each
parameter must be given a value.
This function has no parameters.
Properties
Visibility
help
Visibility determines if the function is visible to users and other contracts.
Only functions that are public can be used.
public
Mutability
help
Mutability tells you if a function can make changes on the blockchain.
View means the function can be called by anyone without
a wallet and without submitting a transaction.
transaction
Requirements
help
Requirements are checks that the function makes when it runs, and give you
insight on what conditions are required for the function to succeed.
Source Code
function finalize() external {
// Abort if not in Funding Success state.
if (!funding) throw;
if (
(block.number <= fundingEndBlock || totalTokens < tokenCreationMin) &&
totalTokens < tokenCreationCap
) throw;
// Switch to Operational state. This is the only place this can happen.
funding = false;
// Create additional GNT for the Golem Factory and developers as
// the 18% of total number of tokens.
// All additional tokens are transfered to the account controller by
// GNTAllocation contract which will not allow using them for 6 months.
uint256 percentOfTotal = 18;
uint256 additionalTokens = (totalTokens * percentOfTotal) /
(100 - percentOfTotal);
totalTokens += additionalTokens;
balances[lockedAllocation] += additionalTokens;
Transfer(0, lockedAllocation, additionalTokens);
// Transfer ETH to the Golem Factory address.
if (!golemFactory.send(this.balance)) throw;
}
refund
keyboard_arrow_up
Parameters
help
Function parameters list what input the function expects from the user. Each
parameter must be given a value.
This function has no parameters.
Properties
Visibility
help
Visibility determines if the function is visible to users and other contracts.
Only functions that are public can be used.
public
Mutability
help
Mutability tells you if a function can make changes on the blockchain.
View means the function can be called by anyone without
a wallet and without submitting a transaction.
transaction
Requirements
help
Requirements are checks that the function makes when it runs, and give you
insight on what conditions are required for the function to succeed.
Source Code
function refund() external {
// Abort if not in Funding Failure state.
if (!funding) throw;
if (block.number <= fundingEndBlock) throw;
if (totalTokens >= tokenCreationMin) throw;
var gntValue = balances[msg.sender];
if (gntValue == 0) throw;
balances[msg.sender] = 0;
totalTokens -= gntValue;
var ethValue = gntValue / tokenCreationRate;
Refund(msg.sender, ethValue);
if (!msg.sender.send(ethValue)) throw;
}
Internal functions are parts of the contract that can't be used directly, but instead are used by
the public functions listed above.