Sponsored:   Temco - Join the Largest VC Backed ICO on the Bitcoin Network! TEMCO KYC Whitelist Starts Now!!
Contract Overview
Balance: 0 Ether
Ether Value: $0
Transactions: 1 txn
Misc:
Address Watch: Add To Watch List
Contract Creator: 0x0b22380b7c423470979ac3ed7d3c07696773dea1at txn 0x635843998ef2569e342ec9528193932cee04aba2bd640ad32a092a1e1c7cd529
 Internal Transactions as a result of Contract Execution
View All
ParentTxHash Block Age From To Value
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: MokenTopDownComposableStateHash
Compiler Text: v0.4.24+commit.e67f0147
Optimization Enabled: Yes
Runs (Optimiser):  999



  Contract Source Code   Find Similiar Contracts

pragma solidity 0.4.24;
/******************************************************************************\
* Author: Nick Mudge, [email protected]
* Mokens
* Copyright (c) 2018
*
* The getStateHash function returns a hash that represents the state of a moken. 
* This can be used to verify that child non-fungible tokens have not
* been added/removed right before a transfer or sale.
/******************************************************************************/
///////////////////////////////////////////////////////////////////////////////////
//Storage contracts
////////////
//Some delegate contracts are listed with storage contracts they inherit.
///////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////
//Mokens
///////////////////////////////////////////////////////////////////////////////////
contract Storage0 {
    // funcId => delegate contract
    mapping(bytes4 => address) internal delegates;
}
///////////////////////////////////////////////////////////////////////////////////
//MokenUpdates
//MokenOwner
//QueryMokenDelegates
///////////////////////////////////////////////////////////////////////////////////
contract Storage1 is Storage0 {
    address internal contractOwner;
    bytes[] internal funcSignatures;
    // signature => index+1
    mapping(bytes => uint256) internal funcSignatureToIndex;
}
///////////////////////////////////////////////////////////////////////////////////
//MokensSupportsInterfaces
///////////////////////////////////////////////////////////////////////////////////
contract Storage2 is Storage1 {
    mapping(bytes4 => bool) internal supportedInterfaces;
}
///////////////////////////////////////////////////////////////////////////////////
//MokenRootOwnerOf
//MokenERC721Metadata
///////////////////////////////////////////////////////////////////////////////////
contract Storage3 is Storage2 {
    struct Moken {
        string name;
        uint256 data;
        uint256 parentTokenId;
    }
    //tokenId => moken
    mapping(uint256 => Moken) internal mokens;
    uint256 internal mokensLength;
    // child address => child tokenId => tokenId+1
    mapping(address => mapping(uint256 => uint256)) internal childTokenOwner;
}
///////////////////////////////////////////////////////////////////////////////////
//MokenERC721Enumerable
//MokenLinkHash
///////////////////////////////////////////////////////////////////////////////////
contract Storage4 is Storage3 {
    // root token owner address => (tokenId => approved address)
    mapping(address => mapping(uint256 => address)) internal rootOwnerAndTokenIdToApprovedAddress;
    // token owner => (operator address => bool)
    mapping(address => mapping(address => bool)) internal tokenOwnerToOperators;
    // Mapping from owner to list of owned token IDs
    mapping(address => uint32[]) internal ownedTokens;
}
///////////////////////////////////////////////////////////////////////////////////
//MokenERC998ERC721TopDown
//MokenERC998ERC721TopDownBatch
//MokenERC721
//MokenERC721Batch
///////////////////////////////////////////////////////////////////////////////////
contract Storage5 is Storage4 {
    // tokenId => (child address => array of child tokens)
    mapping(uint256 => mapping(address => uint256[])) internal childTokens;
    // tokenId => (child address => (child token => child index)
    mapping(uint256 => mapping(address => mapping(uint256 => uint256))) internal childTokenIndex;
    // tokenId => (child address => contract index)
    mapping(uint256 => mapping(address => uint256)) internal childContractIndex;
    // tokenId => child contract
    mapping(uint256 => address[]) internal childContracts;
}
///////////////////////////////////////////////////////////////////////////////////
//MokenERC998ERC20TopDown
//MokenStateChange
///////////////////////////////////////////////////////////////////////////////////
contract Storage6 is Storage5 {
    // tokenId => token contract
    mapping(uint256 => address[]) internal erc20Contracts;
    // tokenId => (token contract => token contract index)
    mapping(uint256 => mapping(address => uint256)) erc20ContractIndex;
    // tokenId => (token contract => balance)
    mapping(uint256 => mapping(address => uint256)) internal erc20Balances;
}

contract MokenTopDownComposableStateHash is Storage6 {
    function topDownComposableStateHash(uint256 _tokenId) external view returns (bytes32 stateHash) {
        address[] memory childContracts_ = childContracts[_tokenId];
        uint256 length = childContracts_.length;
        uint256 i;
        if(length > 0) {
            stateHash = keccak256(stateHash, childContracts_);
            for (i = 0; i < length; i++) {
                stateHash = keccak256(stateHash, childTokens[_tokenId][childContracts_[i]]);
            }
        }
        address[] memory erc20Contracts_ = erc20Contracts[_tokenId];
        length = erc20Contracts_.length;
        if(length > 0) {
            stateHash = keccak256(stateHash, erc20Contracts_);
            for (i = 0; i < length; i++) {
                stateHash = keccak256(stateHash, erc20Balances[_tokenId][erc20Contracts_[i]]);
            }
        }
        return stateHash;
    }
}

    Contract ABI  
[{"constant":true,"inputs":[{"name":"_tokenId","type":"uint256"}],"name":"topDownComposableStateHash","outputs":[{"name":"stateHash","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"}]

  Contract Creation Code Switch To Opcodes View
608060405234801561001057600080fd5b50610395806100206000396000f3006080604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663983e2e148114610045575b600080fd5b34801561005157600080fd5b5061005d60043561006f565b60408051918252519081900360200190f35b600060606000806060600e60008781526020019081526020016000208054806020026020016040519081016040528092919081815260200182805480156100ec57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116100c1575b5050505050935083519250600083111561021657604051858152845186918691602080830191818501910280838360005b8381101561013557818101518382015260200161011d565b505050509050019250505060405180910390209450600091505b82821015610216576000868152600b60205260408120855187929087908690811061017657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180836000191660001916815260200182805480156101fa57602002820191906000526020600020905b8154815260200190600101908083116101e6575b50506040519081900390209750506001909301925061014f9050565b6000868152600f60209081526040918290208054835181840281018401909452808452909183018282801561028157602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610256575b5050505050905080519250600083111561036057604051858152815186918391602080830191818501910280838360005b838110156102ca5781810151838201526020016102b2565b505050509050019250505060405180910390209450600091505b82821015610360576000868152601160205260408120825187929084908690811061030b57fe5b602090810290910181015173ffffffffffffffffffffffffffffffffffffffff1682528181019290925260409081016000205481519384529183019190915280519182900301902094506001909101906102e4565b505050509190505600a165627a7a7230582077e8a8134d21a12921c88a9f7d1b8b22905d6408f9a1810af89d9ddc0ed201420029

   Swarm Source:
bzzr://77e8a8134d21a12921c88a9f7d1b8b22905d6408f9a1810af89d9ddc0ed20142

 

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.