Contract Overview
Balance: 17.988220000000000005 Ether
Ether Value: $2,098.87 (@ $116.68/ETH)
Transactions: 5241 txns
Misc:
Address Watch: Add To Watch List
Contract Creator: 0xe0a66218c40230967d4240d25f6220a28e52c7ffat txn 0x0322b2162a332ee759f00560636f662057c0aabba70e354b84a80d1b443ecbc1
 Latest 25 transactions from a total of 5241 transactions
(+9 PendingTxns)

TxHash Age From To Value [TxFee]
0x4aa497fab93b553ef0902f3a7374bff4631b3532a6343c448661689d10fd1191(pending)0x7eb282f1701fd71c3d387ec96815c401bd851b8b  IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether(Pending)
0xb56fc36730b93ce3441149b9b31121ca1b451f29c1c5bd515314e09ab326a679(pending)0x7eb282f1701fd71c3d387ec96815c401bd851b8b  IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether(Pending)
0x8c0fd660656f4082ae41e4166d4c99f1814a911ccdaab5432ca0248e1a371226(pending)0xf94164a9e73d77dd1a35fad94bb5484a79ed2814  IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether(Pending)
0x674a31e3cf11f6422cfa7e26770f9663fd1d31505d7f6db63ba4d0557914389c(pending)0x42803fabbd88017e6a9f57e0de1478218fa9cfc7  IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether(Pending)
0x8296a369ed3941f65e2313aeafe86909a59b3ca0ff46157f6ed312cb5d9f954e(pending)0xfa98ecaa15ed7e526c8f132537f7a81c4822685e  IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether(Pending)
0x1176a4ff72bb35cd915fe6335d45fb48e03003958e94fd649d2381d0a4d0f7d3(pending)0x9272a4a51e28a1bdc384f3346d3f782379d8fcb9  IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether(Pending)
0x63f06ae8fdec1b845a0c6dc51127603bbf96870d2079174a47c0c437e8563ab9(pending)0xb1f8fba15beea5355f7f186861e8799600c9ed6b  IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether(Pending)
0x237e406b5e4729af630df508112a2cc39239aae743d11dcc53c59c7fde4e29b5(pending)0x9c21e9da5ff4eb7aff6c96aa08fb95503e4b97f9  IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether(Pending)
0x6373fe560e40bf752f9178b87ba58ab70f792248700e4c23453e8095fdd065a1(pending)0x9c21e9da5ff4eb7aff6c96aa08fb95503e4b97f9  IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether(Pending)
0x420a791dfdfe3042a809253215918c1b692a7bab1e6000e6fc15d9489e22aa454 mins ago0x1459465da744efa6628feef0528914dbbb32de5e  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.001954065
0xf3e6ed3a1aa61c96bc8888ee5f5bd29ba18d6e375c3b37b8eea1a87ab6f077544 mins ago0x1459465da744efa6628feef0528914dbbb32de5e  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.001949515
0x37dd4598b9a716199ce6f547da633b0b6a40e4da197dcd1cb90bcccefe9a576a4 mins ago0x1459465da744efa6628feef0528914dbbb32de5e  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.002094645
0x138e1ebede95c7562e62639b905e7c6fd7494b6e7a72487fb45feac1d63223ea3 hrs 10 mins ago0x31b340bd77fc5fb638951ef407a2b5f0d4cf2958  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.002094005
0xaea0341c3787f95273d1440e5790187995cfaa42227078bb29e56d0db90049415 hrs 14 mins ago0xc24c375a77baf82750c46f1c76c809d5ad4c6769  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.002036635
0x40f61657b5377e6d294e435f1b091fba5b71b5b7f4357014d3265b46175eb83e5 hrs 27 mins ago0xc24c375a77baf82750c46f1c76c809d5ad4c6769  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.001957975
0x42cd87e84419a449f24933481077dcc61673752724381361ce0b4f5b7ff3b56a5 hrs 36 mins ago0x5f4b44e3b147553a681af2e2ce2d105a0a16dba6  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.001954385
0x1f23c6adbd2f931c263cb4c968196ef44fb5361b836b672f3f0a853cb63765ac5 hrs 48 mins ago0xc24c375a77baf82750c46f1c76c809d5ad4c6769  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.001953105
0x1692a88fd209bcf7759a45aea417d229510bd5140620626dd389f6898a0945ce5 hrs 49 mins ago0x5f4b44e3b147553a681af2e2ce2d105a0a16dba6  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.001948875
0x6a92fd8912aaaed5d4e54f4441b40aee7bd2f9d82f77feae21830bba9897ffba7 hrs 35 mins ago0x5f4b44e3b147553a681af2e2ce2d105a0a16dba6  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.001256595
0x7f795df704c71c619cf79a17176c6c3801891e3b7d6bc2530f520cf08873446c8 hrs 21 mins ago0x11f7d9f08d7b548b0a0ec8329de0994fc0c7dbbd  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.00419249
0x6bf83935b9d8f30db49fb913e2688a824a49c922b5e4f10df3bb894ccbec1d1b9 hrs 26 mins ago0x4550d74cc0ac86f88aabed20a6c1a4b59dfab3c5  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00.03186 Ether0.0016669
0x26bf49c466e51acca40a5811d5ff4b8653a1a64f896451a3c1a60f2c5932910410 hrs 16 mins ago0x64b7fcc8c17540139bdd84d00c7261035602cb66  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.001171863
0x51d8966c7057a3afd9824d4e9d8b89176ccfa4588959a35b631301801e7a2b6e10 hrs 16 mins ago0x64b7fcc8c17540139bdd84d00c7261035602cb66  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.001169325
0xca5932d586e1225391283f0e677ccee056562e7b8556205d2ccf597328579cca10 hrs 16 mins ago0x64b7fcc8c17540139bdd84d00c7261035602cb66  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.001256403
0x9f67db5afd83b9f6d755b8ee7d0f25ef6ec63295c12e859e34b8306f01b8111a11 hrs 26 mins ago0xc46881b1b09c18c2885891e27e6d96be37a2157c  IN   0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.0038570908
[ 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
0x6c72ffea2c750a97f62f30b4d462166f786d66c1fe678217a984fd348e931f83701181617 days 11 hrs ago0xffa4bee0b9cd2c2e4eacb8d8f11096baa3e6c55d0x5f480ca354304aae88d7dd66cd4735c59d543af00.031440000000000004 Ether
0xd92c54e5961feaecbf4a1637a8f0d24c6d845213eafc4a9cb332de6a8045e985696628425 days 6 hrs ago0x5f480ca354304aae88d7dd66cd4735c59d543af00x7ec915b8d3ffee3deaae5aa90def8ad826d2e1100.01712 Ether
0x0d7996ce077273241f3a3752a94176d8e88d8e70b04a51113ac377c07052aa73669481770 days 8 hrs ago0x5f480ca354304aae88d7dd66cd4735c59d543af00x68d36dcbdd7bbf206e27134f28103abe7cf972df0.00008 Ether
0x02d93a7fc7d67ed43c11f8388c968b6b1f1871e96005d50e3fd2b071a066e671658038689 days 1 hr ago0x5f480ca354304aae88d7dd66cd4735c59d543af00xcd4fec10c8ad4873e209062b31defb684ff8cb7c0.00026 Ether
0xe2a6a053b502155013e4695007c00899a414c565b7c69f629e9f2640dd53232e657501589 days 22 hrs ago0xffa4bee0b9cd2c2e4eacb8d8f11096baa3e6c55d0x5f480ca354304aae88d7dd66cd4735c59d543af00.0312 Ether
0x5277d9161ddda9a8830f3fefdb21e0918c30485905f848fd14522459bc9babd9656375491 days 18 hrs ago0x5f480ca354304aae88d7dd66cd4735c59d543af00x11201a653cc4c6cea0610f09fd6ea4559db7c5640.00003 Ether
0xb30e45526ad7b7b7872de59765701b61b80f7590dca813fd2ec1ff5683a98cb8656065592 days 7 hrs ago0x5f480ca354304aae88d7dd66cd4735c59d543af00x5ef4848a529942ec87d4f73686a6c221d4d76d3a0.002 Ether
0x159ac8e5f3f83cad93320051f58665e97c25216bc8c036e6c92cd2dda2e4ffb0656064392 days 7 hrs ago0x5f480ca354304aae88d7dd66cd4735c59d543af00x5ef4848a529942ec87d4f73686a6c221d4d76d3a0.00068 Ether
0xfb1719b67a43e49ea6f8c765f44f205678e12273d071afb9b9be358e554f5802655835092 days 16 hrs ago0x5f480ca354304aae88d7dd66cd4735c59d543af00x45a49a84bca4c04c6b7234658ca2953f416285310.00018 Ether
0x0d556fcc7b9d150fbbf463d739ad9cf583dc624122ecd2d07351d0786bdba140655541693 days 3 hrs ago0xffa4bee0b9cd2c2e4eacb8d8f11096baa3e6c55d0x5f480ca354304aae88d7dd66cd4735c59d543af00.03144 Ether
0x46840b4f6580a2e748243dec59eb0986ddd1d633242c9b3263fd8253593cf74e6502054101 days 20 hrs ago0x5f480ca354304aae88d7dd66cd4735c59d543af00xcbbdce7e539916630936453dfbd1cbcb82d414bf0.00001 Ether
0x92bfa16a831b93c27b6afbf4ac1372b5f623b6cb418d1586fb687b7a537a84ef6495411102 days 22 hrs ago0x5f480ca354304aae88d7dd66cd4735c59d543af00x1d18e6494ce1e5f12eae7df7a44a9156bbc9941f0.00022 Ether
0xa302ce9fcac90f5f3ed3b83e97072b9d927e1f7e4a223d686b7bd25da77a0e336478663105 days 15 hrs ago0xffa4bee0b9cd2c2e4eacb8d8f11096baa3e6c55d0x5f480ca354304aae88d7dd66cd4735c59d543af00.03111 Ether
0xdda560beffe518ede706b9291cf6ab02d610cd40decefe783de16f324c18e5586474500106 days 7 hrs ago0x5f480ca354304aae88d7dd66cd4735c59d543af00x30b0e3507e60300baccc0dc9c7932e1c487015f70.00003 Ether
0xdc091c1064659573781bdf04547ea61dede14d838632aca48a21a37f9c18c4b86474464106 days 8 hrs ago0x5f480ca354304aae88d7dd66cd4735c59d543af00x951cbf802dc181541586b478ac867a48074942890.00012 Ether
0x8b7c1cefddf4c7c6934209e3bae4bac456bd76acf1dd18de1ccd0cb84e6dc7636470187107 days 26 mins ago0x5f480ca354304aae88d7dd66cd4735c59d543af00x45bc64754df98bca99e86d4321fae33cfbbebd5b0.00009 Ether
0xd2b1dd6471e182dedf467173d9dcafa63013256193041a9f88a54dad6b58bd336468285107 days 7 hrs ago0x5f480ca354304aae88d7dd66cd4735c59d543af00xf35728a27318156ae04ba8a6dff8074fe98b19b844.2 Ether
0x289ea006cb6ba67399ccdd9f6a743fe7e6f361673fe0e532576266529f23f0c76465602107 days 18 hrs ago0xffa4bee0b9cd2c2e4eacb8d8f11096baa3e6c55d0x5f480ca354304aae88d7dd66cd4735c59d543af00.3369 Ether
0x4bcd015770c3975d56fddc79b9ba98cc66559c21ec3f0f9f59420e4a640838846465014107 days 20 hrs ago0xffa4bee0b9cd2c2e4eacb8d8f11096baa3e6c55d0x5f480ca354304aae88d7dd66cd4735c59d543af00.3363 Ether
0x42c02056593a438e570b08975a351f324130e8e65502824f823352b611f25a436463237108 days 3 hrs ago0xffa4bee0b9cd2c2e4eacb8d8f11096baa3e6c55d0x5f480ca354304aae88d7dd66cd4735c59d543af00.03237 Ether
0x63e29dedfc9aa68855168830f42270477e305e0bcd29589c26b1fc24d05352106463174108 days 3 hrs ago0xffa4bee0b9cd2c2e4eacb8d8f11096baa3e6c55d0x5f480ca354304aae88d7dd66cd4735c59d543af00.336 Ether
0xcf1755037700b6bb9951578eea21e622f414c0ea8bc037900f6e61bb7ec691f26463118108 days 3 hrs ago0xffa4bee0b9cd2c2e4eacb8d8f11096baa3e6c55d0x5f480ca354304aae88d7dd66cd4735c59d543af00.3357 Ether
0x614b91a7cdcd96316e107a7e08d1ac7cea797582121d61d37a3aa642ab9da73f6463107108 days 3 hrs ago0xffa4bee0b9cd2c2e4eacb8d8f11096baa3e6c55d0x5f480ca354304aae88d7dd66cd4735c59d543af00.3354 Ether
0xacd7c14900045f162fc13ea20cd446324093349fec279b98e943b57075e999306462942108 days 4 hrs ago0x5f480ca354304aae88d7dd66cd4735c59d543af00xb7cbb68d685f3bd1a151663eb9679d64dfd947900.0049 Ether
0x4e3e985bc574f756f41d9b8ee4aa275adca622d8ee8f23a5d604f424ecbc292b6456964109 days 3 hrs ago0xffa4bee0b9cd2c2e4eacb8d8f11096baa3e6c55d0x5f480ca354304aae88d7dd66cd4735c59d543af00.3324 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: EtheremonWorldNFT
Compiler Text: v0.4.24+commit.e67f0147
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.23;

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

    constructor() 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;
    }
}

interface EtheremonMonsterNFTInterface {
   function triggerTransferEvent(address _from, address _to, uint _tokenId) external;
   function getMonsterCP(uint64 _monsterId) constant external returns(uint cp);
}

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
    }
    
    enum PropertyType {
        ANCESTOR,
        XFACTOR
    }
}

contract EtheremonDataBase {
    
    uint64 public totalMonster;
    uint32 public totalClass;
    
    // write
    function addElementToArrayType(EtheremonEnum.ArrayType _type, uint64 _id, uint8 _value) external returns(uint);
    function addMonsterObj(uint32 _classId, address _trainer, string _name) external returns(uint64);
    function removeMonsterIdMapping(address _trainer, uint64 _monsterId) external;
    
    // read
    function getElementInArrayType(EtheremonEnum.ArrayType _type, uint64 _id, uint _index) constant external returns(uint8);
    function getMonsterClass(uint32 _classId) constant external returns(uint32 classId, uint256 price, uint256 returnPrice, uint32 total, bool catchable);
    function getMonsterObj(uint64 _objId) constant external returns(uint64 objId, uint32 classId, address trainer, uint32 exp, uint32 createIndex, uint32 lastClaimIndex, uint createTime);
}

contract EtheremonWorldNFT is BasicAccessControl {
    uint8 constant public STAT_COUNT = 6;
    uint8 constant public STAT_MAX = 32;
    
    struct MonsterClassAcc {
        uint32 classId;
        uint256 price;
        uint256 returnPrice;
        uint32 total;
        bool catchable;
    }

    struct MonsterObjAcc {
        uint64 monsterId;
        uint32 classId;
        address trainer;
        string name;
        uint32 exp;
        uint32 createIndex;
        uint32 lastClaimIndex;
        uint createTime;
    }
    
    address public dataContract;
    address public monsterNFT;
    
    mapping(uint32 => bool) classWhitelist;
    mapping(address => bool) addressWhitelist;
    
    uint public gapFactor = 5;
    uint public priceIncreasingRatio = 1000;
    
    function setContract(address _dataContract, address _monsterNFT) onlyModerators external {
        dataContract = _dataContract;
        monsterNFT = _monsterNFT;
    }
    
    function setConfig(uint _gapFactor, uint _priceIncreasingRatio) onlyModerators external {
        gapFactor = _gapFactor;
        priceIncreasingRatio = _priceIncreasingRatio;
    }
    
    function setClassWhitelist(uint32 _classId, bool _status) onlyModerators external {
        classWhitelist[_classId] = _status;
    }

    function setAddressWhitelist(address _smartcontract, bool _status) onlyModerators external {
        addressWhitelist[_smartcontract] = _status;
    }
    
    function withdrawEther(address _sendTo, uint _amount) onlyOwner public {
        if (_amount > address(this).balance) {
            revert();
        }
        _sendTo.transfer(_amount);
    }
    
    function mintMonster(uint32 _classId, address _trainer, string _name) onlyModerators external returns(uint){
        EtheremonDataBase data = EtheremonDataBase(dataContract);
        // add monster
        uint64 objId = data.addMonsterObj(_classId, _trainer, _name);
        uint8 value;
        uint seed = getRandom(_trainer, block.number-1, objId);
        // generate base stat for the previous one
        for (uint i=0; i < STAT_COUNT; i+= 1) {
            seed /= 100;
            value = uint8(seed % STAT_MAX) + data.getElementInArrayType(EtheremonEnum.ArrayType.STAT_START, uint64(_classId), i);
            data.addElementToArrayType(EtheremonEnum.ArrayType.STAT_BASE, objId, value);
        }
        
        EtheremonMonsterNFTInterface(monsterNFT).triggerTransferEvent(address(0), _trainer, objId);
        return objId;
    }
    
    function burnMonster(uint64 _tokenId) onlyModerators external {
        // need to check condition before calling this function
        EtheremonDataBase data = EtheremonDataBase(dataContract);
        MonsterObjAcc memory obj;
        (obj.monsterId, obj.classId, obj.trainer, obj.exp, obj.createIndex, obj.lastClaimIndex, obj.createTime) = data.getMonsterObj(_tokenId);
        require(obj.trainer != address(0));
        data.removeMonsterIdMapping(obj.trainer, _tokenId);
        EtheremonMonsterNFTInterface(monsterNFT).triggerTransferEvent(obj.trainer, address(0), _tokenId);
    }
    
    // public api 
    function getRandom(address _player, uint _block, uint _count) view public returns(uint) {
        return uint(keccak256(abi.encodePacked(blockhash(_block), _player, _count)));
    }
    
    function getMonsterClassBasic(uint32 _classId) constant external returns(uint256, uint256, uint256, bool) {
        EtheremonDataBase data = EtheremonDataBase(dataContract);
        MonsterClassAcc memory class;
        (class.classId, class.price, class.returnPrice, class.total, class.catchable) = data.getMonsterClass(_classId);
        return (class.price, class.returnPrice, class.total, class.catchable);
    }
    
    function getPrice(uint32 _classId) constant external returns(bool catchable, uint price) {
        EtheremonDataBase data = EtheremonDataBase(dataContract);
        MonsterClassAcc memory class;
        (class.classId, class.price, class.returnPrice, class.total, class.catchable) = data.getMonsterClass(_classId);
        
        price = class.price;
        if (class.total > 0)
            price += class.price*(class.total-1)/priceIncreasingRatio;
        
        if (class.catchable == false) {
            return (classWhitelist[_classId], price);
        } else {
            return (true, price);
        }
    }
    
    function catchMonsterNFT(uint32 _classId, string _name) isActive external payable{
        EtheremonDataBase data = EtheremonDataBase(dataContract);
        MonsterClassAcc memory class;
        (class.classId, class.price, class.returnPrice, class.total, class.catchable) = data.getMonsterClass(_classId);
        if (class.classId == 0 || class.catchable == false) {
            revert();
        }
        
        uint price = class.price;
        if (class.total > 0)
            price += class.price*(class.total-1)/priceIncreasingRatio;
        if (msg.value < price) {
            revert();
        }
        
        // add new monster 
        uint64 objId = data.addMonsterObj(_classId, msg.sender, _name);
        uint8 value;
        uint seed = getRandom(msg.sender, block.number-1, objId);
        // generate base stat for the previous one
        for (uint i=0; i < STAT_COUNT; i+= 1) {
            seed /= 100;
            value = uint8(seed % STAT_MAX) + data.getElementInArrayType(EtheremonEnum.ArrayType.STAT_START, uint64(_classId), i);
            data.addElementToArrayType(EtheremonEnum.ArrayType.STAT_BASE, objId, value);
        }
        
        EtheremonMonsterNFTInterface(monsterNFT).triggerTransferEvent(address(0), msg.sender, objId);
        // refund extra
        if (msg.value > price) {
            msg.sender.transfer((msg.value - price));
        }
    }
    
    // for whitelist contracts, no refund extra
    function catchMonster(address _player, uint32 _classId, string _name) isActive external payable returns(uint tokenId) {
        if (addressWhitelist[msg.sender] == false) {
            revert();
        }
        
        EtheremonDataBase data = EtheremonDataBase(dataContract);
        MonsterClassAcc memory class;
        (class.classId, class.price, class.returnPrice, class.total, class.catchable) = data.getMonsterClass(_classId);
        if (class.classId == 0) {
            revert();
        }
        
        if (class.catchable == false && classWhitelist[_classId] == false) {
            revert();
        }
        
        uint price = class.price;
        if (class.total > gapFactor) {
            price += class.price*(class.total - gapFactor)/priceIncreasingRatio;
        }
        if (msg.value < price) {
            revert();
        }
        
        // add new monster 
        uint64 objId = data.addMonsterObj(_classId, _player, _name);
        uint8 value;
        uint seed = getRandom(_player, block.number-1, objId);
        // generate base stat for the previous one
        for (uint i=0; i < STAT_COUNT; i+= 1) {
            seed /= 100;
            value = uint8(seed % STAT_MAX) + data.getElementInArrayType(EtheremonEnum.ArrayType.STAT_START, uint64(_classId), i);
            data.addElementToArrayType(EtheremonEnum.ArrayType.STAT_BASE, objId, value);
        }
        
        EtheremonMonsterNFTInterface(monsterNFT).triggerTransferEvent(address(0), _player, objId);
        return objId; 
    }
    
}

    Contract ABI  
[{"constant":false,"inputs":[{"name":"_classId","type":"uint32"},{"name":"_trainer","type":"address"},{"name":"_name","type":"string"}],"name":"mintMonster","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"dataContract","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"moderators","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_classId","type":"uint32"},{"name":"_name","type":"string"}],"name":"catchMonsterNFT","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_gapFactor","type":"uint256"},{"name":"_priceIncreasingRatio","type":"uint256"}],"name":"setConfig","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_dataContract","type":"address"},{"name":"_monsterNFT","type":"address"}],"name":"setContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_classId","type":"uint32"},{"name":"_status","type":"bool"}],"name":"setClassWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_isMaintaining","type":"bool"}],"name":"UpdateMaintaining","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"STAT_MAX","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalModerators","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_sendTo","type":"address"},{"name":"_amount","type":"uint256"}],"name":"withdrawEther","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"monsterNFT","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newModerator","type":"address"}],"name":"AddModerator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_tokenId","type":"uint64"}],"name":"burnMonster","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":"_classId","type":"uint32"}],"name":"getMonsterClassBasic","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"uint256"},{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_smartcontract","type":"address"},{"name":"_status","type":"bool"}],"name":"setAddressWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_oldModerator","type":"address"}],"name":"RemoveModerator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_player","type":"address"},{"name":"_classId","type":"uint32"},{"name":"_name","type":"string"}],"name":"catchMonster","outputs":[{"name":"tokenId","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"gapFactor","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_player","type":"address"},{"name":"_block","type":"uint256"},{"name":"_count","type":"uint256"}],"name":"getRandom","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"STAT_COUNT","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_classId","type":"uint32"}],"name":"getPrice","outputs":[{"name":"catchable","type":"bool"},{"name":"price","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"priceIncreasingRatio","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"}]

  Contract Creation Code Switch To Opcodes View
6080604052600080546002805460ff1916905560056006556103e8600755600160b060020a03191633179055611b918061003a6000396000f30060806040526004361061013a5763ffffffff60e060020a6000350416630963d4b7811461013f5780630d6688181461018857806314d0f1ba146101b957806315834ebd146101ee5780631e34c5851461020d5780632bf6e0a5146102285780634661bb981461024f57806348ef5aa8146102725780634e3dc2f11461028c5780634efb023e146102b7578063522f6815146102e3578063678a1013146103075780636c81fd6d1461031c57806381b230421461033d5780638da5cb5b1461035f57806394f6ba1c14610374578063af4c14ee146103ba578063b85d6275146103e0578063c0845e8a14610401578063c10be5211461042b578063c8660a3214610440578063d98e14bd14610467578063da26663a1461047c578063e19bb964146104b5578063ee4e4416146104ca578063f2853292146104df575b600080fd5b34801561014b57600080fd5b506101766004803563ffffffff169060248035600160a060020a031691604435918201910135610500565b60408051918252519081900360200190f35b34801561019457600080fd5b5061019d610845565b60408051600160a060020a039092168252519081900360200190f35b3480156101c557600080fd5b506101da600160a060020a0360043516610859565b604080519115158252519081900360200190f35b61020b6004803563ffffffff16906024803590810191013561086e565b005b34801561021957600080fd5b5061020b600435602435610cdc565b34801561023457600080fd5b5061020b600160a060020a0360043581169060243516610d20565b34801561025b57600080fd5b5061020b63ffffffff600435166024351515610dab565b34801561027e57600080fd5b5061020b6004351515610e0c565b34801561029857600080fd5b506102a1610e36565b6040805160ff9092168252519081900360200190f35b3480156102c357600080fd5b506102cc610e3b565b6040805161ffff9092168252519081900360200190f35b3480156102ef57600080fd5b5061020b600160a060020a0360043516602435610e5d565b34801561031357600080fd5b5061019d610ebd565b34801561032857600080fd5b5061020b600160a060020a0360043516610ecc565b34801561034957600080fd5b5061020b67ffffffffffffffff60043516610f72565b34801561036b57600080fd5b5061019d6111f5565b34801561038057600080fd5b5061039263ffffffff60043516611204565b6040805194855260208501939093528383019190915215156060830152519081900360800190f35b3480156103c657600080fd5b5061020b600160a060020a036004351660243515156112ed565b3480156103ec57600080fd5b5061020b600160a060020a0360043516611351565b61017660048035600160a060020a0316906024803563ffffffff16916044359182019101356113f7565b34801561043757600080fd5b5061017661189f565b34801561044c57600080fd5b50610176600160a060020a03600435166024356044356118a5565b34801561047357600080fd5b506102a161194f565b34801561048857600080fd5b5061049a63ffffffff60043516611954565b60408051921515835260208301919091528051918290030190f35b3480156104c157600080fd5b50610176611a92565b3480156104d657600080fd5b506101da611a98565b3480156104eb57600080fd5b5061020b600160a060020a0360043516611aa1565b6000805481908190819081908190600160a060020a031633148061053957503360009081526001602081905260409091205460ff161515145b151561054457600080fd5b6002546040517ffc4d20f500000000000000000000000000000000000000000000000000000000815263ffffffff8c1660048201908152600160a060020a038c81166024840152606060448401908152606484018c9052610100909404169750879263fc4d20f5928e928e928e928e929190608401848480828437820191505095505050505050602060405180830381600087803b1580156105e557600080fd5b505af11580156105f9573d6000803e3d6000fd5b505050506040513d602081101561060f57600080fd5b5051935061062c89600019430167ffffffffffffffff87166118a5565b9150600090505b600681101561079957604080517f62b21ad70000000000000000000000000000000000000000000000000000000081526002600482015263ffffffff8c16602482015260448101839052905160649384900493600160a060020a038816926362b21ad792818301926020928290030181600087803b1580156106b457600080fd5b505af11580156106c8573d6000803e3d6000fd5b505050506040513d60208110156106de57600080fd5b5051604080517f26bda7390000000000000000000000000000000000000000000000000000000081526003600482015267ffffffffffffffff87166024820152601f851690920160ff811660448401529051909450600160a060020a038716916326bda7399160648083019260209291908290030181600087803b15801561076557600080fd5b505af1158015610779573d6000803e3d6000fd5b505050506040513d602081101561078f57600080fd5b5050600101610633565b600354604080517fc463b008000000000000000000000000000000000000000000000000000000008152600060048201819052600160a060020a038d8116602484015267ffffffffffffffff891660448401529251929093169263c463b0089260648084019382900301818387803b15801561081457600080fd5b505af1158015610828573d6000803e3d6000fd5b505067ffffffffffffffff9095169b9a5050505050505050505050565b6002546101009004600160a060020a031681565b60016020526000908152604090205460ff1681565b6000610878611af4565b600254600090819081908190819060ff161561089357600080fd5b6002546040805160e260020a63274a72b102815263ffffffff8d1660048201529051610100909204600160a060020a031698508891639d29cac49160248082019260a0929091908290030181600087803b1580156108f057600080fd5b505af1158015610904573d6000803e3d6000fd5b505050506040513d60a081101561091a57600080fd5b5080516020808301516040808501516060808701516080978801511515978e019790975263ffffffff968716908d0152908b01529089015216808752158061096457506080860151155b1561096e57600080fd5b856020015194506000866060015163ffffffff1611156109ae57600754600187606001510363ffffffff168760200151028115156109a857fe5b04850194505b843410156109bb57600080fd5b6040517ffc4d20f500000000000000000000000000000000000000000000000000000000815263ffffffff8b16600482019081523360248301819052606060448401908152606484018c9052600160a060020a038b169363fc4d20f5938f93928f928f929190608401848480828437820191505095505050505050602060405180830381600087803b158015610a5057600080fd5b505af1158015610a64573d6000803e3d6000fd5b505050506040513d6020811015610a7a57600080fd5b50519350610a9733600019430167ffffffffffffffff87166118a5565b9150600090505b6006811015610c0457604080517f62b21ad70000000000000000000000000000000000000000000000000000000081526002600482015263ffffffff8c16602482015260448101839052905160649384900493600160a060020a038a16926362b21ad792818301926020928290030181600087803b158015610b1f57600080fd5b505af1158015610b33573d6000803e3d6000fd5b505050506040513d6020811015610b4957600080fd5b5051604080517f26bda7390000000000000000000000000000000000000000000000000000000081526003600482015267ffffffffffffffff87166024820152601f851690920160ff811660448401529051909450600160a060020a038916916326bda7399160648083019260209291908290030181600087803b158015610bd057600080fd5b505af1158015610be4573d6000803e3d6000fd5b505050506040513d6020811015610bfa57600080fd5b5050600101610a9e565b600354604080517fc463b00800000000000000000000000000000000000000000000000000000000815260006004820181905233602483015267ffffffffffffffff881660448301529151600160a060020a039093169263c463b0089260648084019391929182900301818387803b158015610c7f57600080fd5b505af1158015610c93573d6000803e3d6000fd5b5050505084341115610cd05760405133903487900380156108fc02916000818181858888f19350505050158015610cce573d6000803e3d6000fd5b505b50505050505050505050565b600054600160a060020a0316331480610d0a57503360009081526001602081905260409091205460ff161515145b1515610d1557600080fd5b600691909155600755565b600054600160a060020a0316331480610d4e57503360009081526001602081905260409091205460ff161515145b1515610d5957600080fd5b6002805474ffffffffffffffffffffffffffffffffffffffff001916610100600160a060020a03948516021790556003805473ffffffffffffffffffffffffffffffffffffffff191691909216179055565b600054600160a060020a0316331480610dd957503360009081526001602081905260409091205460ff161515145b1515610de457600080fd5b63ffffffff919091166000908152600460205260409020805460ff1916911515919091179055565b600054600160a060020a03163314610e2357600080fd5b6002805460ff1916911515919091179055565b602081565b60005474010000000000000000000000000000000000000000900461ffff1681565b600054600160a060020a03163314610e7457600080fd5b3031811115610e8257600080fd5b604051600160a060020a0383169082156108fc029083906000818181858888f19350505050158015610eb8573d6000803e3d6000fd5b505050565b600354600160a060020a031681565b600054600160a060020a03163314610ee357600080fd5b600160a060020a03811660009081526001602052604090205460ff161515610f6f57600160a060020a03811660009081526001602081905260408220805460ff191682179055815461ffff7401000000000000000000000000000000000000000080830482169093011690910275ffff0000000000000000000000000000000000000000199091161790555b50565b6000610f7c611b22565b600054600160a060020a0316331480610faa57503360009081526001602081905260409091205460ff161515145b1515610fb557600080fd5b600254604080517f0720246000000000000000000000000000000000000000000000000000000000815267ffffffffffffffff861660048201529051610100909204600160a060020a03169350839163072024609160248082019260e0929091908290030181600087803b15801561102c57600080fd5b505af1158015611040573d6000803e3d6000fd5b505050506040513d60e081101561105657600080fd5b508051602080830151604080850151606086015160808088015160a0808a015160c09a8b015160e08d015263ffffffff9081169a8c019a909a52908916908a015290871690880152600160a060020a031690860181905293169084015267ffffffffffffffff16825215156110ca57600080fd5b60408082015181517f60c6ccb2000000000000000000000000000000000000000000000000000000008152600160a060020a03918216600482015267ffffffffffffffff861660248201529151908416916360c6ccb291604480830192600092919082900301818387803b15801561114157600080fd5b505af1158015611155573d6000803e3d6000fd5b505060035460408085015181517fc463b008000000000000000000000000000000000000000000000000000000008152600160a060020a03918216600482015260006024820181905267ffffffffffffffff8a166044830152925191909316945063c463b008935060648084019382900301818387803b1580156111d857600080fd5b505af11580156111ec573d6000803e3d6000fd5b50505050505050565b600054600160a060020a031681565b6000806000806000611214611af4565b6002546040805160e260020a63274a72b102815263ffffffff8a1660048201529051610100909204600160a060020a031693508391639d29cac49160248082019260a0929091908290030181600087803b15801561127157600080fd5b505af1158015611285573d6000803e3d6000fd5b505050506040513d60a081101561129b57600080fd5b508051602080830151604080850151606080870151608097880151151597890188905263ffffffff90811691890182905292880182905293870183905293169094529299909850919650945092505050565b600054600160a060020a031633148061131b57503360009081526001602081905260409091205460ff161515145b151561132657600080fd5b600160a060020a03919091166000908152600560205260409020805460ff1916911515919091179055565b600054600160a060020a0316331461136857600080fd5b600160a060020a03811660009081526001602081905260409091205460ff1615151415610f6f57600160a060020a03166000908152600160205260408120805460ff19169055805475ffff0000000000000000000000000000000000000000198116740100000000000000000000000000000000000000009182900461ffff9081166000190116909102179055565b600080611402611af4565b600254600090819081908190819060ff161561141d57600080fd5b3360009081526005602052604090205460ff16151561143b57600080fd5b6002546040805160e260020a63274a72b102815263ffffffff8e1660048201529051610100909204600160a060020a031698508891639d29cac49160248082019260a0929091908290030181600087803b15801561149857600080fd5b505af11580156114ac573d6000803e3d6000fd5b505050506040513d60a08110156114c257600080fd5b5080516020808301516040808501516060808701516080978801511515978e019790975263ffffffff968716908d0152908b01529089015216808752151561150957600080fd5b6080860151158015611531575063ffffffff8b1660009081526004602052604090205460ff16155b1561153b57600080fd5b85602001519450600654866060015163ffffffff16111561157d57600754600654876060015163ffffffff160387602001510281151561157757fe5b04850194505b8434101561158a57600080fd5b86600160a060020a031663fc4d20f58c8e8d8d6040518563ffffffff1660e060020a028152600401808563ffffffff1663ffffffff16815260200184600160a060020a0316600160a060020a03168152602001806020018281038252848482818152602001925080828437820191505095505050505050602060405180830381600087803b15801561161b57600080fd5b505af115801561162f573d6000803e3d6000fd5b505050506040513d602081101561164557600080fd5b505193506116628c600019430167ffffffffffffffff87166118a5565b9150600090505b60068110156117cf57604080517f62b21ad70000000000000000000000000000000000000000000000000000000081526002600482015263ffffffff8d16602482015260448101839052905160649384900493600160a060020a038a16926362b21ad792818301926020928290030181600087803b1580156116ea57600080fd5b505af11580156116fe573d6000803e3d6000fd5b505050506040513d602081101561171457600080fd5b5051604080517f26bda7390000000000000000000000000000000000000000000000000000000081526003600482015267ffffffffffffffff87166024820152601f851690920160ff811660448401529051909450600160a060020a038916916326bda7399160648083019260209291908290030181600087803b15801561179b57600080fd5b505af11580156117af573d6000803e3d6000fd5b505050506040513d60208110156117c557600080fd5b5050600101611669565b600360009054906101000a9004600160a060020a0316600160a060020a031663c463b00860008e876040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a031681526020018267ffffffffffffffff1681526020019350505050600060405180830381600087803b15801561186c57600080fd5b505af1158015611880573d6000803e3d6000fd5b505067ffffffffffffffff9095169d9c50505050505050505050505050565b60065481565b6040805183406020808301919091526c01000000000000000000000000600160a060020a03871602828401526054808301859052835180840390910181526074909201928390528151600093918291908401908083835b6020831061191b5780518252601f1990920191602091820191016118fc565b5181516020939093036101000a60001901801990911692169190911790526040519201829003909120979650505050505050565b600681565b6000806000611961611af4565b6002546040805160e260020a63274a72b102815263ffffffff881660048201529051610100909204600160a060020a031693508391639d29cac49160248082019260a0929091908290030181600087803b1580156119be57600080fd5b505af11580156119d2573d6000803e3d6000fd5b505050506040513d60a08110156119e857600080fd5b50805160208083015160408085015160608087015160809788015115159789019790975263ffffffff9687169088018190529187015291850181905292909116835290935060001015611a5b57600754600182606001510363ffffffff16826020015102811515611a5557fe5b04830192505b60808101511515611a865763ffffffff851660009081526004602052604090205460ff169350611a8b565b600193505b5050915091565b60075481565b60025460ff1681565b600054600160a060020a03163314611ab857600080fd5b600160a060020a03811615610f6f5760008054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff1990911617905550565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915290565b60408051610100810182526000808252602082018190529181018290526060808201526080810182905260a0810182905260c0810182905260e0810191909152905600a165627a7a7230582020b9bffc9d900d84a4b3371e8225eff753430e584a2a2746cb46235b0806a8600029

   Swarm Source:
bzzr://20b9bffc9d900d84a4b3371e8225eff753430e584a2a2746cb46235b0806a860

 

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.