Contract 0xfdF4411669fC6e8951A6aE987307D7582FDA7A05

 
Ad
Crypto.com
Txn Hash Method
Block
From
To
Value
0xf345edad357004bdecfd6515512da30ea179e354d09f506bcd413145f1f55f6aAdd Moderator62293912018-08-28 14:57:041119 days 17 hrs agoEtheremonToken: Deployer 1 IN  Etheremon: Transform Data0 Ether0.000197564
0xd214f0cbdd41244c4a3a4c125ce604d2616e7cd667ca3303164e9e1b4b333381Add Moderator53245232018-03-26 9:44:181274 days 22 hrs agoEtheremonToken: Deployer 1 IN  Etheremon: Transform Data0 Ether0.000246955
0x18fd8e8823c101669cb69d00e690ad1d5306c81824da002cc56a4e3ce7a2608dAdd Moderator50001902018-01-30 14:25:531329 days 17 hrs agoEtheremonToken: Deployer 1 IN  Etheremon: Transform Data0 Ether0.000345737
0xd1eb45baa34ce570dd251d20c2746657b9bee4116f684f64904913913b6485b7Remove Moderator50001832018-01-30 14:23:451329 days 18 hrs agoEtheremonToken: Deployer 1 IN  Etheremon: Transform Data0 Ether0.0001369627
0x1101d4e9a23a64840c2b98e68d3aeeceb6da7f724c85c24cb6c365604350c960Add Moderator50000082018-01-30 13:43:541329 days 18 hrs agoEtheremonToken: Deployer 1 IN  Etheremon: Transform Data0 Ether0.000345737
0xee539ce8780d8db0f1e70b49590ebc83050fb86797af716728a0524a219d68740x6060604049949272018-01-29 16:57:151330 days 15 hrs agoEtheremonToken: Deployer 1 IN  Create: EtheremonTransformData0 Ether0.01331245311
[ Download CSV Export 
View more zero value Internal Transactions in Advanced View mode
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
EtheremonTransformData

Compiler Version
v0.4.19+commit.c4cbbb05

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
/**
 *Submitted for verification at Etherscan.io on 2018-01-29
*/

pragma solidity ^0.4.16;

// copyright [email protected]

contract SafeMath {

    /* function assert(bool assertion) internal { */
    /*   if (!assertion) { */
    /*     throw; */
    /*   } */
    /* }      // assert no longer needed once solidity is on 0.4.10 */

    function safeAdd(uint256 x, uint256 y) pure internal returns(uint256) {
      uint256 z = x + y;
      assert((z >= x) && (z >= y));
      return z;
    }

    function safeSubtract(uint256 x, uint256 y) pure internal returns(uint256) {
      assert(x >= y);
      uint256 z = x - y;
      return z;
    }

    function safeMult(uint256 x, uint256 y) pure internal returns(uint256) {
      uint256 z = x * y;
      assert((x == 0)||(z/x == y));
      return z;
    }

}

contract BasicAccessControl {
    address public owner;
    // address[] public moderators;
    uint16 public totalModerators = 0;
    mapping (address => bool) public moderators;
    bool public isMaintaining = true;

    function BasicAccessControl() public {
        owner = msg.sender;
    }

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

    modifier onlyModerators() {
        require(msg.sender == owner || moderators[msg.sender] == true);
        _;
    }

    modifier isActive {
        require(!isMaintaining);
        _;
    }

    function ChangeOwner(address _newOwner) onlyOwner public {
        if (_newOwner != address(0)) {
            owner = _newOwner;
        }
    }


    function AddModerator(address _newModerator) onlyOwner public {
        if (moderators[_newModerator] == false) {
            moderators[_newModerator] = true;
            totalModerators += 1;
        }
    }
    
    function RemoveModerator(address _oldModerator) onlyOwner public {
        if (moderators[_oldModerator] == true) {
            moderators[_oldModerator] = false;
            totalModerators -= 1;
        }
    }

    function UpdateMaintaining(bool _isMaintaining) onlyOwner public {
        isMaintaining = _isMaintaining;
    }
}

contract EtheremonEnum {

    enum ResultCode {
        SUCCESS,
        ERROR_CLASS_NOT_FOUND,
        ERROR_LOW_BALANCE,
        ERROR_SEND_FAIL,
        ERROR_NOT_TRAINER,
        ERROR_NOT_ENOUGH_MONEY,
        ERROR_INVALID_AMOUNT
    }
    
    enum ArrayType {
        CLASS_TYPE,
        STAT_STEP,
        STAT_START,
        STAT_BASE,
        OBJ_SKILL
    }
}


contract EtheremonTransformData is EtheremonEnum, BasicAccessControl, SafeMath {
    
    struct MonsterEgg {
        uint64 eggId;
        uint64 objId;
        uint32 classId;
        address trainer;
        uint hatchTime;
        uint64 newObjId;
    }
    
    uint64 public totalEgg = 0;
    mapping(uint64 => MonsterEgg) public eggs; // eggId
    mapping(address => uint64) public hatchingEggs;
    mapping(uint64 => uint64[]) public eggList; // objId -> [eggId]
    mapping(uint64 => uint64) public transformed; //objId -> newObjId
    
    // only moderators
    /*
    TO AVOID ANY BUGS, WE ALLOW MODERATORS TO HAVE PERMISSION TO ALL THESE FUNCTIONS AND UPDATE THEM IN EARLY BETA STAGE.
    AFTER THE SYSTEM IS STABLE, WE WILL REMOVE OWNER OF THIS SMART CONTRACT AND ONLY KEEP ONE MODERATOR WHICH IS ETHEREMON BATTLE CONTRACT.
    HENCE, THE DECENTRALIZED ATTRIBUTION IS GUARANTEED.
    */
    
    function addEgg(uint64 _objId, uint32 _classId, address _trainer, uint _hatchTime) onlyModerators external returns(uint64) {
        totalEgg += 1;
        MonsterEgg storage egg = eggs[totalEgg];
        egg.objId = _objId;
        egg.eggId = totalEgg;
        egg.classId = _classId;
        egg.trainer = _trainer;
        egg.hatchTime = _hatchTime;
        egg.newObjId = 0;
        hatchingEggs[_trainer] = totalEgg;
        
        // increase count
        if (_objId > 0) {
            eggList[_objId].push(totalEgg);
        }
        return totalEgg;
    }
    
    function setHatchedEgg(uint64 _eggId, uint64 _newObjId) onlyModerators external {
        MonsterEgg storage egg = eggs[_eggId];
        if (egg.eggId != _eggId)
            revert();
        egg.newObjId = _newObjId;
        hatchingEggs[egg.trainer] = 0;
    }
    
    function setHatchTime(uint64 _eggId, uint _hatchTime) onlyModerators external {
        MonsterEgg storage egg = eggs[_eggId];
        if (egg.eggId != _eggId)
            revert();
        egg.hatchTime = _hatchTime;
    }
    
    function setTranformed(uint64 _objId, uint64 _newObjId) onlyModerators external {
        transformed[_objId] = _newObjId;
    }
    
    
    function getHatchingEggId(address _trainer) constant external returns(uint64) {
        return hatchingEggs[_trainer];
    }
    
    function getEggDataById(uint64 _eggId) constant external returns(uint64, uint64, uint32, address, uint, uint64) {
        MonsterEgg memory egg = eggs[_eggId];
        return (egg.eggId, egg.objId, egg.classId, egg.trainer, egg.hatchTime, egg.newObjId);
    }
    
    function getHatchingEggData(address _trainer) constant external returns(uint64, uint64, uint32, address, uint, uint64) {
        MonsterEgg memory egg = eggs[hatchingEggs[_trainer]];
        return (egg.eggId, egg.objId, egg.classId, egg.trainer, egg.hatchTime, egg.newObjId);
    }
    
    function getTranformedId(uint64 _objId) constant external returns(uint64) {
        return transformed[_objId];
    }
    
    function countEgg(uint64 _objId) constant external returns(uint) {
        return eggList[_objId].length;
    }
    
    function getEggIdByObjId(uint64 _objId, uint _index) constant external returns(uint64, uint64, uint32, address, uint, uint64) {
        MonsterEgg memory egg = eggs[eggList[_objId][_index]];
        return (egg.eggId, egg.objId, egg.classId, egg.trainer, egg.hatchTime, egg.newObjId);
    }
}

Contract Security Audit

Contract ABI

[{"constant":false,"inputs":[{"name":"_objId","type":"uint64"},{"name":"_classId","type":"uint32"},{"name":"_trainer","type":"address"},{"name":"_hatchTime","type":"uint256"}],"name":"addEgg","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"moderators","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_eggId","type":"uint64"},{"name":"_newObjId","type":"uint64"}],"name":"setHatchedEgg","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint64"},{"name":"","type":"uint256"}],"name":"eggList","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_isMaintaining","type":"bool"}],"name":"UpdateMaintaining","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"totalModerators","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_objId","type":"uint64"},{"name":"_newObjId","type":"uint64"}],"name":"setTranformed","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_eggId","type":"uint64"}],"name":"getEggDataById","outputs":[{"name":"","type":"uint64"},{"name":"","type":"uint64"},{"name":"","type":"uint32"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newModerator","type":"address"}],"name":"AddModerator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_trainer","type":"address"}],"name":"getHatchingEggData","outputs":[{"name":"","type":"uint64"},{"name":"","type":"uint64"},{"name":"","type":"uint32"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"hatchingEggs","outputs":[{"name":"","type":"uint64"}],"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":"_objId","type":"uint64"},{"name":"_index","type":"uint256"}],"name":"getEggIdByObjId","outputs":[{"name":"","type":"uint64"},{"name":"","type":"uint64"},{"name":"","type":"uint32"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint64"}],"name":"eggs","outputs":[{"name":"eggId","type":"uint64"},{"name":"objId","type":"uint64"},{"name":"classId","type":"uint32"},{"name":"trainer","type":"address"},{"name":"hatchTime","type":"uint256"},{"name":"newObjId","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint64"}],"name":"transformed","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_trainer","type":"address"}],"name":"getHatchingEggId","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_oldModerator","type":"address"}],"name":"RemoveModerator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_eggId","type":"uint64"},{"name":"_hatchTime","type":"uint256"}],"name":"setHatchTime","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_objId","type":"uint64"}],"name":"countEgg","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isMaintaining","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"ChangeOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_objId","type":"uint64"}],"name":"getTranformedId","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalEgg","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"}]

6060604052600080546002805468ffffffffffffffff001960ff19909116600117169055600160a060020a033316600160b060020a03199091161790556110858061004b6000396000f3006060604052600436106101325763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630bc954dc811461013757806314d0f1ba1461018c57806337bd1868146101bf5780633a812010146101e757806348ef5aa81461020a5780634efb023e1461022257806354b670571461024c57806355a51cde146102725780636c81fd6d146102e3578063710ad128146103025780637ad5177e146103215780638da5cb5b1461034057806395e83c291461036f5780639fc0ed1614610392578063a496fda9146103b2578063aeb669eb146103d2578063b85d6275146103f1578063e177573c14610410578063ec0ba00614610433578063ee4e441614610465578063f285329214610478578063fd7d794814610497578063fdb4dbe0146104b7575b600080fd5b341561014257600080fd5b61016f67ffffffffffffffff6004351663ffffffff60243516600160a060020a03604435166064356104ca565b60405167ffffffffffffffff909116815260200160405180910390f35b341561019757600080fd5b6101ab600160a060020a0360043516610794565b604051901515815260200160405180910390f35b34156101ca57600080fd5b6101e567ffffffffffffffff600435811690602435166107a9565b005b34156101f257600080fd5b61016f67ffffffffffffffff60043516602435610861565b341561021557600080fd5b6101e560043515156108ad565b341561022d57600080fd5b6102356108db565b60405161ffff909116815260200160405180910390f35b341561025757600080fd5b6101e567ffffffffffffffff600435811690602435166108fd565b341561027d57600080fd5b61029267ffffffffffffffff60043516610973565b60405167ffffffffffffffff9687168152948616602086015263ffffffff909316604080860191909152600160a060020a0390921660608501526080840152921660a082015260c001905180910390f35b34156102ee57600080fd5b6101e5600160a060020a0360043516610a4e565b341561030d57600080fd5b610292600160a060020a0360043516610af8565b341561032c57600080fd5b61016f600160a060020a0360043516610be9565b341561034b57600080fd5b610353610c05565b604051600160a060020a03909116815260200160405180910390f35b341561037a57600080fd5b61029267ffffffffffffffff60043516602435610c14565b341561039d57600080fd5b61029267ffffffffffffffff60043516610d4b565b34156103bd57600080fd5b61016f67ffffffffffffffff60043516610db7565b34156103dd57600080fd5b61016f600160a060020a0360043516610dd3565b34156103fc57600080fd5b6101e5600160a060020a0360043516610df8565b341561041b57600080fd5b6101e567ffffffffffffffff60043516602435610ea2565b341561043e57600080fd5b61045367ffffffffffffffff60043516610f1a565b60405190815260200160405180910390f35b341561047057600080fd5b6101ab610f36565b341561048357600080fd5b6101e5600160a060020a0360043516610f3f565b34156104a257600080fd5b61016f67ffffffffffffffff60043516610f96565b34156104c257600080fd5b61016f610fb5565b60008054819033600160a060020a03908116911614806105085750600160a060020a03331660009081526001602081905260409091205460ff161515145b151561051357600080fd5b6001600260018282829054906101000a900467ffffffffffffffff160192506101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060036000600260019054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020019081526020016000209050858160000160086101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550600260019054906101000a900467ffffffffffffffff168160000160006101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550848160000160106101000a81548163ffffffff021916908363ffffffff160217905550838160010160006101000a815481600160a060020a030219169083600160a060020a0316021790555082816002018190555060008160030160006101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550600260019054906101000a900467ffffffffffffffff166004600086600160a060020a0316600160a060020a0316815260200190815260200160002060006101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060008667ffffffffffffffff1611156107785767ffffffffffffffff861660009081526005602052604090208054600181016107208382610fca565b9160005260206000209060049182820401919006600802600260019054906101000a900467ffffffffffffffff16909190916101000a81548167ffffffffffffffff021916908367ffffffffffffffff160217905550505b5050600254610100900467ffffffffffffffff16949350505050565b60016020526000908152604090205460ff1681565b6000805433600160a060020a03908116911614806107e55750600160a060020a03331660009081526001602081905260409091205460ff161515145b15156107f057600080fd5b5067ffffffffffffffff808316600081815260036020526040902080549092161461081a57600080fd5b60038101805467ffffffffffffffff90931667ffffffffffffffff1993841617905560010154600160a060020a031660009081526004602052604090208054909116905550565b60056020528160005260406000208181548110151561087c57fe5b9060005260206000209060049182820401919006600802915091509054906101000a900467ffffffffffffffff1681565b60005433600160a060020a039081169116146108c857600080fd5b6002805460ff1916911515919091179055565b60005474010000000000000000000000000000000000000000900461ffff1681565b60005433600160a060020a03908116911614806109385750600160a060020a03331660009081526001602081905260409091205460ff161515145b151561094357600080fd5b67ffffffffffffffff9182166000908152600660205260409020805467ffffffffffffffff191691909216179055565b600080600080600080610984611003565b67ffffffffffffffff8816600090815260036020526040908190209060c090519081016040908152825467ffffffffffffffff80821684526801000000000000000082048116602085015270010000000000000000000000000000000090910463ffffffff16918301919091526001830154600160a060020a031660608301526002830154608083015260039092015490911660a08201529050805181602001518260400151836060015184608001518560a00151949d939c50919a509850965090945092505050565b60005433600160a060020a03908116911614610a6957600080fd5b600160a060020a03811660009081526001602052604090205460ff161515610af557600160a060020a03811660009081526001602081905260408220805460ff191682179055815461ffff7401000000000000000000000000000000000000000080830482169093011690910275ffff0000000000000000000000000000000000000000199091161790555b50565b600080600080600080610b09611003565b600160a060020a03881660009081526004602090815260408083205467ffffffffffffffff1683526003909152908190209060c090519081016040908152825467ffffffffffffffff80821684526801000000000000000082048116602085015270010000000000000000000000000000000090910463ffffffff16918301919091526001830154600160a060020a031660608301526002830154608083015260039092015490911660a08201529050805181602001518260400151836060015184608001518560a00151949d939c50919a509850965090945092505050565b60046020526000908152604090205467ffffffffffffffff1681565b600054600160a060020a031681565b600080600080600080610c25611003565b67ffffffffffffffff89166000908152600560205260408120805460039291908b908110610c4f57fe5b90600052602060002090600491828204019190066008029054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060c06040519081016040908152825467ffffffffffffffff80821684526801000000000000000082048116602085015270010000000000000000000000000000000090910463ffffffff16918301919091526001830154600160a060020a031660608301526002830154608083015260039092015490911660a08201529050805181602001518260400151836060015184608001518560a00151949e939d50919b50995097509095509350505050565b6003602081905260009182526040909120805460018201546002830154929093015467ffffffffffffffff8083169468010000000000000000840482169470010000000000000000000000000000000090940463ffffffff1693600160a060020a039091169290911686565b60066020526000908152604090205467ffffffffffffffff1681565b600160a060020a031660009081526004602052604090205467ffffffffffffffff1690565b60005433600160a060020a03908116911614610e1357600080fd5b600160a060020a03811660009081526001602081905260409091205460ff1615151415610af557600160a060020a03166000908152600160205260408120805460ff19169055805475ffff0000000000000000000000000000000000000000198116740100000000000000000000000000000000000000009182900461ffff9081166000190116909102179055565b6000805433600160a060020a0390811691161480610ede5750600160a060020a03331660009081526001602081905260409091205460ff161515145b1515610ee957600080fd5b5067ffffffffffffffff8083166000818152600360205260409020805490921614610f1357600080fd5b6002015550565b67ffffffffffffffff1660009081526005602052604090205490565b60025460ff1681565b60005433600160a060020a03908116911614610f5a57600080fd5b600160a060020a03811615610af55760008054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff1990911617905550565b67ffffffffffffffff9081166000908152600660205260409020541690565b600254610100900467ffffffffffffffff1681565b815481835581811511610ffe576003016004900481600301600490048360005260206000209182019101610ffe9190611038565b505050565b60c06040519081016040908152600080835260208301819052908201819052606082018190526080820181905260a082015290565b61105691905b80821115611052576000815560010161103e565b5090565b905600a165627a7a723058205708cb3921fe88621fb3d8ccafb86a4c1566931a3192879f5a58ecfaab39a6c90029

Swarm Source

bzzr://5708cb3921fe88621fb3d8ccafb86a4c1566931a3192879f5a58ecfaab39a6c9
Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.