Blockwell

Lunyr Token

ERC20

This contract is an ERC20 token.

Name Lunyr Token
Symbol LUN
Decimals 18
Total Supply 2,703,356 LUN

About link description

Lunyr (LUN) is a cryptocurrency and operates on the Ethereum platform. Lunyr has a current supply of 2,703,356.07853158 with 2,297,853.07853158 in circulation. The last known price of Lunyr is 0.18352348 USD and is up 1.06 over the last 24 hours. It is currently trading on 8 active market(s) with $1,187.39 traded over the last 24 hours. More information can be found at https://lunyr.com/.

Stats

Public Functions 16
Event Types 6
Code Size 28,086 bytes

Events (6) keyboard_arrow_up

Approval Event

Parameters help
owner
address help
spender
address help
value
uint help

Refund Event

Parameters help
_from
address help
_value
uint256 help

Transfer Event

Parameters help
from
address help
to
address help
value
uint help

Upgrade Event

Parameters help
_from
address help
_to
address help
_value
uint256 help

UpgradeAgentSet Event

Parameters help
agent
address help

UpgradeFinalized Event

Parameters help
sender
address help
upgradeAgent
address help

name Constant

string help
Lunyr Token

symbol Constant

string help
LUN

decimals Constant

uint256 help
18

crowdfundPercentOfTotal Constant

uint256 help
78

vaultPercentOfTotal Constant

uint256 help
15

lunyrPercentOfTotal Constant

uint256 help
7

hundredPercent Constant

uint256 help
100

tokensPerEther Constant

uint256 help
44

tokenCreationMax Constant

uint256 help

tokenCreationMin Constant

uint256 help

isLunyrToken Variable

bool help

upgradeMaster Variable

address help

upgradeAgent Variable

address help

totalUpgraded Variable

uint256 help

finalizedCrowdfunding Variable

bool help

fundingStartBlock Variable

uint256 help

fundingEndBlock Variable

uint256 help

lunyrMultisig Variable

address help

timeVault Variable

address help

totalSupply Variable

uint help

balances Variable

mapping(address => uint256) help
Internal Variable

allowed Variable

mapping(address => mapping(address => uint256)) help
Internal Variable

Functions Expand All Collapse All

Parameters help

Name Type
who
address help

Properties

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

Parameters help

Name Type
owner
address help
spender
address help

Properties

Visibility help public
Mutability help constant
Source Code
function allowance(address owner, address spender) constant returns (uint256) {
  return allowed[owner][spender];
}

Parameters help

Name Type
to
address help
value
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function transfer(address to, uint256 value) returns (bool ok);

Parameters help

Name Type
from
address help
to
address help
value
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function transferFrom(
  address from,
  address to,
  uint256 value
) returns (bool ok) {
  if (getState() != State.Success) throw; // Abort if not in Success state.
  if (to == 0x0) throw;
  if (to == address(upgradeAgent)) throw;
  //if (to == address(upgradeAgent.newToken())) throw;
  if (balances[from] >= value && allowed[from][msg.sender] >= value) {
    balances[to] = safeAdd(balances[to], value);
    balances[from] = safeSub(balances[from], value);
    allowed[from][msg.sender] = safeSub(allowed[from][msg.sender], value);
    Transfer(from, to, value);
    return true;
  } else {
    return false;
  }
}

Parameters help

Name Type
spender
address help
value
uint help

Properties

Visibility help public
Mutability help transaction
Source Code
function approve(address spender, uint256 value) returns (bool ok);

Parameters help

Name Type
to
address help
value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function transfer(address to, uint256 value) returns (bool ok) {
  if (getState() != State.Success) throw; // Abort if crowdfunding was not a success.
  if (to == 0x0) throw;
  if (to == address(upgradeAgent)) throw;
  //if (to == address(upgradeAgent.newToken())) throw;
  uint256 senderBalance = balances[msg.sender];
  if (senderBalance >= value && value > 0) {
    senderBalance = safeSub(senderBalance, value);
    balances[msg.sender] = senderBalance;
    balances[to] = safeAdd(balances[to], value);
    Transfer(msg.sender, to, value);
    return true;
  }
  return false;
}

Parameters help

Name Type
spender
address help
value
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
function approve(address spender, uint256 value) returns (bool ok) {
  if (getState() != State.Success) throw; // Abort if not in Success state.
  allowed[msg.sender][spender] = value;
  Approval(msg.sender, spender, value);
  return true;
}

upgrade keyboard_arrow_up

Parameters help

Name Type
value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
function upgrade(uint256 value) external {
  if (getState() != State.Success) throw; // Abort if not in Success state.
  if (upgradeAgent.owner() == 0x0) throw; // need a real upgradeAgent address

  // Validate input value.
  if (value == 0) throw;
  if (value > balances[msg.sender]) throw;

  // update the balances here first before calling out (reentrancy)
  balances[msg.sender] = safeSub(balances[msg.sender], value);
  totalSupply = safeSub(totalSupply, value);
  totalUpgraded = safeAdd(totalUpgraded, value);
  upgradeAgent.upgradeFrom(msg.sender, value);
  Upgrade(msg.sender, upgradeAgent, value);
}

setUpgradeAgent keyboard_arrow_up

Parameters help

Name Type
agent
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function setUpgradeAgent(address agent) external {
  if (getState() != State.Success) throw; // Abort if not in Success state.
  if (agent == 0x0) throw; // don't set agent to nothing
  if (msg.sender != upgradeMaster) throw; // Only a master can designate the next agent
  if (address(upgradeAgent) != 0x0 && upgradeAgent.upgradeHasBegun()) throw; // Don't change the upgrade agent
  upgradeAgent = UpgradeAgent(agent);
  // upgradeAgent must be created and linked to LunyrToken after crowdfunding is over
  if (upgradeAgent.originalSupply() != totalSupply) throw;
  UpgradeAgentSet(upgradeAgent);
}

setUpgradeMaster keyboard_arrow_up

Parameters help

Name Type
master
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function setUpgradeMaster(address master) external {
  if (getState() != State.Success) throw; // Abort if not in Success state.
  if (master == 0x0) throw;
  if (msg.sender != upgradeMaster) throw; // Only a master can designate the next master
  upgradeMaster = master;
}

setMultiSigWallet keyboard_arrow_up

Parameters help

Name Type
newWallet
address help

Properties

Visibility help public
Mutability help transaction
Source Code
function setMultiSigWallet(address newWallet) external {
  if (msg.sender != lunyrMultisig) throw;
  MultiSigWallet wallet = MultiSigWallet(newWallet);
  if (!wallet.isMultiSigWallet()) throw;
  lunyrMultisig = newWallet;
}

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function() {
  throw;
}

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 (getState() != State.Funding) throw;

  // Do not allow creating 0 or more than the cap tokens.
  if (msg.value == 0) throw;

  // multiply by exchange rate to get newly created token amount
  uint256 createdTokens = safeMul(msg.value, tokensPerEther);

  // we are creating tokens, so increase the totalSupply
  totalSupply = safeAdd(totalSupply, createdTokens);

  // don't go over the limit!
  if (totalSupply > tokenCreationMax) throw;

  // Assign new tokens to the sender
  balances[msg.sender] = safeAdd(balances[msg.sender], createdTokens);

  // Log token creation event
  Transfer(0, msg.sender, createdTokens);
}

finalizeCrowdfunding keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
function finalizeCrowdfunding() external {
  // Abort if not in Funding Success state.
  if (getState() != State.Success) throw; // don't finalize unless we won
  if (finalizedCrowdfunding) throw; // can't finalize twice (so sneaky!)

  // prevent more creation of tokens
  finalizedCrowdfunding = true;

  // Endowment: 15% of total goes to vault, timelocked for 6 months
  // uint256 vaultTokens = safeDiv(safeMul(totalSupply, vaultPercentOfTotal), hundredPercent);
  uint256 vaultTokens = safeDiv(
    safeMul(totalSupply, vaultPercentOfTotal),
    crowdfundPercentOfTotal
  );
  balances[timeVault] = safeAdd(balances[timeVault], vaultTokens);
  Transfer(0, timeVault, vaultTokens);

  // Endowment: 7% of total goes to lunyr for marketing and bug bounty
  uint256 lunyrTokens = safeDiv(
    safeMul(totalSupply, lunyrPercentOfTotal),
    crowdfundPercentOfTotal
  );
  balances[lunyrMultisig] = safeAdd(balances[lunyrMultisig], lunyrTokens);
  Transfer(0, lunyrMultisig, lunyrTokens);

  totalSupply = safeAdd(safeAdd(totalSupply, vaultTokens), lunyrTokens);

  // Transfer ETH to the Lunyr Multisig address.
  if (!lunyrMultisig.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 (getState() != State.Failure) throw;

  uint256 lunValue = balances[msg.sender];
  if (lunValue == 0) throw;
  balances[msg.sender] = 0;
  totalSupply = safeSub(totalSupply, lunValue);

  uint256 ethValue = safeDiv(lunValue, tokensPerEther); // lunValue % tokensPerEther == 0
  Refund(msg.sender, ethValue);
  if (!msg.sender.send(ethValue)) throw;
}

getState keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help constant
Source Code
function getState() public constant returns (State) {
  // once we reach success, lock in the state
  if (finalizedCrowdfunding) return State.Success;
  if (block.number < fundingStartBlock) return State.PreFunding;
  else if (block.number <= fundingEndBlock && totalSupply < tokenCreationMax)
    return State.Funding;
  else if (totalSupply >= tokenCreationMin) return State.Success;
  else return State.Failure;
}

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.

internal SafeMath.safeMul keyboard_arrow_up

Parameters help

Name Type
a
uint help
b
uint help

Properties

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

Parameters help

Name Type
a
uint help
b
uint help

Properties

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

Parameters help

Name Type
a
uint help
b
uint help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function safeSub(uint256 a, uint256 b) internal returns (uint256) {
  assert(b <= a);
  return a - b;
}

internal SafeMath.safeAdd keyboard_arrow_up

Parameters help

Name Type
a
uint help
b
uint help

Properties

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

Parameters help

Name Type
a
uint64 help
b
uint64 help

Properties

Visibility help internal
Mutability help constant
Source Code
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
  return a >= b ? a : b;
}

internal SafeMath.min64 keyboard_arrow_up

Parameters help

Name Type
a
uint64 help
b
uint64 help

Properties

Visibility help internal
Mutability help constant
Source Code
function min64(uint64 a, uint64 b) internal constant returns (uint64) {
  return a < b ? a : b;
}

internal SafeMath.max256 keyboard_arrow_up

Parameters help

Name Type
a
uint256 help
b
uint256 help

Properties

Visibility help internal
Mutability help constant
Source Code
function max256(uint256 a, uint256 b) internal constant returns (uint256) {
  return a >= b ? a : b;
}

internal SafeMath.min256 keyboard_arrow_up

Parameters help

Name Type
a
uint256 help
b
uint256 help

Properties

Visibility help internal
Mutability help constant
Source Code
function min256(uint256 a, uint256 b) internal constant returns (uint256) {
  return a < b ? a : b;
}

internal SafeMath.assert keyboard_arrow_up

Parameters help

Name Type
assertion
bool help

Properties

Visibility help internal
Mutability help transaction

Requirements help

Source Code
function assert(bool assertion) internal {
  if (!assertion) {
    throw;
  }
}