EthLend Token
ERC20
This contract is an ERC20 token.
Name
EthLend Token
Symbol
LEND
Decimals
18
Total Supply
1,299,999,942 LEND
About
Stats
Public Functions
14
Event Types
4
Code Size
10,271 bytes
Events (4) keyboard_arrow_up
Constants (12) keyboard_arrow_up
State Variables (11) keyboard_arrow_up
Functions
totalSupply keyboard_arrow_up
balanceOf keyboard_arrow_up
transfer keyboard_arrow_up
Requirements help
enableTransfers must be true
Source Code
function transfer(address _to, uint256 _value) returns (bool) {
require(enableTransfers);
return super.transfer(_to, _value);
}
transferFrom keyboard_arrow_up
Requirements help
Source Code
function transferFrom(
address _from,
address _to,
uint256 _value
) returns (bool) {
require(enableTransfers);
return super.transferFrom(_from, _to, _value);
}
approve keyboard_arrow_up
Requirements help
enableTransfers must be true
One or more of the following:
Source Code
function approve(address _spender, uint256 _value) returns (bool) {
require(enableTransfers);
return super.approve(_spender, _value);
}
allowance keyboard_arrow_up
buyTokens keyboard_arrow_up
Parameters help
This function has no parameters.
Requirements help
One or more of the following:
-
currentState
must be equal to
State.ICORunning
- OR
currentState
must be equal to
State.PresaleRunning
Source Code
function buyTokens() public payable {
require(
currentState == State.PresaleRunning || currentState == State.ICORunning
);
if (currentState == State.PresaleRunning) {
return buyTokensPresale();
} else {
return buyTokensICO();
}
}
buyTokensPresale keyboard_arrow_up
Parameters help
This function has no parameters.
Modifiers help
onlyInState checks for the following:
Requirements help
Source Code
function buyTokensPresale() public payable onlyInState(State.PresaleRunning) {
// min - 1 ETH
require(msg.value >= (1 ether / 1 wei));
uint256 newTokens = msg.value * PRESALE_PRICE;
require(presaleSoldTokens + newTokens <= PRESALE_TOKEN_SUPPLY_LIMIT);
balances[msg.sender] += newTokens;
supply += newTokens;
presaleSoldTokens += newTokens;
totalSoldTokens += newTokens;
LogBuy(msg.sender, newTokens);
}
buyTokensICO keyboard_arrow_up
Parameters help
This function has no parameters.
Modifiers help
onlyInState checks for the following:
Requirements help
Source Code
function buyTokensICO() public payable onlyInState(State.ICORunning) {
// min - 0.01 ETH
require(msg.value >= ((1 ether / 1 wei) / 100));
uint256 newTokens = msg.value * getPrice();
require(totalSoldTokens + newTokens <= TOTAL_SOLD_TOKEN_SUPPLY_LIMIT);
balances[msg.sender] += newTokens;
supply += newTokens;
icoSoldTokens += newTokens;
totalSoldTokens += newTokens;
LogBuy(msg.sender, newTokens);
}
getPrice keyboard_arrow_up
Parameters help
This function has no parameters.
Source Code
function getPrice() constant returns (uint256) {
if (currentState == State.ICORunning) {
if (icoSoldTokens < (200000000 * (1 ether / 1 wei))) {
return ICO_PRICE1;
}
if (icoSoldTokens < (300000000 * (1 ether / 1 wei))) {
return ICO_PRICE2;
}
return ICO_PRICE3;
} else {
return PRESALE_PRICE;
}
}
setState keyboard_arrow_up
Modifiers help
onlyTokenManager checks for the following:
Requirements help
Source Code
function setState(State _nextState) public onlyTokenManager {
//setState() method call shouldn't be entertained after ICOFinished
require(currentState != State.ICOFinished);
currentState = _nextState;
// enable/disable transfers
//enable transfers only after ICOFinished, disable otherwise
enableTransfers = (currentState == State.ICOFinished);
}
withdrawEther keyboard_arrow_up
setTokenManager keyboard_arrow_up
Modifiers help
onlyTokenManager checks for the following:
Source Code
function setTokenManager(address _mgr) public onlyTokenManager {
tokenManager = _mgr;
}
constructor keyboard_arrow_up
Parameters help
This function has no parameters.
Requirements help
One or more of the following:
-
currentState
must be equal to
State.ICORunning
- OR
currentState
must be equal to
State.PresaleRunning
Source Code
function() payable {
buyTokens();
}
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.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;
}