ETH Price: $2,635.98 (+1.85%)

Contract

0x3fcCb426c33b1ae067115390354B968592348D05
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Stop27650922016-12-07 15:50:232985 days ago1481125823IN
0x3fcCb426...592348D05
0 ETH0.0004928622
__callback27650012016-12-07 15:30:592985 days ago1481124659IN
0x3fcCb426...592348D05
0 ETH0.0102420
Trigger Attack M...27649842016-12-07 15:27:322985 days ago1481124452IN
0x3fcCb426...592348D05
0 ETH0.0016629122
__callback27639582016-12-07 11:37:412985 days ago1481110661IN
0x3fcCb426...592348D05
0 ETH0.0102420
__callback27639412016-12-07 11:33:402985 days ago1481110420IN
0x3fcCb426...592348D05
0 ETH0.0021291820
__callback27638462016-12-07 11:08:042985 days ago1481108884IN
0x3fcCb426...592348D05
0 ETH0.020023250
__callback27587772016-12-06 14:57:392986 days ago1481036259IN
0x3fcCb426...592348D05
0 ETH0.0021513620
Exit27531292016-12-05 16:35:482987 days ago1480955748IN
0x3fcCb426...592348D05
0 ETH0.0009787621
__callback27527052016-12-05 14:57:142987 days ago1480949834IN
0x3fcCb426...592348D05
0 ETH0.0024105220
Trigger Attack M...27526902016-12-05 14:53:342987 days ago1480949614IN
0x3fcCb426...592348D05
0 ETH0.0016629122
Exit27467962016-12-04 15:15:512988 days ago1480864551IN
0x3fcCb426...592348D05
0 ETH0.0035999421
Add Animals27285832016-12-01 15:18:462991 days ago1480605526IN
0x3fcCb426...592348D05
0.4 ETH0.0026494421
__callback27242892016-11-30 22:20:352991 days ago1480544435IN
0x3fcCb426...592348D05
0 ETH0.0038005620
__callback27182272016-11-29 22:19:292992 days ago1480457969IN
0x3fcCb426...592348D05
0 ETH0.0038233820
Exit27171882016-11-29 18:10:162993 days ago1480443016IN
0x3fcCb426...592348D05
0 ETH0.001496121
__callback27122302016-11-28 22:18:522993 days ago1480371532IN
0x3fcCb426...592348D05
0 ETH0.0039036420
__callback27061932016-11-27 22:18:322994 days ago1480285112IN
0x3fcCb426...592348D05
0 ETH0.0045604620
__callback27002292016-11-26 22:18:092995 days ago1480198689IN
0x3fcCb426...592348D05
0 ETH0.004550120
__callback26943112016-11-25 22:17:452996 days ago1480112265IN
0x3fcCb426...592348D05
0 ETH0.00403820
Add Animals26926242016-11-25 16:05:402997 days ago1480089940IN
0x3fcCb426...592348D05
0.1 ETH0.0026470521
Exit26926212016-11-25 16:04:542997 days ago1480089894IN
0x3fcCb426...592348D05
0 ETH0.0020240821
Exit26895862016-11-25 3:36:462997 days ago1480045006IN
0x3fcCb426...592348D05
0 ETH0.0016676921
__callback26881902016-11-24 22:17:312997 days ago1480025851IN
0x3fcCb426...592348D05
0 ETH0.0051154220
__callback26822882016-11-23 22:19:172998 days ago1479939557IN
0x3fcCb426...592348D05
0 ETH0.0051422220
Add Animals26795282016-11-23 10:33:472999 days ago1479897227IN
0x3fcCb426...592348D05
0.2 ETH0.0026515421
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block
From
To
27650922016-12-07 15:50:232985 days ago1481125823
0x3fcCb426...592348D05
1.02359885 ETH
27650922016-12-07 15:50:232985 days ago1481125823
0x3fcCb426...592348D05
0.83094269 ETH
27650922016-12-07 15:50:232985 days ago1481125823
0x3fcCb426...592348D05
0.53794269 ETH
27649842016-12-07 15:27:322985 days ago1481124452
0x3fcCb426...592348D05
0.01101881 ETH
27639412016-12-07 11:33:402985 days ago1481110420
0x3fcCb426...592348D05
0.01101881 ETH
27587772016-12-06 14:57:392986 days ago1481036259
0x3fcCb426...592348D05
0.01113881 ETH
27531292016-12-05 16:35:482987 days ago1480955748
0x3fcCb426...592348D05
0.79924713 ETH
27527052016-12-05 14:57:142987 days ago1480949834
0x3fcCb426...592348D05
0.01137881 ETH
27526902016-12-05 14:53:342987 days ago1480949614
0x3fcCb426...592348D05
0.01149881 ETH
27467962016-12-04 15:15:512988 days ago1480864551
0x3fcCb426...592348D05
6.2590095 ETH
27242892016-11-30 22:20:352991 days ago1480544435
0x3fcCb426...592348D05
0.01149881 ETH
27182272016-11-29 22:19:292992 days ago1480457969
0x3fcCb426...592348D05
0.01149881 ETH
27171882016-11-29 18:10:162993 days ago1480443016
0x3fcCb426...592348D05
0.94458674 ETH
27122302016-11-28 22:18:522993 days ago1480371532
0x3fcCb426...592348D05
0.01161881 ETH
27061932016-11-27 22:18:322994 days ago1480285112
0x3fcCb426...592348D05
0.01173881 ETH
27002292016-11-26 22:18:092995 days ago1480198689
0x3fcCb426...592348D05
0.01173881 ETH
26943112016-11-25 22:17:452996 days ago1480112265
0x3fcCb426...592348D05
0.01173881 ETH
26895862016-11-25 3:36:462997 days ago1480045006
0x3fcCb426...592348D05
0.55883586 ETH
26881902016-11-24 22:17:312997 days ago1480025851
0x3fcCb426...592348D05
0.01185881 ETH
26822882016-11-23 22:19:172998 days ago1479939557
0x3fcCb426...592348D05
0.01185881 ETH
26794042016-11-23 10:03:182999 days ago1479895398
0x3fcCb426...592348D05
0.22588962 ETH
26786462016-11-23 7:04:292999 days ago1479884669
0x3fcCb426...592348D05
0.75042815 ETH
26764352016-11-22 22:16:532999 days ago1479853013
0x3fcCb426...592348D05
0.01197881 ETH
26705222016-11-21 22:16:113000 days ago1479766571
0x3fcCb426...592348D05
0.01197881 ETH
26705042016-11-21 22:11:593000 days ago1479766319
0x3fcCb426...592348D05
0.01197881 ETH
View All Internal Transactions
Loading...
Loading
Contract Self Destruct called at Txn Hash 0x28b074288a2618ff3fe8e9fb8c65af505b79145a6adfe2778f8b04166ad6d91f


Contract Source Code Verified (Exact Match)

Contract Name:
Pray4Prey

Compiler Version
v0.3.5+commit.5f97274

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2016-09-22
*/

// <ORACLIZE_API>
/*
Copyright (c) 2015-2016 Oraclize srl, Thomas Bertani



Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:



The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.



THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

contract OraclizeI {
    address public cbAddress;
    function query(uint _timestamp, string _datasource, string _arg) returns (bytes32 _id);
    function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) returns (bytes32 _id);
    function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) returns (bytes32 _id);
    function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) returns (bytes32 _id);
    function getPrice(string _datasource) returns (uint _dsprice);
    function getPrice(string _datasource, uint gaslimit) returns (uint _dsprice);
    function useCoupon(string _coupon);
    function setProofType(byte _proofType);
}
contract OraclizeAddrResolverI {
    function getAddress() returns (address _addr);
}
contract usingOraclize {
    uint constant day = 60*60*24;
    uint constant week = 60*60*24*7;
    uint constant month = 60*60*24*30;
    byte constant proofType_NONE = 0x00;
    byte constant proofType_TLSNotary = 0x10;
    byte constant proofStorage_IPFS = 0x01;
    uint8 constant networkID_auto = 0;
    uint8 constant networkID_mainnet = 1;
    uint8 constant networkID_testnet = 2;
    uint8 constant networkID_morden = 2;
    uint8 constant networkID_consensys = 161;

    OraclizeAddrResolverI OAR;
    
    OraclizeI oraclize;
    modifier oraclizeAPI {
        address oraclizeAddr = OAR.getAddress();
        if (oraclizeAddr == 0){
            oraclize_setNetwork(networkID_auto);
            oraclizeAddr = OAR.getAddress();
        }
        oraclize = OraclizeI(oraclizeAddr);
        _
    }
    modifier coupon(string code){
        oraclize = OraclizeI(OAR.getAddress());
        oraclize.useCoupon(code);
        _
    }

    function oraclize_setNetwork(uint8 networkID) internal returns(bool){
        if (getCodeSize(0x1d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed)>0){
            OAR = OraclizeAddrResolverI(0x1d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed);
            return true;
        }
        if (getCodeSize(0x9efbea6358bed926b293d2ce63a730d6d98d43dd)>0){
            OAR = OraclizeAddrResolverI(0x9efbea6358bed926b293d2ce63a730d6d98d43dd);
            return true;
        }
        if (getCodeSize(0x20e12a1f859b3feae5fb2a0a32c18f5a65555bbf)>0){
            OAR = OraclizeAddrResolverI(0x20e12a1f859b3feae5fb2a0a32c18f5a65555bbf);
            return true;
        }
        return false;
    }
    
    function oraclize_query(string datasource, string arg) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query.value(price)(0, datasource, arg);
    }
    function oraclize_query(uint timestamp, string datasource, string arg) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query.value(price)(timestamp, datasource, arg);
    }
    function oraclize_query(uint timestamp, string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query_withGasLimit.value(price)(timestamp, datasource, arg, gaslimit);
    }
    function oraclize_query(string datasource, string arg, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query_withGasLimit.value(price)(0, datasource, arg, gaslimit);
    }
    function oraclize_query(string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query2.value(price)(0, datasource, arg1, arg2);
    }
    function oraclize_query(uint timestamp, string datasource, string arg1, string arg2) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource);
        if (price > 1 ether + tx.gasprice*200000) return 0; // unexpectedly high price
        return oraclize.query2.value(price)(timestamp, datasource, arg1, arg2);
    }
    function oraclize_query(uint timestamp, string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query2_withGasLimit.value(price)(timestamp, datasource, arg1, arg2, gaslimit);
    }
    function oraclize_query(string datasource, string arg1, string arg2, uint gaslimit) oraclizeAPI internal returns (bytes32 id){
        uint price = oraclize.getPrice(datasource, gaslimit);
        if (price > 1 ether + tx.gasprice*gaslimit) return 0; // unexpectedly high price
        return oraclize.query2_withGasLimit.value(price)(0, datasource, arg1, arg2, gaslimit);
    }
    function oraclize_cbAddress() oraclizeAPI internal returns (address){
        return oraclize.cbAddress();
    }
    function oraclize_setProof(byte proofP) oraclizeAPI internal {
        return oraclize.setProofType(proofP);
    }

    function getCodeSize(address _addr) constant internal returns(uint _size) {
        assembly {
            _size := extcodesize(_addr)
        }
    }


    function parseAddr(string _a) internal returns (address){
        bytes memory tmp = bytes(_a);
        uint160 iaddr = 0;
        uint160 b1;
        uint160 b2;
        for (uint i=2; i<2+2*20; i+=2){
            iaddr *= 256;
            b1 = uint160(tmp[i]);
            b2 = uint160(tmp[i+1]);
            if ((b1 >= 97)&&(b1 <= 102)) b1 -= 87;
            else if ((b1 >= 48)&&(b1 <= 57)) b1 -= 48;
            if ((b2 >= 97)&&(b2 <= 102)) b2 -= 87;
            else if ((b2 >= 48)&&(b2 <= 57)) b2 -= 48;
            iaddr += (b1*16+b2);
        }
        return address(iaddr);
    }


    function strCompare(string _a, string _b) internal returns (int) {
        bytes memory a = bytes(_a);
        bytes memory b = bytes(_b);
        uint minLength = a.length;
        if (b.length < minLength) minLength = b.length;
        for (uint i = 0; i < minLength; i ++)
            if (a[i] < b[i])
                return -1;
            else if (a[i] > b[i])
                return 1;
        if (a.length < b.length)
            return -1;
        else if (a.length > b.length)
            return 1;
        else
            return 0;
   } 

    function indexOf(string _haystack, string _needle) internal returns (int)
    {
        bytes memory h = bytes(_haystack);
        bytes memory n = bytes(_needle);
        if(h.length < 1 || n.length < 1 || (n.length > h.length)) 
            return -1;
        else if(h.length > (2**128 -1))
            return -1;                                  
        else
        {
            uint subindex = 0;
            for (uint i = 0; i < h.length; i ++)
            {
                if (h[i] == n[0])
                {
                    subindex = 1;
                    while(subindex < n.length && (i + subindex) < h.length && h[i + subindex] == n[subindex])
                    {
                        subindex++;
                    }   
                    if(subindex == n.length)
                        return int(i);
                }
            }
            return -1;
        }   
    }

    function strConcat(string _a, string _b, string _c, string _d, string _e) internal returns (string){
        bytes memory _ba = bytes(_a);
        bytes memory _bb = bytes(_b);
        bytes memory _bc = bytes(_c);
        bytes memory _bd = bytes(_d);
        bytes memory _be = bytes(_e);
        string memory abcde = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length);
        bytes memory babcde = bytes(abcde);
        uint k = 0;
        for (uint i = 0; i < _ba.length; i++) babcde[k++] = _ba[i];
        for (i = 0; i < _bb.length; i++) babcde[k++] = _bb[i];
        for (i = 0; i < _bc.length; i++) babcde[k++] = _bc[i];
        for (i = 0; i < _bd.length; i++) babcde[k++] = _bd[i];
        for (i = 0; i < _be.length; i++) babcde[k++] = _be[i];
        return string(babcde);
    }
    
    function strConcat(string _a, string _b, string _c, string _d) internal returns (string) {
        return strConcat(_a, _b, _c, _d, "");
    }

    function strConcat(string _a, string _b, string _c) internal returns (string) {
        return strConcat(_a, _b, _c, "", "");
    }

    function strConcat(string _a, string _b) internal returns (string) {
        return strConcat(_a, _b, "", "", "");
    }

    // parseInt
    function parseInt(string _a) internal returns (uint) {
        return parseInt(_a, 0);
    }

    // parseInt(parseFloat*10^_b)
    function parseInt(string _a, uint _b) internal returns (uint) {
        bytes memory bresult = bytes(_a);
        uint mint = 0;
        bool decimals = false;
        for (uint i=0; i<bresult.length; i++){
            if ((bresult[i] >= 48)&&(bresult[i] <= 57)){
                if (decimals){
                   if (_b == 0) break;
                    else _b--;
                }
                mint *= 10;
                mint += uint(bresult[i]) - 48;
            } else if (bresult[i] == 46) decimals = true;
        }
        if (_b > 0) mint *= 10**_b;
        return mint;
    }
    

}
// </ORACLIZE_API>

library strings {
    struct slice {
        uint _len;
        uint _ptr;
    }

    function memcpy(uint dest, uint src, uint len) private {
        // Copy word-length chunks while possible
        for(; len >= 32; len -= 32) {
            assembly {
                mstore(dest, mload(src))
            }
            dest += 32;
            src += 32;
        }

        // Copy remaining bytes
        uint mask = 256 ** (32 - len) - 1;
        assembly {
            let srcpart := and(mload(src), not(mask))
            let destpart := and(mload(dest), mask)
            mstore(dest, or(destpart, srcpart))
        }
    }

    /**
     * @dev Returns a slice containing the entire string.
     * @param self The string to make a slice from.
     * @return A newly allocated slice containing the entire string.
     */
    function toSlice(string self) internal returns (slice) {
        uint ptr;
        assembly {
            ptr := add(self, 0x20)
        }
        return slice(bytes(self).length, ptr);
    }

    /**
     * @dev Returns the length of a null-terminated bytes32 string.
     * @param self The value to find the length of.
     * @return The length of the string, from 0 to 32.
     */
    function len(bytes32 self) internal returns (uint) {
        uint ret;
        if (self == 0)
            return 0;
        if (self & 0xffffffffffffffffffffffffffffffff == 0) {
            ret += 16;
            self = bytes32(uint(self) / 0x100000000000000000000000000000000);
        }
        if (self & 0xffffffffffffffff == 0) {
            ret += 8;
            self = bytes32(uint(self) / 0x10000000000000000);
        }
        if (self & 0xffffffff == 0) {
            ret += 4;
            self = bytes32(uint(self) / 0x100000000);
        }
        if (self & 0xffff == 0) {
            ret += 2;
            self = bytes32(uint(self) / 0x10000);
        }
        if (self & 0xff == 0) {
            ret += 1;
        }
        return 32 - ret;
    }

    /**
     * @dev Returns a slice containing the entire bytes32, interpreted as a
     *      null-termintaed utf-8 string.
     * @param self The bytes32 value to convert to a slice.
     * @return A new slice containing the value of the input argument up to the
     *         first null.
     */
    function toSliceB32(bytes32 self) internal returns (slice ret) {
        // Allocate space for `self` in memory, copy it there, and point ret at it
        assembly {
            let ptr := mload(0x40)
            mstore(0x40, add(ptr, 0x20))
            mstore(ptr, self)
            mstore(add(ret, 0x20), ptr)
        }
        ret._len = len(self);
    }

    /**
     * @dev Returns a new slice containing the same data as the current slice.
     * @param self The slice to copy.
     * @return A new slice containing the same data as `self`.
     */
    function copy(slice self) internal returns (slice) {
        return slice(self._len, self._ptr);
    }

    /**
     * @dev Copies a slice to a new string.
     * @param self The slice to copy.
     * @return A newly allocated string containing the slice's text.
     */
    function toString(slice self) internal returns (string) {
        var ret = new string(self._len);
        uint retptr;
        assembly { retptr := add(ret, 32) }

        memcpy(retptr, self._ptr, self._len);
        return ret;
    }

    /**
     * @dev Returns the length in runes of the slice. Note that this operation
     *      takes time proportional to the length of the slice; avoid using it
     *      in loops, and call `slice.empty()` if you only need to know whether
     *      the slice is empty or not.
     * @param self The slice to operate on.
     * @return The length of the slice in runes.
     */
    function len(slice self) internal returns (uint) {
        // Starting at ptr-31 means the LSB will be the byte we care about
        var ptr = self._ptr - 31;
        var end = ptr + self._len;
        for (uint len = 0; ptr < end; len++) {
            uint8 b;
            assembly { b := and(mload(ptr), 0xFF) }
            if (b < 0x80) {
                ptr += 1;
            } else if(b < 0xE0) {
                ptr += 2;
            } else if(b < 0xF0) {
                ptr += 3;
            } else if(b < 0xF8) {
                ptr += 4;
            } else if(b < 0xFC) {
                ptr += 5;
            } else {
                ptr += 6;
            }
        }
        return len;
    }

    /**
     * @dev Returns true if the slice is empty (has a length of 0).
     * @param self The slice to operate on.
     * @return True if the slice is empty, False otherwise.
     */
    function empty(slice self) internal returns (bool) {
        return self._len == 0;
    }

    /**
     * @dev Returns a positive number if `other` comes lexicographically after
     *      `self`, a negative number if it comes before, or zero if the
     *      contents of the two slices are equal. Comparison is done per-rune,
     *      on unicode codepoints.
     * @param self The first slice to compare.
     * @param other The second slice to compare.
     * @return The result of the comparison.
     */
    function compare(slice self, slice other) internal returns (int) {
        uint shortest = self._len;
        if (other._len < self._len)
            shortest = other._len;

        var selfptr = self._ptr;
        var otherptr = other._ptr;
        for (uint idx = 0; idx < shortest; idx += 32) {
            uint a;
            uint b;
            assembly {
                a := mload(selfptr)
                b := mload(otherptr)
            }
            if (a != b) {
                // Mask out irrelevant bytes and check again
                uint mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);
                var diff = (a & mask) - (b & mask);
                if (diff != 0)
                    return int(diff);
            }
            selfptr += 32;
            otherptr += 32;
        }
        return int(self._len) - int(other._len);
    }

    /**
     * @dev Returns true if the two slices contain the same text.
     * @param self The first slice to compare.
     * @param self The second slice to compare.
     * @return True if the slices are equal, false otherwise.
     */
    function equals(slice self, slice other) internal returns (bool) {
        return compare(self, other) == 0;
    }

    /**
     * @dev Extracts the first rune in the slice into `rune`, advancing the
     *      slice to point to the next rune and returning `self`.
     * @param self The slice to operate on.
     * @param rune The slice that will contain the first rune.
     * @return `rune`.
     */
    function nextRune(slice self, slice rune) internal returns (slice) {
        rune._ptr = self._ptr;

        if (self._len == 0) {
            rune._len = 0;
            return rune;
        }

        uint len;
        uint b;
        // Load the first byte of the rune into the LSBs of b
        assembly { b := and(mload(sub(mload(add(self, 32)), 31)), 0xFF) }
        if (b < 0x80) {
            len = 1;
        } else if(b < 0xE0) {
            len = 2;
        } else if(b < 0xF0) {
            len = 3;
        } else {
            len = 4;
        }

        // Check for truncated codepoints
        if (len > self._len) {
            rune._len = self._len;
            self._ptr += self._len;
            self._len = 0;
            return rune;
        }

        self._ptr += len;
        self._len -= len;
        rune._len = len;
        return rune;
    }

    /**
     * @dev Returns the first rune in the slice, advancing the slice to point
     *      to the next rune.
     * @param self The slice to operate on.
     * @return A slice containing only the first rune from `self`.
     */
    function nextRune(slice self) internal returns (slice ret) {
        nextRune(self, ret);
    }

    /**
     * @dev Returns the number of the first codepoint in the slice.
     * @param self The slice to operate on.
     * @return The number of the first codepoint in the slice.
     */
    function ord(slice self) internal returns (uint ret) {
        if (self._len == 0) {
            return 0;
        }

        uint word;
        uint len;
        uint div = 2 ** 248;

        // Load the rune into the MSBs of b
        assembly { word:= mload(mload(add(self, 32))) }
        var b = word / div;
        if (b < 0x80) {
            ret = b;
            len = 1;
        } else if(b < 0xE0) {
            ret = b & 0x1F;
            len = 2;
        } else if(b < 0xF0) {
            ret = b & 0x0F;
            len = 3;
        } else {
            ret = b & 0x07;
            len = 4;
        }

        // Check for truncated codepoints
        if (len > self._len) {
            return 0;
        }

        for (uint i = 1; i < len; i++) {
            div = div / 256;
            b = (word / div) & 0xFF;
            if (b & 0xC0 != 0x80) {
                // Invalid UTF-8 sequence
                return 0;
            }
            ret = (ret * 64) | (b & 0x3F);
        }

        return ret;
    }

    /**
     * @dev Returns the keccak-256 hash of the slice.
     * @param self The slice to hash.
     * @return The hash of the slice.
     */
    function keccak(slice self) internal returns (bytes32 ret) {
        assembly {
            ret := sha3(mload(add(self, 32)), mload(self))
        }
    }

    /**
     * @dev Returns true if `self` starts with `needle`.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return True if the slice starts with the provided text, false otherwise.
     */
    function startsWith(slice self, slice needle) internal returns (bool) {
        if (self._len < needle._len) {
            return false;
        }

        if (self._ptr == needle._ptr) {
            return true;
        }

        bool equal;
        assembly {
            let len := mload(needle)
            let selfptr := mload(add(self, 0x20))
            let needleptr := mload(add(needle, 0x20))
            equal := eq(sha3(selfptr, len), sha3(needleptr, len))
        }
        return equal;
    }

    /**
     * @dev If `self` starts with `needle`, `needle` is removed from the
     *      beginning of `self`. Otherwise, `self` is unmodified.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return `self`
     */
    function beyond(slice self, slice needle) internal returns (slice) {
        if (self._len < needle._len) {
            return self;
        }

        bool equal = true;
        if (self._ptr != needle._ptr) {
            assembly {
                let len := mload(needle)
                let selfptr := mload(add(self, 0x20))
                let needleptr := mload(add(needle, 0x20))
                equal := eq(sha3(selfptr, len), sha3(needleptr, len))
            }
        }

        if (equal) {
            self._len -= needle._len;
            self._ptr += needle._len;
        }

        return self;
    }

    /**
     * @dev Returns true if the slice ends with `needle`.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return True if the slice starts with the provided text, false otherwise.
     */
    function endsWith(slice self, slice needle) internal returns (bool) {
        if (self._len < needle._len) {
            return false;
        }

        var selfptr = self._ptr + self._len - needle._len;

        if (selfptr == needle._ptr) {
            return true;
        }

        bool equal;
        assembly {
            let len := mload(needle)
            let needleptr := mload(add(needle, 0x20))
            equal := eq(sha3(selfptr, len), sha3(needleptr, len))
        }

        return equal;
    }

    /**
     * @dev If `self` ends with `needle`, `needle` is removed from the
     *      end of `self`. Otherwise, `self` is unmodified.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return `self`
     */
    function until(slice self, slice needle) internal returns (slice) {
        if (self._len < needle._len) {
            return self;
        }

        var selfptr = self._ptr + self._len - needle._len;
        bool equal = true;
        if (selfptr != needle._ptr) {
            assembly {
                let len := mload(needle)
                let needleptr := mload(add(needle, 0x20))
                equal := eq(sha3(selfptr, len), sha3(needleptr, len))
            }
        }

        if (equal) {
            self._len -= needle._len;
        }

        return self;
    }

    // Returns the memory address of the first byte of the first occurrence of
    // `needle` in `self`, or the first byte after `self` if not found.
    function findPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private returns (uint) {
        uint ptr;
        uint idx;

        if (needlelen <= selflen) {
            if (needlelen <= 32) {
                // Optimized assembly for 68 gas per byte on short strings
                assembly {
                    let mask := not(sub(exp(2, mul(8, sub(32, needlelen))), 1))
                    let needledata := and(mload(needleptr), mask)
                    let end := add(selfptr, sub(selflen, needlelen))
                    ptr := selfptr
                    loop:
                    jumpi(exit, eq(and(mload(ptr), mask), needledata))
                    ptr := add(ptr, 1)
                    jumpi(loop, lt(sub(ptr, 1), end))
                    ptr := add(selfptr, selflen)
                    exit:
                }
                return ptr;
            } else {
                // For long needles, use hashing
                bytes32 hash;
                assembly { hash := sha3(needleptr, needlelen) }
                ptr = selfptr;
                for (idx = 0; idx <= selflen - needlelen; idx++) {
                    bytes32 testHash;
                    assembly { testHash := sha3(ptr, needlelen) }
                    if (hash == testHash)
                        return ptr;
                    ptr += 1;
                }
            }
        }
        return selfptr + selflen;
    }

    // Returns the memory address of the first byte after the last occurrence of
    // `needle` in `self`, or the address of `self` if not found.
    function rfindPtr(uint selflen, uint selfptr, uint needlelen, uint needleptr) private returns (uint) {
        uint ptr;

        if (needlelen <= selflen) {
            if (needlelen <= 32) {
                // Optimized assembly for 69 gas per byte on short strings
                assembly {
                    let mask := not(sub(exp(2, mul(8, sub(32, needlelen))), 1))
                    let needledata := and(mload(needleptr), mask)
                    ptr := add(selfptr, sub(selflen, needlelen))
                    loop:
                    jumpi(ret, eq(and(mload(ptr), mask), needledata))
                    ptr := sub(ptr, 1)
                    jumpi(loop, gt(add(ptr, 1), selfptr))
                    ptr := selfptr
                    jump(exit)
                    ret:
                    ptr := add(ptr, needlelen)
                    exit:
                }
                return ptr;
            } else {
                // For long needles, use hashing
                bytes32 hash;
                assembly { hash := sha3(needleptr, needlelen) }
                ptr = selfptr + (selflen - needlelen);
                while (ptr >= selfptr) {
                    bytes32 testHash;
                    assembly { testHash := sha3(ptr, needlelen) }
                    if (hash == testHash)
                        return ptr + needlelen;
                    ptr -= 1;
                }
            }
        }
        return selfptr;
    }

    /**
     * @dev Modifies `self` to contain everything from the first occurrence of
     *      `needle` to the end of the slice. `self` is set to the empty slice
     *      if `needle` is not found.
     * @param self The slice to search and modify.
     * @param needle The text to search for.
     * @return `self`.
     */
    function find(slice self, slice needle) internal returns (slice) {
        uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
        self._len -= ptr - self._ptr;
        self._ptr = ptr;
        return self;
    }

    /**
     * @dev Modifies `self` to contain the part of the string from the start of
     *      `self` to the end of the first occurrence of `needle`. If `needle`
     *      is not found, `self` is set to the empty slice.
     * @param self The slice to search and modify.
     * @param needle The text to search for.
     * @return `self`.
     */
    function rfind(slice self, slice needle) internal returns (slice) {
        uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr);
        self._len = ptr - self._ptr;
        return self;
    }

    /**
     * @dev Splits the slice, setting `self` to everything after the first
     *      occurrence of `needle`, and `token` to everything before it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and `token` is set to the entirety of `self`.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @param token An output parameter to which the first token is written.
     * @return `token`.
     */
    function split(slice self, slice needle, slice token) internal returns (slice) {
        uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
        token._ptr = self._ptr;
        token._len = ptr - self._ptr;
        if (ptr == self._ptr + self._len) {
            // Not found
            self._len = 0;
        } else {
            self._len -= token._len + needle._len;
            self._ptr = ptr + needle._len;
        }
        return token;
    }

    /**
     * @dev Splits the slice, setting `self` to everything after the first
     *      occurrence of `needle`, and returning everything before it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and the entirety of `self` is returned.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @return The part of `self` up to the first occurrence of `delim`.
     */
    function split(slice self, slice needle) internal returns (slice token) {
        split(self, needle, token);
    }

    /**
     * @dev Splits the slice, setting `self` to everything before the last
     *      occurrence of `needle`, and `token` to everything after it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and `token` is set to the entirety of `self`.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @param token An output parameter to which the first token is written.
     * @return `token`.
     */
    function rsplit(slice self, slice needle, slice token) internal returns (slice) {
        uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr);
        token._ptr = ptr;
        token._len = self._len - (ptr - self._ptr);
        if (ptr == self._ptr) {
            // Not found
            self._len = 0;
        } else {
            self._len -= token._len + needle._len;
        }
        return token;
    }

    /**
     * @dev Splits the slice, setting `self` to everything before the last
     *      occurrence of `needle`, and returning everything after it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and the entirety of `self` is returned.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @return The part of `self` after the last occurrence of `delim`.
     */
    function rsplit(slice self, slice needle) internal returns (slice token) {
        rsplit(self, needle, token);
    }

    /**
     * @dev Counts the number of nonoverlapping occurrences of `needle` in `self`.
     * @param self The slice to search.
     * @param needle The text to search for in `self`.
     * @return The number of occurrences of `needle` found in `self`.
     */
    function count(slice self, slice needle) internal returns (uint count) {
        uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len;
        while (ptr <= self._ptr + self._len) {
            count++;
            ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._len, needle._ptr) + needle._len;
        }
    }

    /**
     * @dev Returns True if `self` contains `needle`.
     * @param self The slice to search.
     * @param needle The text to search for in `self`.
     * @return True if `needle` is found in `self`, false otherwise.
     */
    function contains(slice self, slice needle) internal returns (bool) {
        return rfindPtr(self._len, self._ptr, needle._len, needle._ptr) != self._ptr;
    }

    /**
     * @dev Returns a newly allocated string containing the concatenation of
     *      `self` and `other`.
     * @param self The first slice to concatenate.
     * @param other The second slice to concatenate.
     * @return The concatenation of the two strings.
     */
    function concat(slice self, slice other) internal returns (string) {
        var ret = new string(self._len + other._len);
        uint retptr;
        assembly { retptr := add(ret, 32) }
        memcpy(retptr, self._ptr, self._len);
        memcpy(retptr + self._len, other._ptr, other._len);
        return ret;
    }

    /**
     * @dev Joins an array of slices, using `self` as a delimiter, returning a
     *      newly allocated string.
     * @param self The delimiter to use.
     * @param parts A list of slices to join.
     * @return A newly allocated string containing all the slices in `parts`,
     *         joined with `self`.
     */
    function join(slice self, slice[] parts) internal returns (string) {
        if (parts.length == 0)
            return "";

        uint len = self._len * (parts.length - 1);
        for(uint i = 0; i < parts.length; i++)
            len += parts[i]._len;

        var ret = new string(len);
        uint retptr;
        assembly { retptr := add(ret, 32) }

        for(i = 0; i < parts.length; i++) {
            memcpy(retptr, parts[i]._ptr, parts[i]._len);
            retptr += parts[i]._len;
            if (i < parts.length - 1) {
                memcpy(retptr, self._ptr, self._len);
                retptr += self._len;
            }
        }

        return ret;
    }
}


contract mortal {
    address owner;

    function mortal() {
        owner = msg.sender;
    }

    function kill() internal{
        suicide(owner);
    }
}

contract Pray4Prey is mortal, usingOraclize {
	using strings for *;
	
    /**the balances in wei being held by each player */
    mapping(address => uint128) winBalances;
    /**list of all players*/
    address[] public players;
    /** the number of players (may be != players.length, since players can leave the game)*/
    uint16 public numPlayers;
    
    /** animals[0] -> list of the owners of the animals of type 0, animals[1] animals type 1 etc (using a mapping instead of a multidimensional array for lower gas consumptions) */
    mapping(uint8 => address[]) animals;
    /** the cost of each animal type */
    uint128[] public costs;
    /** the value of each animal type (cost - fee), so it's not necessary to compute it each time*/
    uint128[] public values;
    /** internal  array of the probability factors, so it's not necessary to compute it each time*/
    uint8[] probabilityFactors;
    /** the fee to be paid each time an animal is bought in percent*/
    uint8[] public fees;

    /** the indices of the animals per type per player */
   // mapping(address => mapping(uint8 => uint16[])) animalIndices; 
  // mapping(address => mapping(uint8 => uint16)) numAnimalsXPlayerXType;
    
    /** total number of animals in the game 
    (!=sum of the lengths of the prey animals arrays, since those arrays contain holes) */
    uint16 public numAnimals;
    /** The maximum of animals allowed in the game */
    uint16 public maxAnimals;
    /** number of animals per player */
    mapping(address => uint8) numAnimalsXPlayer;
    /** number of animals per type */
    mapping(uint8 => uint16) numAnimalsXType;

    
    /** the query string getting the random numbers from oraclize**/
    string randomQuery;
    /** the timestamp of the next attack **/
    uint public nextAttackTimestamp;
    /** gas provided for oraclize callback (attack)**/
    uint32 public oraclizeGas;
    /** the id of the next oraclize callback*/
    bytes32 nextAttackId;
    
    
    /** is fired when new animals are purchased (who bought how many animals of which type?) */
    event newPurchase(address player, uint8 animalType, uint8 amount);
    /** is fired when a player leaves the game */
    event newExit(address player, uint256 totalBalance);
    /** is fired when an attack occures*/
    event newAttack();
    
    
    /** expected parameters: the costs per animal type and the game fee in percent 
    *   assumes that the cheapest animal is stored in [0]
    */
    function Pray4Prey(uint128[] animalCosts, uint8[] gameFees) {
        costs = animalCosts;
        fees = gameFees;
        for(uint8 i = 0; i< costs.length; i++){
            values.push(costs[i]-costs[i]/100*fees[i]);
            probabilityFactors.push(uint8(costs[costs.length-i-1]/costs[0]));
        }
        maxAnimals = 3000;
        randomQuery = "https://www.random.org/integers/?num=10&min=0&max=10000&col=1&base=10&format=plain&rnd=new";
        oraclizeGas=550000;
    }
    
     /** The fallback function runs whenever someone sends ether
        Depending of the value of the transaction the sender is either granted a prey or 
        the transaction is discarded and no ether accepted
        In the first case fees have to be paid*/
     function (){
         for(uint8 i = 0; i < costs.length; i++)
            if(msg.value==costs[i])
                addAnimals(i);
                
        if(msg.value==1000000000000000)
            exit();
        else
            throw;
            
     }
     
     /** buy animals of a given type 
     *  as many animals as possible are bought with msg.value, rest is added to the winBalance of the sender
     */
     function addAnimals(uint8 animalType){
        uint8 amount = uint8(msg.value/costs[animalType]);
        if(animalType >= costs.length || msg.value<costs[animalType] || numAnimalsXPlayer[msg.sender]+amount>50 || numAnimals+amount>=maxAnimals) throw;
        //if type exists, enough ether was transferred, the player doesn't posess to many animals already (else exit is too costly) and there are less than 10000 animals in the game
        if(numAnimalsXPlayer[msg.sender]==0)//new player
            addPlayer();
        for(uint8 j = 0; j<amount; j++){
            addAnimal(animalType);
        }
        numAnimals+=amount;
        numAnimalsXPlayer[msg.sender]+=amount;
        //numAnimalsXPlayerXType[msg.sender][animalType]+=amount;
        winBalances[msg.sender]+=uint128(msg.value*(100-fees[animalType])/100);
        newPurchase(msg.sender, animalType, j);
        
     }
     
     /**
     *  adds a single animal of the given type
     */
     function addAnimal(uint8 animalType) internal{
        if(numAnimalsXType[animalType]<animals[animalType].length)
            animals[animalType][numAnimalsXType[animalType]]=msg.sender;
        else
            animals[animalType].push(msg.sender);
        numAnimalsXType[animalType]++;
     }
     
  
     
     /**
      * adds an address to the list of players
      * before calling you need to check if the address is already in the game
      * */
     function addPlayer() internal{
        if(numPlayers<players.length)
            players[numPlayers]=msg.sender;
        else
            players.push(msg.sender);
        numPlayers++;
     }
     
     /**
      * removes a given address from the player array
      * */
     function deletePlayer(address playerAddress) internal{
         for(uint16 i  = 0; i < numPlayers; i++)
             if(players[i]==playerAddress){
                numPlayers--;
                players[i]=players[numPlayers];
                delete players[numPlayers];
                return;
             }
     }
     
     
     /** leave the game
      * pays out the sender's winBalance and removes him and his animals from the game
      * */
    function exit(){
    	cleanUp(msg.sender);//delete the animals
        newExit(msg.sender, winBalances[msg.sender]); //fire the event to notify the client
        if(!payout(msg.sender)) throw;
        delete winBalances[msg.sender];
        deletePlayer(msg.sender);
    }
    
    /**
     * Deletes the animals of a given player
     * */
    function cleanUp(address playerAddress) internal{
    	for(uint8 animalType = 0;  animalType< costs.length;  animalType++){//costs.length == num animal types
    	    if(numAnimalsXType[animalType]>0){
                for(uint16 i = 0; i < numAnimalsXType[animalType]; i++){
                    if(animals[animalType][i] == playerAddress){
                       replaceAnimal(animalType,i, true);
                    }
                }
    	    }
        }
        numAnimals-=numAnimalsXPlayer[playerAddress];
        delete numAnimalsXPlayer[playerAddress];
    }
    
    
    /**
     * Replaces the animal at the given index with the last animal in the array
     * */
    function replaceAnimal(uint8 animalType, uint16 index, bool exit) internal{
        if(exit){//delete all animals at the end of the array that belong to the same player
            while(animals[animalType][numAnimalsXType[animalType]-1]==animals[animalType][index]){
                numAnimalsXType[animalType]--;
                delete animals[animalType][numAnimalsXType[animalType]];
                if(numAnimalsXType[animalType]==index)
                    return;
            }
        }
        numAnimalsXType[animalType]--;
		animals[animalType][index]=animals[animalType][numAnimalsXType[animalType]];
		delete animals[animalType][numAnimalsXType[animalType]];//actually there's no need for the delete, since the index will not be accessed since it's higher than numAnimalsXType[animalType]
    }
    
    
    
    /**
     * pays out the given player and removes his fishes.
     * amount = winbalance + sum(fishvalues)
     * returns true if payout was successful
     * */
    function payout(address playerAddress) internal returns(bool){
        return playerAddress.send(winBalances[playerAddress]);
    }

    
    /**
     * manually triggers the attack. cannot be called afterwards, except
     * by the owner if and only if the attack wasn't launched as supposed, signifying
     * an error ocurred during the last invocation of oraclize, or there wasn't enough ether to pay the gas
     * */
    function triggerAttackManually(uint32 inseconds){
        if(!(msg.sender==owner && nextAttackTimestamp < now+300)) throw;
        triggerAttack(inseconds);
    }
    
    /**
     * sends a query to oraclize in order to get random numbers in 'inseconds' seconds
     */
    function triggerAttack(uint32 inseconds) internal{
    	nextAttackTimestamp = now+inseconds;
    	nextAttackId = oraclize_query(nextAttackTimestamp, "URL", randomQuery, oraclizeGas+6000*numPlayers);
    }
    
    /**
     * The actual predator attack.
     * The predator kills up to 10 animals, but in case there are less than 100 animals in the game up to 10% get eaten.
     * */
    function __callback(bytes32 myid, string result) {
        if (msg.sender != oraclize_cbAddress()||myid!=nextAttackId) throw; // just to be sure the calling address is the Oraclize authorized one and the callback is the expected one
        
        uint16[] memory ranges = new uint16[](costs.length+1);
        ranges[0] = 0;
        for(uint8 animalType = 0; animalType < costs.length; animalType ++){
            ranges[animalType+1] = ranges[animalType]+uint16(probabilityFactors[animalType]*numAnimalsXType[animalType]); 
        }     
        uint128 pot;
        uint16 random;        
        uint16 howmany = numAnimals<100?(numAnimals<10?1:numAnimals/10):10;//do not kill more than 10%, but at least one
        uint16[] memory randomNumbers = getNumbersFromString(result,"\n", howmany);
        for(uint8 i = 0; i < howmany; i++){
            random = mapToNewRange(randomNumbers[i], ranges[costs.length]);
            for(animalType = 0; animalType < costs.length; animalType ++)
                if (random < ranges[animalType+1]){
                    pot+= killAnimal(animalType, (random-ranges[animalType])/probabilityFactors[animalType]);
                    break;
                }
        }
        numAnimals-=howmany;
        newAttack();
        if(pot>uint128(oraclizeGas*tx.gasprice))
            distribute(uint128(pot-oraclizeGas*tx.gasprice));//distribute the pot minus the oraclize gas costs
        triggerAttack(timeTillNextAttack());
    }
    
    /**
     * the frequency of the shark attacks depends on the number of animals in the game. 
     * many animals -> many shark attacks
     * at least one attack in 24 hours
     * */
    function timeTillNextAttack() constant internal returns(uint32){
        return (86400/(1+numAnimals/100));
    }
    

    /**
     * kills the animal of the given type at the given index. 
     * */
    function killAnimal(uint8 animalType, uint16 index) internal returns(uint128){
        address preyOwner = animals[animalType][index];

        replaceAnimal(animalType,index,false);
        numAnimalsXPlayer[preyOwner]--;
        
        //numAnimalsXPlayerXType[preyOwner][animalType]--;
        //if the player still owns prey, the value of the animalType1 alone goes into the pot
        if(numAnimalsXPlayer[preyOwner]>0){
        	winBalances[preyOwner]-=values[animalType];
            return values[animalType];
        }
        //owner does not have anymore prey, his winBlanace goes into the pot
        else{
            uint128 bounty = winBalances[preyOwner];
            delete winBalances[preyOwner];
            deletePlayer(preyOwner);
            return bounty;
        }

    }
    
    
    /** distributes the given amount among the players depending on the number of fishes they possess*/
    function distribute(uint128 amount) internal{
        uint128 share = amount/numAnimals;
        for(uint16 i = 0; i < numPlayers; i++){
            winBalances[players[i]]+=share*numAnimalsXPlayer[players[i]];
        }
    }
    
    /**
     * allows the owner to collect the accumulated fees
     * sends the given amount to the owner's address if the amount does not exceed the
     * fees (cannot touch the players' balances) minus 100 finney (ensure that oraclize fees can be paid)
     * */
    function collectFees(uint128 amount){
        if(!(msg.sender==owner)) throw;
        uint collectedFees = getFees();
        if(amount + 100 finney < collectedFees){
            if(!owner.send(amount)) throw;
        }
    }
    
    /**
     * pays out the players and kills the game.
     * */
    function stop(){
        if(!(msg.sender==owner)) throw;
        for(uint16 i = 0; i< numPlayers; i++){
            payout(players[i]);
        }
        kill();
    }
    
    /**
     * adds a new animal type to the game
     * max. number of animal types: 100
     * the cost may not be lower than costs[0]
     * */
    function addAnimalType(uint128 cost, uint8 fee){
        if(!(msg.sender==owner)||cost<costs[0]||costs.length>=100) throw;
        costs.push(cost);
        fees.push(fee);
        values.push(cost/100*fee);
        probabilityFactors.push(uint8(cost/costs[0]));
    }
    
 
   
   /****************** GETTERS *************************/
    
    
    function getWinBalancesOf(address playerAddress) constant returns(uint128){
        return winBalances[playerAddress];
    }
    
    function getAnimals(uint8 animalType) constant returns(address[]){
        return animals[animalType];
    }
    
    function getFees() constant returns(uint){
        uint reserved = 0;
        for(uint16 j = 0; j< numPlayers; j++)
            reserved+=winBalances[players[j]];
        return address(this).balance - reserved;
    }

    function getNumAnimalsXType(uint8 animalType) constant returns(uint16){
        return numAnimalsXType[animalType];
    }
    
    function getNumAnimalsXPlayer(address playerAddress) constant returns(uint16){
        return numAnimalsXPlayer[playerAddress];
    }
    
   /* function getNumAnimalsXPlayerXType(address playerAddress, uint8 animalType) constant returns(uint16){
        return numAnimalsXPlayerXType[playerAddress][animalType];
    }
    */
    /****************** SETTERS *************************/
    
    function setOraclizeGas(uint32 newGas){
        if(!(msg.sender==owner)) throw;
    	oraclizeGas = newGas;
    }
    
    function setMaxAnimals(uint16 number){
        if(!(msg.sender==owner)) throw;
    	maxAnimals = number;
    }
    
    /************* HELPERS ****************/

    /**
     * maps a given number to the new range (old range 10000)
     * */
    function mapToNewRange(uint number, uint range) constant internal returns (uint16 randomNumber) {
        return uint16(number*range / 10000);
    }
    
    /**
     * converts a string of numbers being separated by a given delimiter into an array of numbers (#howmany) 
     */
     function getNumbersFromString(string s, string delimiter, uint16 howmany) constant internal returns(uint16[] numbers){
         strings.slice memory myresult = s.toSlice();
         strings.slice memory delim = delimiter.toSlice();
         numbers = new uint16[](howmany);
         for(uint8 i = 0; i < howmany; i++){
             numbers[i]= uint16(parseInt(myresult.split(delim).toString())); 
         }
         return numbers;
     }
    
}

Contract Security Audit

Contract ABI

[{"constant":false,"inputs":[],"name":"stop","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"inseconds","type":"uint32"}],"name":"triggerAttackManually","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"numAnimals","outputs":[{"name":"","type":"uint16"}],"type":"function"},{"constant":false,"inputs":[{"name":"myid","type":"bytes32"},{"name":"result","type":"string"}],"name":"__callback","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint128"}],"name":"collectFees","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"oraclizeGas","outputs":[{"name":"","type":"uint32"}],"type":"function"},{"constant":false,"inputs":[{"name":"animalType","type":"uint8"}],"name":"addAnimals","outputs":[],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"costs","outputs":[{"name":"","type":"uint128"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"fees","outputs":[{"name":"","type":"uint8"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"values","outputs":[{"name":"","type":"uint128"}],"type":"function"},{"constant":true,"inputs":[{"name":"animalType","type":"uint8"}],"name":"getNumAnimalsXType","outputs":[{"name":"","type":"uint16"}],"type":"function"},{"constant":true,"inputs":[{"name":"playerAddress","type":"address"}],"name":"getWinBalancesOf","outputs":[{"name":"","type":"uint128"}],"type":"function"},{"constant":false,"inputs":[{"name":"newGas","type":"uint32"}],"name":"setOraclizeGas","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"numPlayers","outputs":[{"name":"","type":"uint16"}],"type":"function"},{"constant":false,"inputs":[{"name":"number","type":"uint16"}],"name":"setMaxAnimals","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"maxAnimals","outputs":[{"name":"","type":"uint16"}],"type":"function"},{"constant":true,"inputs":[],"name":"getFees","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[{"name":"animalType","type":"uint8"}],"name":"getAnimals","outputs":[{"name":"","type":"address[]"}],"type":"function"},{"constant":false,"inputs":[],"name":"exit","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"cost","type":"uint128"},{"name":"fee","type":"uint8"}],"name":"addAnimalType","outputs":[],"type":"function"},{"constant":true,"inputs":[],"name":"nextAttackTimestamp","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"players","outputs":[{"name":"","type":"address"}],"type":"function"},{"constant":true,"inputs":[{"name":"playerAddress","type":"address"}],"name":"getNumAnimalsXPlayer","outputs":[{"name":"","type":"uint16"}],"type":"function"},{"inputs":[{"name":"animalCosts","type":"uint128[]"},{"name":"gameFees","type":"uint8[]"}],"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"player","type":"address"},{"indexed":false,"name":"animalType","type":"uint8"},{"indexed":false,"name":"amount","type":"uint8"}],"name":"newPurchase","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"player","type":"address"},{"indexed":false,"name":"totalBalance","type":"uint256"}],"name":"newExit","type":"event"},{"anonymous":false,"inputs":[],"name":"newAttack","type":"event"}]

60606040526040516129693803806129698339810160405280516080519082019101600060008054600160a060020a03191633179055600780548451808355600083905260026001929092019190910460008051602061294983398151915290810191906020870182156100b95791602002820160005b838211156100df57835183826101000a8154816001608060020a03021916908302179055509260200192601001602081600f01049283019260010302610076565b505b506101129291505b8082111561018e5780546001608060020a03191681556001016100c1565b80156100b75782816101000a8154906001608060020a030219169055601001602081600f010492830192600103026100df565b50508151600a8054828255600082905290916020601f9290920182900460008051602061292983398151915290810192860182156101945791602002820160005b838211156101b457835183826101000a81548160ff021916908302179055509260200192600101602081600001049283019260010302610153565b5090565b505b506101e19291505b8082111561018e57805460ff1916815560010161019c565b80156101925782816101000a81549060ff02191690556001016020816000010492830192600103026101b4565b5050600090505b60075460ff82161015610233576008805460018101808355828183801582901161033b57600101600290048160010160029004836000526020600020918201910161033b9190610490565b600b805463ffff00001916630bb8000017905560408051608081018252605a81527f68747470733a2f2f7777772e72616e646f6d2e6f72672f696e7465676572732f60208281019182527f3f6e756d3d3130266d696e3d30266d61783d313030303026636f6c3d31266261938301939093527f73653d313026666f726d61743d706c61696e26726e643d6e65770000000000006060830152600e8054600082905260b58255909360026001831615610100026000190190921691909104601f01047fbb7b4a454dc3493923482f07822329ed19e8244eff582cc204f8554c3620c3fd90810192607a015b8281111561048857825182600050559160200191906001019061031d565b50505091909060005260206000209060029182820401919006601002600a805460ff8616908110156100025760009190915260208082046000805160206129298339815191520191069054906101000a900460ff1660ff16606460076000508660ff1681548110156100025760009190915260028082046000805160206129498339815191520191066010029054906101000a90046001608060020a03166001608060020a0316040260076000508560ff1681548110156100025760009190915260028082046000805160206129498339815191520191066010029054906101000a90046001608060020a031603909190916101000a8154816001608060020a030219169083021790555050600960005080548060010182818154818355818115116104a457601f016020900481601f016020900483600052602060002091820191016104a49190610490565b506105599291505b8082111561018e5760008155600101610490565b5050509190906000526020600020906020918282040191900660078054600090811015610002578190528054600080516020612949833981519152546001608060020a0316919060ff8716810360001901908110156100025760009190915260028082046000805160206129498339815191520191066010029054906101000a90046001608060020a03166001608060020a031604909190916101000a81548160ff02191690830217905550506001016101e8565b50506010805463ffffffff1916620864701790555050506123aa8061057f6000396000f300606060405236156101115760e060020a600035046307da68f581146101745780631402f0311461019557806326195901146101cc57806327dc297e146101d957806328acb002146102cd5780633e9836c6146102f15780633ff8c9541461030057806349b3b29f146103f75780634acc79ed1461043b5780635e383d21146104885780636620ffd3146104de578063883dfaba1461050157806389ed0b301461052e57806397b2f556146105515780639ead14781461055e578063c49fef6614610581578063db8d55f114610594578063dc597b4714610603578063e9fad8ee14610682578063f4e6a70d1461073f578063f6b098f8146107ab578063f71d96cb146107b4578063fe1e079e146107e8575b61080f60005b60075460ff82161015610811576007805460ff83169081101561000257600091909152600280820460008051602061236a833981519152015491066010026101000a90046001608060020a03163414156108285761082881610307565b61080f60008054600160a060020a03908116339190911614610d2a57610002565b61080f600435600054600160a060020a0390811633919091161480156101c15750600f5461012c420190105b1515610d9557610002565b610838600b5461ffff1681565b60408051602060248035600481810135601f810185900485028601850190965285855261080f9581359591946044949293909201918190840183828082843750506040805160208181018352600080835283518083018552818152600154855160e060020a6338cc483102815295519a9c949b5091998a99508998508897509095508694610e3b9486948594600160a060020a0316936338cc4831938084019390829003018187876161da5a03f11561000257505060405151915050600160a060020a0381168214156119805761192860005b60006000612131731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed5b3b90565b61080f60043560008054600160a060020a0390811633919091161461146257610002565b61085060105463ffffffff1681565b61080f6004355b6000600060076000508360ff168154811015610002578183529054600280830460008051602061236a833981519152015492066010026101000a9091046001608060020a03163404925060ff841610158061039c57506007805460ff85169081101561000257600280820460008051602061236a833981519152015491066010026101000a90046001608060020a0316341090505b806103c95750600160a060020a0333166000908152600c6020526040902054603260ff9182168401909116115b806103ed5750600b5462010000810461ffff90811660ff8516928216929092011610155b15610a2d57610002565b6108696004356007805482908110156100025750600052600280820460008051602061236a833981519152015491066010026101000a90046001608060020a031681565b610886600435600a80548290811015610002575060005260208082047fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8015491066101000a900460ff1681565b610869600435600880548290811015610002575060005260028082047ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3015491066010026101000a90046001608060020a031681565b61083860043560ff81166000908152600d602052604090205461ffff165b919050565b610869600435600160a060020a0381166000908152600360205260409020546001608060020a03166104fc565b61080f600435600054600160a060020a039081163391909116146114bb57610002565b61083860055461ffff1681565b61080f600435600054600160a060020a039081163391909116146114cd57610002565b610838600b5462010000900461ffff1681565b61089d5b600080805b60055461ffff90811690821610156114e6576004805460039160009161ffff8516908110156100025760008051602061238a8339815191520154600160a060020a031682525060209190915260409020546001608060020a03169091019060010161059d565b6108af6004356040805160208181018352600080835260ff85168152600682528390208054845181840281018401909552808552929392909183018282801561067657602002820191906000526020600020905b8154600160a060020a0316815260019190910190602001808311610657575b505050505090506104fc565b61080f5b610b3a336000805b60075460ff831610156118075760ff82166000908152600d602052604081205461ffff16111561184a575060005b600d60005060008360ff16815260200190815260200160002060009054906101000a900461ffff1661ffff168161ffff16101561184a57600660205260406000208054600160a060020a038516919061ffff84169081101561000257600091825260209091200154600160a060020a0316141561185657611856828260016112ec565b61080f600435602435600054600160a060020a039081163391909116141580610792575060078054600090811015610002575260008051602061236a833981519152546001608060020a03908116908316105b806107a1575060075460649010155b156114f857610002565b61089d600f5481565b6108f9600435600480548290811015610002575060005260008051602061238a8339815191520154600160a060020a031681565b610838600435600160a060020a0381166000908152600c602052604090205460ff166104fc565b005b3466038d7ea4c68000141561083057610835610686565b600101610117565b610002565b50565b6040805161ffff929092168252519081900360200190f35b6040805163ffffffff9092168252519081900360200190f35b604080516001608060020a03929092168252519081900360200190f35b6040805160ff929092168252519081900360200190f35b60408051918252519081900360200190f35b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600f02600301f1509050019250505060405180910390f35b60408051600160a060020a03929092168252519081900360200190f35b600b805461ffff19811661ffff9190911660ff8581169190910191909117909155600160a060020a0333166000908152600c60205260409020805460ff1981169083168501179055600a80546064928616908110156100025760208082047fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8015460038252604060008190208054948490066101000a90920460ff908116870381163402969096046001608060020a038516016001608060020a031994909416939093179055815133600160a060020a031681528785169181019190915292841683820152517f715ef43dbedfc155b15b9b1b8dd4b5f30c4ec506e3c56da713df4c19c761d7a9928190036060019150a15b505050565b600160a060020a0333166000908152600c602052604081205460ff161415610aa357610aa360045460055461ffff1610156117185760055460048054339261ffff16908110156100025760009190915260008051602061238a833981519152018054600160a060020a0319169091179055611768565b5060005b8160ff168160ff16101561091657610b328360ff8116600090815260066020908152604080832054600d9092529091205461ffff1610156117815760ff81166000908152600660209081526040808320600d90925290912054815433929161ffff16908110156100025760009182526020909120018054600160a060020a03191690911790556117df565b600101610aa7565b600160a060020a0333166000818152600360209081526040805192819020549383526001608060020a03939093169082015281517f313c40939ea55b1e0d953726a58438e52664c3dcda25b209f6de87d741e7ebb6929181900390910190a1610be0335b600160a060020a03811660008181526003602052604080519082205491929183916001608060020a03919091169082818181858883f1935050505090506104fc565b1515610beb57610002565b33600160a060020a038116600090815260036020526040902080546001608060020a0319169055610d28905b60005b60055461ffff9081169082161015610d245781600160a060020a031660046000508261ffff1681548110156100025760009190915260008051602061238a8339815191520154600160a060020a0316141561185e576005805460001961ffff8281169190910161ffff1990921691909117918290556004805490929091169081101561000257815460008051602061238a8339815191529190910154600160a060020a0316919061ffff8416908110156100025760008051602061238a833981519152018054600160a060020a031916909217909155600554815461ffff91909116908110156100025760008051602061238a833981519152018054600160a060020a0319169055505b5050565b565b5060005b60055461ffff9081169082161015610d7b57610d8c60046000508261ffff1681548110156100025760009190915260008051602061238a8339815191520154600160a060020a0316610b9e565b610835600054600160a060020a0316ff5b50600101610d2e565b610835815b4263ffffffff821601600f819055604080518082018252600381527f55524c00000000000000000000000000000000000000000000000000000000006020828101919091528251600e805460026001821615610100026000190190911604601f8101849004840283018401909552848252611866959491929091908301828280156118975780601f1061186c57610100808354040283529160200191611897565b600160a060020a031633600160a060020a0316141580610e5d57506011548914155b15610e6757610002565b60405160075460010190805910610e7b5750595b90808252806020026020018201604052509650600087600081518110156100025750506020880181905295505b60075460ff87161015610f625760ff86166000818152600d60205260409020546009805461ffff929092169290918110156100025760009190915260208082047f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01548a519183066101000a900460ff1690920291899190811015610002579060200190602002015101878760010160ff1681518110156100025761ffff9290921660209283029091019091015260019590950194610ea8565b600b54606461ffff9190911610610f7a57600a610fa0565b600b54600a61ffff9190911610610f9d57600b54600a61ffff9190911604610fa0565b60015b604080518082018252600181527f0a00000000000000000000000000000000000000000000000000000000000000602082810191909152825180820184526000808252845180860186528181528084018290528551808701909652818652928501819052949750611042948d948993916119ff875b60408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b9150600090505b8261ffff168160ff1610156110a5576111fb828260ff168151811015610002579060200190602002015161ffff16886007600050805490508151811015610002579060200190602002015161ffff166127108282020492915050565b600b805461ffff19811661ffff919091168590031790556040517f2dad58729eca67877ad6cc8f3370e1acf1b19d425395f652bf91a7ed7b567b0890600090a160105463ffffffff163a026001608060020a03908116908616111561142c5760105461142c9063ffffffff163a026001608060020a03871603600b5461ffff166001608060020a0382160460005b60055461ffff9081169082161015610a285760048054600c9160009161ffff85169081101561000257815460008051602061238a833981519152820154600160a060020a03168452602094909452604083205460ff168602936003939291908110156100025790825260008051602061238a833981519152018190546101009190910a9004600160a060020a03168152602081019190915260400160002080546001608060020a031981166001608060020a0391909116909201919091179055600101611133565b6000965093505b60075460ff8716101561141857868660010160ff168151811015610002579060200190602002015161ffff168461ffff161015611420576114128660096000508860ff1681548110156100025760009190915260208082047f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0191069054906101000a900460ff1660ff16898960ff1681518110156100025790602001906020020151870361ffff160460ff8216600090815260066020526040812080548291829161ffff86169081101561000257908252602082200154600160a060020a03169150611c568585835b8015611d96575b60ff83166000908152600660205260409020805461ffff841690811015610002578154600083815260208082209093015460ff88168252600d9093526040902054600160a060020a0392909216929161ffff90811660001901169081101561000257906000526020600020900160009054906101000a9004600160a060020a0316600160a060020a03161415611d965760ff83166000908152600d60208181526040808420805461ffff19811661ffff918216600019011791829055600684529190942092909152815491921690811015610002579060005260206000209001600081546101009190910a600160a060020a03021916905560ff83166000908152600d602052604090205461ffff9081169083161415611ea057610a28565b94909401935b600101611049565b60019590950194611202565b61145261145d600b5462ffffff606461ffff928316046001019091166201518004165b90565b505050505050505050565b610d9a565b61146a610598565b9050808267016345785d8a0000016001608060020a03161015610d245760405160008054600160a060020a0316916001608060020a0385169082818181858883f193505050501515610d2457610002565b6010805463ffffffff19168217905550565b600b805462010000830263ffff00001990911617905550565b5030600160a060020a03163103919050565b6007805460018101808355828183801582901161154657600101600290048160010160029004836000526020600020918201910161154691905b808211156115bd5760008155600101611532565b505050600092835250602090912060028083049091018054919092066010026101000a8085026001608060020a039190910219909116179055600a80546001810180835582818380158290116115c157601f016020900481601f016020900483600052602060002091820191016115c19190611532565b5090565b505050600092835250602091829020828204018054929091066101000a60ff810219929092169183029190911790556008805460018101808355828183801582901161162e57600101600290048160010160029004836000526020600020918201910161162e9190611532565b5050506000928352602090922060028083049091019106601002815460646001608060020a038781169190910460ff8716026101009390930a9283029202191617905550600980546001810180835582818380158290116116b057601f016020900481601f016020900483600052602060002091820191016116b09190611532565b5050509190906000526020600020906020918282040191900660078054600090811015610002575260008051602061236a8339815191525482546101009290920a60ff8102199092166001608060020a03918216969091169590950402939093179092555050565b60048054600181018083558281838015829011611748578183600052602060002091820191016117489190611532565b5050506000928352506020909120018054600160a060020a031916331790555b6005805461ffff19811661ffff91909116600101179055565b60ff8116600090815260066020526040902080546001810180835582818380158290116117bf576000838152602090206117bf918101908301611532565b5050506000928352506020909120018054600160a060020a031916331790555b60ff166000908152600d60205260409020805461ffff811660010161ffff1991909116179055565b5050600160a060020a03166000908152600c602052604090208054600b805460ff9290921661ffff83160361ffff1992909216919091179055805460ff19169055565b6001919091019061068e565b6001016106bc565b600101610c1a565b60115550565b820191906000526020600020905b81548152906001019060200180831161187a57829003601f168201915b50506040805160055460105460015460e060020a6338cc4831028452935161ffff9283166117700290921663ffffffff91821601169550600094508493508392600160a060020a0316916338cc4831916004828101926020929190829003018187876161da5a03f11561000257505060405151915050600160a060020a038116821415611efd57611ea560006102ac565b50600160009054906101000a9004600160a060020a0316600160a060020a03166338cc48316040518160e060020a0281526004018090506020604051808303816000876161da5a03f115610002575050604051519150505b60028054600160a060020a031916821790819055604080517fc281d19e0000000000000000000000000000000000000000000000000000000081529051600160a060020a03929092169163c281d19e9160048181019260209290919082900301816000876161da5a03f11561000257505060405151925061144f915050565b9250611a0a86611015565b91508461ffff16604051805910611a1e5750595b818152602091820281019091016040529350600090505b8461ffff168160ff161015611ae857611af2611b1b611bd9858560408051808201909152600080825260208201526122138383836040805180820190915260008082526020828101829052855186820151865192870151612221939060008080808088871161231e57602087116123305760018760200360080260020a031980875116888b038a018a96505b818388511614611add576001870196819010611ac1578b8b0196505b505050839450612324565b5050509392505050565b848260ff1681518110156100025761ffff92909216602092830290910190910152600101611a35565b600061221a8260006040805160208101909152600090819052828180805b8351811015611bbb57603060f860020a028482815181101561000257016020015160f860020a9081900402600160f860020a03191610801590611ba65750603960f860020a028482815181101561000257016020015160f860020a9081900402600160f860020a03191611155b1561228a5781156122ea5785600014156122e2575b6000861115611bce57600a86900a909202915b509095945050505050565b60408051602081810183526000808352835191820184528082528451935192939192909190805910611c085750595b90808252806020026020018201604052509150602082019050612213818560200151866000015160005b6020821061226c57825184526020938401939290920191601f199190910190611c32565b600160a060020a0382166000908152600c60205260408120805460ff19811660ff918216600019011791829055161115611d53576008805460ff8716908110156100025760028082047ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee301546003602052604060002080546001608060020a031981169385066010026101000a9092046001608060020a0390811692169190910391909117905581548110156100025760009190915260028082047ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3015491066010026101000a90046001608060020a031692505b505092915050565b50600160a060020a038116600090815260036020526040902080546001608060020a031981169091556001608060020a0316611d8e82610c17565b809250611d4b565b60ff83166000908152600d60208181526040808420805461ffff19811661ffff9182166000190117918290556006845291909420929091528154919216908110156100025790600052602060002090016000905460ff8516600090815260066020526040902080546101009390930a909104600160a060020a03169161ffff851690811015610002579060005260206000209001600081546101009190910a928302600160a060020a0393909302191691909117905560ff83166000908152600660209081526040808320600d90925290912054815461ffff9091169081101561000257906000526020600020900160006101000a815490600160a060020a030219169055505050565b6112f3565b50600160009054906101000a9004600160a060020a0316600160a060020a03166338cc48316040518160e060020a0281526004018090506020604051808303816000876161da5a03f115610002575050604051519150505b60028054600160a060020a031916821790819055604080517f2ef3accc000000000000000000000000000000000000000000000000000000008152602481018790526004818101928352895160448301528951600160a060020a039490941693632ef3accc938b938a939192839260649290920191602087810192918291859183918691600091601f850104600f02600301f150905090810190601f168015611fba5780820380516001836020036101000a031916815260200191505b5093505050506020604051808303816000876161da5a03f11561000257505060405151925050670de0b6b3a76400003a8502018211156120035750600091505b50949350505050565b600260009054906101000a9004600160a060020a0316600160a060020a031663c51be90f83898989896040518660e060020a0281526004018085815260200180602001806020018481526020018381038352868181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156120a85780820380516001836020036101000a031916815260200191505b508381038252858181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156121015780820380516001836020036101000a031916815260200191505b50965050505050505060206040518083038185886185025a03f115610002575050604051519450611ffa92505050565b1115612166575060018054731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed600160a060020a0319919091161781556104fc565b6000612185739efbea6358bed926b293d2ce63a730d6d98d43dd6102c9565b11156121ba575060018054739efbea6358bed926b293d2ce63a730d6d98d43dd600160a060020a0319919091161781556104fc565b60006121d97320e12a1f859b3feae5fb2a0a32c18f5a65555bbf6102c9565b111561220b575060018054600160a060020a0319167320e12a1f859b3feae5fb2a0a32c18f5a65555bbf1781556104fc565b5060006104fc565b5092915050565b90506104fc565b6020868101805191860191909152805182038552865190519192500181141561224d5760008552612263565b8351835186519101900385528351810160208601525b50909392505050565b50825191516020919091036101000a60001901918216911916179052565b8381815181101561000257016020015160f860020a9081900402600160f860020a0319167f2e0000000000000000000000000000000000000000000000000000000000000014156122da57600191505b600101611b39565b600019909501945b600a83029250825060308482815181101561000257016020015160f860020a90819004810204909301602f190192506122da565b88880194505b50505050949350505050565b8686208894506000935091505b868903831161231e57508583208082141561235a57839450612324565b600193840193929092019161233d56a66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6888a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19bc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8a66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688

Deployed Bytecode

0x606060405236156101115760e060020a600035046307da68f581146101745780631402f0311461019557806326195901146101cc57806327dc297e146101d957806328acb002146102cd5780633e9836c6146102f15780633ff8c9541461030057806349b3b29f146103f75780634acc79ed1461043b5780635e383d21146104885780636620ffd3146104de578063883dfaba1461050157806389ed0b301461052e57806397b2f556146105515780639ead14781461055e578063c49fef6614610581578063db8d55f114610594578063dc597b4714610603578063e9fad8ee14610682578063f4e6a70d1461073f578063f6b098f8146107ab578063f71d96cb146107b4578063fe1e079e146107e8575b61080f60005b60075460ff82161015610811576007805460ff83169081101561000257600091909152600280820460008051602061236a833981519152015491066010026101000a90046001608060020a03163414156108285761082881610307565b61080f60008054600160a060020a03908116339190911614610d2a57610002565b61080f600435600054600160a060020a0390811633919091161480156101c15750600f5461012c420190105b1515610d9557610002565b610838600b5461ffff1681565b60408051602060248035600481810135601f810185900485028601850190965285855261080f9581359591946044949293909201918190840183828082843750506040805160208181018352600080835283518083018552818152600154855160e060020a6338cc483102815295519a9c949b5091998a99508998508897509095508694610e3b9486948594600160a060020a0316936338cc4831938084019390829003018187876161da5a03f11561000257505060405151915050600160a060020a0381168214156119805761192860005b60006000612131731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed5b3b90565b61080f60043560008054600160a060020a0390811633919091161461146257610002565b61085060105463ffffffff1681565b61080f6004355b6000600060076000508360ff168154811015610002578183529054600280830460008051602061236a833981519152015492066010026101000a9091046001608060020a03163404925060ff841610158061039c57506007805460ff85169081101561000257600280820460008051602061236a833981519152015491066010026101000a90046001608060020a0316341090505b806103c95750600160a060020a0333166000908152600c6020526040902054603260ff9182168401909116115b806103ed5750600b5462010000810461ffff90811660ff8516928216929092011610155b15610a2d57610002565b6108696004356007805482908110156100025750600052600280820460008051602061236a833981519152015491066010026101000a90046001608060020a031681565b610886600435600a80548290811015610002575060005260208082047fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8015491066101000a900460ff1681565b610869600435600880548290811015610002575060005260028082047ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3015491066010026101000a90046001608060020a031681565b61083860043560ff81166000908152600d602052604090205461ffff165b919050565b610869600435600160a060020a0381166000908152600360205260409020546001608060020a03166104fc565b61080f600435600054600160a060020a039081163391909116146114bb57610002565b61083860055461ffff1681565b61080f600435600054600160a060020a039081163391909116146114cd57610002565b610838600b5462010000900461ffff1681565b61089d5b600080805b60055461ffff90811690821610156114e6576004805460039160009161ffff8516908110156100025760008051602061238a8339815191520154600160a060020a031682525060209190915260409020546001608060020a03169091019060010161059d565b6108af6004356040805160208181018352600080835260ff85168152600682528390208054845181840281018401909552808552929392909183018282801561067657602002820191906000526020600020905b8154600160a060020a0316815260019190910190602001808311610657575b505050505090506104fc565b61080f5b610b3a336000805b60075460ff831610156118075760ff82166000908152600d602052604081205461ffff16111561184a575060005b600d60005060008360ff16815260200190815260200160002060009054906101000a900461ffff1661ffff168161ffff16101561184a57600660205260406000208054600160a060020a038516919061ffff84169081101561000257600091825260209091200154600160a060020a0316141561185657611856828260016112ec565b61080f600435602435600054600160a060020a039081163391909116141580610792575060078054600090811015610002575260008051602061236a833981519152546001608060020a03908116908316105b806107a1575060075460649010155b156114f857610002565b61089d600f5481565b6108f9600435600480548290811015610002575060005260008051602061238a8339815191520154600160a060020a031681565b610838600435600160a060020a0381166000908152600c602052604090205460ff166104fc565b005b3466038d7ea4c68000141561083057610835610686565b600101610117565b610002565b50565b6040805161ffff929092168252519081900360200190f35b6040805163ffffffff9092168252519081900360200190f35b604080516001608060020a03929092168252519081900360200190f35b6040805160ff929092168252519081900360200190f35b60408051918252519081900360200190f35b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600f02600301f1509050019250505060405180910390f35b60408051600160a060020a03929092168252519081900360200190f35b600b805461ffff19811661ffff9190911660ff8581169190910191909117909155600160a060020a0333166000908152600c60205260409020805460ff1981169083168501179055600a80546064928616908110156100025760208082047fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8015460038252604060008190208054948490066101000a90920460ff908116870381163402969096046001608060020a038516016001608060020a031994909416939093179055815133600160a060020a031681528785169181019190915292841683820152517f715ef43dbedfc155b15b9b1b8dd4b5f30c4ec506e3c56da713df4c19c761d7a9928190036060019150a15b505050565b600160a060020a0333166000908152600c602052604081205460ff161415610aa357610aa360045460055461ffff1610156117185760055460048054339261ffff16908110156100025760009190915260008051602061238a833981519152018054600160a060020a0319169091179055611768565b5060005b8160ff168160ff16101561091657610b328360ff8116600090815260066020908152604080832054600d9092529091205461ffff1610156117815760ff81166000908152600660209081526040808320600d90925290912054815433929161ffff16908110156100025760009182526020909120018054600160a060020a03191690911790556117df565b600101610aa7565b600160a060020a0333166000818152600360209081526040805192819020549383526001608060020a03939093169082015281517f313c40939ea55b1e0d953726a58438e52664c3dcda25b209f6de87d741e7ebb6929181900390910190a1610be0335b600160a060020a03811660008181526003602052604080519082205491929183916001608060020a03919091169082818181858883f1935050505090506104fc565b1515610beb57610002565b33600160a060020a038116600090815260036020526040902080546001608060020a0319169055610d28905b60005b60055461ffff9081169082161015610d245781600160a060020a031660046000508261ffff1681548110156100025760009190915260008051602061238a8339815191520154600160a060020a0316141561185e576005805460001961ffff8281169190910161ffff1990921691909117918290556004805490929091169081101561000257815460008051602061238a8339815191529190910154600160a060020a0316919061ffff8416908110156100025760008051602061238a833981519152018054600160a060020a031916909217909155600554815461ffff91909116908110156100025760008051602061238a833981519152018054600160a060020a0319169055505b5050565b565b5060005b60055461ffff9081169082161015610d7b57610d8c60046000508261ffff1681548110156100025760009190915260008051602061238a8339815191520154600160a060020a0316610b9e565b610835600054600160a060020a0316ff5b50600101610d2e565b610835815b4263ffffffff821601600f819055604080518082018252600381527f55524c00000000000000000000000000000000000000000000000000000000006020828101919091528251600e805460026001821615610100026000190190911604601f8101849004840283018401909552848252611866959491929091908301828280156118975780601f1061186c57610100808354040283529160200191611897565b600160a060020a031633600160a060020a0316141580610e5d57506011548914155b15610e6757610002565b60405160075460010190805910610e7b5750595b90808252806020026020018201604052509650600087600081518110156100025750506020880181905295505b60075460ff87161015610f625760ff86166000818152600d60205260409020546009805461ffff929092169290918110156100025760009190915260208082047f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01548a519183066101000a900460ff1690920291899190811015610002579060200190602002015101878760010160ff1681518110156100025761ffff9290921660209283029091019091015260019590950194610ea8565b600b54606461ffff9190911610610f7a57600a610fa0565b600b54600a61ffff9190911610610f9d57600b54600a61ffff9190911604610fa0565b60015b604080518082018252600181527f0a00000000000000000000000000000000000000000000000000000000000000602082810191909152825180820184526000808252845180860186528181528084018290528551808701909652818652928501819052949750611042948d948993916119ff875b60408051808201825260008082526020918201528151808301909252825182529182019181019190915290565b9150600090505b8261ffff168160ff1610156110a5576111fb828260ff168151811015610002579060200190602002015161ffff16886007600050805490508151811015610002579060200190602002015161ffff166127108282020492915050565b600b805461ffff19811661ffff919091168590031790556040517f2dad58729eca67877ad6cc8f3370e1acf1b19d425395f652bf91a7ed7b567b0890600090a160105463ffffffff163a026001608060020a03908116908616111561142c5760105461142c9063ffffffff163a026001608060020a03871603600b5461ffff166001608060020a0382160460005b60055461ffff9081169082161015610a285760048054600c9160009161ffff85169081101561000257815460008051602061238a833981519152820154600160a060020a03168452602094909452604083205460ff168602936003939291908110156100025790825260008051602061238a833981519152018190546101009190910a9004600160a060020a03168152602081019190915260400160002080546001608060020a031981166001608060020a0391909116909201919091179055600101611133565b6000965093505b60075460ff8716101561141857868660010160ff168151811015610002579060200190602002015161ffff168461ffff161015611420576114128660096000508860ff1681548110156100025760009190915260208082047f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af0191069054906101000a900460ff1660ff16898960ff1681518110156100025790602001906020020151870361ffff160460ff8216600090815260066020526040812080548291829161ffff86169081101561000257908252602082200154600160a060020a03169150611c568585835b8015611d96575b60ff83166000908152600660205260409020805461ffff841690811015610002578154600083815260208082209093015460ff88168252600d9093526040902054600160a060020a0392909216929161ffff90811660001901169081101561000257906000526020600020900160009054906101000a9004600160a060020a0316600160a060020a03161415611d965760ff83166000908152600d60208181526040808420805461ffff19811661ffff918216600019011791829055600684529190942092909152815491921690811015610002579060005260206000209001600081546101009190910a600160a060020a03021916905560ff83166000908152600d602052604090205461ffff9081169083161415611ea057610a28565b94909401935b600101611049565b60019590950194611202565b61145261145d600b5462ffffff606461ffff928316046001019091166201518004165b90565b505050505050505050565b610d9a565b61146a610598565b9050808267016345785d8a0000016001608060020a03161015610d245760405160008054600160a060020a0316916001608060020a0385169082818181858883f193505050501515610d2457610002565b6010805463ffffffff19168217905550565b600b805462010000830263ffff00001990911617905550565b5030600160a060020a03163103919050565b6007805460018101808355828183801582901161154657600101600290048160010160029004836000526020600020918201910161154691905b808211156115bd5760008155600101611532565b505050600092835250602090912060028083049091018054919092066010026101000a8085026001608060020a039190910219909116179055600a80546001810180835582818380158290116115c157601f016020900481601f016020900483600052602060002091820191016115c19190611532565b5090565b505050600092835250602091829020828204018054929091066101000a60ff810219929092169183029190911790556008805460018101808355828183801582901161162e57600101600290048160010160029004836000526020600020918201910161162e9190611532565b5050506000928352602090922060028083049091019106601002815460646001608060020a038781169190910460ff8716026101009390930a9283029202191617905550600980546001810180835582818380158290116116b057601f016020900481601f016020900483600052602060002091820191016116b09190611532565b5050509190906000526020600020906020918282040191900660078054600090811015610002575260008051602061236a8339815191525482546101009290920a60ff8102199092166001608060020a03918216969091169590950402939093179092555050565b60048054600181018083558281838015829011611748578183600052602060002091820191016117489190611532565b5050506000928352506020909120018054600160a060020a031916331790555b6005805461ffff19811661ffff91909116600101179055565b60ff8116600090815260066020526040902080546001810180835582818380158290116117bf576000838152602090206117bf918101908301611532565b5050506000928352506020909120018054600160a060020a031916331790555b60ff166000908152600d60205260409020805461ffff811660010161ffff1991909116179055565b5050600160a060020a03166000908152600c602052604090208054600b805460ff9290921661ffff83160361ffff1992909216919091179055805460ff19169055565b6001919091019061068e565b6001016106bc565b600101610c1a565b60115550565b820191906000526020600020905b81548152906001019060200180831161187a57829003601f168201915b50506040805160055460105460015460e060020a6338cc4831028452935161ffff9283166117700290921663ffffffff91821601169550600094508493508392600160a060020a0316916338cc4831916004828101926020929190829003018187876161da5a03f11561000257505060405151915050600160a060020a038116821415611efd57611ea560006102ac565b50600160009054906101000a9004600160a060020a0316600160a060020a03166338cc48316040518160e060020a0281526004018090506020604051808303816000876161da5a03f115610002575050604051519150505b60028054600160a060020a031916821790819055604080517fc281d19e0000000000000000000000000000000000000000000000000000000081529051600160a060020a03929092169163c281d19e9160048181019260209290919082900301816000876161da5a03f11561000257505060405151925061144f915050565b9250611a0a86611015565b91508461ffff16604051805910611a1e5750595b818152602091820281019091016040529350600090505b8461ffff168160ff161015611ae857611af2611b1b611bd9858560408051808201909152600080825260208201526122138383836040805180820190915260008082526020828101829052855186820151865192870151612221939060008080808088871161231e57602087116123305760018760200360080260020a031980875116888b038a018a96505b818388511614611add576001870196819010611ac1578b8b0196505b505050839450612324565b5050509392505050565b848260ff1681518110156100025761ffff92909216602092830290910190910152600101611a35565b600061221a8260006040805160208101909152600090819052828180805b8351811015611bbb57603060f860020a028482815181101561000257016020015160f860020a9081900402600160f860020a03191610801590611ba65750603960f860020a028482815181101561000257016020015160f860020a9081900402600160f860020a03191611155b1561228a5781156122ea5785600014156122e2575b6000861115611bce57600a86900a909202915b509095945050505050565b60408051602081810183526000808352835191820184528082528451935192939192909190805910611c085750595b90808252806020026020018201604052509150602082019050612213818560200151866000015160005b6020821061226c57825184526020938401939290920191601f199190910190611c32565b600160a060020a0382166000908152600c60205260408120805460ff19811660ff918216600019011791829055161115611d53576008805460ff8716908110156100025760028082047ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee301546003602052604060002080546001608060020a031981169385066010026101000a9092046001608060020a0390811692169190910391909117905581548110156100025760009190915260028082047ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3015491066010026101000a90046001608060020a031692505b505092915050565b50600160a060020a038116600090815260036020526040902080546001608060020a031981169091556001608060020a0316611d8e82610c17565b809250611d4b565b60ff83166000908152600d60208181526040808420805461ffff19811661ffff9182166000190117918290556006845291909420929091528154919216908110156100025790600052602060002090016000905460ff8516600090815260066020526040902080546101009390930a909104600160a060020a03169161ffff851690811015610002579060005260206000209001600081546101009190910a928302600160a060020a0393909302191691909117905560ff83166000908152600660209081526040808320600d90925290912054815461ffff9091169081101561000257906000526020600020900160006101000a815490600160a060020a030219169055505050565b6112f3565b50600160009054906101000a9004600160a060020a0316600160a060020a03166338cc48316040518160e060020a0281526004018090506020604051808303816000876161da5a03f115610002575050604051519150505b60028054600160a060020a031916821790819055604080517f2ef3accc000000000000000000000000000000000000000000000000000000008152602481018790526004818101928352895160448301528951600160a060020a039490941693632ef3accc938b938a939192839260649290920191602087810192918291859183918691600091601f850104600f02600301f150905090810190601f168015611fba5780820380516001836020036101000a031916815260200191505b5093505050506020604051808303816000876161da5a03f11561000257505060405151925050670de0b6b3a76400003a8502018211156120035750600091505b50949350505050565b600260009054906101000a9004600160a060020a0316600160a060020a031663c51be90f83898989896040518660e060020a0281526004018085815260200180602001806020018481526020018381038352868181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156120a85780820380516001836020036101000a031916815260200191505b508381038252858181518152602001915080519060200190808383829060006004602084601f0104600f02600301f150905090810190601f1680156121015780820380516001836020036101000a031916815260200191505b50965050505050505060206040518083038185886185025a03f115610002575050604051519450611ffa92505050565b1115612166575060018054731d3b2638a7cc9f2cb3d298a3da7a90b67e5506ed600160a060020a0319919091161781556104fc565b6000612185739efbea6358bed926b293d2ce63a730d6d98d43dd6102c9565b11156121ba575060018054739efbea6358bed926b293d2ce63a730d6d98d43dd600160a060020a0319919091161781556104fc565b60006121d97320e12a1f859b3feae5fb2a0a32c18f5a65555bbf6102c9565b111561220b575060018054600160a060020a0319167320e12a1f859b3feae5fb2a0a32c18f5a65555bbf1781556104fc565b5060006104fc565b5092915050565b90506104fc565b6020868101805191860191909152805182038552865190519192500181141561224d5760008552612263565b8351835186519101900385528351810160208601525b50909392505050565b50825191516020919091036101000a60001901918216911916179052565b8381815181101561000257016020015160f860020a9081900402600160f860020a0319167f2e0000000000000000000000000000000000000000000000000000000000000014156122da57600191505b600101611b39565b600019909501945b600a83029250825060308482815181101561000257016020015160f860020a90819004810204909301602f190192506122da565b88880194505b50505050949350505050565b8686208894506000935091505b868903831161231e57508583208082141561235a57839450612324565b600193840193929092019161233d56a66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6888a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b

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

000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000002c68af0bb140000000000000000000000000000000000000000000000000000058d15e1762800000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000003

-----Decoded View---------------
Arg [0] : animalCosts (uint128[]): 100000000000000000,200000000000000000,400000000000000000
Arg [1] : gameFees (uint8[]): 5,4,3

-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [3] : 000000000000000000000000000000000000000000000000016345785d8a0000
Arg [4] : 00000000000000000000000000000000000000000000000002c68af0bb140000
Arg [5] : 000000000000000000000000000000000000000000000000058d15e176280000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000003


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  ]
[ 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.