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
Constants (10) keyboard_arrow_up
tokenCreationMax Constant
uint256 help
the result of calling safeMul with UNKNOWN ARGUMENT, tokensPerEther
tokenCreationMin Constant
uint256 help
the result of calling safeMul with UNKNOWN ARGUMENT, tokensPerEther
State Variables (12) keyboard_arrow_up
Functions
balanceOf keyboard_arrow_up
allowance keyboard_arrow_up
transfer keyboard_arrow_up
transferFrom keyboard_arrow_up
Requirements help
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;
}
}
approve keyboard_arrow_up
transfer keyboard_arrow_up
Requirements help
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
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
Requirements help
UNKNOWN VALUE
must not be equal to
0x0
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
Requirements help
One or more of the following:
-
UNKNOWN VALUE
must be equal to
0x0
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
Requirements help
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
Requirements help
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
create keyboard_arrow_up
Parameters help
This function has no parameters.
Requirements help
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.
Requirements help
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.
Requirements help
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.
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
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;
}