Contract Overview |  GU_LegendaryPackThree
Balance: 0 Ether
Ether Value: $0
Transactions: 271 txns
Misc:
Address Watch: Add To Watch List
Contract Creator: 0xbea8c2f97fa34dc1cfdd7acbdc8226fb1c8c7473at txn 0xed7de89df0c669933ab6162c823e2bab6b8a8b27c578b25fc1ff4aa47933c3c0
 Latest 25 transactions from a total of 271 transactions

TxHash Age From To Value [TxFee]
0x376f5d4d02c02c338b02bc170eb815f303ff2988402f060d7b7722a34ee8ea7b55 days 21 hrs ago0x98f260fad74083c1e5206b0230abadb071d465ce  IN   GU_LegendaryPackThree0 Ether0.000328489
0x644250c926045c5359105182bd3cf86055455ceb35327e4a1afbb47a599dec5255 days 21 hrs ago0x70f4f47d9617b457c7b84346a10858b615b154be  IN   GU_LegendaryPackThree0 Ether0.000328489
0x2ba95e42be6a27c175b901483e10f6e7b0c2062bb39bb87d4e0abf16bb2caea355 days 21 hrs ago0xcc0ae29222f3af1075989ece85862f5f67b4a3ab  IN   GU_LegendaryPackThree0 Ether0.000328489
0x05e8371c99edacaa71e3c227f9ed0fe0a17fdef1435ad3abe5dd7f04df60582855 days 21 hrs ago0x77e20669bd11a2dade44b98f30a0a72cb87ec52b  IN   GU_LegendaryPackThree0 Ether0.000328489
0x8791913d57c977642100b57c2111967b86753c1bcb28297df9b291c88f4dfe6155 days 21 hrs ago0xcc0ae29222f3af1075989ece85862f5f67b4a3ab  IN   GU_LegendaryPackThree0 Ether0.000328489
0x2d475780c776e78decec244ad80bfce17fdefa4f882c41c7a173c405abbdf6e855 days 21 hrs ago0xb4e88af27ad8eb4d86251e718fdda92a2a6ab5bb  IN   GU_LegendaryPackThree0 Ether0.000328489
0x0af58bb5949cd39ba8136f4d3c0ba4d02160bfea337e203e8ddd438e1ea7e15655 days 21 hrs ago0xeb38a654c85464c6a9d8c69abb628676658e4676  IN   GU_LegendaryPackThree0 Ether0.000281562
0xfc5038ac342f87627f0a080c9e285abe0e0c0a61d93b78cbfce7ca79b1b6594b55 days 21 hrs ago0xefde29777a33ace296e264db2257702246a3ca2e  IN   GU_LegendaryPackThree0 Ether0.000281562
0x01b99d206368b62e36c03173f64f271caef8f09697a45df206493689b39b13b855 days 21 hrs ago0x56b227f911de9fe90ca042fa95c4c8cee27326b9  IN   GU_LegendaryPackThree0 Ether0.000281562
0x635f70692d51cad7a0d53dbaed054ced1ea16b0db2a8abb691d5136a4aa37e0255 days 21 hrs ago0xaa10a5a0944c01b09ef3efd52b0f241ece6886af  IN   GU_LegendaryPackThree0 Ether0.000281562
0xce3b7e1a00cf7836f6649a9b9072a394a27505608d13dc4a3ab87be489578a2555 days 21 hrs ago0xcc0ae29222f3af1075989ece85862f5f67b4a3ab  IN   GU_LegendaryPackThree0 Ether0.000281562
0xa71d236b36bfe825d2653b19570873370016f1d282e6d7994164943d04e662ed55 days 21 hrs ago0xf91757e38b3ee64ad16025014c221c00aa026f31  IN   GU_LegendaryPackThree0 Ether0.000281562
0x6da8dccf3dc4ad0c489122e6308cb95d61fa4f0610fa25c92317d9aa2973fd8b55 days 21 hrs ago0x4e93abcf7787d9007bc987e49ff9513c31541291  IN   GU_LegendaryPackThree0 Ether0.000281562
0x36c879e51c970519074638e4fda4251071a89262bda0da64c2cc52cce60c925d55 days 21 hrs ago0xeb38a654c85464c6a9d8c69abb628676658e4676  IN   GU_LegendaryPackThree0 Ether0.000281562
0xe74cd5bae0021b0c1e4eabac52bf0ca13a88b1882045aad77e4fa2ee6760038b55 days 21 hrs ago0xf6830759e8d0a10ac71bb61a39238877793f4983  IN   GU_LegendaryPackThree0 Ether0.000281562
0xf4b839b9c761e97e15402a3732fe90d893962b6474c4e7bdb99945629558216955 days 21 hrs ago0x4e93abcf7787d9007bc987e49ff9513c31541291  IN   GU_LegendaryPackThree0 Ether0.000281562
0xf2b12a69d482146522307af1678f3d20b5747151214c2a5d53f1345e543c34f255 days 21 hrs ago0x6c177ae59e313a1ac3f203854c2a7da28759e605  IN   GU_LegendaryPackThree0 Ether0.000281562
0x12e333e747b2c353fa65e51d87173fe80df0ae253269c2c16fb0fb829f3df33255 days 21 hrs ago0x6c177ae59e313a1ac3f203854c2a7da28759e605  IN   GU_LegendaryPackThree0 Ether0.000281562
0x567fb40ddcb818924b13b22f0ab59d9974f603b061eaeb6c295ebf39513f2dc555 days 21 hrs ago0x3d9e03c19b9103b7a1bf64780b30a91a19c544df  IN   GU_LegendaryPackThree0 Ether0.000281562
0x8dd44497b62a14457ae911b2334239e065fc0f5c6f9d4e0be865400f8962488b55 days 21 hrs ago0x62cb5d92b491d4f921844e5d787041225b87876d  IN   GU_LegendaryPackThree0 Ether0.000281562
0xb708c1f393656c3644eddee40c5054a08ee4f9606e72d5e1b9ef9ba8af0c162a55 days 21 hrs ago0x88825f7128693d20e86fe6e6ab288fa7690881a9  IN   GU_LegendaryPackThree0 Ether0.00033083535
0x7c509fe785e9750775025caa084592e4bc08cf4da1607c51de540b4cee64875455 days 21 hrs ago0x64e6d553a4a071a1133ba02d74f1d84013861177  IN   GU_LegendaryPackThree0 Ether0.00033083535
0x305ae344588deb65f3d263aa93a1f641002158824708d36a0b3b1f1a5e748a4755 days 21 hrs ago0xbdb1b430f194b6f5eb161948dfb15c07836889f4  IN   GU_LegendaryPackThree0 Ether0.00033083535
0xab014b8aff10c9aa0e9cc4010dcd0d1249540a18325d3770eeb00ae9799a4ff455 days 21 hrs ago0x21ff1a0d747b369fea618fdb30d9ffbbe7aa8e4c  IN   GU_LegendaryPackThree0 Ether0.00033083535
0xf99e93e635e48236426fb21fb94e7c4af240799b65c9384c1b2ad63cfb2ade6856 days 32 mins ago0x8b5f5bae3ecb49a9b65f0f3d6e52cf9d98678bd4  IN   GU_LegendaryPackThree0 Ether0.000316310326
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Latest 25 Internal Txns, Click here To View More View All
ParentTxHash Block Age From To Value
0x06bcbe5067205bebe76f3d1451d39fff2d02a80556f01e8f2f9e2957af7dfecf6007486184 days 4 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.10192 Ether
0xa2eb578356705c83fa2d268c59b9544dd0c8d3bb92fcd48190338df6bfd876c76006809184 days 7 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.1008 Ether
0xcc91b43b4b4dc2d3b119afabd5de47b56483d7479275ac9adfd9b24cfb6dc3985974872189 days 18 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.0952 Ether
0x8311ce6d238971a4d3cdad6d55d7fa2284154a4d894807c979b90ee3d5d7f2d95974801189 days 18 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.0952 Ether
0x959bc39bf992806fc628ac0d478db9516594bcf7e7bb9e1fd02c3395b75133e05974381189 days 20 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.0952 Ether
0xebe54657f78873532229d7c5e899b1620a2440ca27d98746f6cbf2eecc2bf8905974334189 days 20 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.0952 Ether
0x1b592ae9fc572c09115944c2d4934fb2e16472e59d604d58c1d8e1f95d0336455974090189 days 21 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.0952 Ether
0xcdf1a58da7dcd8d83904db91107ca65f9521d0a1ef1442501a886e22348376f45973977189 days 21 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.0952 Ether
0x143f3ab6227c4d12f64ff48aa9ee32a346ae066e7e30f9b9ac6e3062a6f38fb95973821189 days 22 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.5712 Ether
0xfbf745a4f1bcf13d392b26e8ece90c9b62d744c40fb383ca8507313969a563785973708189 days 22 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.08568 Ether
0xfbf745a4f1bcf13d392b26e8ece90c9b62d744c40fb383ca8507313969a563785973708189 days 22 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x7e1dcf785f0353bf657c38ab7865c1f184efe2080.00952 Ether
0xc56b378797029b532127ce588bf9de74f86649401aa0c6912025b30038f9e0eb5973379190 days 16 mins ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.5712 Ether
0x2b9f14cc504c2b62bd822de7230f46cd44901dede6ee92509dcefd5004cc7c965973304190 days 35 mins ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.0952 Ether
0x12424a9a56cb7cc866c4962ec38589a3ed4a76cdb3472eac716239046d5fd8305973291190 days 38 mins ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.0952 Ether
0x575c664c254e0ed99b5cf814effd0976c94a88c92fc5cca078f56972ff60e3055973007190 days 1 hr ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.08568 Ether
0x575c664c254e0ed99b5cf814effd0976c94a88c92fc5cca078f56972ff60e3055973007190 days 1 hr ago0x80b3075410ee52c520dd203f60206f633d27a1090xb94f8a4c5542279ef7fe2b9f6df8721b01e57fd90.00952 Ether
0x1caa6532a5fed7cbb07686b1ac62938a81f396cd6e3159cba5e19937195a37c45972997190 days 1 hr ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.0952 Ether
0x2e9a7cfeff7c7238b49da98e2f332670763be231daad8661cb8d6c8141d5154b5972852190 days 2 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.51408 Ether
0x2e9a7cfeff7c7238b49da98e2f332670763be231daad8661cb8d6c8141d5154b5972852190 days 2 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x30558d6e343f2044ac04928cdfe6e75f4bd1a0520.05712 Ether
0xeca03416a235ec1c174563ecba956a1f751e5206ab4ff384371ea3a920b275b65972849190 days 2 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.51408 Ether
0xeca03416a235ec1c174563ecba956a1f751e5206ab4ff384371ea3a920b275b65972849190 days 2 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x30558d6e343f2044ac04928cdfe6e75f4bd1a0520.05712 Ether
0x37a0cc96d7523f079b31d8db2c818818871edfeefb0cb30b3837e3e7aa0792915972626190 days 3 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.5712 Ether
0xac2bec06ad8f72c32abe5b2d37388ee395c07f67b3fd82bdee1282f1099c20ff5972535190 days 3 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.0952 Ether
0x967b6af87c08a88045b8d0994c2263ff9a3f768ecd617093169130a888191a7f5972478190 days 4 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.0952 Ether
0x526022a34283a360bd1e211c131d721b042d20266c20915a676eba298411b29a5972475190 days 4 hrs ago0x80b3075410ee52c520dd203f60206f633d27a1090x91b9d2835ad914bc1dcfe09bd1816febd04fd6890.0952 Ether
[ Download CSV Export  ] 
Warning: The Compiled Contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) SolidityCompiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: LegendaryPackThree
Compiler Text: v0.4.24+commit.e67f0147
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity 0.4.24;

contract Ownable {

    address public owner;

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

    function setOwner(address _owner) public onlyOwner {
        owner = _owner;
    }

    modifier onlyOwner {
        require(msg.sender == owner);
        _;
    }

}

contract Vault is Ownable { 

    function () public payable {

    }

    function getBalance() public view returns (uint) {
        return address(this).balance;
    }

    function withdraw(uint amount) public onlyOwner {
        require(address(this).balance >= amount);
        owner.transfer(amount);
    }

    function withdrawAll() public onlyOwner {
        withdraw(address(this).balance);
    }
}

contract ERC20 {

    event Approval(address indexed owner, address indexed spender, uint256 value);
    event Transfer(address indexed from, address indexed to, uint256 value);
    
    function allowance(address owner, address spender) public view returns (uint256);
    
    function transferFrom(address from, address to, uint256 value) public returns (bool);

    function approve(address spender, uint256 value) public returns (bool);

    function totalSupply() public view returns (uint256);

    function balanceOf(address who) public view returns (uint256);
    
    function transfer(address to, uint256 value) public returns (bool);
    
}

library SafeMath {

  /**
  * @dev Multiplies two numbers, throws on overflow.
  */
  function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
    // Gas optimization: this is cheaper than asserting 'a' not being zero, but the
    // benefit is lost if 'b' is also tested.
    // See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
    if (a == 0) {
      return 0;
    }

    c = a * b;
    assert(c / a == b);
    return c;
  }

  /**
  * @dev Integer division of two numbers, truncating the quotient.
  */
  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    // assert(b > 0); // Solidity automatically throws when dividing by 0
    // uint256 c = a / b;
    // assert(a == b * c + a % b); // There is no case in which this doesn't hold
    return a / b;
  }

  /**
  * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
  */
  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    assert(b <= a);
    return a - b;
  }

  /**
  * @dev Adds two numbers, throws on overflow.
  */
  function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
    c = a + b;
    assert(c >= a);
    return c;
  }
}

contract TournamentPass is ERC20, Ownable {

    using SafeMath for uint256;

    Vault vault;

    constructor(Vault _vault) public {
        vault = _vault;
    }

    mapping(address => uint256) balances;
    mapping (address => mapping (address => uint256)) internal allowed;
    address[] public minters;
    uint256 supply;
    uint mintLimit = 20000;
    
    function name() public view returns (string){
        return "GU Tournament Passes";
    }

    function symbol() public view returns (string) {
        return "PASS";
    }

    function addMinter(address minter) public onlyOwner {
        minters.push(minter);
    }

    function totalSupply() public view returns (uint256) {
        return supply;
    }

    function transfer(address _to, uint256 _value) public returns (bool) {
        require(_to != address(0));
        require(_value <= balances[msg.sender]);

        balances[msg.sender] = balances[msg.sender].sub(_value);
        balances[_to] = balances[_to].add(_value);
        emit Transfer(msg.sender, _to, _value);
        return true;
    }

    function balanceOf(address _owner) public view returns (uint256) {
        return balances[_owner];
    }

    function isMinter(address test) internal view returns (bool) {
        for (uint i = 0; i < minters.length; i++) {
            if (minters[i] == test) {
                return true;
            }
        }
        return false;
    }

    function mint(address to, uint amount) public returns (bool) {
        require(isMinter(msg.sender));
        if (amount.add(supply) > mintLimit) {
            return false;
        } 
        supply = supply.add(amount);
        balances[to] = balances[to].add(amount);
        emit Transfer(address(0), to, amount);
        return true;
    }

    function approve(address _spender, uint256 _value) public returns (bool) {
        allowed[msg.sender][_spender] = _value;
        emit Approval(msg.sender, _spender, _value);
        return true;
    }

    function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
        require(_to != address(0));
        require(_value <= balances[_from]);
        require(_value <= allowed[_from][msg.sender]);

        balances[_from] = balances[_from].sub(_value);
        balances[_to] = balances[_to].add(_value);
        allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
        emit Transfer(_from, _to, _value);
        return true;
    }

    function increaseApproval(address spender, uint256 addedValue) public returns (bool) {
        allowed[msg.sender][spender] = allowed[msg.sender][spender].add(addedValue);
        emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
        return true;
    }

    function decreaseApproval(address spender, uint256 subtractedValue) public returns (bool) {
        uint256 oldValue = allowed[msg.sender][spender];
        if (subtractedValue > oldValue) {
            allowed[msg.sender][spender] = 0;
        } else {
            allowed[msg.sender][spender] = oldValue.sub(subtractedValue);
        }
        emit Approval(msg.sender, spender, allowed[msg.sender][spender]);
        return true;
    }

    function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
        return allowed[_owner][_spender];
    }

    uint public price = 250 finney;

    function purchase(uint amount) public payable {
        
        require(msg.value >= price.mul(amount));
        require(supply.add(amount) <= mintLimit);

        supply = supply.add(amount);
        balances[msg.sender] = balances[msg.sender].add(amount);
        emit Transfer(address(0), msg.sender, amount);

        address(vault).transfer(msg.value);
    }

}

contract CappedVault is Vault { 

    uint public limit;
    uint withdrawn = 0;

    constructor() public {
        limit = 33333 ether;
    }

    function () public payable {
        require(total() + msg.value <= limit);
    }

    function total() public view returns(uint) {
        return getBalance() + withdrawn;
    }

    function withdraw(uint amount) public onlyOwner {
        require(address(this).balance >= amount);
        owner.transfer(amount);
        withdrawn += amount;
    }

}


contract PreviousInterface {

    function ownerOf(uint id) public view returns (address);

    function getCard(uint id) public view returns (uint16, uint16);

    function totalSupply() public view returns (uint);

    function burnCount() public view returns (uint);

}

contract Pausable is Ownable {
    
    event Pause();
    event Unpause();

    bool public paused = false;


    /**
    * @dev Modifier to make a function callable only when the contract is not paused.
    */
    modifier whenNotPaused() {
        require(!paused);
        _;
    }

    /**
    * @dev Modifier to make a function callable only when the contract is paused.
    */
    modifier whenPaused() {
        require(paused);
        _;
    }

    /**
    * @dev called by the owner to pause, triggers stopped state
    */
    function pause() onlyOwner whenNotPaused public {
        paused = true;
        emit Pause();
    }

    /**
    * @dev called by the owner to unpause, returns to normal state
    */
    function unpause() onlyOwner whenPaused public {
        paused = false;
        emit Unpause();
    }
}

contract Governable {

    event Pause();
    event Unpause();

    address public governor;
    bool public paused = false;

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

    function setGovernor(address _gov) public onlyGovernor {
        governor = _gov;
    }

    modifier onlyGovernor {
        require(msg.sender == governor);
        _;
    }

    /**
    * @dev Modifier to make a function callable only when the contract is not paused.
    */
    modifier whenNotPaused() {
        require(!paused);
        _;
    }

    /**
    * @dev Modifier to make a function callable only when the contract is paused.
    */
    modifier whenPaused() {
        require(paused);
        _;
    }

    /**
    * @dev called by the owner to pause, triggers stopped state
    */
    function pause() onlyGovernor whenNotPaused public {
        paused = true;
        emit Pause();
    }

    /**
    * @dev called by the owner to unpause, returns to normal state
    */
    function unpause() onlyGovernor whenPaused public {
        paused = false;
        emit Unpause();
    }

}

contract CardBase is Governable {


    struct Card {
        uint16 proto;
        uint16 purity;
    }

    function getCard(uint id) public view returns (uint16 proto, uint16 purity) {
        Card memory card = cards[id];
        return (card.proto, card.purity);
    }

    function getShine(uint16 purity) public pure returns (uint8) {
        return uint8(purity / 1000);
    }

    Card[] public cards;
    
}

contract CardProto is CardBase {

    event NewProtoCard(
        uint16 id, uint8 season, uint8 god, 
        Rarity rarity, uint8 mana, uint8 attack, 
        uint8 health, uint8 cardType, uint8 tribe, bool packable
    );

    struct Limit {
        uint64 limit;
        bool exists;
    }

    // limits for mythic cards
    mapping(uint16 => Limit) public limits;

    // can only set limits once
    function setLimit(uint16 id, uint64 limit) public onlyGovernor {
        Limit memory l = limits[id];
        require(!l.exists);
        limits[id] = Limit({
            limit: limit,
            exists: true
        });
    }

    function getLimit(uint16 id) public view returns (uint64 limit, bool set) {
        Limit memory l = limits[id];
        return (l.limit, l.exists);
    }

    // could make these arrays to save gas
    // not really necessary - will be update a very limited no of times
    mapping(uint8 => bool) public seasonTradable;
    mapping(uint8 => bool) public seasonTradabilityLocked;
    uint8 public currentSeason;

    function makeTradable(uint8 season) public onlyGovernor {
        seasonTradable[season] = true;
    }

    function makeUntradable(uint8 season) public onlyGovernor {
        require(!seasonTradabilityLocked[season]);
        seasonTradable[season] = false;
    }

    function makePermanantlyTradable(uint8 season) public onlyGovernor {
        require(seasonTradable[season]);
        seasonTradabilityLocked[season] = true;
    }

    function isTradable(uint16 proto) public view returns (bool) {
        return seasonTradable[protos[proto].season];
    }

    function nextSeason() public onlyGovernor {
        //Seasons shouldn't go to 0 if there is more than the uint8 should hold, the governor should know this ¯\_(ツ)_/¯ -M
        require(currentSeason <= 255); 

        currentSeason++;
        mythic.length = 0;
        legendary.length = 0;
        epic.length = 0;
        rare.length = 0;
        common.length = 0;
    }

    enum Rarity {
        Common,
        Rare,
        Epic,
        Legendary, 
        Mythic
    }

    uint8 constant SPELL = 1;
    uint8 constant MINION = 2;
    uint8 constant WEAPON = 3;
    uint8 constant HERO = 4;

    struct ProtoCard {
        bool exists;
        uint8 god;
        uint8 season;
        uint8 cardType;
        Rarity rarity;
        uint8 mana;
        uint8 attack;
        uint8 health;
        uint8 tribe;
    }

    // there is a particular design decision driving this:
    // need to be able to iterate over mythics only for card generation
    // don't store 5 different arrays: have to use 2 ids
    // better to bear this cost (2 bytes per proto card)
    // rather than 1 byte per instance

    uint16 public protoCount;
    
    mapping(uint16 => ProtoCard) protos;

    uint16[] public mythic;
    uint16[] public legendary;
    uint16[] public epic;
    uint16[] public rare;
    uint16[] public common;

    function addProtos(
        uint16[] externalIDs, uint8[] gods, Rarity[] rarities, uint8[] manas, uint8[] attacks, 
        uint8[] healths, uint8[] cardTypes, uint8[] tribes, bool[] packable
    ) public onlyGovernor returns(uint16) {

        for (uint i = 0; i < externalIDs.length; i++) {

            ProtoCard memory card = ProtoCard({
                exists: true,
                god: gods[i],
                season: currentSeason,
                cardType: cardTypes[i],
                rarity: rarities[i],
                mana: manas[i],
                attack: attacks[i],
                health: healths[i],
                tribe: tribes[i]
            });

            _addProto(externalIDs[i], card, packable[i]);
        }
        
    }

    function addProto(
        uint16 externalID, uint8 god, Rarity rarity, uint8 mana, uint8 attack, uint8 health, uint8 cardType, uint8 tribe, bool packable
    ) public onlyGovernor returns(uint16) {
        ProtoCard memory card = ProtoCard({
            exists: true,
            god: god,
            season: currentSeason,
            cardType: cardType,
            rarity: rarity,
            mana: mana,
            attack: attack,
            health: health,
            tribe: tribe
        });

        _addProto(externalID, card, packable);
    }

    function addWeapon(
        uint16 externalID, uint8 god, Rarity rarity, uint8 mana, uint8 attack, uint8 durability, bool packable
    ) public onlyGovernor returns(uint16) {

        ProtoCard memory card = ProtoCard({
            exists: true,
            god: god,
            season: currentSeason,
            cardType: WEAPON,
            rarity: rarity,
            mana: mana,
            attack: attack,
            health: durability,
            tribe: 0
        });

        _addProto(externalID, card, packable);
    }

    function addSpell(uint16 externalID, uint8 god, Rarity rarity, uint8 mana, bool packable) public onlyGovernor returns(uint16) {

        ProtoCard memory card = ProtoCard({
            exists: true,
            god: god,
            season: currentSeason,
            cardType: SPELL,
            rarity: rarity,
            mana: mana,
            attack: 0,
            health: 0,
            tribe: 0
        });

        _addProto(externalID, card, packable);
    }

    function addMinion(
        uint16 externalID, uint8 god, Rarity rarity, uint8 mana, uint8 attack, uint8 health, uint8 tribe, bool packable
    ) public onlyGovernor returns(uint16) {

        ProtoCard memory card = ProtoCard({
            exists: true,
            god: god,
            season: currentSeason,
            cardType: MINION,
            rarity: rarity,
            mana: mana,
            attack: attack,
            health: health,
            tribe: tribe
        });

        _addProto(externalID, card, packable);
    }

    function _addProto(uint16 externalID, ProtoCard memory card, bool packable) internal {

        require(!protos[externalID].exists);

        card.exists = true;

        protos[externalID] = card;

        protoCount++;

        emit NewProtoCard(
            externalID, currentSeason, card.god, 
            card.rarity, card.mana, card.attack, 
            card.health, card.cardType, card.tribe, packable
        );

        if (packable) {
            Rarity rarity = card.rarity;
            if (rarity == Rarity.Common) {
                common.push(externalID);
            } else if (rarity == Rarity.Rare) {
                rare.push(externalID);
            } else if (rarity == Rarity.Epic) {
                epic.push(externalID);
            } else if (rarity == Rarity.Legendary) {
                legendary.push(externalID);
            } else if (rarity == Rarity.Mythic) {
                mythic.push(externalID);
            } else {
                require(false);
            }
        }
    }

    function getProto(uint16 id) public view returns(
        bool exists, uint8 god, uint8 season, uint8 cardType, Rarity rarity, uint8 mana, uint8 attack, uint8 health, uint8 tribe
    ) {
        ProtoCard memory proto = protos[id];
        return (
            proto.exists,
            proto.god,
            proto.season,
            proto.cardType,
            proto.rarity,
            proto.mana,
            proto.attack,
            proto.health,
            proto.tribe
        );
    }

    function getRandomCard(Rarity rarity, uint16 random) public view returns (uint16) {
        // modulo bias is fine - creates rarity tiers etc
        // will obviously revert is there are no cards of that type: this is expected - should never happen
        if (rarity == Rarity.Common) {
            return common[random % common.length];
        } else if (rarity == Rarity.Rare) {
            return rare[random % rare.length];
        } else if (rarity == Rarity.Epic) {
            return epic[random % epic.length];
        } else if (rarity == Rarity.Legendary) {
            return legendary[random % legendary.length];
        } else if (rarity == Rarity.Mythic) {
            // make sure a mythic is available
            uint16 id;
            uint64 limit;
            bool set;
            for (uint i = 0; i < mythic.length; i++) {
                id = mythic[(random + i) % mythic.length];
                (limit, set) = getLimit(id);
                if (set && limit > 0){
                    return id;
                }
            }
            // if not, they get a legendary :(
            return legendary[random % legendary.length];
        }
        require(false);
        return 0;
    }

    // can never adjust tradable cards
    // each season gets a 'balancing beta'
    // totally immutable: season, rarity
    function replaceProto(
        uint16 index, uint8 god, uint8 cardType, uint8 mana, uint8 attack, uint8 health, uint8 tribe
    ) public onlyGovernor {
        ProtoCard memory pc = protos[index];
        require(!seasonTradable[pc.season]);
        protos[index] = ProtoCard({
            exists: true,
            god: god,
            season: pc.season,
            cardType: cardType,
            rarity: pc.rarity,
            mana: mana,
            attack: attack,
            health: health,
            tribe: tribe
        });
    }

}

contract MigrationInterface {

    function createCard(address user, uint16 proto, uint16 purity) public returns (uint);

    function getRandomCard(CardProto.Rarity rarity, uint16 random) public view returns (uint16);

    function migrate(uint id) public;

}

contract CardPackThree {

    MigrationInterface public migration;
    uint public creationBlock;

    constructor(MigrationInterface _core) public payable {
        migration = _core;
        creationBlock = 5939061 + 2000; // set to creation block of first contracts + 8 hours for down time
    }

    event Referral(address indexed referrer, uint value, address purchaser);

    /**
    * purchase 'count' of this type of pack
    */
    function purchase(uint16 packCount, address referrer) public payable;

    // store purity and shine as one number to save users gas
    function _getPurity(uint16 randOne, uint16 randTwo) internal pure returns (uint16) {
        if (randOne >= 998) {
            return 3000 + randTwo;
        } else if (randOne >= 988) {
            return 2000 + randTwo;
        } else if (randOne >= 938) {
            return 1000 + randTwo;
        } else {
            return randTwo;
        }
    }

}

contract FirstPheonix is Pausable {

    MigrationInterface core;

    constructor(MigrationInterface _core) public {
        core = _core;
    }

    address[] public approved;

    uint16 PHEONIX_PROTO = 380;

    mapping(address => bool) public claimed;

    function approvePack(address toApprove) public onlyOwner {
        approved.push(toApprove);
    }

    function isApproved(address test) public view returns (bool) {
        for (uint i = 0; i < approved.length; i++) {
            if (approved[i] == test) {
                return true;
            }
        }
        return false;
    }

    // pause once cards become tradable
    function claimPheonix(address user) public returns (bool){

        require(isApproved(msg.sender));

        if (claimed[user] || paused){
            return false;
        }

        claimed[user] = true;

        core.createCard(user, PHEONIX_PROTO, 0);

        return true;
    }

}

contract PresalePackThree is CardPackThree, Pausable {

    CappedVault public vault;

    Purchase[] public purchases;

    function getPurchaseCount() public view returns (uint) {
        return purchases.length;
    }

    struct Purchase {
        uint16 current;
        uint16 count;
        address user;
        uint randomness;
        uint64 commit;
    }

    event PacksPurchased(uint indexed id, address indexed user, uint16 count);
    event PackOpened(uint indexed id, uint16 startIndex, address indexed user, uint[] cardIDs);
    event RandomnessReceived(uint indexed id, address indexed user, uint16 count, uint randomness);

    constructor(MigrationInterface _core, CappedVault _vault) public payable CardPackThree(_core) {
        vault = _vault;
    }

    function basePrice() public returns (uint);
    function getCardDetails(uint16 packIndex, uint8 cardIndex, uint result) public view returns (uint16 proto, uint16 purity);
    
    function packSize() public view returns (uint8) {
        return 5;
    }

    function packsPerClaim() public view returns (uint16) {
        return 15;
    }

    // start in bytes, length in bytes
    function extract(uint num, uint length, uint start) internal pure returns (uint) {
        return (((1 << (length * 8)) - 1) & (num >> ((start * 8) - 1)));
    }

    function purchase(uint16 packCount, address referrer) whenNotPaused public payable {

        require(packCount > 0);
        require(referrer != msg.sender);

        uint price = calculatePrice(basePrice(), packCount);

        require(msg.value >= price);

        Purchase memory p = Purchase({
            user: msg.sender,
            count: packCount,
            commit: uint64(block.number),
            randomness: 0,
            current: 0
        });

        uint id = purchases.push(p) - 1;

        emit PacksPurchased(id, msg.sender, packCount);

        if (referrer != address(0)) {
            uint commission = price / 10;
            referrer.transfer(commission);
            price -= commission;
            emit Referral(referrer, commission, msg.sender);
        }
        
        address(vault).transfer(price); 
    }

    // can be called by anybody
    // can miners withhold blocks --> not really
    // giving up block reward for extra chance --> still really low
    function callback(uint id) public {

        Purchase storage p = purchases[id];

        require(p.randomness == 0);

        bytes32 bhash = blockhash(p.commit);
        // will get the same on every block
        // only use properties which can't be altered by the user
        uint random = uint(keccak256(abi.encodePacked(bhash, p.user, address(this), p.count)));

        // can't callback on the original block
        require(uint64(block.number) != p.commit);

        if (uint(bhash) == 0) {
            // should never happen (must call within next 256 blocks)
            // if it does, just give them 1: will become common and therefore less valuable
            // set to 1 rather than 0 to avoid calling claim before randomness
            p.randomness = 1;
        } else {
            p.randomness = random;
        }

        emit RandomnessReceived(id, p.user, p.count, p.randomness);
    }

    function claim(uint id) public {
        
        Purchase storage p = purchases[id];

        require(canClaim);

        uint16 proto;
        uint16 purity;
        uint16 count = p.count;
        uint result = p.randomness;
        uint8 size = packSize();

        address user = p.user;
        uint16 current = p.current;

        require(result != 0); // have to wait for the callback
        // require(user == msg.sender); // not needed
        require(count > 0);

        uint[] memory ids = new uint[](size);

        uint16 end = current + packsPerClaim() > count ? count : current + packsPerClaim();

        require(end > current);

        for (uint16 i = current; i < end; i++) {
            for (uint8 j = 0; j < size; j++) {
                (proto, purity) = getCardDetails(i, j, result);
                ids[j] = migration.createCard(user, proto, purity);
            }
            emit PackOpened(id, (i * size), user, ids);
        }
        p.current += (end - current);
    }

    function predictPacks(uint id) external view returns (uint16[] protos, uint16[] purities) {

        Purchase memory p = purchases[id];

        uint16 proto;
        uint16 purity;
        uint16 count = p.count;
        uint result = p.randomness;
        uint8 size = packSize();

        purities = new uint16[](size * count);
        protos = new uint16[](size * count);

        for (uint16 i = 0; i < count; i++) {
            for (uint8 j = 0; j < size; j++) {
                (proto, purity) = getCardDetails(i, j, result);
                purities[(i * size) + j] = purity;
                protos[(i * size) + j] = proto;
            }
        }
        return (protos, purities);
    }

    function calculatePrice(uint base, uint16 packCount) public view returns (uint) {
        // roughly 6k blocks per day
        uint difference = block.number - creationBlock;
        uint numDays = difference / 6000;
        if (20 > numDays) {
            return (base - (((20 - numDays) * base) / 100)) * packCount;
        }
        return base * packCount;
    }

    function _getCommonPlusRarity(uint32 rand) internal pure returns (CardProto.Rarity) {
        if (rand == 999999) {
            return CardProto.Rarity.Mythic;
        } else if (rand >= 998345) {
            return CardProto.Rarity.Legendary;
        } else if (rand >= 986765) {
            return CardProto.Rarity.Epic;
        } else if (rand >= 924890) {
            return CardProto.Rarity.Rare;
        } else {
            return CardProto.Rarity.Common;
        }
    }

    function _getRarePlusRarity(uint32 rand) internal pure returns (CardProto.Rarity) {
        if (rand == 999999) {
            return CardProto.Rarity.Mythic;
        } else if (rand >= 981615) {
            return CardProto.Rarity.Legendary;
        } else if (rand >= 852940) {
            return CardProto.Rarity.Epic;
        } else {
            return CardProto.Rarity.Rare;
        } 
    }

    function _getEpicPlusRarity(uint32 rand) internal pure returns (CardProto.Rarity) {
        if (rand == 999999) {
            return CardProto.Rarity.Mythic;
        } else if (rand >= 981615) {
            return CardProto.Rarity.Legendary;
        } else {
            return CardProto.Rarity.Epic;
        }
    }

    function _getLegendaryPlusRarity(uint32 rand) internal pure returns (CardProto.Rarity) {
        if (rand == 999999) {
            return CardProto.Rarity.Mythic;
        } else {
            return CardProto.Rarity.Legendary;
        } 
    }

    bool public canClaim = true;

    function setCanClaim(bool claim) public onlyOwner {
        canClaim = claim;
    }

    function getComponents(
        uint16 i, uint8 j, uint rand
    ) internal returns (
        uint random, uint32 rarityRandom, uint16 purityOne, uint16 purityTwo, uint16 protoRandom
    ) {
        random = uint(keccak256(abi.encodePacked(i, rand, j)));
        rarityRandom = uint32(extract(random, 4, 10) % 1000000);
        purityOne = uint16(extract(random, 2, 4) % 1000);
        purityTwo = uint16(extract(random, 2, 6) % 1000);
        protoRandom = uint16(extract(random, 2, 8) % (2**16-1));
        return (random, rarityRandom, purityOne, purityTwo, protoRandom);
    }

    function withdraw() public onlyOwner {
        owner.transfer(address(this).balance);
    }

}

contract PackMultiplier is PresalePackThree {

    address[] public packs;
    uint16 public multiplier = 3;
    FirstPheonix pheonix;
    PreviousInterface old;

    uint16 public packLimit = 5;

    constructor(PreviousInterface _old, address[] _packs, MigrationInterface _core, CappedVault vault, FirstPheonix _pheonix) 
        public PresalePackThree(_core, vault) 
    {
        packs = _packs;
        pheonix = _pheonix;
        old = _old;
    }

    function getCardCount() internal view returns (uint) {
        return old.totalSupply() + old.burnCount();
    }

    function isPriorPack(address test) public view returns(bool) {
        for (uint i = 0; i < packs.length; i++) {
            if (packs[i] == test) {
                return true;
            }
        }
        return false;
    }

    event Status(uint before, uint aft);

    function claimMultiple(address pack, uint purchaseID) public returns (uint16, address) {

        require(isPriorPack(pack));

        uint length = getCardCount();

        PresalePackThree(pack).claim(purchaseID);

        uint lengthAfter = getCardCount();

        require(lengthAfter > length);

        uint16 cardDifference = uint16(lengthAfter - length);

        require(cardDifference % 5 == 0);

        uint16 packCount = cardDifference / 5;

        uint16 extra = packCount * multiplier;

        address lastCardOwner = old.ownerOf(lengthAfter - 1);

        Purchase memory p = Purchase({
            user: lastCardOwner,
            count: extra,
            commit: uint64(block.number),
            randomness: 0,
            current: 0
        });

        uint id = purchases.push(p) - 1;

        emit PacksPurchased(id, lastCardOwner, extra);

        // try to give them a first pheonix
        pheonix.claimPheonix(lastCardOwner);

        emit Status(length, lengthAfter);


        if (packCount <= packLimit) {
            for (uint i = 0; i < cardDifference; i++) {
                migration.migrate(lengthAfter - 1 - i);
            }
        }

        return (extra, lastCardOwner);
    }

    function setPackLimit(uint16 limit) public onlyOwner {
        packLimit = limit;
    }


}

contract LegendaryPackThree is PackMultiplier {
    
    function basePrice() public returns (uint) {
        return 112 finney;
    }

    TournamentPass public tournament;

    constructor(PreviousInterface _old, address[] _packs, MigrationInterface _core, CappedVault vault, TournamentPass _tournament, FirstPheonix _pheonix) 
        public PackMultiplier(_old, _packs, _core, vault, _pheonix) {
        
        tournament = _tournament;
    }

    function claimMultiple(address pack, uint purchaseID) public returns (uint16, address) {
        uint16 extra;
        address user;
        (extra, user) = super.claimMultiple(pack, purchaseID);
        tournament.mint(user, extra);
    }

    function getCardDetails(uint16 packIndex, uint8 cardIndex, uint result) public view returns (uint16 proto, uint16 purity) {
        uint random;
        uint32 rarityRandom;
        uint16 protoRandom;
        uint16 purityOne;
        uint16 purityTwo;

        CardProto.Rarity rarity;

        (random, rarityRandom, purityOne, purityTwo, protoRandom) = getComponents(packIndex, cardIndex, result);

        if (cardIndex == 4) {
            rarity = _getLegendaryPlusRarity(rarityRandom);
        } else if (cardIndex == 3) {
            rarity = _getRarePlusRarity(rarityRandom);
        } else {
            rarity = _getCommonPlusRarity(rarityRandom);
        }

        purity = _getPurity(purityOne, purityTwo);
    
        proto = migration.getRandomCard(rarity, protoRandom);

        return (proto, purity);
    } 
    
}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"packSize","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"migration","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"creationBlock","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"multiplier","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"tournament","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"}],"name":"claim","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"packCount","type":"uint16"},{"name":"referrer","type":"address"}],"name":"purchase","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"pack","type":"address"},{"name":"purchaseID","type":"uint256"}],"name":"claimMultiple","outputs":[{"name":"","type":"uint16"},{"name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"canClaim","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"purchases","outputs":[{"name":"current","type":"uint16"},{"name":"count","type":"uint16"},{"name":"user","type":"address"},{"name":"randomness","type":"uint256"},{"name":"commit","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"packsPerClaim","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"packs","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"test","type":"address"}],"name":"isPriorPack","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getPurchaseCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"packIndex","type":"uint16"},{"name":"cardIndex","type":"uint8"},{"name":"result","type":"uint256"}],"name":"getCardDetails","outputs":[{"name":"proto","type":"uint16"},{"name":"purity","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"claim","type":"bool"}],"name":"setCanClaim","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"basePrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"predictPacks","outputs":[{"name":"protos","type":"uint16[]"},{"name":"purities","type":"uint16[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"limit","type":"uint16"}],"name":"setPackLimit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"base","type":"uint256"},{"name":"packCount","type":"uint16"}],"name":"calculatePrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"packLimit","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"vault","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"}],"name":"callback","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_old","type":"address"},{"name":"_packs","type":"address[]"},{"name":"_core","type":"address"},{"name":"vault","type":"address"},{"name":"_tournament","type":"address"},{"name":"_pheonix","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"before","type":"uint256"},{"indexed":false,"name":"aft","type":"uint256"}],"name":"Status","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":true,"name":"user","type":"address"},{"indexed":false,"name":"count","type":"uint16"}],"name":"PacksPurchased","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":false,"name":"startIndex","type":"uint16"},{"indexed":true,"name":"user","type":"address"},{"indexed":false,"name":"cardIDs","type":"uint256[]"}],"name":"PackOpened","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"uint256"},{"indexed":true,"name":"user","type":"address"},{"indexed":false,"name":"count","type":"uint16"},{"indexed":false,"name":"randomness","type":"uint256"}],"name":"RandomnessReceived","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"referrer","type":"address"},{"indexed":false,"name":"value","type":"uint256"},{"indexed":false,"name":"purchaser","type":"address"}],"name":"Referral","type":"event"}]

  Contract Creation Code Switch To Opcodes View
60806040526002805460a060020a60ff02191690556005805460ff191660011790556007805461ffff19166003179055600880547405000000000000000000000000000000000000000060a060020a61ffff02199091161790553480156200006657600080fd5b5060405162001f4a38038062001f4a8339810160409081528151602080840151928401516060850151608086015160a087015160008054600160a060020a03808716600160a060020a031992831617909255625aa745600155600280548216331790556003805492861692909116919091179055959096018051949690959294919390929187918791879187918691620001069160069187019062000162565b50600780546201000060b060020a03191662010000600160a060020a039384160217905560088054600160a060020a03199081169683169690961790556009805490951696169590951790925550620001f69650505050505050565b828054828255906000526020600020908101928215620001ba579160200282015b82811115620001ba5782518254600160a060020a031916600160a060020a0390911617825560209092019160019091019062000183565b50620001c8929150620001cc565b5090565b620001f391905b80821115620001c8578054600160a060020a0319168155600101620001d3565b90565b611d4480620002066000396000f30060806040526004361061015b5763ffffffff60e060020a60003504166306a628d4811461016057806313af40351461018b5780631705a3bd146101ae57806317634514146101df5780631b3ed722146102065780631e0197e214610232578063379607f514610247578063396c82281461025f5780633ccfd60b1461027a5780633f4ba83a1461028f5780635c975abb146102a45780636bc3e4a8146102cd5780636dc7a627146103175780638392fe311461032c5780638456cb59146103885780638be4339b1461039d5780638da5cb5b146103b2578063b84c1392146103c7578063bd6cac4f146103df578063becd283f14610400578063c2f0bb2914610415578063c503101e1461045b578063c7876ea414610475578063ca2bf0471461048a578063d42a50111461053b578063e3f7faaf14610557578063eb1098b814610576578063fbfa77cf1461058b578063ff585caf146105a0575b600080fd5b34801561016c57600080fd5b506101756105b8565b6040805160ff9092168252519081900360200190f35b34801561019757600080fd5b506101ac600160a060020a03600435166105bd565b005b3480156101ba57600080fd5b506101c3610603565b60408051600160a060020a039092168252519081900360200190f35b3480156101eb57600080fd5b506101f4610612565b60408051918252519081900360200190f35b34801561021257600080fd5b5061021b610618565b6040805161ffff9092168252519081900360200190f35b34801561023e57600080fd5b506101c3610622565b34801561025357600080fd5b506101ac600435610631565b6101ac61ffff60043516600160a060020a036024351661091b565b34801561028657600080fd5b506101ac610bd0565b34801561029b57600080fd5b506101ac610c24565b3480156102b057600080fd5b506102b9610c9c565b604080519115158252519081900360200190f35b3480156102d957600080fd5b506102f1600160a060020a0360043516602435610cac565b6040805161ffff9093168352600160a060020a0390911660208301528051918290030190f35b34801561032357600080fd5b506102b9610d6a565b34801561033857600080fd5b50610344600435610d73565b6040805161ffff9687168152949095166020850152600160a060020a0390921683850152606083015267ffffffffffffffff16608082015290519081900360a00190f35b34801561039457600080fd5b506101ac610dcf565b3480156103a957600080fd5b5061021b610e4c565b3480156103be57600080fd5b506101c3610e51565b3480156103d357600080fd5b506101c3600435610e60565b3480156103eb57600080fd5b506102b9600160a060020a0360043516610e88565b34801561040c57600080fd5b506101f4610ee6565b34801561042157600080fd5b5061043a61ffff6004351660ff60243516604435610eec565b6040805161ffff938416815291909216602082015281519081900390910190f35b34801561046757600080fd5b506101ac600435151561101b565b34801561048157600080fd5b506101f4611045565b34801561049657600080fd5b506104a2600435611051565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156104e65781810151838201526020016104ce565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561052557818101518382015260200161050d565b5050505090500194505050505060405180910390f35b34801561054757600080fd5b506101ac61ffff60043516611216565b34801561056357600080fd5b506101f460043561ffff60243516611260565b34801561058257600080fd5b5061021b6112a1565b34801561059757600080fd5b506101c36112b2565b3480156105ac57600080fd5b506101ac6004356112c1565b600590565b600254600160a060020a031633146105d457600080fd5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a031681565b60015481565b60075461ffff1681565b600954600160a060020a031681565b6000806000806000806000806060600080600060048d81548110151561065357fe5b600091825260209091206005546003909202019c5060ff16151561067657600080fd5b8b5460018d01546201000090910461ffff16995097506106946105b8565b8c54909750600160a060020a03640100000000820416965061ffff1694508715156106be57600080fd5b600061ffff8a16116106cf57600080fd5b8660ff166040519080825280602002602001820160405280156106fc578160200160208202803883390190505b5093508861ffff1661070c610e4c565b860161ffff16116107265761071f610e4c565b8501610728565b885b925061ffff8086169084161161073d57600080fd5b8491505b8261ffff168261ffff1610156108f4575060005b8660ff168160ff1610156108545761076e82828a610eec565b809b50819c5050506000809054906101000a9004600160a060020a0316600160a060020a031663fb36eba1878d8d6040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a031681526020018361ffff1661ffff1681526020018261ffff1661ffff1681526020019350505050602060405180830381600087803b15801561080557600080fd5b505af1158015610819573d6000803e3d6000fd5b505050506040513d602081101561082f57600080fd5b50518451859060ff841690811061084257fe5b60209081029091010152600101610755565b85600160a060020a03168d7f69ac64af86d3ef40c9def928534f6a6a9e12d85ec3af2948bd66b802afcc10468960ff16850287604051808361ffff1661ffff16815260200180602001828103825283818151815260200191508051906020019060200280838360005b838110156108d55781810151838201526020016108bd565b50505050905001935050505060405180910390a3600190910190610741565b5050895461ffff1981169390910361ffff9182160116919091179097555050505050505050565b6000610925611cea565b600254600090819060a060020a900460ff161561094157600080fd5b600061ffff87161161095257600080fd5b600160a060020a03851633141561096857600080fd5b610979610973611045565b87611260565b93503484111561098857600080fd5b6040805160a081018252600080825261ffff8981166020808501828152338688018181526060880187815267ffffffffffffffff43811660808b01908152600480546001810182559a528a5160038b027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b8101805498519651600160a060020a03166401000000000277ffffffffffffffffffffffffffffffffffffffff0000000019978d16620100000263ffff00001994909d1661ffff19909a1699909917929092169a909a179490941695909517909255517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c87015591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d90950180549590921667ffffffffffffffff19909516949094179055855191825294519397509195509285927f861fd6f8fe14603acc05fa404f8cca86371619cac8a65a92edf687f81b9bafbd9281900390910190a3600160a060020a03851615610b8d5750604051600a840490600160a060020a0386169082156108fc029083906000818181858888f19350505050158015610b44573d6000803e3d6000fd5b506040805182815233602082015281519583900395600160a060020a038816927f13aa7090696e2a1d666cfc6046f2f72f1c4e0290649b47bab28d1b370ad73783928290030190a25b600354604051600160a060020a039091169085156108fc029086906000818181858888f19350505050158015610bc7573d6000803e3d6000fd5b50505050505050565b600254600160a060020a03163314610be757600080fd5b600254604051600160a060020a0390911690303180156108fc02916000818181858888f19350505050158015610c21573d6000803e3d6000fd5b50565b600254600160a060020a03163314610c3b57600080fd5b60025460a060020a900460ff161515610c5357600080fd5b6002805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b60025460a060020a900460ff1681565b600080600080610cbc868661148a565b600954604080517f40c10f19000000000000000000000000000000000000000000000000000000008152600160a060020a03808516600483015261ffff86166024830152915194965092945016916340c10f19916044808201926020929091908290030181600087803b158015610d3257600080fd5b505af1158015610d46573d6000803e3d6000fd5b505050506040513d6020811015610d5c57600080fd5b509396929550919350505050565b60055460ff1681565b6004805482908110610d8157fe5b600091825260209091206003909102018054600182015460029092015461ffff80831694506201000083041692640100000000909204600160a060020a0316919067ffffffffffffffff1685565b600254600160a060020a03163314610de657600080fd5b60025460a060020a900460ff1615610dfd57600080fd5b6002805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600f90565b600254600160a060020a031681565b6006805482908110610e6e57fe5b600091825260209091200154600160a060020a0316905081565b6000805b600654811015610edb5782600160a060020a0316600682815481101515610eaf57fe5b600091825260209091200154600160a060020a03161415610ed35760019150610ee0565b600101610e8c565b600091505b50919050565b60045490565b600080600080600080600080610f038b8b8b611911565b9399509197509195509093509150600460ff8b161415610f2d57610f2685611a78565b9050610f4e565b8960ff1660031415610f4257610f2685611a9c565b610f4b85611aef565b90505b610f588383611b5a565b6000546040517fcaa19168000000000000000000000000000000000000000000000000000000008152919850600160a060020a03169063caa19168908390879060049081019081908490811115610fab57fe5b60ff1681526020018261ffff1661ffff16815260200192505050602060405180830381600087803b158015610fdf57600080fd5b505af1158015610ff3573d6000803e3d6000fd5b505050506040513d602081101561100957600080fd5b50519750505050505050935093915050565b600254600160a060020a0316331461103257600080fd5b6005805460ff1916911515919091179055565b67018de76816d8000090565b60608061105c611cea565b600080600080600080600060048b81548110151561107657fe5b60009182526020918290206040805160a0810182526003909302909101805461ffff808216855262010000820416948401859052600160a060020a03640100000000909104169183019190915260018101546060830181905260029091015467ffffffffffffffff16608083015290995090955093506110f46105b8565b9250848360ff160261ffff16604051908082528060200260200182016040528015611129578160200160208202803883390190505b509850848360ff160261ffff1660405190808252806020026020018201604052801561115f578160200160208202803883390190505b509950600091505b8461ffff168261ffff161015611209575060005b8260ff168160ff1610156111fe57611194828286610eec565b8a51919850965086908a9061ffff60ff878116870290861601169081106111b757fe5b61ffff928316602091820290920101528a5188918c9160ff8781168702908616019091169081106111e457fe5b61ffff90921660209283029091019091015260010161117b565b600190910190611167565b5050505050505050915091565b600254600160a060020a0316331461122d57600080fd5b6008805461ffff90921660a060020a0275ffff000000000000000000000000000000000000000019909216919091179055565b60015460009043036117708104601481101561128f5761ffff8416606460148390038702048603029250611299565b8361ffff16850292505b505092915050565b60085460a060020a900461ffff1681565b600354600160a060020a031681565b60008060006004848154811015156112d557fe5b90600052602060002090600302019250826001015460001415156112f857600080fd5b600283015483546040805167ffffffffffffffff9093164060208085018290526401000000008404600160a060020a03166c0100000000000000000000000090810286850152300260548601526201000090930461ffff167e010000000000000000000000000000000000000000000000000000000000000260688501528151808503604a018152606a90940191829052835190955090918291908401908083835b602083106113b95780518252601f19909201916020918201910161139a565b5181516000196020949094036101000a93909301928316921916919091179052604051920182900390912060028701549094504367ffffffffffffffff90811691161415925061140b91505057600080fd5b81151561141d57600183810155611425565b600183018190555b825460018401546040805162010000840461ffff16815260208101929092528051640100000000909304600160a060020a03169287927fedb5ce4012b6e9c5904afa2ffad9811d5c2e91e6bca8914cf7e3ffc28e630c5792908290030190a350505050565b60008060008060008060008061149e611cea565b6000806114aa8d610e88565b15156114b557600080fd5b6114bd611bad565b98508c600160a060020a031663379607f58d6040518263ffffffff1660e060020a02815260040180828152602001915050600060405180830381600087803b15801561150857600080fd5b505af115801561151c573d6000803e3d6000fd5b50505050611528611bad565b975088881161153657600080fd5b8888039650600561ffff88160661ffff161561155157600080fd5b600561ffff8816600754600854604080517f6352211e0000000000000000000000000000000000000000000000000000000081526000198e016004820152905194909304995061ffff90911689029750600160a060020a031691636352211e916024808201926020929091908290030181600087803b1580156115d357600080fd5b505af11580156115e7573d6000803e3d6000fd5b505050506040513d60208110156115fd57600080fd5b50516040805160a081018252600080825261ffff8981166020848101828152600160a060020a038089168789018181526060890188815267ffffffffffffffff43811660808c01908152600480546001810182559b528b5160038c027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b81018054995196519098166401000000000277ffffffffffffffffffffffffffffffffffffffff0000000019968d16620100000263ffff00001993909d1661ffff19909a1699909917919091169a909a17939093169590951790935591517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19c87015590517f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19d90950180549590921667ffffffffffffffff19909516949094179055855191825294519599509297509095509285927f861fd6f8fe14603acc05fa404f8cca86371619cac8a65a92edf687f81b9bafbd928290030190a3600754604080517ff88218e0000000000000000000000000000000000000000000000000000000008152600160a060020a0387811660048301529151620100009093049091169163f88218e0916024808201926020929091908290030181600087803b1580156117e557600080fd5b505af11580156117f9573d6000803e3d6000fd5b505050506040513d602081101561180f57600080fd5b5050604080518a8152602081018a905281517f31a1adb447f9b6b89f24bf104f0b7a06975ad9f35670dbfaf7ce29190ec54762929181900390910190a160085461ffff60a060020a9091048116908716116118fe575060005b8661ffff168110156118fe5760008054604080517f454b0608000000000000000000000000000000000000000000000000000000008152848c036000190160048201529051600160a060020a039092169263454b06089260248084019382900301818387803b1580156118da57600080fd5b505af11580156118ee573d6000803e3d6000fd5b5050600190920191506118689050565b50929b919a509098505050505050505050565b6000806000806000878688604051602001808461ffff1661ffff167e010000000000000000000000000000000000000000000000000000000000000281526002018381526020018260ff1660ff167f010000000000000000000000000000000000000000000000000000000000000002815260010193505050506040516020818303038152906040526040518082805190602001908083835b602083106119c95780518252601f1990920191602091820191016119aa565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020600190049450620f4240611a0d866004600a611cca565b811515611a1657fe5b0693506103e8611a298660026004611cca565b811515611a3257fe5b0692506103e8611a458660026006611cca565b811515611a4e57fe5b06915061ffff611a618660026008611cca565b811515611a6a57fe5b069050939792965093509350565b60008163ffffffff16620f423f1415611a9357506004611a97565b5060035b919050565b60008163ffffffff16620f423f1415611ab757506004611a97565b620efa6f63ffffffff831610611acf57506003611a97565b620d03cc63ffffffff831610611ae757506002611a97565b506001611a97565b60008163ffffffff16620f423f1415611b0a57506004611a97565b620f3bc963ffffffff831610611b2257506003611a97565b620f0e8d63ffffffff831610611b3a57506002611a97565b620e1cda63ffffffff831610611b5257506001611a97565b506000611a97565b60006103e661ffff841610611b745750610bb88101611ba7565b6103dc61ffff841610611b8c57506107d08101611ba7565b6103aa61ffff841610611ba457506103e88101611ba7565b50805b92915050565b600854604080517f524773ce0000000000000000000000000000000000000000000000000000000081529051600092600160a060020a03169163524773ce91600480830192602092919082900301818787803b158015611c0c57600080fd5b505af1158015611c20573d6000803e3d6000fd5b505050506040513d6020811015611c3657600080fd5b5051600854604080517f18160ddd0000000000000000000000000000000000000000000000000000000081529051600160a060020a03909216916318160ddd916004808201926020929091908290030181600087803b158015611c9857600080fd5b505af1158015611cac573d6000803e3d6000fd5b505050506040513d6020811015611cc257600080fd5b505101905090565b6008828102600290810a60001990810192840201900a8404169392505050565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152905600a165627a7a72305820598230238e21bc34b26443d2521340dd5f4f01c21b34bbbba260517b61be62690029000000000000000000000000512fbd15bde6570ff09e4438af27ede60402451500000000000000000000000000000000000000000000000000000000000000c00000000000000000000000006ebeaf8e8e946f0716e6533a6f2cefc83f60e8ab00000000000000000000000091b9d2835ad914bc1dcfe09bd1816febd04fd68900000000000000000000000022365168c8705e95b2d08876c23a8c13e3ad72e2000000000000000000000000657c8982d63f58ddd6a54c75591a572d4180cec800000000000000000000000000000000000000000000000000000000000000020000000000000000000000006c5dc1dcda3d309a6e919e6d0965f197e0fc19130000000000000000000000005789e2b5460cae9329d93a78511e2ac49f98a1f6

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

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 000000000000000000000000512fbd15bde6570ff09e4438af27ede604024515
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 0000000000000000000000006ebeaf8e8e946f0716e6533a6f2cefc83f60e8ab
Arg [3] : 00000000000000000000000091b9d2835ad914bc1dcfe09bd1816febd04fd689
Arg [4] : 00000000000000000000000022365168c8705e95b2d08876c23a8c13e3ad72e2
Arg [5] : 000000000000000000000000657c8982d63f58ddd6a54c75591a572d4180cec8
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [7] : 0000000000000000000000006c5dc1dcda3d309a6e919e6d0965f197e0fc1913
Arg [8] : 0000000000000000000000005789e2b5460cae9329d93a78511e2ac49f98a1f6


   Swarm Source:
bzzr://598230238e21bc34b26443d2521340dd5f4f01c21b34bbbba260517b61be6269

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.