Contract 0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b

 

TxHash Block Age From To Value [TxFee]
0x32c5999e96b22177e3a0087b08b615b404ef1a45bda52485b13dedf4b1c2809f6228921173 days 4 hrs ago0xe8586a22833ceab9b2490ef4afa3b149459dcae7  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.000255816
0x490700ff266de944ba92b8868428896bef6af4cbcc96d7a9ff6b1e0b1b7ce2115308933330 days 21 hrs ago0x7d64f6b9966d9b0251b931ee243b6d2647e9ab00  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.000640195
0xba1d8a545dc42e9aa8a78190769fbbd84b05bbaf9555ace87776a90424a4078d5308918330 days 21 hrs ago0x7d64f6b9966d9b0251b931ee243b6d2647e9ab00  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.00014026
0x3b909f554bfd09162736a6a7ba4656b003e9d777eec7c36d06e5741299ed931a5308897330 days 21 hrs ago0x7d64f6b9966d9b0251b931ee243b6d2647e9ab00  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.00014026
0xfbfb10c2cef6f4fa368fe9a776a813920fc65144349f9f2d606d70c6197764145308882330 days 21 hrs ago0x7d64f6b9966d9b0251b931ee243b6d2647e9ab00  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.000084156
0xe2ab0b4045d25df3d436e17fe763fc749403c971d71d7a7e5aeba2a36dd3ce365166589354 days 23 hrs ago0x98fe9da45d4124dfec0d03bf7a41c1ecdea65c8a  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.00025682
0x26338a08bc6abe7d5e8161fbdedb71d8494326d8728027b907f612dc9d7655235046286375 days 7 hrs ago0x64d599b035dfa85e7e988e844522d3e00e01586f  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.004947347
0x5adb312d849379f2daa9d3f39830f5f3de26f0f805ecfa770685436e307fc6105046258375 days 7 hrs ago0x64d599b035dfa85e7e988e844522d3e00e01586f  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.000241306
0x63da36a86333bd2b7c07567d9d39ebf2fb2ad154b1b1948a49580689678caef35046243375 days 7 hrs ago0x64d599b035dfa85e7e988e844522d3e00e01586f  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.004946773
0xe53e04850512fed3a05247c0352b02a5d70c99fcccac9d1daab911223eb556fa5046185375 days 8 hrs ago0x64d599b035dfa85e7e988e844522d3e00e01586f  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.000121646
0x04f79214247f7977d7bd332c3c2818da3e2838c54c269722e2800a3d395f8f7f5045715375 days 9 hrs ago0x64d599b035dfa85e7e988e844522d3e00e01586f  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.000120988
0xd0d1d716ab840b3feab5cf5cecd8462aca16886c95783689f60ddbff99b753b75045426375 days 11 hrs ago0x64d599b035dfa85e7e988e844522d3e00e01586f  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.000121706
0x94cdf9279c6afc2d929cb440ec4468812f9609d53d5fd0d0d9753ec60f7fa24e5041554376 days 2 hrs ago0x64d599b035dfa85e7e988e844522d3e00e01586f  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.000481812
0xdacb2938c37ba2fe3d45c69f821b57a94bac071d8c72412a8d13397cd3c9e4a55041550376 days 2 hrs ago0x64d599b035dfa85e7e988e844522d3e00e01586f  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.000120439
0xcb9589628c58e8bb2fb476ef2af846e588d46a5a4220606509f3a383acf1cf175006160382 days 2 hrs ago0x47169f78750be1e6ec2deb2974458ac4f8751714  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.0006385353
0x0b8d972854bf64b24cd739c291303b718e81c2c9a928a9e2bcbbe5ca26a829725006152382 days 2 hrs ago0x47169f78750be1e6ec2deb2974458ac4f8751714  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.0006425388
0x2cc763b0856e96bfa3a4d6afe07ab9593c7da7f46b84cde3ca069a2a8f2935814976798387 days 1 hr ago0x0371678bd6734b85c3f35a0cb233ebb1477c6284  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.000129705
0xc182d1f6d5d1175a37a43eb85834540c16ea5cd2a620b3fa97195dfee787e2124797832418 days 15 hrs ago0x0b01ed3b1c7a9e546a75b3483a13c5999da0431b  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.002565297
0x58ab1f0c4391447b0920a86dd170ed917aeae8497628f301f8225f6656964ca24721462431 days 21 hrs ago0x9fcfe63108f0957aad1c6f2ed30270e8d35c6491  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.003825
0xc153159bb6033746214b30f3f78bfd9b38e591d22318f031f2085d7042a61d504690668437 days 5 hrs ago0x82d942401b6e8ea90cef03a14dd1926a68b7ba1b  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.0045694
0x4ee69de52195e552b192d994ac8fc7eb03b595585d2ee69e008a63daeb2517304688542437 days 14 hrs ago0x9fcfe63108f0957aad1c6f2ed30270e8d35c6491  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.00169776
0xd53f27eb4de955ebf5634e2df3868adf77aa08a5d1e49c93de3ddbae59f0fae44688514437 days 14 hrs ago0x9fcfe63108f0957aad1c6f2ed30270e8d35c6491  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.00130614
0xac10202aa660d7ea1129f3bcd1293683b12304ad89ce4a7527089500f71c32e64688415437 days 14 hrs ago0x9fcfe63108f0957aad1c6f2ed30270e8d35c6491  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.006
0x7f2c1bab17ac823220d4f3729bc673c4698e553a389dc4899fbbc1356c5b69914687938437 days 16 hrs ago0xe067f7df8d1a2418fc84ff2d1c76a115876bdbef  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.00609155
0xf1ade09cf99397772a7c1822038b21c6e31a9b91bbe4acf9a38951c34faad10d4687934437 days 16 hrs ago0xe067f7df8d1a2418fc84ff2d1c76a115876bdbef  IN   0xf97e0a5b616dffc913e72455fde9ea8bbe946a2b0 Ether0.0061077
[ Download CSV Export 

Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value
Warning: The compiled contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity), NestedArrayFunctionCallDecoder (medium-severity) Solidity Compiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: GeneScience
Compiler Version: v0.4.18+commit.9cf6e910
Optimization Enabled: Yes
Runs (Optimizer):  200


Contract Source Code
pragma solidity ^0.4.18;



/// @title GeneScience implements the trait calculation for new kitties
/// @author Axiom Zen, Dieter Shirley <[email protected]> (https://github.com/dete), Fabiano P. Soriani <[email protected]> (https://github.com/flockonus), Jordan Schalm <[email protected]> (https://github.com/jordanschalm)
contract GeneScience {
    bool public isGeneScience = true;

    uint256 internal constant maskLast8Bits = uint256(0xff);
    uint256 internal constant maskFirst248Bits = uint256(~0xff);

    function GeneScience() public {}

    /// @dev given a characteristic and 2 genes (unsorted) - returns > 0 if the genes ascended, that's the value
    /// @param trait1 any trait of that characteristic
    /// @param trait2 any trait of that characteristic
    /// @param rand is expected to be a 3 bits number (0~7)
    /// @return -1 if didnt match any ascention, OR a number from 0 to 30 for the ascended trait
    function _ascend(uint8 trait1, uint8 trait2, uint256 rand) internal pure returns(uint8 ascension) {
        ascension = 0;

        uint8 smallT = trait1;
        uint8 bigT = trait2;

        if (smallT > bigT) {
            bigT = trait1;
            smallT = trait2;
        }

        // https://github.com/axiomzen/cryptokitties/issues/244
        if ((bigT - smallT == 1) && smallT % 2 == 0) {

            // The rand argument is expected to be a random number 0-7.
            // 1st and 2nd tier: 1/4 chance (rand is 0 or 1)
            // 3rd and 4th tier: 1/8 chance (rand is 0)

            // must be at least this much to ascend
            uint256 maxRand;
            if (smallT < 23) maxRand = 1;
            else maxRand = 0;

            if (rand <= maxRand ) {
                ascension = (smallT / 2) + 16;
            }
        }
    }

    /// @dev given a number get a slice of any bits, at certain offset
    /// @param _n a number to be sliced
    /// @param _nbits how many bits long is the new number
    /// @param _offset how many bits to skip
    function _sliceNumber(uint256 _n, uint256 _nbits, uint256 _offset) private pure returns (uint256) {
        // mask is made by shifting left an offset number of times
        uint256 mask = uint256((2**_nbits) - 1) << _offset;
        // AND n with mask, and trim to max of _nbits bits
        return uint256((_n & mask) >> _offset);
    }

    /// @dev Get a 5 bit slice from an input as a number
    /// @param _input bits, encoded as uint
    /// @param _slot from 0 to 50
    function _get5Bits(uint256 _input, uint256 _slot) internal pure returns(uint8) {
        return uint8(_sliceNumber(_input, uint256(5), _slot * 5));
    }

    /// @dev Parse a kitten gene and returns all of 12 "trait stack" that makes the characteristics
    /// @param _genes kitten gene
    /// @return the 48 traits that composes the genetic code, logically divided in stacks of 4, where only the first trait of each stack may express
    function decode(uint256 _genes) public pure returns(uint8[]) {
        uint8[] memory traits = new uint8[](48);
        uint256 i;
        for(i = 0; i < 48; i++) {
            traits[i] = _get5Bits(_genes, i);
        }
        return traits;
    }

    /// @dev Given an array of traits return the number that represent genes
    function encode(uint8[] _traits) public pure returns (uint256 _genes) {
        _genes = 0;
        for(uint256 i = 0; i < 48; i++) {
            _genes = _genes << 5;
            // bitwise OR trait with _genes
            _genes = _genes | _traits[47 - i];
        }
        return _genes;
    }

    /// @dev return the expressing traits
    /// @param _genes the long number expressing cat genes
    function expressingTraits(uint256 _genes) public pure returns(uint8[12]) {
        uint8[12] memory express;
        for(uint256 i = 0; i < 12; i++) {
            express[i] = _get5Bits(_genes, i * 4);
        }
        return express;
    }

    /// @dev the function as defined in the breeding contract - as defined in CK bible
    function mixGenes(uint256 _genes1, uint256 _genes2, uint256 _targetBlock) public returns (uint256) {
        require(block.number > _targetBlock);

        // Try to grab the hash of the "target block". This should be available the vast
        // majority of the time (it will only fail if no-one calls giveBirth() within 256
        // blocks of the target block, which is about 40 minutes. Since anyone can call
        // giveBirth() and they are rewarded with ether if it succeeds, this is quite unlikely.)
        uint256 randomN = uint256(block.blockhash(_targetBlock));

        if (randomN == 0) {
            // We don't want to completely bail if the target block is no-longer available,
            // nor do we want to just use the current block's hash (since it could allow a
            // caller to game the random result). Compute the most recent block that has the
            // the same value modulo 256 as the target block. The hash for this block will
            // still be available, and – while it can still change as time passes – it will
            // only change every 40 minutes. Again, someone is very likely to jump in with
            // the giveBirth() call before it can cycle too many times.
            _targetBlock = (block.number & maskFirst248Bits) + (_targetBlock & maskLast8Bits);

            // The computation above could result in a block LARGER than the current block,
            // if so, subtract 256.
            if (_targetBlock >= block.number) _targetBlock -= 256;

            randomN = uint256(block.blockhash(_targetBlock));

            // DEBUG ONLY
            // assert(block.number != _targetBlock);
            // assert((block.number - _targetBlock) <= 256);
            // assert(randomN != 0);
        }

        // generate 256 bits of random, using as much entropy as we can from
        // sources that can't change between calls.
        randomN = uint256(keccak256(randomN, _genes1, _genes2, _targetBlock));
        uint256 randomIndex = 0;

        uint8[] memory genes1Array = decode(_genes1);
        uint8[] memory genes2Array = decode(_genes2);
        // All traits that will belong to baby
        uint8[] memory babyArray = new uint8[](48);
        // A pointer to the trait we are dealing with currently
        uint256 traitPos;
        // Trait swap value holder
        uint8 swap;
        // iterate all 12 characteristics
        for(uint256 i = 0; i < 12; i++) {
            // pick 4 traits for characteristic i
            uint256 j;
            // store the current random value
            uint256 rand;
            for(j = 3; j >= 1; j--) {
                traitPos = (i * 4) + j;

                rand = _sliceNumber(randomN, 2, randomIndex); // 0~3
                randomIndex += 2;

                // 1/4 of a chance of gene swapping forward towards expressing.
                if (rand == 0) {
                    // do it for parent 1
                    swap = genes1Array[traitPos];
                    genes1Array[traitPos] = genes1Array[traitPos - 1];
                    genes1Array[traitPos - 1] = swap;

                }

                rand = _sliceNumber(randomN, 2, randomIndex); // 0~3
                randomIndex += 2;

                if (rand == 0) {
                    // do it for parent 2
                    swap = genes2Array[traitPos];
                    genes2Array[traitPos] = genes2Array[traitPos - 1];
                    genes2Array[traitPos - 1] = swap;
                }
            }

        }

        // DEBUG ONLY - We should have used 72 2-bit slices above for the swapping
        // which will have consumed 144 bits.
        // assert(randomIndex == 144);

        // We have 256 - 144 = 112 bits of randomness left at this point. We will use up to
        // four bits for the first slot of each trait (three for the possible ascension, one
        // to pick between mom and dad if the ascension fails, for a total of 48 bits. The other
        // traits use one bit to pick between parents (36 gene pairs, 36 genes), leaving us
        // well within our entropy budget.

        // done shuffling parent genes, now let's decide on choosing trait and if ascending.
        // NOTE: Ascensions ONLY happen in the "top slot" of each characteristic. This saves
        //  gas and also ensures ascensions only happen when they're visible.
        for(traitPos = 0; traitPos < 48; traitPos++) {

            // See if this trait pair should ascend
            uint8 ascendedTrait = 0;

            // There are two checks here. The first is straightforward, only the trait
            // in the first slot can ascend. The first slot is zero mod 4.
            //
            // The second check is more subtle: Only values that are one apart can ascend,
            // which is what we check inside the _ascend method. However, this simple mask
            // and compare is very cheap (9 gas) and will filter out about half of the
            // non-ascending pairs without a function call.
            //
            // The comparison itself just checks that one value is even, and the other
            // is odd.
            if ((traitPos % 4 == 0) && (genes1Array[traitPos] & 1) != (genes2Array[traitPos] & 1)) {
                rand = _sliceNumber(randomN, 3, randomIndex);
                randomIndex += 3;

                ascendedTrait = _ascend(genes1Array[traitPos], genes2Array[traitPos], rand);
            }

            if (ascendedTrait > 0) {
                babyArray[traitPos] = uint8(ascendedTrait);
            } else {
                // did not ascend, pick one of the parent's traits for the baby
                // We use the top bit of rand for this (the bottom three bits were used
                // to check for the ascension itself).
                rand = _sliceNumber(randomN, 1, randomIndex);
                randomIndex += 1;

                if (rand == 0) {
                    babyArray[traitPos] = uint8(genes1Array[traitPos]);
                } else {
                    babyArray[traitPos] = uint8(genes2Array[traitPos]);
                }
            }
        }

        return encode(babyArray);
    }
}

Contract ABI
[{"constant":false,"inputs":[{"name":"_genes1","type":"uint256"},{"name":"_genes2","type":"uint256"},{"name":"_targetBlock","type":"uint256"}],"name":"mixGenes","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_traits","type":"uint8[]"}],"name":"encode","outputs":[{"name":"_genes","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"isGeneScience","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_genes","type":"uint256"}],"name":"decode","outputs":[{"name":"","type":"uint8[]"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"_genes","type":"uint256"}],"name":"expressingTraits","outputs":[{"name":"","type":"uint8[12]"}],"payable":false,"stateMutability":"pure","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}]

Contract Creation Code
60606040526000805460ff19166001179055341561001c57600080fd5b6107708061002b6000396000f30060606040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630d9f5aed81146100715780631597ee441461009f57806354c15b82146100ee57806361a769001461011557806377a74a201461017e575b600080fd5b341561007c57600080fd5b61008d6004356024356044356101cd565b60405190815260200160405180910390f35b34156100aa57600080fd5b61008d600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284375094965061055a95505050505050565b34156100f957600080fd5b61010161059d565b604051901515815260200160405180910390f35b341561012057600080fd5b61012b6004356105a6565b60405160208082528190810183818151815260200191508051906020019060200280838360005b8381101561016a578082015183820152602001610152565b505050509050019250505060405180910390f35b341561018957600080fd5b61019460043561061e565b604051808261018080838360005b838110156101ba5780820151838201526020016101a2565b5050505090500191505060405180910390f35b60008060006101da610709565b6101e2610709565b6101ea610709565b60008080808080438d90116101fe57600080fd5b8c409a508a151561022b5760ff8d1660ff194316019c50438d101515610226576101008d039c505b8c409a505b8a8f8f8f604051808581526020018481526020018381526020018281526020019450505050506040519081900390209a50600099506102698f6105a6565b98506102748e6105a6565b975060306040518059106102855750595b90808252806020026020018201604052509650600093505b600c8410156103ee57600392505b600183106103e35782846004020195506102c78b60028c610668565b915060028a0199508160001415610349578886815181106102e457fe5b9060200190602002015194508860018703815181106102ff57fe5b9060200190602002015189878151811061031557fe5b60ff909216602092830290910190910152848960001988018151811061033757fe5b60ff9092166020928302909101909101525b6103558b60028c610668565b915060028a01995081600014156103d75787868151811061037257fe5b90602001906020020151945087600187038151811061038d57fe5b906020019060200201518887815181106103a357fe5b60ff90921660209283029091019091015284886000198801815181106103c557fe5b60ff9092166020928302909101909101525b600019909201916102ab565b60019093019261029d565b600095505b603086101561053e5750600060048606158015610440575087868151811061041757fe5b9060200190602002015160011689878151811061043057fe5b9060200190602002015160011614155b15610491576104518b60038c610668565b915060038a01995061048e89878151811061046857fe5b9060200190602002015189888151811061047e57fe5b906020019060200201518461067e565b90505b60008160ff1611156104c057808787815181106104aa57fe5b60ff909216602092830290910190910152610533565b6104cc8b60018c610668565b915060018a01995081600014156104ff578886815181106104e957fe5b906020019060200201518787815181106104aa57fe5b87868151811061050b57fe5b9060200190602002015187878151811061052157fe5b60ff9092166020928302909101909101525b6001909501946103f3565b6105478761055a565b9f9e505050505050505050505050505050565b6000805b60308110156105975760209091029082602f8290038151811061057d57fe5b9060200190602002015160ff16919091179060010161055e565b50919050565b60005460ff1681565b6105ae610709565b6105b6610709565b600060306040518059106105c75750595b90808252806020026020018201604052509150600090505b6030811015610617576105f284826106f1565b8282815181106105fe57fe5b60ff9092166020928302909101909101526001016105df565b5092915050565b61062661071b565b61062e61071b565b60005b600c8110156106175761064784826004026106f1565b8282600c811061065357fe5b60ff9092166020929092020152600101610631565b600290810a91900a600019018102919091160490565b600083838260ff8083169084161115610698578691508592505b82820360ff1660011480156106b65750600260ff84160660ff166000145b156106e75760178360ff1610156106cf575060016106d3565b5060005b8085116106e757600260ff84160460100193505b5050509392505050565b600061070283600584600502610668565b9392505050565b60206040519081016040526000815290565b610180604051908101604052600c815b60008152600019909101906020018161072b57905050905600a165627a7a7230582002483cc8ee323961b70a731235c3564df45a0ae6eb45983dc9e88e1c380635780029


   Swarm Source:
bzzr://02483cc8ee323961b70a731235c3564df45a0ae6eb45983dc9e88e1c38063578
Block Age transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.