Contract 0x7d3e5eff86d25e9618512d871f4533c277361cc1

 

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: Config
Compiler Version: v0.4.21+commit.dfe3193c
Optimization Enabled: Yes
Runs (Optimizer):  200


Contract Source Code
pragma solidity ^0.4.20;







/**
 * @title Ownable
 * @dev The Ownable contract has an owner address, and provides basic authorization control
 * functions, this simplifies the implementation of "user permissions".
 */
contract Ownable {
  address public owner;


  event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);


  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  function Ownable() public {
    owner = msg.sender;
  }

  /**
   * @dev Throws if called by any account other than the owner.
   */
  modifier onlyOwner() {
    require(msg.sender == owner);
    _;
  }

  /**
   * @dev Allows the current owner to transfer control of the contract to a newOwner.
   * @param newOwner The address to transfer ownership to.
   */
  function transferOwnership(address newOwner) public onlyOwner {
    require(newOwner != address(0));
    emit OwnershipTransferred(owner, newOwner);
    owner = newOwner;
  }

}



/**
 * @title Pausable
 * @dev Base contract which allows children to implement an emergency stop mechanism.
 */
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();
  }
}



/// @title BlockchainCuties: Collectible and breedable cuties on the Ethereum blockchain.
/// @author https://BlockChainArchitect.io
/// @dev This is the BlockchainCuties configuration. It can be changed redeploying another version.
contract ConfigInterface
{
    function isConfig() public pure returns (bool);

    function getCooldownIndexFromGeneration(uint16 _generation) public view returns (uint16);
    
    function getCooldownEndTimeFromIndex(uint16 _cooldownIndex) public view returns (uint40);

    function getCooldownIndexCount() public view returns (uint256);
    
    function getBabyGen(uint16 _momGen, uint16 _dadGen) public pure returns (uint16);

    function getTutorialBabyGen(uint16 _dadGen) public pure returns (uint16);

    function getBreedingFee(uint40 _momId, uint40 _dadId) public view returns (uint256);
}



contract CutieCoreInterface
{
    function isCutieCore() pure public returns (bool);

    function transferFrom(address _from, address _to, uint256 _cutieId) external;
    function transfer(address _to, uint256 _cutieId) external;

    function ownerOf(uint256 _cutieId)
        external
        view
        returns (address owner);

    function getCutie(uint40 _id)
        external
        view
        returns (
        uint256 genes,
        uint40 birthTime,
        uint40 cooldownEndTime,
        uint40 momId,
        uint40 dadId,
        uint16 cooldownIndex,
        uint16 generation
    );

    function getGenes(uint40 _id)
        public
        view
        returns (
        uint256 genes
    );


    function getCooldownEndTime(uint40 _id)
        public
        view
        returns (
        uint40 cooldownEndTime
    );

    function getCooldownIndex(uint40 _id)
        public
        view
        returns (
        uint16 cooldownIndex
    );


    function getGeneration(uint40 _id)
        public
        view
        returns (
        uint16 generation
    );

    function getOptional(uint40 _id)
        public
        view
        returns (
        uint64 optional
    );


    function changeGenes(
        uint40 _cutieId,
        uint256 _genes)
        public;

    function changeCooldownEndTime(
        uint40 _cutieId,
        uint40 _cooldownEndTime)
        public;

    function changeCooldownIndex(
        uint40 _cutieId,
        uint16 _cooldownIndex)
        public;

    function changeOptional(
        uint40 _cutieId,
        uint64 _optional)
        public;

    function changeGeneration(
        uint40 _cutieId,
        uint16 _generation)
        public;
}


/// @title BlockchainCuties: Collectible and breedable cuties on the Ethereum blockchain.
/// @author https://BlockChainArchitect.io
/// @dev This is the BlockchainCuties configuration. It can be changed redeploying another version.

contract Config is Ownable, ConfigInterface
{
	function isConfig() public pure returns (bool)
	{
		return true;
	}

    /// @dev A lookup table that shows the cooldown duration after a successful
    ///  breeding action, called "breeding cooldown". The cooldown roughly doubles each time
    /// a cutie is bred, so that owners don't breed the same cutie continuously. Maximum cooldown is seven days.
    uint32[14] public cooldowns = [
        uint32(1 minutes),
        uint32(2 minutes),
        uint32(5 minutes),
        uint32(10 minutes),
        uint32(30 minutes),
        uint32(1 hours),
        uint32(2 hours),
        uint32(4 hours),
        uint32(8 hours),
        uint32(16 hours),
        uint32(1 days),
        uint32(2 days),
        uint32(4 days),
        uint32(7 days)
    ];

/*    function setCooldown(uint16 index, uint32 newCooldown) public onlyOwner
    {
        cooldowns[index] = newCooldown;
    }*/

    CutieCoreInterface public coreContract;

    function setup(address _coreAddress) public onlyOwner
    {
        CutieCoreInterface candidateContract = CutieCoreInterface(_coreAddress);
        require(candidateContract.isCutieCore());
        coreContract = candidateContract;
    }

    function getCooldownIndexFromGeneration(uint16 _generation) public view returns (uint16)
    {
        uint16 result = _generation;
        if (result >= getCooldownIndexCount()) {
            result = uint16(getCooldownIndexCount() - 1);
        }
        return result;
    }

    function getCooldownEndTimeFromIndex(uint16 _cooldownIndex) public view returns (uint40)
    {
        return uint40(now + cooldowns[_cooldownIndex]);
    }

    function getCooldownIndexCount() public view returns (uint256)
    {
        return cooldowns.length;
    }

    function getBabyGen(uint16 _momGen, uint16 _dadGen) public pure returns (uint16)
    {
        uint16 babyGen = _momGen;
        if (_dadGen > _momGen) {
            babyGen = _dadGen;
        }
        babyGen = babyGen + 1;
        return babyGen;
    }

    function getTutorialBabyGen(uint16 _dadGen) public pure returns (uint16)
    {
        // Tutorial pet gen is 1
        return getBabyGen(1, _dadGen);
    }

    function getBreedingFee(uint40 _momId, uint40 _dadId)
        public
        view
        returns (uint256)
    {
        uint16 momGen = coreContract.getGeneration(_momId);
        uint16 dadGen = coreContract.getGeneration(_dadId);
        uint16 momCooldown = coreContract.getCooldownIndex(_momId);
        uint16 dadCooldown = coreContract.getCooldownIndex(_dadId);

        uint256 sum = uint256(momCooldown) + dadCooldown - momGen - dadGen;
        return 1 finney + 3 szabo*sum*sum;
    }
}

Contract ABI
[{"constant":true,"inputs":[{"name":"_cooldownIndex","type":"uint16"}],"name":"getCooldownEndTimeFromIndex","outputs":[{"name":"","type":"uint40"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_momGen","type":"uint16"},{"name":"_dadGen","type":"uint16"}],"name":"getBabyGen","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"_generation","type":"uint16"}],"name":"getCooldownIndexFromGeneration","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_dadGen","type":"uint16"}],"name":"getTutorialBabyGen","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"name":"_coreAddress","type":"address"}],"name":"setup","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_momId","type":"uint40"},{"name":"_dadId","type":"uint40"}],"name":"getBreedingFee","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCooldownIndexCount","outputs":[{"name":"","type":"uint256"}],"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":"cooldowns","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isConfig","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"coreContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

Contract Creation Code
60606040526101c06040519081016040908152603c82526078602083015261012c9082015261025860608201526107086080820152610e1060a0820152611c2060c082015261384060e082015261708061010082015261e100610120820152620151806101408201526202a3006101608201526205460061018082015262093a806101a082015261009490600190600e6100b5565b5060008054600160a060020a03191633600160a060020a0316179055610175565b6002830191839082156101415791602002820160005b8382111561010f57835183826101000a81548163ffffffff021916908363ffffffff16021790555092602001926004016020816003010492830192600103026100cb565b801561013f5782816101000a81549063ffffffff021916905560040160208160030104928301926001030261010f565b505b5061014d929150610151565b5090565b61017291905b8082111561014d57805463ffffffff19168155600101610157565b90565b6106a6806101846000396000f3006060604052600436106100a05763ffffffff60e060020a60003504166306347def81146100a55780631af97fb7146100d95780635757dcdf14610110578063656e8d6f1461012a57806366d382031461014457806366dc860a14610165578063732606fc1461019a5780638da5cb5b146101ad5780639d6fac6f146101dc578063dcb31b821461020b578063e80db5db14610232578063f2fde38b14610245575b600080fd5b34156100b057600080fd5b6100bf61ffff60043516610264565b60405164ffffffffff909116815260200160405180910390f35b34156100e457600080fd5b6100f961ffff600435811690602435166102a2565b60405161ffff909116815260200160405180910390f35b341561011b57600080fd5b6100f961ffff600435166102c1565b341561013557600080fd5b6100f961ffff600435166102ea565b341561014f57600080fd5b610163600160a060020a03600435166102f7565b005b341561017057600080fd5b61018864ffffffffff600435811690602435166103a4565b60405190815260200160405180910390f35b34156101a557600080fd5b61018861058a565b34156101b857600080fd5b6101c061058f565b604051600160a060020a03909116815260200160405180910390f35b34156101e757600080fd5b6101f260043561059e565b60405163ffffffff909116815260200160405180910390f35b341561021657600080fd5b61021e6105cb565b604051901515815260200160405180910390f35b341561023d57600080fd5b6101c06105d0565b341561025057600080fd5b610163600160a060020a03600435166105df565b6000600161ffff8316600e811061027757fe5b600891828204019190066004029054906101000a900463ffffffff1663ffffffff1642019050919050565b60008261ffff80821690841611156102b75750815b6001019392505050565b6000816102cc61058a565b61ffff8216106102e45760016102e061058a565b0390505b92915050565b60006102e46001836102a2565b6000805433600160a060020a0390811691161461031357600080fd5b5080600160a060020a038116634d6a813a6040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561035257600080fd5b5af1151561035f57600080fd5b50505060405180519050151561037457600080fd5b6003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039290921691909117905550565b60035460009081908190819081908190600160a060020a0316639c91ae208960405160e060020a63ffffffff841602815264ffffffffff9091166004820152602401602060405180830381600087803b15156103ff57600080fd5b5af1151561040c57600080fd5b5050506040518051600354909650600160a060020a03169050639c91ae208860405160e060020a63ffffffff841602815264ffffffffff9091166004820152602401602060405180830381600087803b151561046757600080fd5b5af1151561047457600080fd5b5050506040518051600354909550600160a060020a03169050632917f1628960405160e060020a63ffffffff841602815264ffffffffff9091166004820152602401602060405180830381600087803b15156104cf57600080fd5b5af115156104dc57600080fd5b5050506040518051600354909450600160a060020a03169050632917f1628860405160e060020a63ffffffff841602815264ffffffffff9091166004820152602401602060405180830381600087803b151561053757600080fd5b5af1151561054457600080fd5b5050506040518051905091508361ffff168561ffff168361ffff168561ffff16010303905080816502ba7def3000020266038d7ea4c68000019550505050505092915050565b600e90565b600054600160a060020a031681565b600181600e81106105ab57fe5b60089182820401919006600402915054906101000a900463ffffffff1681565b600190565b600354600160a060020a031681565b60005433600160a060020a039081169116146105fa57600080fd5b600160a060020a038116151561060f57600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a72305820fdf49fa9bea78c80b4b0d52f46b4e74794df596e300e0b130d9c2b0e3887f6e10029


   Swarm Source:
bzzr://fdf49fa9bea78c80b4b0d52f46b4e74794df596e300e0b130d9c2b0e3887f6e1
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.