ETH Price: $3,440.29 (-1.16%)
Gas: 9 Gwei

Contract

0x37eB2e8263ABE544eb5C41FDCE6Ef11764364c32
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Token Contra...32353922017-02-23 9:54:552702 days ago1487843695IN
0x37eB2e82...764364c32
0 ETH0.0008801620
0x6060604032353512017-02-23 9:47:332702 days ago1487843253IN
 Create: LegendsCrowdfund
0 ETH0.0198434440

Advanced mode:
Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
LegendsCrowdfund

Compiler Version
v0.4.9+commit.364da425

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2017-02-23
*/

pragma solidity ^0.4.9;


/***
 * VIP Token and Crowdfunding contracts.
 */


/**
 * @title ERC20
 */
contract ERC20 {
    function totalSupply() constant returns (uint256 totalSupply);
    function balanceOf(address _owner) constant returns (uint256 balance);
    function transfer(address _to, uint256 _value) returns (bool success);
    function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
    function approve(address _spender, uint256 _value) returns (bool success);
    function allowance(address _owner, address _spender) constant returns (uint256 remaining);

    event Transfer(address indexed _from, address indexed _to, uint256 _value);
    event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}

/**
 * @title LegendsCrowdfund
 */
contract LegendsCrowdfund {

    address public creator;
    address public exitAddress;

    uint public start;
    uint public limitVIP;

    LegendsToken public legendsToken;

    mapping (address => uint) public recipientETH;
    mapping (address => uint) public recipientVIP;

    uint public totalETH;
    uint public totalVIP;

    event VIPPurchase(address indexed sender, address indexed recipient, uint ETH, uint VIP);

    modifier saleActive() {
        if (address(legendsToken) == 0) {
            throw;
        }
        if (block.timestamp < start) {
            throw;
        }
        _;
    }

    modifier hasValue() {
        if (msg.value == 0) {
            throw;
        }
        _;
    }

    modifier recipientIsValid(address recipient) {
        if (recipient == 0 || recipient == address(this)) {
            throw;
        }
        _;
    }

    modifier isCreator() {
        if (msg.sender != creator) {
            throw;
        }
        _;
    }

    modifier tokenContractNotSet() {
        if (address(legendsToken) != 0) {
            throw;
        }
        _;
    }

    /**
     * @dev Constructor.
     * @param _exitAddress Address that all ETH should be forwarded to.
     * @param _start Timestamp of when the crowdsale will start.
     * @param _limitVIP Maximum amount of VIP that can be allocated in total. Denominated in wei.
     */
    function LegendsCrowdfund(address _exitAddress, uint _start, uint _limitVIP) {
        creator = msg.sender;
        exitAddress = _exitAddress;
        start = _start;
        limitVIP = _limitVIP;
    }

    /**
     * @dev Set the address of the token contract. Must be called by creator of this. Can only be set once.
     * @param _legendsToken Address of the token contract.
     */
    function setTokenContract(LegendsToken _legendsToken) external isCreator tokenContractNotSet {
        legendsToken = _legendsToken;
    }

    /**
     * @dev Forward Ether to the exit address. Store all ETH and VIP information in public state and logs.
     * @param recipient Address that tokens should be attributed to.
     */
    function purchaseMembership(address sender, address recipient) external payable saleActive hasValue recipientIsValid(recipient) {

        if (msg.sender != address(legendsToken)) {
            throw;
        }
        // Attempt to send the ETH to the exit address.
        if (!exitAddress.send(msg.value)) {
            throw;
        }

        // Update ETH amounts.
        recipientETH[recipient] += msg.value;
        totalETH += msg.value;

        // Calculate VIP amount.
        uint VIP = msg.value * 10;  // $1 / VIP based on $10 / ETH value.

        // Are we in the pre-sale?
        if (block.timestamp - start < 2 weeks) {
            VIP = (VIP * 10) / 9;   // 10% discount.
        }

        // Update VIP amounts.
        recipientVIP[recipient] += VIP;
        totalVIP += VIP;

        // Check we have not exceeded the maximum VIP.
        if (totalVIP > limitVIP) {
            throw;
        }

        // Tell the token contract about the increase.
        legendsToken.addTokens(recipient, VIP);

        // Log this purchase.
        VIPPurchase(sender, recipient, msg.value, VIP);
    }

}


/**
 * @title LegendsToken
 */
contract LegendsToken is ERC20 {
    string public name = 'VIP';             //The Token's name: e.g. DigixDAO Tokens
    uint8 public decimals = 18;             // 1Token ¨= 1$ (1ETH ¨= 10$)
    string public symbol = 'VIP';           //An identifier: e.g. REP
    string public version = 'VIP_0.1';

    mapping (address => uint) ownerVIP;
    mapping (address => mapping (address => uint)) allowed;
    uint public totalVIP;
    uint public start;

    address public legendsCrowdfund;

    bool public testing;

    modifier fromCrowdfund() {
        if (msg.sender != legendsCrowdfund) {
            throw;
        }
        _;
    }

    modifier isActive() {
        if (block.timestamp < start) {
            throw;
        }
        _;
    }

    modifier isNotActive() {
        if (!testing && block.timestamp >= start) {
            throw;
        }
        _;
    }

    modifier recipientIsValid(address recipient) {
        if (recipient == 0 || recipient == address(this)) {
            throw;
        }
        _;
    }

    modifier allowanceIsZero(address spender, uint value) {
        // To change the approve amount you first have to reduce the addresses´
        // allowance to zero by calling `approve(_spender,0)` if it is not
        // already 0 to mitigate the race condition described here:
        // https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
        if ((value != 0) && (allowed[msg.sender][spender] != 0)) {
            throw;
        }
        _;
    }

    /**
     * @dev Constructor.
     * @param _legendsCrowdfund Address of crowdfund contract.
     * @param _preallocation Address to receive the pre-allocation.
     * @param _start Timestamp when the token becomes active.
     */
    function LegendsToken(address _legendsCrowdfund, address _preallocation, uint _start, bool _testing) {
        legendsCrowdfund = _legendsCrowdfund;
        start = _start;
        testing = _testing;
        totalVIP = ownerVIP[_preallocation] = 25000 ether;
    }

    /**
     * @dev Add to token balance on address. Must be from crowdfund.
     * @param recipient Address to add tokens to.
     * @return VIP Amount of VIP to add.
     */
    function addTokens(address recipient, uint VIP) external isNotActive fromCrowdfund {
        ownerVIP[recipient] += VIP;
        totalVIP += VIP;
        Transfer(0x0, recipient, VIP);
    }

    /**
     * @dev Implements ERC20 totalSupply()
     */
    function totalSupply() constant returns (uint256 totalSupply) {
        totalSupply = totalVIP;
    }

    /**
     * @dev Implements ERC20 balanceOf()
     */
    function balanceOf(address _owner) constant returns (uint256 balance) {
        balance = ownerVIP[_owner];
    }

    /**
     * @dev Implements ERC20 transfer()
     */
    function transfer(address _to, uint256 _value) isActive recipientIsValid(_to) returns (bool success) {
        if (ownerVIP[msg.sender] >= _value) {
            ownerVIP[msg.sender] -= _value;
            ownerVIP[_to] += _value;
            Transfer(msg.sender, _to, _value);
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Implements ERC20 transferFrom()
     */
    function transferFrom(address _from, address _to, uint256 _value) isActive recipientIsValid(_to) returns (bool success) {
        if (allowed[_from][msg.sender] >= _value && ownerVIP[_from] >= _value) {
            ownerVIP[_to] += _value;
            ownerVIP[_from] -= _value;
            allowed[_from][msg.sender] -= _value;
            Transfer(_from, _to, _value);
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Implements ERC20 approve()
     */
    function approve(address _spender, uint256 _value) isActive allowanceIsZero(_spender, _value) returns (bool success) {
        allowed[msg.sender][_spender] = _value;
        Approval(msg.sender, _spender, _value);
        return true;
    }

    /**
     * @dev Implements ERC20 allowance()
     */
    function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
        remaining = allowed[_owner][_spender];
    }

    /**
     * @dev Direct Buy
     */
    function () payable {
        LegendsCrowdfund(legendsCrowdfund).purchaseMembership.value(msg.value)(msg.sender, msg.sender);
    }

    /**
     * @dev Proxy Buy
     */
    function purchaseMembership(address recipient) payable {
        LegendsCrowdfund(legendsCrowdfund).purchaseMembership.value(msg.value)(msg.sender, recipient);
    }

}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[],"name":"creator","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalETH","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalVIP","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"limitVIP","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"recipientETH","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"sender","type":"address"},{"name":"recipient","type":"address"}],"name":"purchaseMembership","outputs":[],"payable":true,"type":"function"},{"constant":true,"inputs":[],"name":"exitAddress","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_legendsToken","type":"address"}],"name":"setTokenContract","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"start","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"legendsToken","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"recipientVIP","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[{"name":"_exitAddress","type":"address"},{"name":"_start","type":"uint256"},{"name":"_limitVIP","type":"uint256"}],"payable":false,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"sender","type":"address"},{"indexed":true,"name":"recipient","type":"address"},{"indexed":false,"name":"ETH","type":"uint256"},{"indexed":false,"name":"VIP","type":"uint256"}],"name":"VIPPurchase","type":"event"}]

6060604052341561000c57fe5b6040516060806105ac8339810160409081528151602083015191909201515b60008054600160a060020a03338116600160a060020a0319928316179092556001805492861692909116919091179055600282905560038190555b5050505b610533806100796000396000f300606060405236156100935763ffffffff60e060020a60003504166302d05d3f811461009557806336bdee74146100c1578063407a6727146100e3578063416ccd02146101055780634c12d8b914610127578063583f0ae6146101555780636be0022914610171578063bbcd5bbe1461019d578063be9a6555146101bb578063c851b643146101dd578063cc6da37514610209575bfe5b341561009d57fe5b6100a5610237565b60408051600160a060020a039092168252519081900360200190f35b34156100c957fe5b6100d1610246565b60408051918252519081900360200190f35b34156100eb57fe5b6100d161024c565b60408051918252519081900360200190f35b341561010d57fe5b6100d1610252565b60408051918252519081900360200190f35b341561012f57fe5b6100d1600160a060020a0360043516610258565b60408051918252519081900360200190f35b61016f600160a060020a036004358116906024351661026a565b005b341561017957fe5b6100a5610472565b60408051600160a060020a039092168252519081900360200190f35b34156101a557fe5b61016f600160a060020a0360043516610481565b005b34156101c357fe5b6100d16104e0565b60408051918252519081900360200190f35b34156101e557fe5b6100a56104e6565b60408051600160a060020a039092168252519081900360200190f35b341561021157fe5b6100d1600160a060020a03600435166104f5565b60408051918252519081900360200190f35b600054600160a060020a031681565b60075481565b60085481565b60035481565b60056020526000908152604090205481565b600454600090600160a060020a0316151561028457610000565b60025442101561029357610000565b34151561029f57610000565b81600160a060020a03811615806102c7575030600160a060020a031681600160a060020a0316145b156102d157610000565b60045433600160a060020a039081169116146102ec57610000565b600154604051600160a060020a03909116903480156108fc02916000818181858888f19350505050151561031f57610000565b600160a060020a03831660009081526005602052604090208054349081019091556007805482019055600254600a9091029250621275004291909103101561036c576009600a83025b0491505b600160a060020a0383166000908152600660205260409020805483019055600880548301908190556003549011156103a357610000565b60048054604080517f6039fbdb000000000000000000000000000000000000000000000000000000008152600160a060020a03878116948201949094526024810186905290519290911691636039fbdb9160448082019260009290919082900301818387803b151561041157fe5b60325a03f1151561041e57fe5b505060408051348152602081018590528151600160a060020a0380881694508816927fa8b57f15ffe511f633f9bd512e6fdb2e692b54ff870617cfcc2f63f1f1b1d326928290030190a35b5b505b5b505050565b600154600160a060020a031681565b60005433600160a060020a0390811691161461049c57610000565b600454600160a060020a0316156104b257610000565b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b60025481565b600454600160a060020a031681565b600660205260009081526040902054815600a165627a7a723058207a14a15826de197189f5dc8012d196e90e4e441194e1bf944c7a17a9410e60d2002900000000000000000000000012df5f4d53cafc71d3395df2731fb3149b5fdb2b0000000000000000000000000000000000000000000000000000000058af77800000000000000000000000000000000000000000000c685fa11e01ec6f000000

Deployed Bytecode

0x606060405236156100935763ffffffff60e060020a60003504166302d05d3f811461009557806336bdee74146100c1578063407a6727146100e3578063416ccd02146101055780634c12d8b914610127578063583f0ae6146101555780636be0022914610171578063bbcd5bbe1461019d578063be9a6555146101bb578063c851b643146101dd578063cc6da37514610209575bfe5b341561009d57fe5b6100a5610237565b60408051600160a060020a039092168252519081900360200190f35b34156100c957fe5b6100d1610246565b60408051918252519081900360200190f35b34156100eb57fe5b6100d161024c565b60408051918252519081900360200190f35b341561010d57fe5b6100d1610252565b60408051918252519081900360200190f35b341561012f57fe5b6100d1600160a060020a0360043516610258565b60408051918252519081900360200190f35b61016f600160a060020a036004358116906024351661026a565b005b341561017957fe5b6100a5610472565b60408051600160a060020a039092168252519081900360200190f35b34156101a557fe5b61016f600160a060020a0360043516610481565b005b34156101c357fe5b6100d16104e0565b60408051918252519081900360200190f35b34156101e557fe5b6100a56104e6565b60408051600160a060020a039092168252519081900360200190f35b341561021157fe5b6100d1600160a060020a03600435166104f5565b60408051918252519081900360200190f35b600054600160a060020a031681565b60075481565b60085481565b60035481565b60056020526000908152604090205481565b600454600090600160a060020a0316151561028457610000565b60025442101561029357610000565b34151561029f57610000565b81600160a060020a03811615806102c7575030600160a060020a031681600160a060020a0316145b156102d157610000565b60045433600160a060020a039081169116146102ec57610000565b600154604051600160a060020a03909116903480156108fc02916000818181858888f19350505050151561031f57610000565b600160a060020a03831660009081526005602052604090208054349081019091556007805482019055600254600a9091029250621275004291909103101561036c576009600a83025b0491505b600160a060020a0383166000908152600660205260409020805483019055600880548301908190556003549011156103a357610000565b60048054604080517f6039fbdb000000000000000000000000000000000000000000000000000000008152600160a060020a03878116948201949094526024810186905290519290911691636039fbdb9160448082019260009290919082900301818387803b151561041157fe5b60325a03f1151561041e57fe5b505060408051348152602081018590528151600160a060020a0380881694508816927fa8b57f15ffe511f633f9bd512e6fdb2e692b54ff870617cfcc2f63f1f1b1d326928290030190a35b5b505b5b505050565b600154600160a060020a031681565b60005433600160a060020a0390811691161461049c57610000565b600454600160a060020a0316156104b257610000565b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b5b50565b60025481565b600454600160a060020a031681565b600660205260009081526040902054815600a165627a7a723058207a14a15826de197189f5dc8012d196e90e4e441194e1bf944c7a17a9410e60d20029

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000012df5f4d53cafc71d3395df2731fb3149b5fdb2b0000000000000000000000000000000000000000000000000000000058af77800000000000000000000000000000000000000000000c685fa11e01ec6f000000

-----Decoded View---------------
Arg [0] : _exitAddress (address): 0x12df5F4D53CaFC71D3395dF2731fb3149B5FDB2B
Arg [1] : _start (uint256): 1487894400
Arg [2] : _limitVIP (uint256): 15000000000000000000000000

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000012df5f4d53cafc71d3395df2731fb3149b5fdb2b
Arg [1] : 0000000000000000000000000000000000000000000000000000000058af7780
Arg [2] : 0000000000000000000000000000000000000000000c685fa11e01ec6f000000


Swarm Source

bzzr://7a14a15826de197189f5dc8012d196e90e4e441194e1bf944c7a17a9410e60d2

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.