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 describes itself as an Ethereum-based decentralized world knowledge base which rewards users with app tokens for peer-reviewing and contributing information. It aims to be the starting point of the internet for finding reliable, accurate information. Its long-term vision is to develop a knowledge base API that developers can use to create decentralized applications in Artificial Intelligence, Virtual Reality, Augmented Reality, and more.

Stats

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

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

Functions Expand All Collapse All

balanceOf keyboard_arrow_up

Parameters help

Name Type
who
address help

Properties

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

allowance keyboard_arrow_up

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 (uint) {
        return allowed[owner][spender];
    }

transfer keyboard_arrow_up

Parameters help

Name Type
to
address help
value
uint help

Properties

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

transferFrom keyboard_arrow_up

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

approve keyboard_arrow_up

Parameters help

Name Type
spender
address help
value
uint help

Properties

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

transfer keyboard_arrow_up

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

approve keyboard_arrow_up

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() payable external {
        // 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;
    }