Sponsored:   Ubex.com - World roadshow: Seoul Sep 17-19, Singapore Sep 19-20, Dubai 18-23. Meet us!.
Contract Overview
Balance: 0 Ether
Ether Value: $0
Transactions: 1 txn
 Internal Transactions as a result of Contract Execution
View All
ParentTxHash Block Age From To Value
Contract Source Code Verified (Exact Match)
Contract Name: ContractProbe
Compiler Text: v0.4.25+commit.59dbf8f1
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.23;

/*
The MIT License (MIT)

Copyright (c) 2018 Murray Software, LLC.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
//solhint-disable max-line-length

contract ContractProbe {

    function probe(address _addr) public view returns (bool isContract, address forwardedTo) {
        bytes memory clone = hex"363d3d373d3d3d363d73bebebebebebebebebebebebebebebebebebebebe5af43d82803e903d91602b57fd5bf3";
        uint size;
        bytes memory code;

        assembly {  //solhint-disable-line
            size := extcodesize(_addr)
        }

        isContract = size > 0;
        forwardedTo = _addr;

        if (size <= 45 && size >= 41) {
            bool matches = true;
            uint i;

            assembly { //solhint-disable-line
                code := mload(0x40)
                mstore(0x40, add(code, and(add(add(size, 0x20), 0x1f), not(0x1f))))
                mstore(code, size)
                extcodecopy(_addr, add(code, 0x20), 0, size)
            }
            for (i = 0; matches && i < 9; i++) { 
                matches = code[i] == clone[i];
            }
            for (i = 0; matches && i < 15; i++) {
                if (i == 4) {
                    matches = code[code.length - i - 1] == byte(uint(clone[45 - i - 1]) - (45 - size));
                } else {
                    matches = code[code.length - i - 1] == clone[45 - i - 1];
                }
            }
            if (code[9] != byte(0x73 - (45 - size))) {
                matches = false;
            }
            uint forwardedToBuffer;
            if (matches) {
                assembly { //solhint-disable-line
                    forwardedToBuffer := mload(add(code, 30))
                }
                forwardedToBuffer &= (0x1 << 20 * 8) - 1;
                forwardedTo = address(forwardedToBuffer >> ((45 - size) * 8));
            }
        }
    }
}

    Contract ABI  
[{"constant":true,"inputs":[{"name":"_addr","type":"address"}],"name":"probe","outputs":[{"name":"isContract","type":"bool"},{"name":"forwardedTo","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]

  Contract Creation Code Switch To Opcodes View
608060405234801561001057600080fd5b506103b7806100206000396000f3006080604052600436106100405763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663275e5da58114610045575b600080fd5b34801561005157600080fd5b5061007373ffffffffffffffffffffffffffffffffffffffff600435166100a3565b60408051921515835273ffffffffffffffffffffffffffffffffffffffff90911660208301528051918290030190f35b6040805160608181018352602d8083527f363d3d373d3d3d363d73bebebebebebebebebebebebebebebebebebebebe5af460208401527f3d82803e903d91602b57fd5bf300000000000000000000000000000000000000938301939093526000843b81811194869493919290819081908511801590610123575060298510155b156103805760408051603f8701601f19168101909152858152935060019250846000602086018b3c600091505b82801561015d5750600982105b156101dc57858281518110151561017057fe5b90602001015160f860020a900460f860020a02600160f860020a031916848381518110151561019b57fe5b01602001517fff0000000000000000000000000000000000000000000000000000000000000060f860020a9182900490910216149250600190910190610150565b600091505b8280156101ee5750600f82105b156102e95781600414156102785784602d0386600184602d030381518110151561021457fe5b90602001015160f860020a900460f860020a0260f860020a90040360f860020a02600160f860020a031916846001848751030381518110151561025357fe5b90602001015160f860020a900460f860020a02600160f860020a0319161492506102de565b85600183602d030381518110151561028c57fe5b90602001015160f860020a900460f860020a02600160f860020a03191684600184875103038151811015156102bd57fe5b90602001015160f860020a900460f860020a02600160f860020a0319161492505b6001909101906101e1565b84602d0360730360f860020a02600160f860020a03191684600981518110151561030f57fe5b60209101015160f860020a90819004027fff00000000000000000000000000000000000000000000000000000000000000161461034b57600092505b82156103805750601e8301516008602d8690030260020a73ffffffffffffffffffffffffffffffffffffffff90911690810496505b5050505050509150915600a165627a7a72305820056f3900e2dad49da396b9f3b4046efd1dfc67f916e398f794fd605c1b190d9d0029

   Swarm Source:
bzzr://056f3900e2dad49da396b9f3b4046efd1dfc67f916e398f794fd605c1b190d9d

 

View All
Block Age transaction Difficulty 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.