Blockwell

Linker Coin

ERC20

This contract is an ERC20 token.

Name Linker Coin
Symbol LNC
Decimals 18
Total Supply 299,998,766 LNC

About

Stats

Public Functions 25
Event Types 11
Code Size 13,962 bytes

Approval Event

Parameters help
_owner
address help
_spender
address help
_value
uint256 help

Burn Event

Parameters help
from
address help
value
uint256 help

FrozenFunds Event

Parameters help
target
address help
frozen
bool help

SetBurnStart Event

Parameters help
_isBurnStart
bool help

SetEdgePerPosition Event

Parameters help
_edgePerPosition
uint256 help

SetLPTargetPostion Event

Parameters help
_lpTargetPositionn
uint256 help

SetLpFee Event

Parameters help
_lpFeeBp
uint256 help

SetLpIsStart Event

Parameters help
_isLpStart
bool help

SetLpMaxVolume Event

Parameters help
_lpMaxVolume
uint256 help

SetPrices Event

Parameters help
_lpBidPrice
uint256 help
_lpAskPrice
uint256 help
_lpBidVolume
uint256 help
_lpAskVolume
uint256 help

Transfer Event

Parameters help
_from
address help
_to
address help
_value
uint256 help

Functions Expand All Collapse All

totalSupply keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help constant
Source Code
    function totalSupply() public constant returns (uint256 supply) {
        supply = _totalSupply;
    }

balanceOf keyboard_arrow_up

Parameters help

Name Type
_owner
address help

Properties

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

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) public returns (bool success)
    {
        if (_to != 0x0  // Prevent transfer to 0x0 address.
            && IsFreezedAccount(msg.sender) == false
            && balances[msg.sender] >= _value 
            && _value > 0
            && balances[_to] + _value > balances[_to]) {
            balances[msg.sender] = balances[msg.sender].sub(_value);
            balances[_to] = balances[_to].add(_value);
            Transfer(msg.sender, _to, _value);
            return true;
        } else {
            return false;
        }
    }

transferFrom keyboard_arrow_up

Parameters help

Name Type
_from
address help
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
    function transferFrom(address _from,address _to, uint256 _value) public returns (bool success) {
        if (_to != 0x0  // Prevent transfer to 0x0 address.
            && IsFreezedAccount(_from) == false
            && balances[_from] >= _value
            && allowed[_from][msg.sender] >= _value
            && _value > 0
            && balances[_to] + _value > balances[_to]) {
            balances[_from] = balances[_from].sub(_value);
            allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
            balances[_to] = balances[_to].add(_value);
            Transfer(_from, _to, _value);
            return true;
        } else {
            return false;
        }
    }

approve keyboard_arrow_up

Parameters help

Name Type
_spender
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
    function approve(address _spender, uint256 _value) public returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }

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) public constant returns (uint256 remaining) {
        return allowed[_owner][_spender];
    }

IsFreezedAccount keyboard_arrow_up

Parameters help

Name Type
_addr
address help

Properties

Visibility help public
Mutability help constant
Source Code
    function IsFreezedAccount(address _addr) public constant returns (bool) {
        return frozenAccount[_addr];
    }

FreezeAccount keyboard_arrow_up

Parameters help

Name Type
target
address help
freeze
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
    function FreezeAccount(address target, bool freeze) onlyOwner public {
        frozenAccount[target] = freeze;
        FrozenFunds(target, freeze);
    }

burn keyboard_arrow_up

Parameters help

Name Type
_value
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
    function burn(uint256 _value) onlyOwner public returns (bool success) {
        if (isBurn == true)
        {
            balances[msg.sender] = balances[msg.sender].sub(_value);
            _totalSupply = _totalSupply.sub(_value);
            Burn(msg.sender, _value);
            return true;
        }
        else{
            return false;
        }
    }

setBurnStart keyboard_arrow_up

Parameters help

Name Type
_isBurnStart
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
    function setBurnStart(bool _isBurnStart) onlyOwner public {
        isBurn = _isBurnStart;
    }

setPrices keyboard_arrow_up

Parameters help

Name Type
_lpBidPrice
uint256 help
_lpAskPrice
uint256 help
_lpBidVolume
uint256 help
_lpAskVolume
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
    function setPrices(uint256 _lpBidPrice, uint256 _lpAskPrice, uint256 _lpBidVolume, uint256 _lpAskVolume) onlyOwner public{
        require(_lpBidPrice < _lpAskPrice);
        require(_lpBidVolume <= lpMaxVolume);
        require(_lpAskVolume <= lpMaxVolume);
        lpBidPrice = _lpBidPrice;
        lpAskPrice = _lpAskPrice;
        lpBidVolume = _lpBidVolume;
        lpAskVolume = _lpAskVolume;
        SetPrices(_lpBidPrice, _lpAskPrice, _lpBidVolume, _lpAskVolume);
    }

setLpMaxVolume keyboard_arrow_up

Parameters help

Name Type
_lpMaxVolume
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
    function setLpMaxVolume(uint256 _lpMaxVolume) onlyOwner public {
        require(_lpMaxVolume < 1000000000000000000000000);
        lpMaxVolume = _lpMaxVolume;
        if (lpMaxVolume < lpBidVolume){
            lpBidVolume = lpMaxVolume;
        }
        if (lpMaxVolume < lpAskVolume){
            lpAskVolume = lpMaxVolume;
        }
        SetLpMaxVolume(_lpMaxVolume);
    }

setEdgePerPosition keyboard_arrow_up

Parameters help

Name Type
_edgePerPosition
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
    function setEdgePerPosition(uint256 _edgePerPosition) onlyOwner public {
        //require(_edgePerPosition < 100000000000000000000000000000);
        edgePerPosition = _edgePerPosition;
        SetEdgePerPosition(_edgePerPosition);
    }

setLPTargetPostion keyboard_arrow_up

Parameters help

Name Type
_lpTargetPosition
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
    function setLPTargetPostion(uint256 _lpTargetPosition) onlyOwner public {
        require(_lpTargetPosition <totalSupply() );
        lpTargetPosition = _lpTargetPosition;
        SetLPTargetPostion(_lpTargetPosition);
    }

setLpFee keyboard_arrow_up

Parameters help

Name Type
_lpFeeBp
uint256 help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
    function setLpFee(uint256 _lpFeeBp) onlyOwner public {
        require(_lpFeeBp <= 100);
        lpFeeBp = _lpFeeBp;
        SetLpFee(lpFeeBp);
    }

setLpIsStart keyboard_arrow_up

Parameters help

Name Type
_isLpStart
bool help

Properties

Visibility help public
Mutability help transaction
Source Code
    function setLpIsStart(bool _isLpStart) onlyOwner public {
        isLpStart = _isLpStart;
    }

getLpBidPrice keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help constant
Source Code
    function getLpBidPrice()public constant returns (uint256)
    { 
        uint256 lpPosition = balanceOf(owner);
            
        if (lpTargetPosition >= lpPosition)
        {
            return lpBidPrice;
        }
        else
        {
            return lpBidPrice.sub((((lpPosition.sub(lpTargetPosition)).div(multiplier)).mul(edgePerPosition)).div(multiplierOfPrice));
        }
    }

getLpAskPrice keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help constant
Source Code
    function getLpAskPrice()public constant returns (uint256)
    {
        uint256 lpPosition = balanceOf(owner);
            
        if (lpTargetPosition <= lpPosition)
        {
            return lpAskPrice;
        }
        else
        {
            return lpAskPrice.add((((lpTargetPosition.sub(lpPosition)).div(multiplier)).mul(edgePerPosition)).div(multiplierOfPrice));
        }
    }

getLpIsWorking keyboard_arrow_up

Parameters help

Name Type
minSpeadBp
int help

Properties

Visibility help public
Mutability help constant
Source Code
    function getLpIsWorking(int minSpeadBp) public constant returns (bool )
    {
        if (isLpStart == false)
            return false;
         
        if (lpAskVolume == 0 || lpBidVolume == 0)
        {
            return false;
        }
        
        int256 bidPrice = int256(getLpBidPrice());
        int256 askPrice = int256(getLpAskPrice());
        
        if (askPrice - bidPrice > minSpeadBp * (bidPrice + askPrice) / 2 / 10000)
        {
            return false;
        }
        
        return true;
    }

getAmountOfLinkerBuy keyboard_arrow_up

Parameters help

Name Type
etherAmountOfSell
uint256 help

Properties

Visibility help public
Mutability help constant
Source Code
    function getAmountOfLinkerBuy(uint256 etherAmountOfSell) public constant returns (uint256)
    {
        return ((( multiplierOfPrice.mul(etherAmountOfSell) ).div(getLpAskPrice())).mul(uint256(10000).sub(lpFeeBp))).div(uint256(10000));
    }

getAmountOfEtherSell keyboard_arrow_up

Parameters help

Name Type
linkerAmountOfBuy
uint256 help

Properties

Visibility help public
Mutability help constant
Source Code
    function getAmountOfEtherSell(uint256 linkerAmountOfBuy) public constant returns (uint256)
    {
        return (((getLpBidPrice().mul(linkerAmountOfBuy)).div(multiplierOfPrice)).mul(uint256(10000).sub(lpFeeBp))).div(uint256(10000));
    }

constructor keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
    function () public payable {
    }

buy keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
    function buy() public payable returns (uint256){
        require (getLpIsWorking(500));                      // Check Whether Lp Bid and Ask spread is less than 5%
        uint256 amount = getAmountOfLinkerBuy(msg.value);   // calculates the amount of buy from customer 
        require(balances[owner] >= amount);                  // checks if it has enough to sell
        balances[msg.sender] = balances[msg.sender].add(amount);                     // adds the amount to buyer's balance
        balances[owner] = balances[owner].sub(amount);                           // subtracts amount from seller's balance
        lpAskVolume = lpAskVolume.sub(amount);
        Transfer(owner, msg.sender, amount);                 // execute an event reflecting the chang               // ends function and returns
        return amount;                                    
    }

sell keyboard_arrow_up

Parameters help

Name Type
amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
    function sell(uint256 amount)public returns (uint256) {    
        require (getLpIsWorking(500));
        require (balances[msg.sender] >= amount);           // checks if the sender has enough to sell
        balances[owner] = balances[owner].add(amount);                           // adds the amount to owner's balance
        balances[msg.sender] = balances[msg.sender].sub(amount);                     // subtracts the amount from seller's balance
        lpBidVolume = lpBidVolume.sub(amount);
        uint256 linkerSendAmount = getAmountOfEtherSell(amount);
        
        msg.sender.transfer(linkerSendAmount);         // sends ether to the seller: it's important to do this last to prevent recursion attacks
        Transfer(msg.sender, this, linkerSendAmount);       // executes an event reflecting on the change
        return linkerSendAmount;                                   // ends function and returns
    }

transferEther keyboard_arrow_up

Parameters help

Name Type
amount
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
    function transferEther(uint256 amount) onlyOwner public{
        msg.sender.transfer(amount);
        Transfer(msg.sender, this, amount);
    }