Contract 0x5f480Ca354304AaE88d7dd66cD4735C59d543af0

 

Contract Overview

Balance:
0.401100000100000002 Ether

EtherValue:
$800.88 (@ $1,996.72/ETH)

Token:
Ad
Crypto.com
Txn Hash Method
Block
From
To
Value
0xe7bb9bdb5cf87b4aafa90b613e145d6081b1af2af77f78aa20c14357ecea67deCatch Monster NF...(pending)2021-06-20 8:40:523 days 3 hrs ago0x0d7b69334625a2ada3c2419a3a6e2dfa27588de6 IN 0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether(Pending)(Pending)
0x3dbe97c79c4276b8d045917ef1d5534ee6ad1f14df8578993d80bafd44bbb789Catch Monster NF...(pending)2021-06-20 6:57:433 days 5 hrs ago0x2b10542d856140508f3758a7b0e996e987ef3c70 IN 0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether(Pending)(Pending)
0x7a55ed724f1f56650adf3f1db508ed5d6791df8ec54d3af33a4b831e6f3e0b28Catch Monster NF...(pending)2021-06-20 5:36:063 days 6 hrs ago0x8ae0accce99369ff4a108d160e80b80111f0c623 IN 0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether(Pending)(Pending)
0x010d23df98c2516993df274fc2d8f9cec23240b6daab07e7b6960bf83d8edabdCatch Monster NF...(pending)2021-06-20 4:31:533 days 7 hrs ago0x571c00069c5fab64d6b36ed28c78b49ccfba0ef9 IN 0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether(Pending)(Pending)
0x58b3194b17b6306460e96d5b37c0f3d42741457c3df4a4ce730db28873133808Catch Monster NF...(pending)2021-06-20 1:48:323 days 10 hrs ago0x51fbb471e278dbd3a1b50cdc76180c15b16118eb IN 0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether(Pending)(Pending)
0x15dc95f735161b6d9ca0d5d37035d3ea3a2ce3d3de176ad7ab618ac764c3321cCatch Monster NF...123011532021-04-24 5:50:1560 days 6 hrs ago0x838413cd20eee412b6797fe00310d4725155cf5b IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00.03534 Ether0.01842219545155.000001347
0x00e6fee841cfd305f9bfd5b42e935d026c8980f6ec810545063ae296892752beCatch Monster NF...123011462021-04-24 5:49:0660 days 6 hrs ago0x838413cd20eee412b6797fe00310d4725155cf5b IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00.03942 Ether0.0183886454555.000001347
0x39fb5c14580dad49986fc4469a3ac040786d06f490eb204601ac5c0c9800dc68Catch Monster NF...123011252021-04-24 5:44:2060 days 6 hrs ago0x838413cd20eee412b6797fe00310d4725155cf5b IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00.03279 Ether0.02023609549555.000001347
0xa9c2e2d5742f55f939d090291b7f924d1530db4eca70de2facbc3f270ae2c445Catch Monster NF...123004482021-04-24 3:16:4860 days 9 hrs ago0xd93bd92fcbf1c3f4640c9f733097f6da12e80a83 IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00.03234 Ether0.02273939264
0x40c6b213aff1d4eae98bbf057d4526a4633cf76e87e79de775e42af62f98378aCatch Monster NF...122936822021-04-23 2:07:5361 days 10 hrs ago0xd93bd92fcbf1c3f4640c9f733097f6da12e80a83 IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00.03219 Ether0.042882688128
0x8c93361b68860eed36178eda54eec319d3afc7b312697d62ba492b55d187869cCatch Monster NF...122893482021-04-22 10:07:0562 days 2 hrs ago0xc859581c72b64a6434e50a1b3b44f83db33cbb0a IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.03545011106
0x0845e48daaa5f1303e8d8fe056c0629b683b7ba4c1c5509d19bb51ce4cc9335dCatch Monster NF...122893452021-04-22 10:06:4662 days 2 hrs ago0xc859581c72b64a6434e50a1b3b44f83db33cbb0a IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.03901065106
0xf7fd0c101f81da69e94bc8557d79d2d50b9b1cdefaef17d38ec220153271c62cCatch Monster NF...122876102021-04-22 3:27:3362 days 8 hrs ago0x90937e9e6dd1f5c5f0834f2b4da7dae7c681fd67 IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.00275110
0x2441204aa206c0a1925255d0541d4975f9f2ccbfd64dee0fe5982f7e31981225Catch Monster NF...122285992021-04-13 0:49:4971 days 11 hrs ago0xf63865a4bf732455d6e6ea2d140386a380cf5c2c IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00.03352 Ether0.0449527280
0xd3b079c4cf5b6cd3dff21b5a21ecaf7b58baf2b66a770f2d8b829d65767d807bCatch Monster NF...122239992021-04-12 7:53:0072 days 4 hrs ago0xfe86cb5d50c21eac44a37e840f69622b6771c487 IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.05266581595
0x3a7c444eeb25a7417f90e4012911a258bc69d10104d7efc7df0e012b72d6ccb9Catch Monster NF...122225442021-04-12 2:25:1172 days 9 hrs ago0x0e7894a605e17c43b3069d9464d9af90dda47022 IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.001560
0x38c0b16692845104c21fbd95d7854b5e36dc63c60b594dcf770bb7d595988ff7Transfer121892372021-04-06 23:46:5477 days 12 hrs ago0x4b7a94fd10d38c57a7e01537b0bafdadb1fc5abf IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00.03186 Ether0.00273130
0xef49500c039edd5008818405dec1d837ae0ab5d5867a3ba9761965bb7ef51947Catch Monster NF...120997272021-03-24 5:28:5291 days 6 hrs ago0xaaf705cc4bdd12dc36253bbed0ce3e3741fc666e IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.01128972120
0x6b7d0b78de995935fc73a8dbdee327ef1e28445fee9c9651709bd22bc21793fdCatch Monster NF...120997032021-03-24 5:23:5591 days 6 hrs ago0xaaf705cc4bdd12dc36253bbed0ce3e3741fc666e IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.00685722115
0xf2b6294f5bb5498f85f62f69ea884476781c853885892d3907855f09de7f3e46Catch Monster NF...120967502021-03-23 18:25:1891 days 17 hrs ago0x4f8b8366a62383275e9fff3a2a81f08d165cd7c9 IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.00475190
0x61e51d5e284120a5fac1529dc7951e0477ff224d537cc34b30f4a4acb53be3deCatch Monster NF...120967202021-03-23 18:17:2891 days 18 hrs ago0x4f8b8366a62383275e9fff3a2a81f08d165cd7c9 IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.005753856192
0x0c0f562f99374223541086fe80f4e2179dc216a25d5c828de9f46b2f63f956d2Catch Monster NF...120676002021-03-19 6:37:2396 days 5 hrs ago0xd47406de63fa9f0953c518cb852400c0eed102d0 IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.004125
0xcbc024961239845aace4c3231dd62dbdf07de42c07805a775e98e4c06c3617ceCatch Monster NF...120341652021-03-14 3:07:46101 days 9 hrs ago0x1c09de919ccffb477e9701a4a8977222b0565f07 IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.00495748209
0xe44143b56ea166882d7eb255d89d520b4a5a7c674bef1e48f59483d9e4fcf58aCatch Monster NF...120339172021-03-14 2:07:07101 days 10 hrs ago0x2e882c468cc32f8a852a16bfd610ee7317ed4534 IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00.03222 Ether0.059324759107
0x687d6c105ba932c3bef2f94e57bc59a61037efa306d3b67e24536bab9f53cd69Catch Monster NF...120279442021-03-13 4:15:43102 days 8 hrs ago0x092e33187b0c84237c7945a9e3ce9e4f0daf8ed2 IN  0x5f480ca354304aae88d7dd66cd4735c59d543af00 Ether0.004417283248147.400001605
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x2441204aa206c0a1925255d0541d4975f9f2ccbfd64dee0fe5982f7e31981225122285992021-04-13 0:49:4971 days 11 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00xf63865a4bf732455d6e6ea2d140386a380cf5c2c0.00001 Ether
0xcf2adbbc3df3bf6616219b0f974daf8383ee4e4a6e49ea615209c6b418cb9034111949832020-11-05 4:15:04230 days 8 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.428739995 Ether
0x64cc30394aaafa8fec9b5f35f094ffd9b338250f2ca4b5fb43a27cc60d43100c109345332020-09-25 22:44:48270 days 13 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd6.2697 Ether
0x86efdf06b000e3aae65b593ba9a78d92fafff4695d1142914fdfcfedafcdd854105518412020-07-29 2:42:41329 days 9 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.001 Ether
0xe63227b4c73ab7d6cd3fa150946327ae16dc69eb53350af56d2f2f66fc280833104479522020-07-13 0:26:01345 days 11 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd5.3178 Ether
0x82a26034e188307bdc9d49d8e954ca5e236b7ec64174bd870aa505c914e4d738103203662020-06-23 6:12:21365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.0003 Ether
0x117bdfd089630a2526b1af9beb3400202487f1879efd6bd8ab0323da8c138e22103203632020-06-23 6:11:50365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.0003 Ether
0xa900adaee2e4f2937f13b3193d2dd693eadc97147cfa347046189c240fb61969103202832020-06-23 5:52:23365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.0003 Ether
0xfb96c764e10c06d841d86fbe626daf037059f4657d5a302eb31dab8c7e9a1fc6103202832020-06-23 5:52:23365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.0003 Ether
0x27211742a7287f157c5ca63f5dcbc3448febeb25ce4678f8b114faf4ff135fb4103202832020-06-23 5:52:23365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.00015 Ether
0x742c946d921b44e9ffee6fbbd206a34504ee068b6ca6f191b83c8daf4b6b5753103202832020-06-23 5:52:23365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.00015 Ether
0xb698434160be401fc1af2de9ff6c070d6541a1cda4639981d359718539844328103202832020-06-23 5:52:23365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.00015 Ether
0xbfa1a4a844fb03edecbcaedfb395930f384e83a7d0590867288a816a2725e05b103202812020-06-23 5:52:11365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.00015 Ether
0x8f788b2f69af4224d2116cb518128ac09b30f17de3630d2b0b7cd300e4f7aaa8103202442020-06-23 5:44:43365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.00015 Ether
0xb0c7d90723c1f961becdacd2d399d2a6578991fa7c37044052472119b95cee42103202412020-06-23 5:44:22365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.00015 Ether
0x66be3b054577397d6fbcc55aed73d056578b4d8b922fcac3968023c004712a6b103202392020-06-23 5:43:51365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.00015 Ether
0x688d30cc272fc2135b438270d98c4bfa5b8e2f9c9b105cea75934cdc80be8e40103202382020-06-23 5:43:45365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.00015 Ether
0x5fa0fbdb1c022e22c627ac639f7d0a044317c710f3cf4ae6d9ac9694b7f2d3de103202372020-06-23 5:43:33365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.00015 Ether
0x6ea3f06cc7aa60ced152f8b9ede0ce7f8508b4bfdad114042d4b04d5093d51d6103202332020-06-23 5:42:59365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.00015 Ether
0xa51a566d510e11d6622c7eb72a67943ac7990568515fc91f85d5f968044fb284103202322020-06-23 5:42:46365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.00015 Ether
0xd5a0e0bd2be5b6b1b6391487a65e0678c822d7890f233af13850707392384567103202182020-06-23 5:40:23365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.00015 Ether
0x85d8df25289f867498f4c98f9891e86cefae4419e230a7194323ba61517159dd103202122020-06-23 5:38:53365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.00015 Ether
0x30f3fb1c80fee4e1ffaf0688d1a1b7a9f3fc3dd6e9dfd9c32f6c88925068746d103202102020-06-23 5:38:39365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.00015 Ether
0x6f8adab63509f0f2518afe3ae250c7c699bac9ea3f391f5de3311e6ea070d3cf103202022020-06-23 5:37:50365 days 6 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd7 Ether
0x13bce2a5d8955a29197bb9c5f4a8da9f5fd0ca0f7ce324941f99ef0828317751103183962020-06-22 22:57:28365 days 13 hrs ago 0x5f480ca354304aae88d7dd66cd4735c59d543af00x7bae63c4dbd39ec66669a1ef6e1cf6f747b71bdd0.00015 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
EtheremonWorldNFT

Compiler Version
v0.4.24+commit.e67f0147

Optimization Enabled:
Yes with 200 runs

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

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 Security Audit

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"}]

6080604052600080546002805460ff1916905560056006556103e8600755600160b060020a03191633179055611b918061003a6000396000f30060806040526004361061013a5763ffffffff60e060020a6000350416630963d4b7811461013f5780630d6688181461018857806314d0f1ba146101b957806315834ebd146101ee5780631e34c5851461020d5780632bf6e0a5146102285780634661bb981461024f57806348ef5aa8146102725780634e3dc2f11461028c5780634efb023e146102b7578063522f6815146102e3578063678a1013146103075780636c81fd6d1461031c57806381b230421461033d5780638da5cb5b1461035f57806394f6ba1c14610374578063af4c14ee146103ba578063b85d6275146103e0578063c0845e8a14610401578063c10be5211461042b578063c8660a3214610440578063d98e14bd14610467578063da26663a1461047c578063e19bb964146104b5578063ee4e4416146104ca578063f2853292146104df575b600080fd5b34801561014b57600080fd5b506101766004803563ffffffff169060248035600160a060020a031691604435918201910135610500565b60408051918252519081900360200190f35b34801561019457600080fd5b5061019d610845565b60408051600160a060020a039092168252519081900360200190f35b3480156101c557600080fd5b506101da600160a060020a0360043516610859565b604080519115158252519081900360200190f35b61020b6004803563ffffffff16906024803590810191013561086e565b005b34801561021957600080fd5b5061020b600435602435610cdc565b34801561023457600080fd5b5061020b600160a060020a0360043581169060243516610d20565b34801561025b57600080fd5b5061020b63ffffffff600435166024351515610dab565b34801561027e57600080fd5b5061020b6004351515610e0c565b34801561029857600080fd5b506102a1610e36565b6040805160ff9092168252519081900360200190f35b3480156102c357600080fd5b506102cc610e3b565b6040805161ffff9092168252519081900360200190f35b3480156102ef57600080fd5b5061020b600160a060020a0360043516602435610e5d565b34801561031357600080fd5b5061019d610ebd565b34801561032857600080fd5b5061020b600160a060020a0360043516610ecc565b34801561034957600080fd5b5061020b67ffffffffffffffff60043516610f72565b34801561036b57600080fd5b5061019d6111f5565b34801561038057600080fd5b5061039263ffffffff60043516611204565b6040805194855260208501939093528383019190915215156060830152519081900360800190f35b3480156103c657600080fd5b5061020b600160a060020a036004351660243515156112ed565b3480156103ec57600080fd5b5061020b600160a060020a0360043516611351565b61017660048035600160a060020a0316906024803563ffffffff16916044359182019101356113f7565b34801561043757600080fd5b5061017661189f565b34801561044c57600080fd5b50610176600160a060020a03600435166024356044356118a5565b34801561047357600080fd5b506102a161194f565b34801561048857600080fd5b5061049a63ffffffff60043516611954565b60408051921515835260208301919091528051918290030190f35b3480156104c157600080fd5b50610176611a92565b3480156104d657600080fd5b506101da611a98565b3480156104eb57600080fd5b5061020b600160a060020a0360043516611aa1565b6000805481908190819081908190600160a060020a031633148061053957503360009081526001602081905260409091205460ff161515145b151561054457600080fd5b6002546040517ffc4d20f500000000000000000000000000000000000000000000000000000000815263ffffffff8c1660048201908152600160a060020a038c81166024840152606060448401908152606484018c9052610100909404169750879263fc4d20f5928e928e928e928e929190608401848480828437820191505095505050505050602060405180830381600087803b1580156105e557600080fd5b505af11580156105f9573d6000803e3d6000fd5b505050506040513d602081101561060f57600080fd5b5051935061062c89600019430167ffffffffffffffff87166118a5565b9150600090505b600681101561079957604080517f62b21ad70000000000000000000000000000000000000000000000000000000081526002600482015263ffffffff8c16602482015260448101839052905160649384900493600160a060020a038816926362b21ad792818301926020928290030181600087803b1580156106b457600080fd5b505af11580156106c8573d6000803e3d6000fd5b505050506040513d60208110156106de57600080fd5b5051604080517f26bda7390000000000000000000000000000000000000000000000000000000081526003600482015267ffffffffffffffff87166024820152601f851690920160ff811660448401529051909450600160a060020a038716916326bda7399160648083019260209291908290030181600087803b15801561076557600080fd5b505af1158015610779573d6000803e3d6000fd5b505050506040513d602081101561078f57600080fd5b5050600101610633565b600354604080517fc463b008000000000000000000000000000000000000000000000000000000008152600060048201819052600160a060020a038d8116602484015267ffffffffffffffff891660448401529251929093169263c463b0089260648084019382900301818387803b15801561081457600080fd5b505af1158015610828573d6000803e3d6000fd5b505067ffffffffffffffff9095169b9a5050505050505050505050565b6002546101009004600160a060020a031681565b60016020526000908152604090205460ff1681565b6000610878611af4565b600254600090819081908190819060ff161561089357600080fd5b6002546040805160e260020a63274a72b102815263ffffffff8d1660048201529051610100909204600160a060020a031698508891639d29cac49160248082019260a0929091908290030181600087803b1580156108f057600080fd5b505af1158015610904573d6000803e3d6000fd5b505050506040513d60a081101561091a57600080fd5b5080516020808301516040808501516060808701516080978801511515978e019790975263ffffffff968716908d0152908b01529089015216808752158061096457506080860151155b1561096e57600080fd5b856020015194506000866060015163ffffffff1611156109ae57600754600187606001510363ffffffff168760200151028115156109a857fe5b04850194505b843410156109bb57600080fd5b6040517ffc4d20f500000000000000000000000000000000000000000000000000000000815263ffffffff8b16600482019081523360248301819052606060448401908152606484018c9052600160a060020a038b169363fc4d20f5938f93928f928f929190608401848480828437820191505095505050505050602060405180830381600087803b158015610a5057600080fd5b505af1158015610a64573d6000803e3d6000fd5b505050506040513d6020811015610a7a57600080fd5b50519350610a9733600019430167ffffffffffffffff87166118a5565b9150600090505b6006811015610c0457604080517f62b21ad70000000000000000000000000000000000000000000000000000000081526002600482015263ffffffff8c16602482015260448101839052905160649384900493600160a060020a038a16926362b21ad792818301926020928290030181600087803b158015610b1f57600080fd5b505af1158015610b33573d6000803e3d6000fd5b505050506040513d6020811015610b4957600080fd5b5051604080517f26bda7390000000000000000000000000000000000000000000000000000000081526003600482015267ffffffffffffffff87166024820152601f851690920160ff811660448401529051909450600160a060020a038916916326bda7399160648083019260209291908290030181600087803b158015610bd057600080fd5b505af1158015610be4573d6000803e3d6000fd5b505050506040513d6020811015610bfa57600080fd5b5050600101610a9e565b600354604080517fc463b00800000000000000000000000000000000000000000000000000000000815260006004820181905233602483015267ffffffffffffffff881660448301529151600160a060020a039093169263c463b0089260648084019391929182900301818387803b158015610c7f57600080fd5b505af1158015610c93573d6000803e3d6000fd5b5050505084341115610cd05760405133903487900380156108fc02916000818181858888f19350505050158015610cce573d6000803e3d6000fd5b505b50505050505050505050565b600054600160a060020a0316331480610d0a57503360009081526001602081905260409091205460ff161515145b1515610d1557600080fd5b600691909155600755565b600054600160a060020a0316331480610d4e57503360009081526001602081905260409091205460ff161515145b1515610d5957600080fd5b6002805474ffffffffffffffffffffffffffffffffffffffff001916610100600160a060020a03948516021790556003805473ffffffffffffffffffffffffffffffffffffffff191691909216179055565b600054600160a060020a0316331480610dd957503360009081526001602081905260409091205460ff161515145b1515610de457600080fd5b63ffffffff919091166000908152600460205260409020805460ff1916911515919091179055565b600054600160a060020a03163314610e2357600080fd5b6002805460ff1916911515919091179055565b602081565b60005474010000000000000000000000000000000000000000900461ffff1681565b600054600160a060020a03163314610e7457600080fd5b3031811115610e8257600080fd5b604051600160a060020a0383169082156108fc029083906000818181858888f19350505050158015610eb8573d6000803e3d6000fd5b505050565b600354600160a060020a031681565b600054600160a060020a03163314610ee357600080fd5b600160a060020a03811660009081526001602052604090205460ff161515610f6f57600160a060020a03811660009081526001602081905260408220805460ff191682179055815461ffff7401000000000000000000000000000000000000000080830482169093011690910275ffff0000000000000000000000000000000000000000199091161790555b50565b6000610f7c611b22565b600054600160a060020a0316331480610faa57503360009081526001602081905260409091205460ff161515145b1515610fb557600080fd5b600254604080517f0720246000000000000000000000000000000000000000000000000000000000815267ffffffffffffffff861660048201529051610100909204600160a060020a03169350839163072024609160248082019260e0929091908290030181600087803b15801561102c57600080fd5b505af1158015611040573d6000803e3d6000fd5b505050506040513d60e081101561105657600080fd5b508051602080830151604080850151606086015160808088015160a0808a015160c09a8b015160e08d015263ffffffff9081169a8c019a909a52908916908a015290871690880152600160a060020a031690860181905293169084015267ffffffffffffffff16825215156110ca57600080fd5b60408082015181517f60c6ccb2000000000000000000000000000000000000000000000000000000008152600160a060020a03918216600482015267ffffffffffffffff861660248201529151908416916360c6ccb291604480830192600092919082900301818387803b15801561114157600080fd5b505af1158015611155573d6000803e3d6000fd5b505060035460408085015181517fc463b008000000000000000000000000000000000000000000000000000000008152600160a060020a03918216600482015260006024820181905267ffffffffffffffff8a166044830152925191909316945063c463b008935060648084019382900301818387803b1580156111d857600080fd5b505af11580156111ec573d6000803e3d6000fd5b50505050505050565b600054600160a060020a031681565b6000806000806000611214611af4565b6002546040805160e260020a63274a72b102815263ffffffff8a1660048201529051610100909204600160a060020a031693508391639d29cac49160248082019260a0929091908290030181600087803b15801561127157600080fd5b505af1158015611285573d6000803e3d6000fd5b505050506040513d60a081101561129b57600080fd5b508051602080830151604080850151606080870151608097880151151597890188905263ffffffff90811691890182905292880182905293870183905293169094529299909850919650945092505050565b600054600160a060020a031633148061131b57503360009081526001602081905260409091205460ff161515145b151561132657600080fd5b600160a060020a03919091166000908152600560205260409020805460ff1916911515919091179055565b600054600160a060020a0316331461136857600080fd5b600160a060020a03811660009081526001602081905260409091205460ff1615151415610f6f57600160a060020a03166000908152600160205260408120805460ff19169055805475ffff0000000000000000000000000000000000000000198116740100000000000000000000000000000000000000009182900461ffff9081166000190116909102179055565b600080611402611af4565b600254600090819081908190819060ff161561141d57600080fd5b3360009081526005602052604090205460ff16151561143b57600080fd5b6002546040805160e260020a63274a72b102815263ffffffff8e1660048201529051610100909204600160a060020a031698508891639d29cac49160248082019260a0929091908290030181600087803b15801561149857600080fd5b505af11580156114ac573d6000803e3d6000fd5b505050506040513d60a08110156114c257600080fd5b5080516020808301516040808501516060808701516080978801511515978e019790975263ffffffff968716908d0152908b01529089015216808752151561150957600080fd5b6080860151158015611531575063ffffffff8b1660009081526004602052604090205460ff16155b1561153b57600080fd5b85602001519450600654866060015163ffffffff16111561157d57600754600654876060015163ffffffff160387602001510281151561157757fe5b04850194505b8434101561158a57600080fd5b86600160a060020a031663fc4d20f58c8e8d8d6040518563ffffffff1660e060020a028152600401808563ffffffff1663ffffffff16815260200184600160a060020a0316600160a060020a03168152602001806020018281038252848482818152602001925080828437820191505095505050505050602060405180830381600087803b15801561161b57600080fd5b505af115801561162f573d6000803e3d6000fd5b505050506040513d602081101561164557600080fd5b505193506116628c600019430167ffffffffffffffff87166118a5565b9150600090505b60068110156117cf57604080517f62b21ad70000000000000000000000000000000000000000000000000000000081526002600482015263ffffffff8d16602482015260448101839052905160649384900493600160a060020a038a16926362b21ad792818301926020928290030181600087803b1580156116ea57600080fd5b505af11580156116fe573d6000803e3d6000fd5b505050506040513d602081101561171457600080fd5b5051604080517f26bda7390000000000000000000000000000000000000000000000000000000081526003600482015267ffffffffffffffff87166024820152601f851690920160ff811660448401529051909450600160a060020a038916916326bda7399160648083019260209291908290030181600087803b15801561179b57600080fd5b505af11580156117af573d6000803e3d6000fd5b505050506040513d60208110156117c557600080fd5b5050600101611669565b600360009054906101000a9004600160a060020a0316600160a060020a031663c463b00860008e876040518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183600160a060020a0316600160a060020a031681526020018267ffffffffffffffff1681526020019350505050600060405180830381600087803b15801561186c57600080fd5b505af1158015611880573d6000803e3d6000fd5b505067ffffffffffffffff9095169d9c50505050505050505050505050565b60065481565b6040805183406020808301919091526c01000000000000000000000000600160a060020a03871602828401526054808301859052835180840390910181526074909201928390528151600093918291908401908083835b6020831061191b5780518252601f1990920191602091820191016118fc565b5181516020939093036101000a60001901801990911692169190911790526040519201829003909120979650505050505050565b600681565b6000806000611961611af4565b6002546040805160e260020a63274a72b102815263ffffffff881660048201529051610100909204600160a060020a031693508391639d29cac49160248082019260a0929091908290030181600087803b1580156119be57600080fd5b505af11580156119d2573d6000803e3d6000fd5b505050506040513d60a08110156119e857600080fd5b50805160208083015160408085015160608087015160809788015115159789019790975263ffffffff9687169088018190529187015291850181905292909116835290935060001015611a5b57600754600182606001510363ffffffff16826020015102811515611a5557fe5b04830192505b60808101511515611a865763ffffffff851660009081526004602052604090205460ff169350611a8b565b600193505b5050915091565b60075481565b60025460ff1681565b600054600160a060020a03163314611ab857600080fd5b600160a060020a03811615610f6f5760008054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff1990911617905550565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915290565b60408051610100810182526000808252602082018190529181018290526060808201526080810182905260a0810182905260c0810182905260e0810191909152905600a165627a7a7230582020b9bffc9d900d84a4b3371e8225eff753430e584a2a2746cb46235b0806a8600029

Swarm Source

bzzr://20b9bffc9d900d84a4b3371e8225eff753430e584a2a2746cb46235b0806a860
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.