ETH Price: $1,998.98 (-9.27%)

Contract

0x7114e6aBB99B00f3255767f4a409E5F5Be3b8b83
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Valid Bw Mar...55723332018-05-07 13:50:492498 days ago1525701049IN
0x7114e6aB...5Be3b8b83
0 ETH0.000130783
Set Valid Bw Cal...55723252018-05-07 13:49:192498 days ago1525700959IN
0x7114e6aB...5Be3b8b83
0 ETH0.000130263

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x2b684E89...3926A6703
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
BWService

Compiler Version
v0.4.23+commit.124ca40d

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2018-05-07
*/

pragma solidity ^0.4.21;

library BWUtility {
    
    // -------- UTILITY FUNCTIONS ----------


    // Return next higher even _multiple for _amount parameter (e.g used to round up to even finneys).
    function ceil(uint _amount, uint _multiple) pure public returns (uint) {
        return ((_amount + _multiple - 1) / _multiple) * _multiple;
    }

    // Checks if two coordinates are adjacent:
    // xxx
    // xox
    // xxx
    // All x (_x2, _xy2) are adjacent to o (_x1, _y1) in this ascii image. 
    // Adjacency does not wrapp around map edges so if y2 = 255 and y1 = 0 then they are not ajacent
    function isAdjacent(uint8 _x1, uint8 _y1, uint8 _x2, uint8 _y2) pure public returns (bool) {
        return ((_x1 == _x2 &&      (_y2 - _y1 == 1 || _y1 - _y2 == 1))) ||      // Same column
               ((_y1 == _y2 &&      (_x2 - _x1 == 1 || _x1 - _x2 == 1))) ||      // Same row
               ((_x2 - _x1 == 1 &&  (_y2 - _y1 == 1 || _y1 - _y2 == 1))) ||      // Right upper or lower diagonal
               ((_x1 - _x2 == 1 &&  (_y2 - _y1 == 1 || _y1 - _y2 == 1)));        // Left upper or lower diagonal
    }

    // Converts (x, y) to tileId xy
    function toTileId(uint8 _x, uint8 _y) pure public returns (uint16) {
        return uint16(_x) << 8 | uint16(_y);
    }

    // Converts _tileId to (x, y)
    function fromTileId(uint16 _tileId) pure public returns (uint8, uint8) {
        uint8 y = uint8(_tileId);
        uint8 x = uint8(_tileId >> 8);
        return (x, y);
    }
    
    function getBoostFromTile(address _claimer, address _attacker, address _defender, uint _blockValue) pure public returns (uint, uint) {
        if (_claimer == _attacker) {
            return (_blockValue, 0);
        } else if (_claimer == _defender) {
            return (0, _blockValue);
        }
    }
}

contract BWData {
    address public owner;
    address private bwService;
    address private bw;
    address private bwMarket;

    uint private blockValueBalance = 0;
    uint private feeBalance = 0;
    uint private BASE_TILE_PRICE_WEI = 1 finney; // 1 milli-ETH.
    
    mapping (address => User) private users; // user address -> user information
    mapping (uint16 => Tile) private tiles; // tileId -> list of TileClaims for that particular tile
    
    // Info about the users = those who have purchased tiles.
    struct User {
        uint creationTime;
        bool censored;
        uint battleValue;
    }

    // Info about a tile ownership
    struct Tile {
        address claimer;
        uint blockValue;
        uint creationTime;
        uint sellPrice;    // If 0 -> not on marketplace. If > 0 -> on marketplace.
    }

    struct Boost {
        uint8 numAttackBoosts;
        uint8 numDefendBoosts;
        uint attackBoost;
        uint defendBoost;
    }

    constructor() public {
        owner = msg.sender;
    }

    // Can't send funds straight to this contract. Avoid people sending by mistake.
    function () payable public {
        revert();
    }

    function kill() public isOwner {
        selfdestruct(owner);
    }

    modifier isValidCaller {
        if (msg.sender != bwService && msg.sender != bw && msg.sender != bwMarket) {
            revert();
        }
        _;
    }
    
    modifier isOwner {
        if (msg.sender != owner) {
            revert();
        }
        _;
    }
    
    function setBwServiceValidCaller(address _bwService) public isOwner {
        bwService = _bwService;
    }

    function setBwValidCaller(address _bw) public isOwner {
        bw = _bw;
    }

    function setBwMarketValidCaller(address _bwMarket) public isOwner {
        bwMarket = _bwMarket;
    }    
    
    // ----------USER-RELATED GETTER FUNCTIONS------------
    
    //function getUser(address _user) view public returns (bytes32) {
        //BWUtility.User memory user = users[_user];
        //require(user.creationTime != 0);
        //return (user.creationTime, user.imageUrl, user.tag, user.email, user.homeUrl, user.creationTime, user.censored, user.battleValue);
    //}
    
    function addUser(address _msgSender) public isValidCaller {
        User storage user = users[_msgSender];
        require(user.creationTime == 0);
        user.creationTime = block.timestamp;
    }

    function hasUser(address _user) view public isValidCaller returns (bool) {
        return users[_user].creationTime != 0;
    }
    

    // ----------TILE-RELATED GETTER FUNCTIONS------------

    function getTile(uint16 _tileId) view public isValidCaller returns (address, uint, uint, uint) {
        Tile storage currentTile = tiles[_tileId];
        return (currentTile.claimer, currentTile.blockValue, currentTile.creationTime, currentTile.sellPrice);
    }
    
    function getTileClaimerAndBlockValue(uint16 _tileId) view public isValidCaller returns (address, uint) {
        Tile storage currentTile = tiles[_tileId];
        return (currentTile.claimer, currentTile.blockValue);
    }
    
    function isNewTile(uint16 _tileId) view public isValidCaller returns (bool) {
        Tile storage currentTile = tiles[_tileId];
        return currentTile.creationTime == 0;
    }
    
    function storeClaim(uint16 _tileId, address _claimer, uint _blockValue) public isValidCaller {
        tiles[_tileId] = Tile(_claimer, _blockValue, block.timestamp, 0);
    }

    function updateTileBlockValue(uint16 _tileId, uint _blockValue) public isValidCaller {
        tiles[_tileId].blockValue = _blockValue;
    }

    function setClaimerForTile(uint16 _tileId, address _claimer) public isValidCaller {
        tiles[_tileId].claimer = _claimer;
    }

    function updateTileTimeStamp(uint16 _tileId) public isValidCaller {
        tiles[_tileId].creationTime = block.timestamp;
    }
    
    function getCurrentClaimerForTile(uint16 _tileId) view public isValidCaller returns (address) {
        Tile storage currentTile = tiles[_tileId];
        if (currentTile.creationTime == 0) {
            return 0;
        }
        return currentTile.claimer;
    }

    function getCurrentBlockValueAndSellPriceForTile(uint16 _tileId) view public isValidCaller returns (uint, uint) {
        Tile storage currentTile = tiles[_tileId];
        if (currentTile.creationTime == 0) {
            return (0, 0);
        }
        return (currentTile.blockValue, currentTile.sellPrice);
    }
    
    function getBlockValueBalance() view public isValidCaller returns (uint){
        return blockValueBalance;
    }

    function setBlockValueBalance(uint _blockValueBalance) public isValidCaller {
        blockValueBalance = _blockValueBalance;
    }

    function getFeeBalance() view public isValidCaller returns (uint) {
        return feeBalance;
    }

    function setFeeBalance(uint _feeBalance) public isValidCaller {
        feeBalance = _feeBalance;
    }
    
    function getUserBattleValue(address _userId) view public isValidCaller returns (uint) {
        return users[_userId].battleValue;
    }
    
    function setUserBattleValue(address _userId, uint _battleValue) public  isValidCaller {
        users[_userId].battleValue = _battleValue;
    }
    
    function verifyAmount(address _msgSender, uint _msgValue, uint _amount, bool _useBattleValue) view public isValidCaller {
        User storage user = users[_msgSender];
        require(user.creationTime != 0);

        if (_useBattleValue) {
            require(_msgValue == 0);
            require(user.battleValue >= _amount);
        } else {
            require(_amount == _msgValue);
        }
    }
    
    function addBoostFromTile(Tile _tile, address _attacker, address _defender, Boost memory _boost) pure private {
        if (_tile.claimer == _attacker) {
            require(_boost.attackBoost + _tile.blockValue >= _tile.blockValue); // prevent overflow
            _boost.attackBoost += _tile.blockValue;
            _boost.numAttackBoosts += 1;
        } else if (_tile.claimer == _defender) {
            require(_boost.defendBoost + _tile.blockValue >= _tile.blockValue); // prevent overflow
            _boost.defendBoost += _tile.blockValue;
            _boost.numDefendBoosts += 1;
        }
    }

    function calculateBattleBoost(uint16 _tileId, address _attacker, address _defender) view public isValidCaller returns (uint, uint) {
        uint8 x;
        uint8 y;

        (x, y) = BWUtility.fromTileId(_tileId);

        Boost memory boost = Boost(0, 0, 0, 0);
        // We overflow x, y on purpose here if x or y is 0 or 255 - the map overflows and so should adjacency.
        // Go through all adjacent tiles to (x, y).
        if (y != 255) {
            if (x != 255) {
                addBoostFromTile(tiles[BWUtility.toTileId(x+1, y+1)], _attacker, _defender, boost);
            }
            
            addBoostFromTile(tiles[BWUtility.toTileId(x, y+1)], _attacker, _defender, boost);

            if (x != 0) {
                addBoostFromTile(tiles[BWUtility.toTileId(x-1, y+1)], _attacker, _defender, boost);
            }
        }

        if (x != 255) {
            addBoostFromTile(tiles[BWUtility.toTileId(x+1, y)], _attacker, _defender, boost);
        }

        if (x != 0) {
            addBoostFromTile(tiles[BWUtility.toTileId(x-1, y)], _attacker, _defender, boost);
        }

        if (y != 0) {
            if(x != 255) {
                addBoostFromTile(tiles[BWUtility.toTileId(x+1, y-1)], _attacker, _defender, boost);
            }

            addBoostFromTile(tiles[BWUtility.toTileId(x, y-1)], _attacker, _defender, boost);

            if(x != 0) {
                addBoostFromTile(tiles[BWUtility.toTileId(x-1, y-1)], _attacker, _defender, boost);
            }
        }
        // The benefit of boosts is multiplicative (quadratic):
        // - More boost tiles gives a higher total blockValue (the sum of the adjacent tiles)
        // - More boost tiles give a higher multiple of that total blockValue that can be used (10% per adjacent tie)
        // Example:
        //   A) I boost attack with 1 single tile worth 10 finney
        //      -> Total boost is 10 * 1 / 10 = 1 finney
        //   B) I boost attack with 3 tiles worth 1 finney each
        //      -> Total boost is (1+1+1) * 3 / 10 = 0.9 finney
        //   C) I boost attack with 8 tiles worth 2 finney each
        //      -> Total boost is (2+2+2+2+2+2+2+2) * 8 / 10 = 14.4 finney
        //   D) I boost attack with 3 tiles of 1, 5 and 10 finney respectively
        //      -> Total boost is (ss1+5+10) * 3 / 10 = 4.8 finney
        // This division by 10 can't create fractions since our uint is wei, and we can't have overflow from the multiplication
        // We do allow fractions of finney here since the boosted values aren't stored anywhere, only used for attack rolls and sent in events
        boost.attackBoost = (boost.attackBoost / 10 * boost.numAttackBoosts);
        boost.defendBoost = (boost.defendBoost / 10 * boost.numDefendBoosts);

        return (boost.attackBoost, boost.defendBoost);
    }
    
    function censorUser(address _userAddress, bool _censored) public isValidCaller {
        User storage user = users[_userAddress];
        require(user.creationTime != 0);
        user.censored = _censored;
    }
    
    function deleteTile(uint16 _tileId) public isValidCaller {
        delete tiles[_tileId];
    }
    
    function setSellPrice(uint16 _tileId, uint _sellPrice) public isValidCaller {
        tiles[_tileId].sellPrice = _sellPrice;  //testrpc cannot estimate gas when delete is used.
    }

    function deleteOffer(uint16 _tileId) public isValidCaller {
        tiles[_tileId].sellPrice = 0;  //testrpc cannot estimate gas when delete is used.
    }
}


interface ERC20I {
    function transfer(address _recipient, uint256 _amount) external returns (bool);
    function balanceOf(address _holder) external view returns (uint256);
}


contract BWService {
    address private owner;
    address private bw;
    address private bwMarket;
    BWData private bwData;
    uint private seed = 42;
    uint private WITHDRAW_FEE = 20; //1/20 = 5%
    
    modifier isOwner {
        if (msg.sender != owner) {
            revert();
        }
        _;
    }  

    modifier isValidCaller {
        if (msg.sender != bw && msg.sender != bwMarket) {
            revert();
        }
        _;
    }

    event TileClaimed(uint16 tileId, address newClaimer, uint priceInWei, uint creationTime);
    event TileFortified(uint16 tileId, address claimer, uint addedValueInWei, uint priceInWei, uint fortifyTime); // Sent when a user fortifies an existing claim by bumping its value.
    event TileAttackedSuccessfully(uint16 tileId, address attacker, uint attackAmount, uint totalAttackAmount, address defender, uint defendAmount, uint totalDefendAmount, uint attackRoll, uint attackTime); // Sent when a user successfully attacks a tile.    
    event TileDefendedSuccessfully(uint16 tileId, address attacker, uint attackAmount, uint totalAttackAmount, address defender, uint defendAmount, uint totalDefendAmount, uint attackRoll, uint defendTime); // Sent when a user successfully defends a tile when attacked.    
    event BlockValueMoved(uint16 sourceTileId, uint16 destTileId, address owner, uint movedBlockValue, uint postSourceValue, uint postDestValue, uint moveTime); // Sent when a user buys a tile from another user, by accepting a tile offer
    event UserBattleValueUpdated(address userAddress, uint battleValue, bool isWithdraw);

    // Constructor.
    constructor(address _bwData) public {
        bwData = BWData(_bwData);
        owner = msg.sender;
    }

    // Can't send funds straight to this contract. Avoid people sending by mistake.
    function () payable public {
        revert();
    }

    // OWNER-ONLY FUNCTIONS
    function kill() public isOwner {
        selfdestruct(owner);
    }

    function setValidBwCaller(address _bw) public isOwner {
        bw = _bw;
    }
    
    function setValidBwMarketCaller(address _bwMarket) public isOwner {
        bwMarket = _bwMarket;
    }


    // TILE-RELATED FUNCTIONS
    // This function claims multiple previously unclaimed tiles in a single transaction.
    // The value assigned to each tile is the msg.value divided by the number of tiles claimed.
    // The msg.value is required to be an even multiple of the number of tiles claimed.
    function storeInitialClaim(address _msgSender, uint16[] _claimedTileIds, uint _claimAmount, bool _useBattleValue) public isValidCaller {
        uint tileCount = _claimedTileIds.length;
        require(tileCount > 0);
        require(_claimAmount >= 1 finney * tileCount); // ensure enough funds paid for all tiles
        require(_claimAmount % tileCount == 0); // ensure payment is an even multiple of number of tiles claimed

        uint valuePerBlockInWei = _claimAmount / tileCount; // Due to requires above this is guaranteed to be an even number

        if (_useBattleValue) {
            subUserBattleValue(_msgSender, _claimAmount, false);  
        }

        addGlobalBlockValueBalance(_claimAmount);

        uint16 tileId;
        bool isNewTile;
        for (uint16 i = 0; i < tileCount; i++) {
            tileId = _claimedTileIds[i];
            isNewTile = bwData.isNewTile(tileId); // Is length 0 if first time purchased
            require(isNewTile); // Can only claim previously unclaimed tiles.

            // Send claim event
            emit TileClaimed(tileId, _msgSender, valuePerBlockInWei, block.timestamp);

            // Update contract state with new tile ownership.
            bwData.storeClaim(tileId, _msgSender, valuePerBlockInWei);
        }
    }

    function fortifyClaims(address _msgSender, uint16[] _claimedTileIds, uint _fortifyAmount, bool _useBattleValue) public isValidCaller {
        uint tileCount = _claimedTileIds.length;
        require(tileCount > 0);

        uint balance = address(this).balance;
        require(balance + _fortifyAmount > balance); // prevent overflow
        require(_fortifyAmount % tileCount == 0); // ensure payment is an even multiple of number of tiles fortified
        uint addedValuePerTileInWei = _fortifyAmount / tileCount; // Due to requires above this is guaranteed to be an even number
        require(_fortifyAmount >= 1 finney * tileCount); // ensure enough funds paid for all tiles

        address claimer;
        uint blockValue;
        for (uint16 i = 0; i < tileCount; i++) {
            (claimer, blockValue) = bwData.getTileClaimerAndBlockValue(_claimedTileIds[i]);
            require(claimer != 0); // Can't do this on never-owned tiles
            require(claimer == _msgSender); // Only current claimer can fortify claim

            if (_useBattleValue) {
                subUserBattleValue(_msgSender, addedValuePerTileInWei, false);
            }
            
            fortifyClaim(_msgSender, _claimedTileIds[i], addedValuePerTileInWei);
        }
    }

    function fortifyClaim(address _msgSender, uint16 _claimedTileId, uint _fortifyAmount) private {
        uint blockValue;
        uint sellPrice;
        (blockValue, sellPrice) = bwData.getCurrentBlockValueAndSellPriceForTile(_claimedTileId);
        uint updatedBlockValue = blockValue + _fortifyAmount;
        // Send fortify event
        emit TileFortified(_claimedTileId, _msgSender, _fortifyAmount, updatedBlockValue, block.timestamp);
        
        // Update tile value. The tile has been fortified by bumping up its value.
        bwData.updateTileBlockValue(_claimedTileId, updatedBlockValue);

        // Track addition to global block value
        addGlobalBlockValueBalance(_fortifyAmount);
    }

    // Return a pseudo random number between lower and upper bounds
    // given the number of previous blocks it should hash.
    // Random function copied from https://github.com/axiomzen/eth-random/blob/master/contracts/Random.sol.
    // Changed sha3 to keccak256.
    // Changed random range from uint64 to uint (=uint256).
    function random(uint _upper) private returns (uint)  {
        seed = uint(keccak256(keccak256(blockhash(block.number), seed), now));
        return seed % _upper;
    }

    // A user tries to claim a tile that's already owned by another user. A battle ensues.
    // A random roll is done with % based on attacking vs defending amounts.
    function attackTile(address _msgSender, uint16 _tileId, uint _attackAmount, bool _useBattleValue, bool _autoFortify) public isValidCaller {
        require(_attackAmount >= 1 finney);         // Don't allow attacking with less than one base tile price.
        require(_attackAmount % 1 finney == 0);

        address claimer;
        uint blockValue;
        (claimer, blockValue) = bwData.getTileClaimerAndBlockValue(_tileId);
        
        require(claimer != 0); // Can't do this on never-owned tiles
        require(claimer != _msgSender); // Can't attack one's own tiles
        require(claimer != owner); // Can't attack owner's tiles because it is used for raffle.

        // Calculate boosted amounts for attacker and defender
        // The base attack amount is sent in the by the user.
        // The base defend amount is the attacked tile's current blockValue.
        uint attackBoost;
        uint defendBoost;
        (attackBoost, defendBoost) = bwData.calculateBattleBoost(_tileId, _msgSender, claimer);
        uint totalAttackAmount = _attackAmount + attackBoost;
        uint totalDefendAmount = blockValue + defendBoost;
        require(totalAttackAmount >= _attackAmount); // prevent overflow
        require(totalDefendAmount >= blockValue); // prevent overflow
        require(totalAttackAmount + totalDefendAmount > totalAttackAmount && totalAttackAmount + totalDefendAmount > totalDefendAmount); // Prevent overflow

        // Verify that attack odds are within allowed range.
        require(totalAttackAmount / 10 <= blockValue); // Disallow attacks with more than 1000% of defendAmount
        require(totalAttackAmount >= blockValue / 10); // Disallow attacks with less than 10% of defendAmount

        // The battle considers boosts.
        uint attackRoll = random(totalAttackAmount + totalDefendAmount); // This is where the excitement happens!
        if (attackRoll > totalDefendAmount) {
            // Send update event
            emit TileAttackedSuccessfully(_tileId, _msgSender, _attackAmount, totalAttackAmount, claimer, blockValue, totalDefendAmount, attackRoll, block.timestamp);

            // Change block owner but keep same block value (attacker got battlevalue instead)
            bwData.setClaimerForTile(_tileId, _msgSender);

            // Tile successfully attacked!
            if (_useBattleValue) {
                if (_autoFortify) {
                    // Fortify the won tile using battle value
                    fortifyClaim(_msgSender, _tileId, _attackAmount);
                    subUserBattleValue(_msgSender, _attackAmount, false);
                } else {
                    // No reason to withdraw followed by deposit of same amount
                }
            } else {
                if (_autoFortify) {
                    // Fortify the won tile using attack amount
                    fortifyClaim(_msgSender, _tileId, _attackAmount);
                } else {
                    addUserBattleValue(_msgSender, _attackAmount); // Don't include boost here!
                }
            }
        } else {
            // Tile successfully defended!
            if (_useBattleValue) {
                subUserBattleValue(_msgSender, _attackAmount, false); // Don't include boost here!
            }
            addUserBattleValue(claimer, _attackAmount); // Don't include boost here!

            // Send update event
            emit TileDefendedSuccessfully(_tileId, _msgSender, _attackAmount, totalAttackAmount, claimer, blockValue, totalDefendAmount, attackRoll, block.timestamp);

            // Update the timestamp for the defended block.
            bwData.updateTileTimeStamp(_tileId);
        }
    }

    function moveBlockValue(address _msgSender, uint8 _xSource, uint8 _ySource, uint8 _xDest, uint8 _yDest, uint _moveAmount) public isValidCaller {
        uint16 sourceTileId = BWUtility.toTileId(_xSource, _ySource);
        uint16 destTileId = BWUtility.toTileId(_xDest, _yDest);

        address sourceTileClaimer;
        address destTileClaimer;
        uint sourceTileBlockValue;
        uint destTileBlockValue;
        (sourceTileClaimer, sourceTileBlockValue) = bwData.getTileClaimerAndBlockValue(sourceTileId);
        (destTileClaimer, destTileBlockValue) = bwData.getTileClaimerAndBlockValue(destTileId);

        require(sourceTileClaimer == _msgSender);
        require(destTileClaimer == _msgSender);
        require(_moveAmount >= 1 finney); // Can't be less
        require(_moveAmount % 1 finney == 0); // Move amount must be in multiples of 1 finney
        // require(sourceTile.blockValue - _moveAmount >= BASE_TILE_PRICE_WEI); // Must always leave some at source
        
        require(sourceTileBlockValue - _moveAmount < sourceTileBlockValue); // Prevent overflow
        require(destTileBlockValue + _moveAmount > destTileBlockValue); // Prevent overflow
        require(BWUtility.isAdjacent(_xSource, _ySource, _xDest, _yDest));

        sourceTileBlockValue -= _moveAmount;
        destTileBlockValue += _moveAmount;

        // If ALL block value was moved away from the source tile, we lose our claim to it. It becomes ownerless.
        if (sourceTileBlockValue == 0) {
            bwData.deleteTile(sourceTileId);
        } else {
            bwData.updateTileBlockValue(sourceTileId, sourceTileBlockValue);
            bwData.deleteOffer(sourceTileId); // Offer invalid since block value has changed
        }

        bwData.updateTileBlockValue(destTileId, destTileBlockValue);
        bwData.deleteOffer(destTileId);   // Offer invalid since block value has changed
        emit BlockValueMoved(sourceTileId, destTileId, _msgSender, _moveAmount, sourceTileBlockValue, destTileBlockValue, block.timestamp);        
    }


    // BATTLE VALUE FUNCTIONS
    function withdrawBattleValue(address msgSender, uint _battleValueInWei) public isValidCaller returns (uint) {
        require(bwData.hasUser(msgSender));
        require(_battleValueInWei % 1 finney == 0); // Must be divisible by 1 finney
        uint fee = _battleValueInWei / WITHDRAW_FEE; // Since we divide by 20 we can never create infinite fractions, so we'll always count in whole wei amounts.
        require(_battleValueInWei - fee < _battleValueInWei); // prevent underflow

        uint amountToWithdraw = _battleValueInWei - fee;
        uint feeBalance = bwData.getFeeBalance();
        require(feeBalance + fee >= feeBalance); // prevent overflow
        feeBalance += fee;
        bwData.setFeeBalance(feeBalance);
        subUserBattleValue(msgSender, _battleValueInWei, true);
        return amountToWithdraw;
    }

    function addUserBattleValue(address _userId, uint _amount) public isValidCaller {
        uint userBattleValue = bwData.getUserBattleValue(_userId);
        require(userBattleValue + _amount > userBattleValue); // prevent overflow
        uint newBattleValue = userBattleValue + _amount;
        bwData.setUserBattleValue(_userId, newBattleValue); // Don't include boost here!
        emit UserBattleValueUpdated(_userId, newBattleValue, false);
    }
    
    function subUserBattleValue(address _userId, uint _amount, bool _isWithdraw) public isValidCaller {
        uint userBattleValue = bwData.getUserBattleValue(_userId);
        require(_amount <= userBattleValue); // Must be less than user's battle value - also implicitly checks that underflow isn't possible
        uint newBattleValue = userBattleValue - _amount;
        bwData.setUserBattleValue(_userId, newBattleValue); // Don't include boost here!
        emit UserBattleValueUpdated(_userId, newBattleValue, _isWithdraw);
    }

    function addGlobalBlockValueBalance(uint _amount) public isValidCaller {
        // Track addition to global block value.
        uint blockValueBalance = bwData.getBlockValueBalance();
        require(blockValueBalance + _amount > blockValueBalance); // Prevent overflow
        bwData.setBlockValueBalance(blockValueBalance + _amount);
    }

    // Allow us to transfer out airdropped tokens if we ever receive any
    function transferTokens(address _tokenAddress, address _recipient) public isOwner {
        ERC20I token = ERC20I(_tokenAddress);
        require(token.transfer(_recipient, token.balanceOf(this)));
    }
}

Contract Security Audit

Contract ABI

API
[{"constant":false,"inputs":[{"name":"_bw","type":"address"}],"name":"setValidBwCaller","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"msgSender","type":"address"},{"name":"_battleValueInWei","type":"uint256"}],"name":"withdrawBattleValue","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_userId","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_isWithdraw","type":"bool"}],"name":"subUserBattleValue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_userId","type":"address"},{"name":"_amount","type":"uint256"}],"name":"addUserBattleValue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_amount","type":"uint256"}],"name":"addGlobalBlockValueBalance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenAddress","type":"address"},{"name":"_recipient","type":"address"}],"name":"transferTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_msgSender","type":"address"},{"name":"_tileId","type":"uint16"},{"name":"_attackAmount","type":"uint256"},{"name":"_useBattleValue","type":"bool"},{"name":"_autoFortify","type":"bool"}],"name":"attackTile","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_bwMarket","type":"address"}],"name":"setValidBwMarketCaller","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_msgSender","type":"address"},{"name":"_claimedTileIds","type":"uint16[]"},{"name":"_fortifyAmount","type":"uint256"},{"name":"_useBattleValue","type":"bool"}],"name":"fortifyClaims","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_msgSender","type":"address"},{"name":"_claimedTileIds","type":"uint16[]"},{"name":"_claimAmount","type":"uint256"},{"name":"_useBattleValue","type":"bool"}],"name":"storeInitialClaim","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_msgSender","type":"address"},{"name":"_xSource","type":"uint8"},{"name":"_ySource","type":"uint8"},{"name":"_xDest","type":"uint8"},{"name":"_yDest","type":"uint8"},{"name":"_moveAmount","type":"uint256"}],"name":"moveBlockValue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_bwData","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tileId","type":"uint16"},{"indexed":false,"name":"newClaimer","type":"address"},{"indexed":false,"name":"priceInWei","type":"uint256"},{"indexed":false,"name":"creationTime","type":"uint256"}],"name":"TileClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tileId","type":"uint16"},{"indexed":false,"name":"claimer","type":"address"},{"indexed":false,"name":"addedValueInWei","type":"uint256"},{"indexed":false,"name":"priceInWei","type":"uint256"},{"indexed":false,"name":"fortifyTime","type":"uint256"}],"name":"TileFortified","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tileId","type":"uint16"},{"indexed":false,"name":"attacker","type":"address"},{"indexed":false,"name":"attackAmount","type":"uint256"},{"indexed":false,"name":"totalAttackAmount","type":"uint256"},{"indexed":false,"name":"defender","type":"address"},{"indexed":false,"name":"defendAmount","type":"uint256"},{"indexed":false,"name":"totalDefendAmount","type":"uint256"},{"indexed":false,"name":"attackRoll","type":"uint256"},{"indexed":false,"name":"attackTime","type":"uint256"}],"name":"TileAttackedSuccessfully","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"tileId","type":"uint16"},{"indexed":false,"name":"attacker","type":"address"},{"indexed":false,"name":"attackAmount","type":"uint256"},{"indexed":false,"name":"totalAttackAmount","type":"uint256"},{"indexed":false,"name":"defender","type":"address"},{"indexed":false,"name":"defendAmount","type":"uint256"},{"indexed":false,"name":"totalDefendAmount","type":"uint256"},{"indexed":false,"name":"attackRoll","type":"uint256"},{"indexed":false,"name":"defendTime","type":"uint256"}],"name":"TileDefendedSuccessfully","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sourceTileId","type":"uint16"},{"indexed":false,"name":"destTileId","type":"uint16"},{"indexed":false,"name":"owner","type":"address"},{"indexed":false,"name":"movedBlockValue","type":"uint256"},{"indexed":false,"name":"postSourceValue","type":"uint256"},{"indexed":false,"name":"postDestValue","type":"uint256"},{"indexed":false,"name":"moveTime","type":"uint256"}],"name":"BlockValueMoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"userAddress","type":"address"},{"indexed":false,"name":"battleValue","type":"uint256"},{"indexed":false,"name":"isWithdraw","type":"bool"}],"name":"UserBattleValueUpdated","type":"event"}]

Deployed Bytecode

0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630b21d446146100bf57806311bb20da146101025780631466724a14610163578063330ae7b3146101bc57806341c0e1b514610209578063542bee82146102205780636a092e791461024d5780638b50cd34146102b0578063acd2988c14610323578063c27bc7b214610366578063d4212e9314610402578063fe562ee61461049e575b600080fd5b3480156100cb57600080fd5b50610100600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061051f565b005b34801561010e57600080fd5b5061014d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105be565b6040518082815260200191505060405180910390f35b34801561016f57600080fd5b506101ba600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080351515906020019092919050505061095d565b005b3480156101c857600080fd5b50610207600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c7f565b005b34801561021557600080fd5b5061021e610fa2565b005b34801561022c57600080fd5b5061024b60048036038101908080359060200190929190505050611037565b005b34801561025957600080fd5b506102ae600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611271565b005b3480156102bc57600080fd5b50610321600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803561ffff16906020019092919080359060200190929190803515159060200190929190803515159060200190929190505050611494565b005b34801561032f57600080fd5b50610364600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611cd0565b005b34801561037257600080fd5b50610400600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190929190803515159060200190929190505050611d6f565b005b34801561040e57600080fd5b5061049c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091929192908035906020019092919080351515906020019092919050505061206e565b005b3480156104aa57600080fd5b5061051d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190803560ff169060200190929190803560ff169060200190929190803560ff16906020019092919080359060200190929190505050612434565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561057a57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141580156106705750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561067a57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a6c4ec0e876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561073757600080fd5b505af115801561074b573d6000803e3d6000fd5b505050506040513d602081101561076157600080fd5b8101908080519060200190929190505050151561077d57600080fd5b600066038d7ea4c680008681151561079157fe5b0614151561079e57600080fd5b600554858115156107ab57fe5b049250848386031015156107be57600080fd5b8285039150600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d4c30ceb6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561084957600080fd5b505af115801561085d573d6000803e3d6000fd5b505050506040513d602081101561087357600080fd5b81019080805190602001909291905050509050808382011015151561089757600080fd5b8281019050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638580eb2f826040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561092d57600080fd5b505af1158015610941573d6000803e3d6000fd5b505050506109518686600161095d565b81935050505092915050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015610a0c5750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b15610a1657600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637d9c68f7866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610ad357600080fd5b505af1158015610ae7573d6000803e3d6000fd5b505050506040513d6020811015610afd57600080fd5b81019080805190602001909291905050509150818411151515610b1f57600080fd5b8382039050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638fa54b8186836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610be957600080fd5b505af1158015610bfd573d6000803e3d6000fd5b505050507f7ae194911c41f370ed4d3589788e5506955ad9d63d7a4f76f8245b4cc1483bcf858285604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182151515158152602001935050505060405180910390a15050505050565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015610d2e5750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b15610d3857600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637d9c68f7856040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610df557600080fd5b505af1158015610e09573d6000803e3d6000fd5b505050506040513d6020811015610e1f57600080fd5b8101908080519060200190929190505050915081838301111515610e4257600080fd5b8282019050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638fa54b8185836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b158015610f0c57600080fd5b505af1158015610f20573d6000803e3d6000fd5b505050507f7ae194911c41f370ed4d3589788e5506955ad9d63d7a4f76f8245b4cc1483bcf84826000604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182151515158152602001935050505060405180910390a150505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ffd57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141580156110e55750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156110ef57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b187b6b16040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561117557600080fd5b505af1158015611189573d6000803e3d6000fd5b505050506040513d602081101561119f57600080fd5b81019080805190602001909291905050509050808282011115156111c257600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166377f122bd8383016040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561125557600080fd5b505af1158015611269573d6000803e3d6000fd5b505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156112ce57600080fd5b8290508073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb838373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561138957600080fd5b505af115801561139d573d6000803e3d6000fd5b505050506040513d60208110156113b357600080fd5b81019080805190602001909291905050506040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561144957600080fd5b505af115801561145d573d6000803e3d6000fd5b505050506040513d602081101561147357600080fd5b8101908080519060200190929190505050151561148f57600080fd5b505050565b6000806000806000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415801561154b5750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561155557600080fd5b66038d7ea4c680008a1015151561156b57600080fd5b600066038d7ea4c680008b81151561157f57fe5b0614151561158c57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357cc59418c6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808261ffff1661ffff1681526020019150506040805180830381600087803b15801561162457600080fd5b505af1158015611638573d6000803e3d6000fd5b505050506040513d604081101561164e57600080fd5b810190808051906020019092919080519060200190929190505050809750819850505060008773ffffffffffffffffffffffffffffffffffffffff161415151561169757600080fd5b8b73ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16141515156116d257600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161415151561172e57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c7ceac998c8e8a6040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808461ffff1661ffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200193505050506040805180830381600087803b15801561182e57600080fd5b505af1158015611842573d6000803e3d6000fd5b505050506040513d604081101561185857600080fd5b8101908080519060200190929190805190602001909291905050508095508196505050848a019250838601915089831015151561189457600080fd5b8582101515156118a357600080fd5b828284011180156118b5575081828401115b15156118c057600080fd5b85600a848115156118cd57fe5b04111515156118db57600080fd5b600a868115156118e757fe5b0483101515156118f657600080fd5b611901828401612e30565b905081811115611b1c577f7e9015ef1659c74b9ae0721cad2d0c9b1c45da929c5944f03db7ff3a186ec5c68b8d8c868b8b888842604051808a61ffff1661ffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018881526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001838152602001828152602001995050505050505050505060405180910390a1600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632f54a61e8c8e6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808361ffff1661ffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050600060405180830381600087803b158015611aaf57600080fd5b505af1158015611ac3573d6000803e3d6000fd5b505050508815611af5578715611aef57611ade8c8c8c612e9f565b611aea8c8b600061095d565b611af0565b5b611b17565b8715611b0b57611b068c8c8c612e9f565b611b16565b611b158c8b610c7f565b5b5b611cc2565b8815611b2f57611b2e8c8b600061095d565b5b611b39878b610c7f565b7ff25098c7bfeb3cb1a04f3b5f48d80665d96794149d99e118d6671e97dfa561a48b8d8c868b8b888842604051808a61ffff1661ffff1681526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018881526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001858152602001848152602001838152602001828152602001995050505050505050505060405180910390a1600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cdde54138c6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808261ffff1661ffff168152602001915050600060405180830381600087803b158015611ca957600080fd5b505af1158015611cbd573d6000803e3d6000fd5b505050505b505050505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611d2b57600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600080600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015611e245750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b15611e2e57600080fd5b88519550600086111515611e4157600080fd5b3073ffffffffffffffffffffffffffffffffffffffff1631945084888601111515611e6b57600080fd5b60008689811515611e7857fe5b06141515611e8557600080fd5b8588811515611e9057fe5b0493508566038d7ea4c68000028810151515611eab57600080fd5b600090505b858161ffff16101561206257600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357cc59418a8361ffff16815181101515611f0c57fe5b906020019060200201516040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808261ffff1661ffff1681526020019150506040805180830381600087803b158015611f6f57600080fd5b505af1158015611f83573d6000803e3d6000fd5b505050506040513d6040811015611f9957600080fd5b810190808051906020019092919080519060200190929190505050809350819450505060008373ffffffffffffffffffffffffffffffffffffffff1614151515611fe257600080fd5b8973ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151561201c57600080fd5b861561202f5761202e8a85600061095d565b5b6120558a8a8361ffff1681518110151561204557fe5b9060200190602002015186612e9f565b8080600101915050611eb0565b50505050505050505050565b6000806000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141580156121225750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1561212c57600080fd5b8751945060008511151561213f57600080fd5b8466038d7ea4c6800002871015151561215757600080fd5b6000858881151561216457fe5b0614151561217157600080fd5b848781151561217c57fe5b0493508515612192576121918988600061095d565b5b61219b87611037565b600090505b848161ffff16101561242957878161ffff168151811015156121be57fe5b906020019060200201519250600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a3ab5045846040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808261ffff1661ffff168152602001915050602060405180830381600087803b15801561226357600080fd5b505af1158015612277573d6000803e3d6000fd5b505050506040513d602081101561228d57600080fd5b810190808051906020019092919050505091508115156122ac57600080fd5b7fbb96a8a6bc21268c6ddd36435db586653d9a868d0607f5295c171f66e7017233838a8642604051808561ffff1661ffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a1600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16632620f61c848b876040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808461ffff1661ffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050600060405180830381600087803b15801561240457600080fd5b505af1158015612418573d6000803e3d6000fd5b5050505080806001019150506121a0565b505050505050505050565b600080600080600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141580156124e95750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b156124f357600080fd5b73402cc14a55f355883df5549c0434877a68b7d089635cc1ad7f8c8c6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808360ff1660ff1681526020018260ff1660ff1681526020019250505060206040518083038186803b15801561257257600080fd5b505af4158015612586573d6000803e3d6000fd5b505050506040513d602081101561259c57600080fd5b8101908080519060200190929190505050955073402cc14a55f355883df5549c0434877a68b7d089635cc1ad7f8a8a6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808360ff1660ff1681526020018260ff1660ff1681526020019250505060206040518083038186803b15801561262e57600080fd5b505af4158015612642573d6000803e3d6000fd5b505050506040513d602081101561265857600080fd5b81019080805190602001909291905050509450600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357cc5941876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808261ffff1661ffff1681526020019150506040805180830381600087803b15801561270357600080fd5b505af1158015612717573d6000803e3d6000fd5b505050506040513d604081101561272d57600080fd5b8101908080519060200190929190805190602001909291905050508093508195505050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166357cc5941866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808261ffff1661ffff1681526020019150506040805180830381600087803b1580156127e857600080fd5b505af11580156127fc573d6000803e3d6000fd5b505050506040513d604081101561281257600080fd5b81019080805190602001909291908051906020019092919050505080925081945050508b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151561286f57600080fd5b8b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415156128a957600080fd5b66038d7ea4c6800087101515156128bf57600080fd5b600066038d7ea4c68000888115156128d357fe5b061415156128e057600080fd5b818783031015156128f057600080fd5b8087820111151561290057600080fd5b73402cc14a55f355883df5549c0434877a68b7d0896310b23ceb8c8c8c8c6040518563ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808560ff1660ff1681526020018460ff1660ff1681526020018360ff1660ff1681526020018260ff1660ff16815260200194505050505060206040518083038186803b15801561299b57600080fd5b505af41580156129af573d6000803e3d6000fd5b505050506040513d60208110156129c557600080fd5b810190808051906020019092919050505015156129e157600080fd5b868203915086810190506000821415612aaa57600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f4010db0876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808261ffff1661ffff168152602001915050600060405180830381600087803b158015612a8d57600080fd5b505af1158015612aa1573d6000803e3d6000fd5b50505050612c15565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639ea6954187846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808361ffff1661ffff16815260200182815260200192505050600060405180830381600087803b158015612b4b57600080fd5b505af1158015612b5f573d6000803e3d6000fd5b50505050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bff10815876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808261ffff1661ffff168152602001915050600060405180830381600087803b158015612bfc57600080fd5b505af1158015612c10573d6000803e3d6000fd5b505050505b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639ea6954186836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808361ffff1661ffff16815260200182815260200192505050600060405180830381600087803b158015612cb657600080fd5b505af1158015612cca573d6000803e3d6000fd5b50505050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663bff10815866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808261ffff1661ffff168152602001915050600060405180830381600087803b158015612d6757600080fd5b505af1158015612d7b573d6000803e3d6000fd5b505050507fbf0e53367a0cbb49421730f62ff3f2d819bbfa962e7cd1ba063404ce5b13efc286868e8a868642604051808861ffff1661ffff1681526020018761ffff1661ffff1681526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200185815260200184815260200183815260200182815260200197505050505050505060405180910390a1505050505050505050505050565b60004340600454604051808360001916600019168152602001828152602001925050506040518091039020426040518083600019166000191681526020018281526020019250505060405180910390206001900460048190555081600454811515612e9757fe5b069050919050565b6000806000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663abd958eb866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808261ffff1661ffff1681526020019150506040805180830381600087803b158015612f3c57600080fd5b505af1158015612f50573d6000803e3d6000fd5b505050506040513d6040811015612f6657600080fd5b810190808051906020019092919080519060200190929190505050809350819450505083830190507f58656e8c1841ccd421b8af8b7dac0b62c7bf9c7c5ca93ad4706d8667c747b1918587868442604051808661ffff1661ffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018281526020019550505050505060405180910390a1600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16639ea6954186836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808361ffff1661ffff16815260200182815260200192505050600060405180830381600087803b1580156130ba57600080fd5b505af11580156130ce573d6000803e3d6000fd5b505050506130db84611037565b5050505050505600a165627a7a72305820f515e1a6e89f4e136b9119c520cd7303adf4e5c3cb4bf4f66baabfd0c0a7c5f40029

Swarm Source

bzzr://f515e1a6e89f4e136b9119c520cd7303adf4e5c3cb4bf4f66baabfd0c0a7c5f4

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.