Contract 0xf1f044e496cc345980e862006909bed09d6f5499

 

TxHash Block Age From To Value [TxFee]
0x7d8604915ad74410eb37d2a7d599a79abf72a0ef8565a7b64283d572020e0f9a687827968 days 19 hrs ago0x1fed8ba9a9fdd72ef9038046ad148beb413491b8 IN  0xf1f044e496cc345980e862006909bed09d6f54990 Ether0.005178978
0xd9b3371688b6e3ede9eb1fbe33a892a1836b2e81ca097956c2841fce560881b8675201789 days 15 hrs ago0x1fed8ba9a9fdd72ef9038046ad148beb413491b8 IN  0xf1f044e496cc345980e862006909bed09d6f54990 Ether0.00329598
0x8111db6954e6169dae822aa331a35ec09426f389980130577fca304690db9e1e671495495 days 17 hrs ago0x1fed8ba9a9fdd72ef9038046ad148beb413491b8 IN  0xf1f044e496cc345980e862006909bed09d6f54990 Ether0.003581886
0x948610995eafd4619688c65ba047f9f8686e32bb0538d01eb8477f85131300b46617959111 days 15 hrs ago0x1fed8ba9a9fdd72ef9038046ad148beb413491b8 IN  0xf1f044e496cc345980e862006909bed09d6f54990 Ether0.0054933
0x2c5f7d45a8cb9f34be933a11af16dbbdd1f20f41c2a9ca581a74bb8c11877f876573578118 days 21 hrs ago0x1fed8ba9a9fdd72ef9038046ad148beb413491b8 IN  Contract Creation0 Ether0.0320802
[ 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) Solidity Compiler Bugs.

Contract Source Code Verified (Exact Match)
Contract Name: MTEpisodeManager
Compiler Version: v0.4.24+commit.e67f0147
Optimization Enabled: No
Runs (Optimizer):  200


Contract Source Code
pragma solidity ^0.4.24;

// File: zeppelin-solidity/contracts/ownership/Ownable.sol

/**
 * @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 OwnershipRenounced(address indexed previousOwner);
  event OwnershipTransferred(
    address indexed previousOwner,
    address indexed newOwner
  );


  /**
   * @dev The Ownable constructor sets the original `owner` of the contract to the sender
   * account.
   */
  constructor() 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 relinquish control of the contract.
   */
  function renounceOwnership() public onlyOwner {
    emit OwnershipRenounced(owner);
    owner = address(0);
  }

  /**
   * @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 {
    _transferOwnership(_newOwner);
  }

  /**
   * @dev Transfers control of the contract to a newOwner.
   * @param _newOwner The address to transfer ownership to.
   */
  function _transferOwnership(address _newOwner) internal {
    require(_newOwner != address(0));
    emit OwnershipTransferred(owner, _newOwner);
    owner = _newOwner;
  }
}

// File: contracts/MTEpisodeManager.sol

contract IMTArtefact {
    uint public typesCount;
}

contract TVToken {
    function transfer(address _to, uint256 _value) public returns (bool);
    function safeTransfer(address _to, uint256 _value, bytes _data) public;
}

contract MTEpisodeManager is Ownable {
    address public manager;
    address public MTArtefactAddress;
    uint[] public restTypes;
    uint constant public artifactInEpisode = 5;
    uint public restTypesLength;

    uint[] public comicsCollection;
    uint public comicsCollectionBonus;
    mapping(uint => Collection) public collections;

    struct Collection {
        uint episodeNumber;
        uint[] artefactsTypes;
        uint comicsArtefactType;
        uint bonusRewardType;
        bool isFinal;
        bool isDefined;
    }

    modifier onlyOwnerOrManager() {
        require(msg.sender == owner || manager == msg.sender);
        _;
    }

    event EpisodeStart(
        uint number,
        uint bonusType,
        uint comicsArtefactType,
        bool isFinal,
        uint[] episodeArtefactTypes
    );

    constructor(
        address _manager,
        address _MTArtefactAddress
    ) public {
        manager = _manager;
        MTArtefactAddress = _MTArtefactAddress;
        restTypesLength =  IMTArtefact(MTArtefactAddress).typesCount();
        for (uint i = 0; i < restTypesLength; i++) {
            restTypes.push(i + 1);
        }
    }

    function episodeStart(
        uint number,
        uint bonusType,
        uint comicsArtefactType,
        bool isFinal
    ) public onlyOwnerOrManager {
        collections[number] = Collection(
            number,
            new uint[](artifactInEpisode),
            comicsArtefactType,
            bonusType,
            isFinal,
            true
        );
        for (uint i = 0; i < artifactInEpisode; i++) {
            uint randomTypeId = restTypes[getRandom(restTypesLength, i)];
            collections[number].artefactsTypes[i] = randomTypeId;
            removeRestType(randomTypeId);
        }
        emit EpisodeStart(number, bonusType, comicsArtefactType, isFinal, collections[number].artefactsTypes);
    }

    function getArtefactOfCollectionByIndex(uint episodeNumber, uint index) public view returns(uint) {
        return collections[episodeNumber].artefactsTypes[index];
    }

    function removeRestType(uint typeId) internal {
        for (uint i = 0; i < restTypesLength; i++) {
            if (restTypes[i] == typeId) {
                restTypes[i] = restTypes[restTypesLength - 1];
                restTypesLength--;
                return;
            }
        }
    }

    function setManager(address _manager) public onlyOwner {
        manager = _manager;
    }

    function getRandom(uint max, uint mix) internal view returns (uint random) {
        random = bytesToUint(keccak256(abi.encodePacked(blockhash(block.number - 1), mix))) % max;
    }

    function changeMTArtefactAddress(address newAddress) public onlyOwnerOrManager {
        MTArtefactAddress = newAddress;
    }

    function setComicsCollection(uint[] comicsArtefactIds, uint bonusTypeId) public onlyOwnerOrManager {
        comicsCollection = comicsArtefactIds;
        comicsCollectionBonus = bonusTypeId;
    }

    function getComicsCollectionLength() public view returns(uint) {
        return comicsCollection.length;
    }

    function getComicsCollectionArtefactByIndex(uint index) public view returns(uint) {
        return comicsCollection[index];
    }

    function getCollectionBonusType(uint episodeNumber) public view returns(uint bonusType) {
        bonusType = collections[episodeNumber].bonusRewardType;
    }

    function isFinal(uint episodeNumber) public view returns(bool) {
        return collections[episodeNumber].isFinal;
    }

    function bytesToUint(bytes32 b) internal pure returns (uint number){
        for (uint i = 0; i < b.length; i++) {
            number = number + uint(b[i]) * (2 ** (8 * (b.length - (i + 1))));
        }
    }
}

Contract ABI
[{"constant":false,"inputs":[{"name":"number","type":"uint256"},{"name":"bonusType","type":"uint256"},{"name":"comicsArtefactType","type":"uint256"},{"name":"isFinal","type":"bool"}],"name":"episodeStart","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"episodeNumber","type":"uint256"},{"name":"index","type":"uint256"}],"name":"getArtefactOfCollectionByIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MTArtefactAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"restTypesLength","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newAddress","type":"address"}],"name":"changeMTArtefactAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"episodeNumber","type":"uint256"}],"name":"isFinal","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"comicsCollectionBonus","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"manager","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getComicsCollectionLength","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"comicsArtefactIds","type":"uint256[]"},{"name":"bonusTypeId","type":"uint256"}],"name":"setComicsCollection","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"episodeNumber","type":"uint256"}],"name":"getCollectionBonusType","outputs":[{"name":"bonusType","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"artifactInEpisode","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"restTypes","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_manager","type":"address"}],"name":"setManager","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"index","type":"uint256"}],"name":"getComicsCollectionArtefactByIndex","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"comicsCollection","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"collections","outputs":[{"name":"episodeNumber","type":"uint256"},{"name":"comicsArtefactType","type":"uint256"},{"name":"bonusRewardType","type":"uint256"},{"name":"isFinal","type":"bool"},{"name":"isDefined","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_manager","type":"address"},{"name":"_MTArtefactAddress","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"number","type":"uint256"},{"indexed":false,"name":"bonusType","type":"uint256"},{"indexed":false,"name":"comicsArtefactType","type":"uint256"},{"indexed":false,"name":"isFinal","type":"bool"},{"indexed":false,"name":"episodeArtefactTypes","type":"uint256[]"}],"name":"EpisodeStart","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"}],"name":"OwnershipRenounced","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"previousOwner","type":"address"},{"indexed":true,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]

Contract Creation Code
608060405234801561001057600080fd5b506040516040806114bf83398101806040528101908080519060200190929190805190602001909291905050506000336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16634edf6fe06040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561018757600080fd5b505af115801561019b573d6000803e3d6000fd5b505050506040513d60208110156101b157600080fd5b8101908080519060200190929190505050600481905550600090505b60045481101561021357600360018201908060018154018082558091505090600182039060005260206000200160009091929091909150555080806001019150506101cd565b50505061129a806102256000396000f300608060405260043610610111576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680621c2c481461011657806303a2bfef1461016357806306cf260d146101ae5780630bd0645c1461020557806328c3301d1461023057806330501b0d1461027357806344ba6f6e146102b8578063481c6a75146102e35780635c1fe2801461033a57806370ea0ba114610365578063715018a6146103d55780638da5cb5b146103ec5780639260a170146104435780639ef2ee8b14610484578063ac9c3295146104af578063d0ebdbe7146104f0578063df0b7f3a14610533578063f2fde38b14610574578063fbd1be9f146105b7578063fdbda0ec146105f8575b600080fd5b34801561012257600080fd5b5061016160048036038101908080359060200190929190803590602001909291908035906020019092919080351515906020019092919050505061065d565b005b34801561016f57600080fd5b50610198600480360381019080803590602001909291908035906020019092919050505061093a565b6040518082815260200191505060405180910390f35b3480156101ba57600080fd5b506101c3610972565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561021157600080fd5b5061021a610998565b6040518082815260200191505060405180910390f35b34801561023c57600080fd5b50610271600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061099e565b005b34801561027f57600080fd5b5061029e60048036038101908080359060200190929190505050610a95565b604051808215151515815260200191505060405180910390f35b3480156102c457600080fd5b506102cd610ac2565b6040518082815260200191505060405180910390f35b3480156102ef57600080fd5b506102f8610ac8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561034657600080fd5b5061034f610aee565b6040518082815260200191505060405180910390f35b34801561037157600080fd5b506103d36004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190929190505050610afb565b005b3480156103e157600080fd5b506103ea610bd0565b005b3480156103f857600080fd5b50610401610cd2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561044f57600080fd5b5061046e60048036038101908080359060200190929190505050610cf7565b6040518082815260200191505060405180910390f35b34801561049057600080fd5b50610499610d17565b6040518082815260200191505060405180910390f35b3480156104bb57600080fd5b506104da60048036038101908080359060200190929190505050610d1c565b6040518082815260200191505060405180910390f35b3480156104fc57600080fd5b50610531600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d3f565b005b34801561053f57600080fd5b5061055e60048036038101908080359060200190929190505050610dde565b6040518082815260200191505060405180910390f35b34801561058057600080fd5b506105b5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e01565b005b3480156105c357600080fd5b506105e260048036038101908080359060200190929190505050610e68565b6040518082815260200191505060405180910390f35b34801561060457600080fd5b5061062360048036038101908080359060200190929190505050610e8b565b6040518086815260200185815260200184815260200183151515158152602001821515151581526020019550505050505060405180910390f35b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061070857503373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b151561071357600080fd5b60c06040519081016040528087815260200160056040519080825280602002602001820160405280156107555781602001602082028038833980820191505090505b508152602001858152602001868152602001841515815260200160011515815250600760008881526020019081526020016000206000820151816000015560208201518160010190805190602001906107af9291906111af565b50604082015181600201556060820151816003015560808201518160040160006101000a81548160ff02191690831515021790555060a08201518160040160016101000a81548160ff021916908315150217905550905050600091505b600582101561088457600361082360045484610edb565b81548110151561082f57fe5b9060005260206000200154905080600760008881526020019081526020016000206001018381548110151561086057fe5b906000526020600020018190555061087781610f8e565b818060010192505061080c565b7f458cb9df9467d8af4471ff994629eb2084f8bb3b0c75ca6d73758bdf8b989f4e86868686600760008c8152602001908152602001600020600101604051808681526020018581526020018481526020018315151515815260200180602001828103825283818154815260200191508054801561092057602002820191906000526020600020905b81548152602001906001019080831161090c575b5050965050505050505060405180910390a1505050505050565b6000600760008481526020019081526020016000206001018281548110151561095f57fe5b9060005260206000200154905092915050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610a4657503373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b1515610a5157600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60006007600083815260200190815260200160002060040160009054906101000a900460ff169050919050565b60065481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600580549050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610ba357503373ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b1515610bae57600080fd5b8160059080519060200190610bc49291906111fc565b50806006819055505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c2b57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600060076000838152602001908152602001600020600301549050919050565b600581565b600381815481101515610d2b57fe5b906000526020600020016000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d9a57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600582815481101515610def57fe5b90600052602060002001549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e5c57600080fd5b610e6581611025565b50565b600581815481101515610e7757fe5b906000526020600020016000915090505481565b60076020528060005260406000206000915090508060000154908060020154908060030154908060040160009054906101000a900460ff16908060040160019054906101000a900460ff16905085565b600082610f7c600143034084604051602001808360001916600019168152602001828152602001925050506040516020818303038152906040526040518082805190602001908083835b602083101515610f4a5780518252602082019150602081019050602083039250610f25565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902061111f565b811515610f8557fe5b06905092915050565b60008090505b6004548110156110205781600382815481101515610fae57fe5b90600052602060002001541415611013576003600160045403815481101515610fd357fe5b9060005260206000200154600382815481101515610fed57fe5b906000526020600020018190555060046000815480929190600190039190505550611021565b8080600101915050610f94565b5b5050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561106157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600090505b602060ff168110156111a95760018101602060ff160360080260020a838260208110151561115157fe5b1a7f0100000000000000000000000000000000000000000000000000000000000000027f0100000000000000000000000000000000000000000000000000000000000000900402820191508080600101915050611127565b50919050565b8280548282559060005260206000209081019282156111eb579160200282015b828111156111ea5782518255916020019190600101906111cf565b5b5090506111f89190611249565b5090565b828054828255906000526020600020908101928215611238579160200282015b8281111561123757825182559160200191906001019061121c565b5b5090506112459190611249565b5090565b61126b91905b8082111561126757600081600090555060010161124f565b5090565b905600a165627a7a7230582021dbf705b6099b5968e08c95f76fccadfda87a882afd9c27150c3a1fa086bacc00290000000000000000000000001fed8ba9a9fdd72ef9038046ad148beb413491b80000000000000000000000004a152c146ec60251c50817e2cff25700d6b711af


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

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000001fed8ba9a9fdd72ef9038046ad148beb413491b8
Arg [1] : 0000000000000000000000004a152c146ec60251c50817e2cff25700d6b711af


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