Blockwell

Golem Network Token

About

Stats

Public Functions 9
Event Types 3
Code Size 11,646 bytes

Events (3) keyboard_arrow_up

Migrate Event

Parameters help
_from
address help
_to
address help
_value
uint256 help

Refund Event

Parameters help
_from
address help
_value
uint256 help

Transfer Event

Parameters help
_from
address help
_to
address help
_value
uint256 help

name Constant

string help
Golem Network Token

symbol Constant

string help
GNT

decimals Constant

uint8 help
18

tokenCreationRate Constant

uint256 help
1000

tokenCreationCap Constant

uint256 help

tokenCreationMin Constant

uint256 help

fundingStartBlock Variable

uint256 help

fundingEndBlock Variable

uint256 help

funding Variable

bool help

golemFactory Variable

address help

migrationMaster Variable

address help

migrationAgent Variable

address help

totalMigrated Variable

uint256 help

lockedAllocation Variable

GNTAllocation help
Internal Variable

totalTokens Variable

uint256 help
Internal Variable

balances Variable

mapping(address => uint256) help
Internal Variable

Functions Expand All Collapse All

Parameters help

Name Type
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

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;
}

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help constant
Source Code
function totalSupply() external constant returns (uint256) {
  return totalTokens;
}

Parameters help

Name Type
_owner
address help

Properties

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

migrate keyboard_arrow_up

Parameters help

Name Type
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
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

Name Type
_agent
address help

Properties

Visibility help public
Mutability help transaction
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

Name Type
_master
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function setMigrationMaster(address _master) external {
  if (msg.sender != migrationMaster) throw;
  if (_master == 0) throw;
  migrationMaster = _master;
}

create keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
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

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
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

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
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 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.