Blockwell

Envion

ERC20

This contract is an ERC20 token.

Name Envion
Symbol EVN
Decimals 18
Total Supply 127,425,494 EVN

About link description

Envion (EVN) is a cryptocurrency token and operates on the Ethereum platform. Envion has a current supply of 127,425,493.562. The last known price of Envion is $0.116483 USD and is down -0.80% over the last 24 hours. It is currently trading on 3 active market(s) with $2,222.86 traded over the last 24 hours. More information can be found at https://www.envion.org.

Stats

Public Functions 27
Event Types 10
Code Size 85,261 bytes

Approval Event

Parameters help
_owner
address help
_spender
address help
_value
uint256 help

LogCancelDelivery Event

Parameters help
_to
address help
_id
string help

LogCreateEVN Event

Parameters help
_to
address help
_value
uint256 help

LogDeliverEVN Event

Parameters help
_to
address help
_value
uint256 help

LogKycRefused Event

Parameters help
_user
address help
_value
uint256 help

LogRefund Event

Parameters help
_to
address help
_value
uint256 help

LogTeamTokensDelivered Event

Parameters help
distributor
address help
_value
uint256 help

Transfer Event

Parameters help
_from
address help
_to
address help
_value
uint256 help

newOraclizeQuery Event

Parameters help
description
string help

updatedPrice Event

Parameters help
price
string help

Purchase Event

Members
buyer
address help
tokenAmount
uint256 help
active
bool help

Functions Expand All Collapse All

__callback keyboard_arrow_up

Parameters help

Name Type
myid
bytes32 help
result
string help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
    function __callback(bytes32 myid, string result) {
        require(msg.sender == oraclize_cbAddress());

        // setting the token price here
        ETH_USD_EXCHANGE_RATE_IN_CENTS = SafeMath.parse(result);
        updatedPrice(result);

        // fetch the next price
        updatePrice();
    }

__callback keyboard_arrow_up

Parameters help

Name Type
myid
bytes32 help
result
string help
proof
bytes help

Properties

Visibility help public
Mutability help transaction
Source Code
    function __callback(bytes32 myid, string result, bytes proof) {
    }

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

Modifiers help

Source Code
    function transfer(address _to, uint256 _value)
    public
    isFinalized // Only allow token transfer after the fundraising has ended
    isKycVerified(msg.sender)
    hasEnoughUnlockedTokens(msg.sender, _value)
    onlyPayloadSize(2)
    returns (bool success)
    {
        bool result = super.transfer(_to, _value);
        if (result) {
            trackHolder(_to); // track the owner for later payouts
        }
        return result;
    }

transferFrom keyboard_arrow_up

Parameters help

Name Type
_from
address help
_to
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function transferFrom(address _from, address _to, uint256 _value)
    public
    isFinalized // Only allow token transfer after the fundraising has ended
    isKycVerified(msg.sender)
    hasEnoughUnlockedTokens(msg.sender, _value)
    onlyPayloadSize(3)
    returns (bool success)
    {
        bool result = super.transferFrom(_from, _to, _value);
        if (result) {
            trackHolder(_to); // track the owner for later payouts
        }
        return result;
    }

approve keyboard_arrow_up

Parameters help

Name Type
_spender
address help
_value
uint256 help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function approve(address _spender, uint256 _value)
    public
    onlyPayloadSize(2)
    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

Modifiers help

Source Code
    function allowance(address _owner, address _spender)
    public constant
    onlyPayloadSize(2)
    returns (uint256 remaining) {
        return allowed[_owner][_spender];
    }

updatePrice keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable
Source Code
    function updatePrice() payable {    // can be left public as a way for replenishing contract's ETH balance, just in case
        if (msg.sender != oraclize_cbAddress()) {
            require(msg.value >= 200 finney);
        }
        if (oraclize_getPrice("URL") > this.balance) {
            newOraclizeQuery("Oraclize query was NOT sent, please add some ETH to cover for the query fee");
        } else {
            newOraclizeQuery("Oraclize sent, wait..");
            // Schedule query in 1 hour. Set the gas amount to 220000, as parsing in __callback takes around 70000 - we play it safe.
            oraclize_query(3600, "URL", "json(https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD).USD", 220000);
        }
    }

getBalanceOf keyboard_arrow_up

Parameters help

Name Type
_owner
address help

Properties

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

getPurchaseById keyboard_arrow_up

Parameters help

Name Type
_id
string help

Properties

Visibility help public
Mutability help constant
Source Code
    function getPurchaseById(string _id)
    constant
    returns (address _buyer, uint256 _tokenAmount, bool _active){
        _buyer = purchases[_id].buyer;
        _tokenAmount = purchases[_id].tokenAmount;
        _active = purchases[_id].active;
    }

getHolderCount keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help constant
Source Code
    function getHolderCount()
    public
    constant
    returns (uint256 _holderCount)
    {
        return holders.length;
    }

getPurchaseCount keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help constant
Source Code
    function getPurchaseCount()
    public
    constant
    returns (uint256 _purchaseCount)
    {
        return purchaseArray.length;
    }

getHolder keyboard_arrow_up

Parameters help

Name Type
_index
uint256 help

Properties

Visibility help public
Mutability help constant
Source Code
    function getHolder(uint256 _index)
    public
    constant
    returns (address _holder)
    {
        return holders[_index];
    }

createTokens keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help payable

Requirements help

Source Code
    function createTokens()
    payable
    external
    isFundraising
    {
        require(block.number >= fundingStartBlock);
        require(block.number <= fundingEndBlock);
        require(msg.value > 0);

        // First we check the ETH cap: would adding this amount to the total unKYCed eth and the already KYCed eth exceed the eth cap?
        // return the contribution if the cap has been reached already
        uint256 totalKycedAndUnKycEdEth = SafeMath.add(allUnKycedEth, allReceivedEth);
        uint256 checkedReceivedEth = SafeMath.add(totalKycedAndUnKycEdEth, msg.value);
        require(checkedReceivedEth <= ETH_RECEIVED_CAP);

        // If all is fine with the ETH cap, we continue to check the
        // minimum amount of tokens and the cap for how many tokens
        // have been generated so far

        // calculate the token amount
        uint256 tokens = SafeMath.mul(msg.value, ETH_USD_EXCHANGE_RATE_IN_CENTS);

        // divide by 100 to turn ETH_USD_EXCHANGE_RATE_IN_CENTS into full USD
        tokens = tokens / 100;

        // apply discount multiplier
        tokens = safeMulPercentage(tokens, getCurrentDiscountRate());

        require(tokens >= TOKEN_MIN);
        uint256 checkedSupply = SafeMath.add(totalSupply, tokens);
        require(checkedSupply <= TOKEN_CREATION_CAP);

        // Only when all the checks have passed, then we check if the address is already KYCEd and then 
        // update the state (noKycEthBalances, allReceivedEth, totalSupply, and balances) of the contract

        if (kycVerified[msg.sender] == false) {
            // @dev The unKYCed eth balances are moved to ethBalances in unlockKyc()

            noKycEthBalances[msg.sender] = SafeMath.add(noKycEthBalances[msg.sender], msg.value);

            // add the contributed eth to the total unKYCed eth amount
            allUnKycedEth = SafeMath.add(allUnKycedEth, msg.value);
        } else {
            // if buyer is already KYC unlocked...
            ethBalances[msg.sender] = SafeMath.add(ethBalances[msg.sender], msg.value);
            allReceivedEth = SafeMath.add(allReceivedEth, msg.value);
        }

        totalSupply = checkedSupply;
        balances[msg.sender] += tokens;  // safeAdd not needed; bad semantics to use here

        trackHolder(msg.sender);

        // to force the check for KYC Status upon the user when he tries transferring tokens
        // and exclude every later token owner
        isIcoBuyer[msg.sender] = true;

        // Log the creation of these tokens
        LogCreateEVN(msg.sender, tokens);
    }

addToKycTeam keyboard_arrow_up

Parameters help

Name Type
_teamMember
address help

Properties

Visibility help public
Mutability help transaction
Source Code
    function addToKycTeam(address _teamMember)
    onlyOwner
    onlyPayloadSize(1){
        isKycTeam[_teamMember] = true;
    }

removeFromKycTeam keyboard_arrow_up

Parameters help

Name Type
_teamMember
address help

Properties

Visibility help public
Mutability help transaction
Source Code
    function removeFromKycTeam(address _teamMember)
    onlyOwner
    onlyPayloadSize(1){
        isKycTeam[_teamMember] = false;
    }

unlockKyc keyboard_arrow_up

Parameters help

Name Type
_owner
address help

Properties

Visibility help public
Mutability help transaction
Source Code
    function unlockKyc(address _owner)
    external
    onlyKycTeam {
        require(kycVerified[_owner] == false);

        //unlock the owner to allow transfer of tokens
        kycVerified[_owner] = true;

        // we leave the ccLockedUpBalances[_owner] as is, because also KYCed users could cancel their CC payments

        if (noKycEthBalances[_owner] > 0) { // check if the user was an ETH buyer

            // now move the unKYCed eth balance to the regular ethBalance. 
            ethBalances[_owner] = noKycEthBalances[_owner];

            // add the now KYCed eth to the total received eth
            allReceivedEth = SafeMath.add(allReceivedEth, noKycEthBalances[_owner]);

            // subtract the now KYCed eth from total amount of unKYCed eth
            allUnKycedEth = SafeMath.sub(allUnKycedEth, noKycEthBalances[_owner]);

            // and set the user's unKYCed eth balance to 0
            noKycEthBalances[_owner] = 0; // preventing replay attacks
        }
    }

refuseKyc keyboard_arrow_up

Parameters help

Name Type
_user
address help

Properties

Visibility help public
Mutability help transaction
Source Code
    function refuseKyc(address _user)
    external
    onlyKycTeam
    {
        // once a user is verified, you can't kick him out.
        require (kycVerified[_user] == false);

        // immediately stop, if a user has none or only CC contributions.
        // we're managing kyc refusing of CC contributors off-chain
        require(noKycEthBalances[_user]>0);

        uint256 EVNVal = balances[_user];
        require(EVNVal > 0);

        uint256 ethVal = noKycEthBalances[_user]; // refund un-KYCd eth
        require(ethVal > 0);

        // Update the state only after all the checks have passed
        allUnKycedEth = SafeMath.sub(allUnKycedEth, noKycEthBalances[_user]); // or if there was any unKYCed Eth, subtract it from the total unKYCed eth balance.
        balances[_user] = ccLockedUpBalances[_user]; // assign user only the token amount he has bought through CC, if there are any.
        noKycEthBalances[_user] = 0;
        totalSupply = SafeMath.sub(totalSupply, EVNVal); // Extra safe

        // Log this refund
        LogKycRefused(_user, ethVal);

        // Send the contributions only after we have updated all the balances
        // If you're using a contract, make sure it works with .transfer() gas limits
        _user.transfer(ethVal);
    }

cancelDelivery keyboard_arrow_up

Parameters help

Name Type
_purchaseID
string help

Properties

Visibility help public
Mutability help transaction
Source Code
    function cancelDelivery(string _purchaseID)
    external
    onlyKycTeam{
        
        // CC payments are only cancelable until ccReleaseBlock
        require (block.number < ccReleaseBlock);

        // check if the purchase to cancel is still active
        require (purchases[_purchaseID].active == true);

        // now withdraw the canceled purchase's token amount from the user's balance
        balances[purchases[_purchaseID].buyer] = SafeMath.sub(balances[purchases[_purchaseID].buyer], purchases[_purchaseID].tokenAmount);

        // and withdraw the canceled purchase's token amount from the lockedUp token balance
        ccLockedUpBalances[purchases[_purchaseID].buyer] = SafeMath.sub(ccLockedUpBalances[purchases[_purchaseID].buyer], purchases[_purchaseID].tokenAmount);

        // set the purchase's status to inactive
        purchases[_purchaseID].active = false;

        //correct th amount of tokens generated
        totalSupply = SafeMath.sub(totalSupply, purchases[_purchaseID].tokenAmount);

        LogCancelDelivery(purchases[_purchaseID].buyer, _purchaseID);
    }

deliverTokens keyboard_arrow_up

Parameters help

Name Type
_to
address help
_tokens
uint256 help
_purchaseId
string help
_btcBuyer
bool help

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
    function deliverTokens(address _to, uint256 _tokens, string _purchaseId, bool _btcBuyer)
    external
    isFundraising
    onlyVendor
    {
        require(_to != 0x0);
        require(_tokens > 0);
        require(bytes(_purchaseId).length>0);
        require(block.number >= fundingStartBlock);
        require(block.number <= fundingEndBlock + 168000); // allow delivery of tokens sold for fiat for 28 days after end of ICO for safety reasons

        // calculate the total amount of tokens and cut out the extra two decimal units,
        // because _tokens was in cents.
        uint256 tokens = SafeMath.mul(_tokens, (10**(decimals) / 10**2));

        // continue to check for how many tokens
        // have been generated so far
        uint256 checkedSupply = SafeMath.add(totalSupply, tokens);
        require(checkedSupply <= TOKEN_CREATION_CAP);

        // Only when all the checks have passed, then we update the state (totalSupply, and balances) of the contract
        totalSupply = checkedSupply;

        // prevent from adding a delivery multiple times
        require(purchases[_purchaseId].buyer==0x0);

        // Log this information in order to be able to cancel token deliveries (on CC refund) by the payment ID
        purchases[_purchaseId] = Purchase({
            buyer: _to,
            tokenAmount: tokens,
            active: true
        });
        purchaseArray.push(_purchaseId);

        // if tokens were not paid with BTC (but credit card), they need to be locked up 
        if (_btcBuyer == false) {
        ccLockedUpBalances[_to] = SafeMath.add(ccLockedUpBalances[_to], tokens); // update user's locked up token balance
        }

        balances[_to] = SafeMath.add(balances[_to], tokens);                     // safeAdd not needed; bad semantics to use here
        trackHolder(_to);                                                        // log holder's address

        // to force the check for KYC Status upon the user when he tries transferring tokens
        // and exclude every later token owner
        isIcoBuyer[_to] = true;

        // Log the creation of these tokens
        LogDeliverEVN(_to, tokens);
   }

retrieveEth keyboard_arrow_up

Parameters help

Name Type
_value
uint256 help
_safe
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Requirements help

Source Code
    function retrieveEth(uint256 _value, address _safe)
    external
    minimumReached
    onlyOwner
    {
        require(SafeMath.sub(this.balance, _value) >= allUnKycedEth); // make sure unKYCed eth cannot be withdrawn
        // make sure a recipient was defined !
        require (_safe != 0x0);

        // send the eth to where admins agree upon
        _safe.transfer(_value);
    }

finalize keyboard_arrow_up

Parameters help

Name Type
_safe
address help

Properties

Visibility help public
Mutability help transaction

Modifiers help

Source Code
    function finalize(address _safe)
    external
    isFundraising
    minimumReached
    onlyOwner  // Only the admins calling this method exactly the same way can finalize the sale.
    {
        // Only allow to finalize the contract before the ending block if we already reached any of the two caps
        require(block.number > fundingEndBlock || totalSupply >= TOKEN_CREATED_MIN || allReceivedEth >= ETH_RECEIVED_MIN);
        // make sure a recipient was defined !
        require (_safe != 0x0);

        // Move the contract to Finalized state
        state = ContractState.Finalized;
        savedState = ContractState.Finalized;

        // Send the KYCed ETH to where admins agree upon.
        _safe.transfer(allReceivedEth);
    }

pause keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
    function pause()
    external
    notPaused   // Prevent the contract getting stuck in the Paused state
    onlyOwner   // Only both admins calling this method can pause the contract
    {
        // Move the contract to Paused state
        savedState = state;
        state = ContractState.Paused;
    }

proceed keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction
Source Code
    function proceed()
    external
    isPaused
    onlyOwner   // Only both admins calling this method can proceed with the contract
    {
        // Move the contract to the previous state
        state = savedState;
    }

refund keyboard_arrow_up

Parameters help

This function has no parameters.

Properties

Visibility help public
Mutability help transaction

Requirements help

Source Code
    function refund()
    external
    {
        // Allow refunds only a week after end of funding to give KYC-team time to verify contributors
        // and thereby move un-KYC-ed ETH over into allReceivedEth as well as deliver the tokens paid with CC
        require(block.number > (fundingEndBlock + 42000));

        // No refunds if the minimum has been reached or minimum of 1 Million Tokens have been generated
        require(allReceivedEth < ETH_RECEIVED_MIN || totalSupply < TOKEN_CREATED_MIN);

        // to prevent CC buyers from accidentally calling refund and burning their tokens
        require (ethBalances[msg.sender] > 0 || noKycEthBalances[msg.sender] > 0);

        // Only refund if there are EVN tokens
        uint256 EVNVal = balances[msg.sender];
        require(EVNVal > 0);

        // refunds either KYCed eth or un-KYCd eth
        uint256 ethVal = SafeMath.add(ethBalances[msg.sender], noKycEthBalances[msg.sender]);
        require(ethVal > 0);

        allReceivedEth = SafeMath.sub(allReceivedEth, ethBalances[msg.sender]);    // subtract only the KYCed ETH from allReceivedEth, because the latter is what admins will only be able to withdraw
        allUnKycedEth = SafeMath.sub(allUnKycedEth, noKycEthBalances[msg.sender]); // or if there was any unKYCed Eth, subtract it from the total unKYCed eth balance.

        // Update the state only after all the checks have passed.
        // reset everything to zero, no replay attacks.
        balances[msg.sender] = 0;
        ethBalances[msg.sender] = 0;
        noKycEthBalances[msg.sender] = 0;
        totalSupply = SafeMath.sub(totalSupply, EVNVal); // Extra safe

        // Log this refund
        LogRefund(msg.sender, ethVal);

        // Send the contributions only after we have updated all the balances
        // If you're using a contract, make sure it works with .transfer() gas limits
        msg.sender.transfer(ethVal);
    }

deliverTeamTokens keyboard_arrow_up

Parameters help

Name Type
_to
address help

Properties

Visibility help public
Mutability help transaction
Source Code
    function deliverTeamTokens(address _to)
    external
    isFinalized
    onlyOwner
    {
        require(teamTokensDelivered == false);
        require(_to != 0x0);

        // allow delivery of tokens for the company and supporters without vesting, team tokens will be supplied like a CC purchase.
        
        // company and supporters gets 7% of a whole final pie, meaning we have to add ~7,5% to the
        // current totalSupply now, basically stretching it and taking 7% from the result, so the 93% that remain equals the amount of tokens created right now.
        // e.g. (93 * x = 100, where x amounts to roughly about 1.07526 and 7 would be the team's part)
        uint256 newTotalSupply = safeMulPercentage(totalSupply, 107526);

        // give company and supporters their 7% 
        uint256 tokens = SafeMath.sub(newTotalSupply, totalSupply);
        balances[_to] = tokens;

        //update state
        teamTokensDelivered = true;
        totalSupply = newTotalSupply;
        trackHolder(_to);

        // Log the creation of these tokens
        LogTeamTokensDelivered(_to, tokens);
    }

setOraclizeGas keyboard_arrow_up

Parameters help

Name Type
_option
uint256 help

Properties

Visibility help public
Mutability help transaction
Source Code
    function setOraclizeGas(uint256 _option)
    external
    onlyOwner
    {
        if (_option <= 30) {
            oraclize_setCustomGasPrice(30000000000 wei);
        } else if (_option <= 50) {
            oraclize_setCustomGasPrice(50000000000 wei);
        } else if (_option <= 70) {
            oraclize_setCustomGasPrice(70000000000 wei);
        } else if (_option <= 100) {
            oraclize_setCustomGasPrice(100000000000 wei);
        }
    }