Contract Overview
ETH Balance: 27.828125 Ether ($361.49)
Mined:  0
No Of Transactions: 93 txns + 9 internalTxns
  Latest 25 txns from a total Of 93 transactions View All

TxHash Block Age From To Value [TxFee]
0x3a43fd01a0dc013c72b4c2f3a7d7b73eba22d085871ca3743bd6a1975693d1c8313482517 days 14 hrs ago0x70b2b3f1912777e3eea440061377a175c1f7ecc3  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.01177946
0x25f82ce58af950c7af8934031db0674ce7ee5747d01700c61d6696f847008fa6313479217 days 14 hrs ago0x70b2b3f1912777e3eea440061377a175c1f7ecc3  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.01423684
0x4caa38293138720e305322c35179094cc03c73b77d587906ff489dce548d39b4313467217 days 15 hrs ago0x70b2b3f1912777e3eea440061377a175c1f7ecc3  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9164 Ether0.00909121
0x0d920c94d1285cb1540e92701c704a26d54105f0b2a65f953d296fa9577e9701313465317 days 15 hrs ago0x70b2b3f1912777e3eea440061377a175c1f7ecc3  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.00253949
0x26d26980b2d59d3e655b326ea7dd9110caaecb251a060b6c9eb1c7e99368093b313446417 days 16 hrs ago0x70b2b3f1912777e3eea440061377a175c1f7ecc3  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.00253949
0xf684b9524a07a47513914912e5ac918b60d0c2d97ae1601756291c3ab79f7352313439517 days 16 hrs ago0x70b2b3f1912777e3eea440061377a175c1f7ecc3  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.00491889
0x372b36bdf2aec62ae015308af96836d89f056872bb9dfff293918d932e2e2a27312964318 days 11 hrs ago0x28e7e905f8bf399a03def270792ed8e3b4d1d3e4  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.00599615
0xe08be7299a4730ce80945c6de82e21143b4940e027a8ac789cb35c8dd981d9cc312105819 days 21 hrs ago0xfe579e803148601cd20bf60b49b8f1af287dd311  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.00599615
0x309a1449e1aa0f5db20dc3147f3dcd1c7cedd2bcf03c4875be32a10d683592b0312009720 days 59 mins ago0xb70a6e9c93fa69d96ab2712c48ac0669eb6bb2bb  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.0103181
0x85519b135e2a393a5756b7c90304fbf8154dc13ce6651759a3e55371df1ee0d5311972020 days 2 hrs ago0xb70a6e9c93fa69d96ab2712c48ac0669eb6bb2bb  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9164 Ether0.01002015
0x4ee2fa9ec3106174b1b9e078aba586f89459c6ec560539ed0e4d6b0998d180f2311960620 days 2 hrs ago0xb70a6e9c93fa69d96ab2712c48ac0669eb6bb2bb  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.00599615
0xf1571a8ee3e24c0c893c713d5654db1e6c4261cc24d5bf193406c5f7c981cc2f303377834 days 8 hrs ago0xfbfe8ee0be2a31774ea1913d49f2ba77fefc7792  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.00082307
0xcdbb9bc03d3ab29e6d03f61fe9583969003f3e547a34bf1b6a6bf6d6d59a2dcc301923736 days 17 hrs ago0x003e5d6ddcf2ce510c935bded1d666d3e601dadf  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.01190884
0xb726efd38e9508010f6db6e2c3c24ae3a834bfa88ff533bb5112f60af755b843301922636 days 17 hrs ago0x003e5d6ddcf2ce510c935bded1d666d3e601dadf  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9164 Ether0.00889999
0x4a189af585a52a350cf0f27df0ffbf9893c7832217394e68b40181a156778589301921536 days 17 hrs ago0x003e5d6ddcf2ce510c935bded1d666d3e601dadf  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.00253949
0x3373721509a6e122c69542ffb357b2a22cc4c6f6d81cde61e30930b646fb61aa301868036 days 20 hrs ago0xa2bc058e2076829ad6b5d44dd89f738dbfb1cf05  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.018565
0x87fb17628e1fdf3baecf6d77cc975fb94c20d92e78a4001dd3c33c7dad8e0996301854836 days 20 hrs ago0xa2bc058e2076829ad6b5d44dd89f738dbfb1cf05  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9169 Ether0.01638097
0x2e6d633c651de38055d24b63cf06d62d1f7bb22544285c74f7c2766cce6a6c0e301850936 days 20 hrs ago0xa2bc058e2076829ad6b5d44dd89f738dbfb1cf05  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.00491889
0x4f8996cc983b65dcc216dca4cd5808858a3ebed284f96ad19f161e9743962831301848036 days 20 hrs ago0xf51f08910ec370db5977cff3d01df4dfb06bfbe1  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.01599024
0xc81c5d987c46078a1001a564b5c1d0209c1bfc3c407ebd07e7e79f705c4729ea301840736 days 21 hrs ago0xf51f08910ec370db5977cff3d01df4dfb06bfbe1  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.00497052
0xa6ab4c58342e71d290f42fbbec22bf69d3c1c83913c4ba3be56a8ac41871f5d1301828036 days 21 hrs ago0xf51f08910ec370db5977cff3d01df4dfb06bfbe1  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.00925181
0xf6c4b3f98e5e9bea8b2dd0d21927714bbc24de48e7344721fc14fc7ba10ef666301822536 days 21 hrs ago0xf51f08910ec370db5977cff3d01df4dfb06bfbe1  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.00987468
0x011fa0949eeb8dfdac646a67f357b8c4d2b88e79092765aac7b27279735b453c301781336 days 23 hrs ago0xffed6e2e48779f9d6feb5e3fff55e497313d4c61  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.00491889
0x21fb41122a3e8c5d125d68e058e051497ca334b4c52120744b4be2a6e0df8c5e300643938 days 20 hrs ago0xf51f08910ec370db5977cff3d01df4dfb06bfbe1  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.00081385
0xd208a8b3dd78526645e34a8fc0e46114f0abb8c312998f9461b385f14a908937300575238 days 23 hrs ago0xf51f08910ec370db5977cff3d01df4dfb06bfbe1  IN   0x15dbdb25f870f21eaf9105e68e249e0426dae9160 Ether0.00123
 Internal Transactions as a result of Contract Execution
  Latest 9 Internal Transactions

ParentTxHash Block Age From To Value
0xf1571a8ee3e24c0c893c713d5654db1e6c4261cc24d5bf193406c5f7c981cc2f303377834 days 8 hrs ago0x15dbdb25f870f21eaf9105e68e249e0426dae9160xfbfe8ee0be2a31774ea1913d49f2ba77fefc77924.5 Ether
0x21fb41122a3e8c5d125d68e058e051497ca334b4c52120744b4be2a6e0df8c5e300643938 days 20 hrs ago0x15dbdb25f870f21eaf9105e68e249e0426dae9160xf51f08910ec370db5977cff3d01df4dfb06bfbe14.625 Ether
0xcdf61b5a5ef98bbb6cfaaffca033798915b2f671d4c5af2a65b2e55d66cbce10290471155 days 15 hrs ago0x15dbdb25f870f21eaf9105e68e249e0426dae9160xcce2c5442aba0969ee894e6d14eceac2c27d78ae0.0625 Ether
0xccc588765e2ad9d47ea4cfda4f5ffa7a9fd1146330837ba828830890abe836b7290454055 days 15 hrs ago0x15dbdb25f870f21eaf9105e68e249e0426dae9160x8e9192956b8dbc1caf573006830384838616f9840.03125 Ether
0xb465b6b1a4d65faabe98ff519955bb97e0929084404e8c8782894462f98aeacd290454055 days 15 hrs ago0x15dbdb25f870f21eaf9105e68e249e0426dae9160x3ab930a126f588cefd2ffd5909209c5341dcf8aa0.125 Ether
0x838f193d184cfaa34f35ede4893d8f406bb00b9741c8775ebbbd899802281910290454055 days 15 hrs ago0x15dbdb25f870f21eaf9105e68e249e0426dae9160x017a79b55db0cab6d9ff00c95971f3bc9fa833c70.015625 Ether
0x4184572941bb6683604b71e7be0eee483cc33c5507ab0d94e31626617ff54256290454055 days 15 hrs ago0x15dbdb25f870f21eaf9105e68e249e0426dae9160x9d35caff93b1f6ab8f762832e267f5d0ecdba2380.25 Ether
0x2c05001fcfdfeb192527c001668c5aaa35d2d228fb8856e076fc8d0799f6b66b290454055 days 15 hrs ago0x15dbdb25f870f21eaf9105e68e249e0426dae9160x542d458166249fb127dafaff9da6b663c013165d0.5 Ether
0xda976514ac56b6fb1bb23b97d9392fd6e22ec9843f1687c86f5fa03fc87252b1280668571 days 20 hrs ago0x15dbdb25f870f21eaf9105e68e249e0426dae9160x241ea87511b3eda4435379581fd61e1674af63250.0625 Ether
Contract Source Code Verified
Contract Name: MillionEther
Compiler Version: v0.4.2+commit.af6afb04
Optimization Enabled: Yes
Online Solidity Editor:  Click To View



  Contract Source Code   Find Similiar Contracts
/*
MillionEther smart contract - decentralized advertising platform.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

pragma solidity ^0.4.2;

contract MillionEther {

    address private admin;

    // Users
    uint private numUsers = 0;
    struct User {
        address referal;
        uint8 handshakes;
        uint balance;
        uint32 activationTime;
        bool banned;
        uint userID;
        bool refunded;
        uint investments;
    }
    mapping(address => User) private users;
    mapping(uint => address) private userAddrs;

    // Blocks. Blocks are 10x10 pixel areas. There are 10 000 blocks.
    uint16 private blocksSold = 0;
    uint private numNewStatus = 0;
    struct Block {
        address landlord;
        uint imageID;
        uint sellPrice;
    }
    Block[101][101] private blocks; 

    // Images
    uint private numImages = 0;
    struct Image {
        uint8 fromX;
        uint8 fromY;
        uint8 toX;
        uint8 toY;
        string imageSourceUrl;
        string adUrl;
        string adText;
    }
    mapping(uint => Image) private images;

    // Contract settings and security
    uint public charityBalance = 0;
    address public charityAddress;
    uint8 private refund_percent = 0;
    uint private totalWeiInvested = 0; //1 024 000 Ether max
    bool private setting_stopped = false;
    bool private setting_refundMode = false;
    uint32 private setting_delay = 3600;
    uint private setting_imagePlacementPriceInWei = 0;

    // Events
    event NewUser(uint ID, address newUser, address invitedBy, uint32 activationTime);
    event NewAreaStatus (uint ID, uint8 fromX, uint8 fromY, uint8 toX, uint8 toY, uint price);
    event NewImage(uint ID, uint8 fromX, uint8 fromY, uint8 toX, uint8 toY, string imageSourceUrl, string adUrl, string adText);


// ** INITIALIZE ** //

    function MillionEther () {
        admin = msg.sender;
        users[admin].referal = admin;
        users[admin].handshakes = 0;
        users[admin].activationTime = uint32(now);
        users[admin].userID = 0;
        userAddrs[0] = admin;
        userAddrs[numUsers] = admin;
    }


// ** FUNCTION MODIFIERS (PERMISSIONS) ** //

    modifier onlyAdmin {
        if (msg.sender != admin) throw;
        _;
    }

    modifier onlyWhenInvitedBy (address someUser) {
        if (users[msg.sender].referal != address(0x0)) throw;   //user already exists
        if (users[someUser].referal == address(0x0)) throw;     //referral does not exist
        if (now < users[someUser].activationTime) throw;        //referral is not active yet
        _;
    }

    modifier onlySignedIn {
        if (users[msg.sender].referal == address(0x0)) throw;   //user does not exist
        _;
    }

    modifier onlyForSale (uint8 _x, uint8 _y) {
        if (blocks[_x][_y].landlord != address(0x0) && blocks[_x][_y].sellPrice == 0) throw;
        _;
    }

    modifier onlyWithin100x100Area (uint8 _fromX, uint8 _fromY, uint8 _toX, uint8 _toY) {
        if ((_fromX < 1) || (_fromY < 1)  || (_toX > 100) || (_toY > 100)) throw;
        _;
    }    

    modifier onlyByLandlord (uint8 _x, uint8 _y) {
        if (msg.sender != admin) {
            if (blocks[_x][_y].landlord != msg.sender) throw;
        }
        _;
    }

    modifier noBannedUsers {
        if (users[msg.sender].banned == true) throw;
        _;
    }

    modifier stopInEmergency { 
        if (msg.sender != admin) {
            if (setting_stopped) throw; 
        }
        _;
    }

    modifier onlyInRefundMode { 
        if (!setting_refundMode) throw;
        _;
    }


// ** USER SIGN IN ** //

    function getActivationTime (uint _currentLevel, uint _setting_delay) private constant returns (uint32) {
        return uint32(now + _setting_delay * (2**(_currentLevel-1)));
    }

    function signIn (address referal) 
        public 
        stopInEmergency ()
        onlyWhenInvitedBy (referal) 
        returns (uint) 
    {
        numUsers++;
        // get user's referral handshakes and increase by one
        uint8 currentLevel = users[referal].handshakes + 1;
        users[msg.sender].referal = referal;
        users[msg.sender].handshakes = currentLevel;
        // 1,2,4,8,16,32,64 hours for activation depending on number of handshakes (if setting delay = 1 hour)
        users[msg.sender].activationTime = getActivationTime (currentLevel, setting_delay); 
        users[msg.sender].refunded = false;
        users[msg.sender].userID = numUsers;
        userAddrs[numUsers] = msg.sender;
        NewUser(numUsers, msg.sender, referal, users[msg.sender].activationTime);
        return numUsers;
    }


 // ** BUY AND SELL BLOCKS ** //

    function getBlockPrice (uint8 fromX, uint8 fromY, uint blocksSold) private constant returns (uint) {
        if (blocks[fromX][fromY].landlord == address(0x0)) { 
                // when buying at initial sale price doubles every 1000 blocks sold
                return 1 ether * (2 ** (blocksSold/1000));
            } else {
                // when the block is already bought and landlord have set a sell price
                return blocks[fromX][fromY].sellPrice;
            }
        }

    function buyBlock (uint8 x, uint8 y) 
        private  
        onlyForSale (x, y) 
        returns (uint)
    {
        uint blockPrice;
        blockPrice = getBlockPrice(x, y, blocksSold);
        // Buy at initial sale
        if (blocks[x][y].landlord == address(0x0)) {
            blocksSold += 1;  
            totalWeiInvested += blockPrice;
        // Buy from current landlord and pay him or her the blockPrice
        } else {
            users[blocks[x][y].landlord].balance += blockPrice;  
        }
        blocks[x][y].landlord = msg.sender;
        return blockPrice;
    }

    // buy an area of blocks at coordinates [fromX, fromY, toX, toY]
    function buyBlocks (uint8 fromX, uint8 fromY, uint8 toX, uint8 toY) 
        public
        payable
        stopInEmergency ()
        onlySignedIn () 
        onlyWithin100x100Area (fromX, fromY, toX, toY)
        returns (uint) 
    {   
        // Put funds to buyerBalance
        if (users[msg.sender].balance + msg.value < users[msg.sender].balance) throw; //checking for overflow
        uint previousWeiInvested = totalWeiInvested;
        uint buyerBalance = users[msg.sender].balance + msg.value;

        // perform buyBlock for coordinates [fromX, fromY, toX, toY] and withdraw funds
        uint purchasePrice;
        for (uint8 ix=fromX; ix<=toX; ix++) {
            for (uint8 iy=fromY; iy<=toY; iy++) {
                purchasePrice = buyBlock (ix,iy);
                if (buyerBalance < purchasePrice) throw;
                buyerBalance -= purchasePrice;
            }
        }
        // update user balance
        users[msg.sender].balance = buyerBalance;
        // user's total investments are used for refunds calculations in emergency
        users[msg.sender].investments += totalWeiInvested - previousWeiInvested;
        // pay rewards to the referral chain starting from the current user referral
        payOut (totalWeiInvested - previousWeiInvested, users[msg.sender].referal);
        numNewStatus += 1;
        // fire new area status event (0 sell price means the area is not for sale)
        NewAreaStatus (numNewStatus, fromX, fromY, toX, toY, 0);
        return purchasePrice;
    }


    //Mark block for sale (set a sell price)
    function sellBlock (uint8 x, uint8 y, uint sellPrice) 
        private
        onlyByLandlord (x, y) 
    {
        blocks[x][y].sellPrice = sellPrice;
    }

    // sell an area of blocks at coordinates [fromX, fromY, toX, toY]
    function sellBlocks (uint8 fromX, uint8 fromY, uint8 toX, uint8 toY, uint priceForEachBlockInWei) 
        public 
        stopInEmergency ()
        onlyWithin100x100Area (fromX, fromY, toX, toY) 
        returns (bool) 
    {
        if (priceForEachBlockInWei == 0) throw;
        for (uint8 ix=fromX; ix<=toX; ix++) {
            for (uint8 iy=fromY; iy<=toY; iy++) {
                sellBlock (ix, iy, priceForEachBlockInWei);
            }
        }
        numNewStatus += 1;
        // fire NewAreaStatus event
        NewAreaStatus (numNewStatus, fromX, fromY, toX, toY, priceForEachBlockInWei);
        return true;
    }


// ** ASSIGNING IMAGES ** //
    
    function chargeForImagePlacement () private {
        if (users[msg.sender].balance + msg.value < users[msg.sender].balance) throw; //check for overflow`
        uint buyerBalance = users[msg.sender].balance + msg.value;
        if (buyerBalance < setting_imagePlacementPriceInWei) throw;
        buyerBalance -= setting_imagePlacementPriceInWei;
        users[admin].balance += setting_imagePlacementPriceInWei;
        users[msg.sender].balance = buyerBalance;
    }

    // every block has its own image id assigned
    function assignImageID (uint8 x, uint8 y, uint _imageID) 
        private
        onlyByLandlord (x, y) 
    {
        blocks[x][y].imageID = _imageID;
    }

    // place new ad to user owned area
    function placeImage (uint8 fromX, uint8 fromY, uint8 toX, uint8 toY, string imageSourceUrl, string adUrl, string adText) 
        public 
        payable
        stopInEmergency ()
        noBannedUsers ()
        onlyWithin100x100Area (fromX, fromY, toX, toY)
        returns (uint) 
    {
        chargeForImagePlacement();
        numImages++;
        for (uint8 ix=fromX; ix<=toX; ix++) {
            for (uint8 iy=fromY; iy<=toY; iy++) {
                assignImageID (ix, iy, numImages);
            }
        }
        images[numImages].fromX = fromX;
        images[numImages].fromY = fromY;
        images[numImages].toX = toX;
        images[numImages].toY = toY;
        images[numImages].imageSourceUrl = imageSourceUrl;
        images[numImages].adUrl = adUrl;
        images[numImages].adText = adText;
        NewImage(numImages, fromX, fromY, toX, toY, imageSourceUrl, adUrl, adText);
        return numImages;
    }





// ** PAYOUTS ** //

    // reward the chain of referrals, admin and charity
    function payOut (uint _amount, address referal) private {
        address iUser = referal;
        address nextUser;
        uint totalPayed = 0;
        for (uint8 i = 1; i < 7; i++) {                 // maximum 6 handshakes from the buyer 
            users[iUser].balance += _amount / (2**i);   // with every handshake far from the buyer reward halves:
            totalPayed += _amount / (2**i);             // 50%, 25%, 12.5%, 6.25%, 3.125%, 1.5625%
            if (iUser == admin) { break; }              // breaks at admin
            nextUser = users[iUser].referal;
            iUser = nextUser;
        }
        goesToCharity(_amount - totalPayed);            // the rest goes to charity
    }

    // charity is the same type of user as everyone else
    function goesToCharity (uint amount) private {
        // if no charityAddress is set yet funds go to charityBalance (see further)
        if (charityAddress == address(0x0)) {
            charityBalance += amount;
        } else {
            users[charityAddress].balance += amount;
        }
    }

    // withdraw funds (no external calls for safety)
    function withdrawAll () 
        public
        stopInEmergency () 
    {
        uint withdrawAmount = users[msg.sender].balance;
        users[msg.sender].balance = 0;
        if (!msg.sender.send(withdrawAmount)) {
            users[msg.sender].balance = withdrawAmount;
        }
    }


 // ** GET INFO (CONSTANT FUNCTIONS)** //

    //USERS
    function getUserInfo (address userAddress) public constant returns (
        address referal,
        uint8 handshakes,
        uint balance,
        uint32 activationTime,
        bool banned,
        uint userID,
        bool refunded,
        uint investments
    ) {
        referal = users[userAddress].referal; 
        handshakes = users[userAddress].handshakes; 
        balance = users[userAddress].balance; 
        activationTime = users[userAddress].activationTime; 
        banned = users[userAddress].banned; 
        userID = users[userAddress].userID;
        refunded = users[userAddress].refunded; 
        investments = users[userAddress].investments;
    }

    function getUserAddressByID (uint userID) 
        public constant returns (address userAddress) 
    {
        return userAddrs[userID];
    }
    
    function getMyInfo() 
        public constant returns(uint balance, uint32 activationTime) 
    {   
        return (users[msg.sender].balance, users[msg.sender].activationTime);
    }

    //BLOCKS
    function getBlockInfo(uint8 x, uint8 y) 
        public constant returns (address landlord, uint imageID, uint sellPrice) 
    {
        return (blocks[x][y].landlord, blocks[x][y].imageID, blocks[x][y].sellPrice);
    }

    function getAreaPrice (uint8 fromX, uint8 fromY, uint8 toX, uint8 toY)
        public
        constant
        onlyWithin100x100Area (fromX, fromY, toX, toY)
        returns (uint) 
    {
        uint blockPrice;
        uint totalPrice = 0;
        uint16 iblocksSold = blocksSold;
        for (uint8 ix=fromX; ix<=toX; ix++) {
            for (uint8 iy=fromY; iy<=toY; iy++) {
                blockPrice = getBlockPrice(ix,iy,iblocksSold);
                if (blocks[ix][iy].landlord == address(0x0)) { 
                        iblocksSold += 1; 
                    }
                if (blockPrice == 0) { 
                    return 0; // not for sale
                    } 
                totalPrice += blockPrice;
            }
        }
        return totalPrice;
    }

    //IMAGES
    function getImageInfo(uint imageID) 
        public constant returns (uint8 fromX, uint8 fromY, uint8 toX, uint8 toY, string imageSourceUrl, string adUrl, string adText)
    {
        Image i = images[imageID];
        return (i.fromX, i.fromY, i.toX, i.toY, i.imageSourceUrl, i.adUrl, i.adText);
    }

    //CONTRACT STATE
    function getStateInfo () public constant returns (
        uint _numUsers, 
        uint16 _blocksSold, 
        uint _totalWeiInvested, 
        uint _numImages, 
        uint _setting_imagePlacementPriceInWei,
        uint _numNewStatus,
        uint32 _setting_delay
    ){
        return (numUsers, blocksSold, totalWeiInvested, numImages, setting_imagePlacementPriceInWei, numNewStatus, setting_delay);
    }


// ** ADMIN ** //

    function adminContractSecurity (address violator, bool banViolator, bool pauseContract, bool refundInvestments)
        public 
        onlyAdmin () 
    {
        //freeze/unfreeze user
        if (violator != address(0x0)) {
            users[violator].banned = banViolator;
        }
        //pause/resume contract 
        setting_stopped = pauseContract;

        //terminate contract, refund investments
        if (refundInvestments) {
            setting_refundMode = refundInvestments;
            refund_percent = uint8((this.balance*100)/totalWeiInvested);
        }
    }

    function adminContractSettings (uint32 newDelayInSeconds, address newCharityAddress, uint newImagePlacementPriceInWei)
        public 
        onlyAdmin () 
    {   
        // setting_delay affects user activation time.
        if (newDelayInSeconds > 0) setting_delay = newDelayInSeconds;
        // when the charityAddress is set charityBalance immediately transfered to it's balance 
        if (newCharityAddress != address(0x0)) {
            if (users[newCharityAddress].referal == address(0x0)) throw;
            charityAddress = newCharityAddress;
            users[charityAddress].balance += charityBalance;
            charityBalance = 0;
        }
        // at deploy is set to 0, but may be needed to support off-chain infrastructure
        setting_imagePlacementPriceInWei = newImagePlacementPriceInWei;
    }

    // escape path - withdraw funds at emergency.
    function emergencyRefund () 
        public
        onlyInRefundMode () 
    {
        if (!users[msg.sender].refunded) {
            uint totalInvested = users[msg.sender].investments;
            uint availableForRefund = (totalInvested*refund_percent)/100;
            users[msg.sender].investments -= availableForRefund;
            users[msg.sender].refunded = true;
            if (!msg.sender.send(availableForRefund)) {
                users[msg.sender].investments = totalInvested;
                users[msg.sender].refunded = false;
            }
        }
    }

    function () {
        throw;
    }

}

  Contract ABI  
[{"constant":false,"inputs":[{"name":"newDelayInSeconds","type":"uint32"},{"name":"newCharityAddress","type":"address"},{"name":"newImagePlacementPriceInWei","type":"uint256"}],"name":"adminContractSettings","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"emergencyRefund","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"fromX","type":"uint8"},{"name":"fromY","type":"uint8"},{"name":"toX","type":"uint8"},{"name":"toY","type":"uint8"},{"name":"priceForEachBlockInWei","type":"uint256"}],"name":"sellBlocks","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"fromX","type":"uint8"},{"name":"fromY","type":"uint8"},{"name":"toX","type":"uint8"},{"name":"toY","type":"uint8"}],"name":"getAreaPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"x","type":"uint8"},{"name":"y","type":"uint8"}],"name":"getBlockInfo","outputs":[{"name":"landlord","type":"address"},{"name":"imageID","type":"uint256"},{"name":"sellPrice","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"fromX","type":"uint8"},{"name":"fromY","type":"uint8"},{"name":"toX","type":"uint8"},{"name":"toY","type":"uint8"},{"name":"imageSourceUrl","type":"string"},{"name":"adUrl","type":"string"},{"name":"adText","type":"string"}],"name":"placeImage","outputs":[{"name":"","type":"uint256"}],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"fromX","type":"uint8"},{"name":"fromY","type":"uint8"},{"name":"toX","type":"uint8"},{"name":"toY","type":"uint8"}],"name":"buyBlocks","outputs":[{"name":"","type":"uint256"}],"payable":true,"type":"function"},{"constant":true,"inputs":[{"name":"userAddress","type":"address"}],"name":"getUserInfo","outputs":[{"name":"referal","type":"address"},{"name":"handshakes","type":"uint8"},{"name":"balance","type":"uint256"},{"name":"activationTime","type":"uint32"},{"name":"banned","type":"bool"},{"name":"userID","type":"uint256"},{"name":"refunded","type":"bool"},{"name":"investments","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"userID","type":"uint256"}],"name":"getUserAddressByID","outputs":[{"name":"userAddress","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getMyInfo","outputs":[{"name":"balance","type":"uint256"},{"name":"activationTime","type":"uint32"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getStateInfo","outputs":[{"name":"_numUsers","type":"uint256"},{"name":"_blocksSold","type":"uint16"},{"name":"_totalWeiInvested","type":"uint256"},{"name":"_numImages","type":"uint256"},{"name":"_setting_imagePlacementPriceInWei","type":"uint256"},{"name":"_numNewStatus","type":"uint256"},{"name":"_setting_delay","type":"uint32"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"withdrawAll","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"referal","type":"address"}],"name":"signIn","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"imageID","type":"uint256"}],"name":"getImageInfo","outputs":[{"name":"fromX","type":"uint8"},{"name":"fromY","type":"uint8"},{"name":"toX","type":"uint8"},{"name":"toY","type":"uint8"},{"name":"imageSourceUrl","type":"string"},{"name":"adUrl","type":"string"},{"name":"adText","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"charityBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"charityAddress","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"violator","type":"address"},{"name":"banViolator","type":"bool"},{"name":"pauseContract","type":"bool"},{"name":"refundInvestments","type":"bool"}],"name":"adminContractSecurity","outputs":[],"payable":false,"type":"function"},{"inputs":[],"type":"constructor"},{"payable":false,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"ID","type":"uint256"},{"indexed":false,"name":"newUser","type":"address"},{"indexed":false,"name":"invitedBy","type":"address"},{"indexed":false,"name":"activationTime","type":"uint32"}],"name":"NewUser","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"ID","type":"uint256"},{"indexed":false,"name":"fromX","type":"uint8"},{"indexed":false,"name":"fromY","type":"uint8"},{"indexed":false,"name":"toX","type":"uint8"},{"indexed":false,"name":"toY","type":"uint8"},{"indexed":false,"name":"price","type":"uint256"}],"name":"NewAreaStatus","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"ID","type":"uint256"},{"indexed":false,"name":"fromX","type":"uint8"},{"indexed":false,"name":"fromY","type":"uint8"},{"indexed":false,"name":"toX","type":"uint8"},{"indexed":false,"name":"toY","type":"uint8"},{"indexed":false,"name":"imageSourceUrl","type":"string"},{"indexed":false,"name":"adUrl","type":"string"},{"indexed":false,"name":"adText","type":"string"}],"name":"NewImage","type":"event"}]

  Contract Creation Code Switch To Opcodes View
6060604052600060018190556004805461ffff191690556005819055617791819055617793819055617794805460a060020a60ff02191690556177958190556177968054630e10000065ffffffffffff199091161790556177975560008054600160a060020a03199081163317808355600160a060020a0390811680845260026020818152604080872080548716909417909355855484168652828620805460a060020a60ff0219169055855484168652828620909101805463ffffffff1916421790558454831685528185206003908101869055855491527f3617319a054d772f909f7c479a2cebe5066e836a939412e32403c99029b92eff8054851691909316908117909255600154845290922080549091169091179055611c0e806101276000396000f3606060405236156100cf5760e060020a60003504630e6b0afc81146100dc57806316bfe25c1461010957806335e49e5f1461012d5780634a00dc38146101715780634abfbbe3146101d057806359ae6e341461027a57806359b95f5a1461037b5780636386c1c7146103bd57806374774370146104625780637daa10ce146104a057806380c81c16146104e4578063853828b61461054d5780638fa9e55c1461057e57806395f22405146105b457806399b8a3f014610684578063afcf2fc414610693578063e9b0c0e1146106ab575b34610002576106da610002565b34610002576106da600435602435604435600054600160a060020a03908116339091161461087f57610002565b34610002576106da617796546000908190610100900460ff16151561092957610002565b34610002576106dc6004356024356044356064356084356000805481908190600160a060020a039081163390911614610a25576177965460ff1615610a2557610002565b34610002576106f06004356024356044356064356000600060006000600060008989898960018460ff1610806101aa575060018360ff16105b806101b8575060648260ff16115b806101c6575060648160ff16115b15610b8657610002565b346100025761070260043560243560008080600660ff861660658110156100025761012f020160ff85166065811015610002576003020160005054600160a060020a0316600660ff871660658110156100025761012f020160ff86166065811015610002576003020160005060010154600660ff881660658110156100025761012f020160ff87166065811015610002576003020160005060020154919450925090509250925092565b604080516020608435600481810135601f81018490048402850184019095528484526106f094813594602480359560443595606435959460a4949391909101918190840183828082843750506040805160209735808a0135601f81018a90048a0283018a0190935282825296989760c4979196506024919091019450909250829150840183828082843750506040805160209735808a0135601f81018a90048a0283018a0190935282825296989760e49791965060249190910194509092508291508401838280828437509496505050505050506000805481908190600160a060020a039081163390911614610cab576177965460ff1615610cab57610002565b6106f06004356024356044356064356000805481908190819081908190600160a060020a039081163390911614611272576177965460ff161561127257610002565b3461000257600160a060020a0360048035821660009081526002602081815260409283902060018101548154938201546003830154968301546005909301548651988616895260a060020a90950460ff908116948901949094528786019190915263ffffffff81166060880152640100000000900482161515608087015260a086019490945292909216151560c084015260e083019190915251908190036101000190f35b3461000257600435600090815260036020526040902054600160a060020a03165b60408051600160a060020a03929092168252519081900360200190f35b3461000257600160a060020a0333166000908152600260208181526040928390206001810154920154835192835263ffffffff169082015281519081900390910190f35b3461000257600454617797546001546005546177955460408051617791546177965495825261ffff9097166020820152808201929092526060820195909552608081019390935260a083015262010000900463ffffffff1660c082015290519081900360e00190f35b34610002576106da60008054600160a060020a039081163390911614611560576177965460ff161561156057610002565b34610002576106f0600435600080548190600160a060020a0390811633909116146115d4576177965460ff16156115d457610002565b346100025761072b60043560408051602081810183526000808352835180830185528181528451808401865282815286835261779284528583208054600182810180548a5160029382161561010090810260001901909216849004601f81018b90048b0282018b01909c528b8152979a8b9a8b9a8b9a919998979660ff8181169795820481169662010000830482169663010000009093049091169490939189019260038a01929185918301828280156117d05780601f106117a5576101008083540402835291602001916117d0565b34610002576106f06177935481565b346100025761048361779454600160a060020a031681565b34610002576106da60043560243560443560643560005433600160a060020a0390811691161461190f57610002565b005b604080519115158252519081900360200190f35b60408051918252519081900360200190f35b60408051600160a060020a03949094168452602084019290925282820152519081900360600190f35b604051808860ff1681526020018760ff1681526020018660ff1681526020018560ff1681526020018060200180602001806020018481038452878181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156107b75780820380516001836020036101000a031916815260200191505b508481038352868181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156108105780820380516001836020036101000a031916815260200191505b508481038252858181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156108695780820380516001836020036101000a031916815260200191505b509a505050505050505050505060405180910390f35b60008363ffffffff1611156108a657617796805465ffffffff000019166201000085021790555b600160a060020a03821660001461092157600160a060020a0382811660009081526002602052604081205490911614156108df57610002565b6177948054600160a060020a0319168317908190556177938054600160a060020a03929092166000908152600260205260408120600101805493909301909255555b617797555050565b33600160a060020a031660009081526002602052604090206004015460ff161515610a21575050604060008181206004810180546005909201805461779454606460a060020a90910460ff1682020480820390925560ff19939093166001179091559251909291600160a060020a0333169183156108fc0291849190818181858888f193505050501515610a2157816002600050600033600160a060020a031681526020019081526020016000206000506005016000508190555060006002600050600033600160a060020a0316815260200190815260200160002060005060040160006101000a81548160ff021916908302179055505b5050565b8787878760018460ff161080610a3e575060018360ff16105b80610a4c575060648260ff16115b80610a5a575060648160ff16115b15610a6457610002565b8760001415610a7257610002565b8b95505b60ff8a811690871611610af8578a94505b60ff89811690861611610b6e57610b7a86868a60005483908390600160a060020a0390811633909116146119b15733600160a060020a0316600660ff841660658110156100025761012f020160ff83166065811015610002576003020154600160a060020a0316146119b157610002565b60058054600101908190556040805191825260ff8e811660208401528d8116838301528c811660608401528b16608083015260a082018a9052517f46cffffd9f27bb4e759b47d034705eda06243dd60eb47be11a2c9b02ae16b89d9181900360c00190a15060019b9a5050505050505050505050565b60019590950194610a76565b60019490940193610a87565b6004546000985061ffff1696508d95505b60ff8c811690871611610bc4578c94505b60ff8b811690861611610bd957610be586868961ffff16610c4b565b8799505b505050505050505050949350505050565b60019590950194610b97565b98506000600660ff881660658110156100025761012f020160ff87166065811015610002576003020160005054600160a060020a03161415610c2957600196909601955b8860001415610c9b5760009950610bc8565b600454611abc908790879061ffff165b600080600660ff861660658110156100025761012f020160ff85166065811015610002576003020154600160a060020a031614156119e557506103e8810460020a670de0b6b3a764000002611a11565b9688019660019490940193610ba8565b33600160a060020a031660009081526002602081905260409091200154640100000000900460ff16151560011415610ce257610002565b8989898960018460ff161080610cfb575060018360ff16105b80610d09575060648260ff16115b80610d17575060648160ff16115b15610d2157610002565b610d4e33600160a060020a03166000908152600260205260408120600101543481011015611a1857610002565b617791805460010190558d95505b60ff8c811690871611610de4578c94505b60ff8b811690861611610f5057610f5c86866177916000505460005483908390600160a060020a039081163390911614611a885733600160a060020a0316600660ff841660658110156100025761012f020160ff83166065811015610002576003020154600160a060020a031614611a8857610002565b8d617792600050600061779160005054815260200190815260200160002060005060000160006101000a81548160ff021916908302179055508c617792600050600061779160005054815260200190815260200160002060005060000160016101000a81548160ff021916908302179055508b617792600050600061779160005054815260200190815260200160002060005060000160026101000a81548160ff021916908302179055508a617792600050600061779160005054815260200190815260200160002060005060000160036101000a81548160ff021916908302179055508961779260005060006177916000505481526020019081526020016000206000506001016000509080519060200190828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610f6857805160ff19168380011785555b50610f989291505b808211156110035760008155600101610f3c565b60019590950194610d5c565b60019490940193610d6d565b82800160010185558215610f34579182015b82811115610f34578251826000505591602001919060010190610f7a565b5050617791546000908152617792602090815260408220600290810180548d518286529484902091946001821615610100026000190190911692909204601f9081018490048201938e019083901061100757805160ff19168380011785555b50611037929150610f3c565b5090565b82800160010185558215610ff7579182015b82811115610ff7578251826000505591602001919060010190611019565b50506177915460009081526177926020908152604082208a516003909101805481855293839020909360026001821615610100026000190190911604601f9081018490048201938d01908390106110a157805160ff19168380011785555b506110d1929150610f3c565b82800160010185558215611095579182015b828111156110955782518260005055916020019190600101906110b3565b50507f542d3e34836f8b331e8441364480130cf7077e9b6ae9dab76dc285dd3961b0a6617791600050548f8f8f8f8f8f8f604051808981526020018860ff1681526020018760ff1681526020018660ff1681526020018560ff1681526020018060200180602001806020018481038452878181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156111945780820380516001836020036101000a031916815260200191505b508481038352868181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156111ed5780820380516001836020036101000a031916815260200191505b508481038252858181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156112465780820380516001836020036101000a031916815260200191505b509b50505050505050505050505060405180910390a15050617791549c9b505050505050505050505050565b600160a060020a03338116600090815260026020526040812054909116141561129a57610002565b8989898960018460ff1610806112b3575060018360ff16105b806112c1575060648260ff16115b806112cf575060648160ff16115b156112d957610002565b33600160a060020a0316600090815260026020526040902060010154348101101561130357610002565b6177955433600160a060020a0316600090815260026020526040902060010154909950340197508d95505b60ff8c8116908716116113c6578c94505b60ff8b8116908616116114a8576114b48686600080838382600660ff841660658110156100025761012f020160ff83166065811015610002576003020154600160a060020a0316148015906113bc5750600660ff831660658110156100025761012f020160ff821660658110156100025760030201600201546000145b15610c3b57610002565b33600160a060020a039081166000908152600260205260409020600181018a90556177958054600583018054918e90039190910190555490546114d492918c900391168060008060015b60078160ff16101561147f578060020a60ff1686811561000257600160a060020a0386166000908152600260208190526040909120600101805493909204909201905581900a60ff168681156100025760005491900490920191600160a060020a039081169085161415611bb6575b611bdf82870361779454600160a060020a031660001415611be7576177938054820190556115d1565b6001959095019461132e565b9650868810156114c357610002565b96869003966001949094019361133f565b600160056000828282505401925050819055507f46cffffd9f27bb4e759b47d034705eda06243dd60eb47be11a2c9b02ae16b89d6005600050548f8f8f8f6000604051808781526020018660ff1681526020018560ff1681526020018460ff1681526020018360ff168152602001828152602001965050505050505060405180910390a1869950610bc8565b5033600160a060020a0316600081815260026020526040808220600101805490839055905190929183156108fc02918491818181858888f1935050505015156115d157806002600050600033600160a060020a03168152602001908152602001600020600050600101600050819055505b50565b600160a060020a03338116600090815260026020526040812054859216146115fb57610002565b600160a060020a03818116600090815260026020526040812054909116141561162357610002565b600160a060020a0381166000908152600260208190526040909120015463ffffffff1642101561165257610002565b6001805481018155600160a060020a03858116600090815260026020819052604080832054339490941683529091208054600160a060020a031916881774ff0000000000000000000000000000000000000000191660a060020a9384900460ff908116909501938402179055617796549194509184166000190190910a6201000090910463ffffffff1602420133600160a060020a038181166000818152600260208181526040808420808401805463ffffffff1916909917895560048101805460ff1916905560018054600392830181905586529083528185208054600160a060020a03191690981790975595549284905290815294548451918252948101919091529087168183015263ffffffff929092166060830152517f9d35dcac34f1dc50826c04b0cf8282b0764ff89463320a8401c9add280b92ebd9181900360800190a160016000505492505050919050565b820191906000526020600020905b8154815290600101906020018083116117b357829003601f168201915b5050604080518754602060026001831615610100026000190190921691909104601f81018290048202830182019093528282529598509487945090925084019050828280156118605780601f1061183557610100808354040283529160200191611860565b820191906000526020600020905b81548152906001019060200180831161184357829003601f168201915b5050845460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152959750869450925084019050828280156118ee5780601f106118c3576101008083540402835291602001916118ee565b820191906000526020600020905b8154815290600101906020018083116118d157829003601f168201915b50505050509050975097509750975097509750975050919395979092949650565b600160a060020a03841660001461195457600160a060020a0384166000908152600260208190526040909120018054640100000000850264ff00000000199091161790555b617796805460ff19168317905580156119ab57617796805461ff00191661010083021790556177955430600160a060020a0316316064028115610002570461779460146101000a81548160ff021916908302179055505b50505050565b82600660ff871660658110156100025761012f020160ff861660658110156100025760030201600050600201555050505050565b600660ff851660658110156100025761012f020160ff8416606581101561000257600302016002015490505b9392505050565b5033600160a060020a031660009081526002602052604090206001015461779754349190910190811015611a4b57610002565b6177975460008054600160a060020a0390811682526002602052604080832060019081018054860190553392909216835290912091909203910155565b82600660ff871660658110156100025761012f020160ff861660658110156100025760030201600050600101555050505050565b92506000600660ff881660658110156100025761012f020160ff87166065811015610002576003020160005054600160a060020a03161415611b1c576004805461ffff19811661ffff909116600101179055617795805484019055611b6e565b8260026000600660ff8a1660658110156100025761012f020160ff89166065811015610002576003020160005054600160a060020a031681526020810191909152604001600020600101805490910190555b33600660ff881660658110156100025761012f020160ff8716606581101561000257600302016000508054600160a060020a0319169091179055919250829150505092915050565b600160a060020a0393841660009081526002602052604090205490931692839250600101611410565b505050505050565b61779454600160a060020a031660009081526002602052604090206001018054820190555056
View All
Block Age txn Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward