library Address {

    /**
     * returns whether the target address is a contract
     * @dev this function will return false if invoked during the constructor of a contract,
     * as the code is not actually created until after the constructor finishes.
     * @param account address of the account to check
     * @return whether the target address is a contract
     */
    function isContract(address account) internal view returns (bool) {
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;

        // XXX currently there is no better way to check if there is a contract in an address
        // than to check the size of the code at that address.
        // see https://ethereum.stackexchange.com/a/14016/36603
        // for more details about how this works.
        // todo check this again before the serenity release, because all addresses will be
        // contracts then.
        assembly { codehash := extcodehash(account) }
        return (codehash != 0x0 && codehash != accountHash);
    }

}
/**
 * utility library of inline functions on addresses
 */
function isContract(address account) internal view returns (bool) {
    bytes32 codehash;
    bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;

    // XXX currently there is no better way to check if there is a contract in an address
    // than to check the size of the code at that address.
    // see https://ethereum.stackexchange.com/a/14016/36603
    // for more details about how this works.
    // todo check this again before the serenity release, because all addresses will be
    // contracts then.
    assembly { codehash := extcodehash(account) }
    return (codehash != 0x0 && codehash != accountHash);
}

/**
 * returns whether the target address is a contract
 * @dev this function will return false if invoked during the constructor of a contract,
 * as the code is not actually created until after the constructor finishes.
 * @param account address of the account to check
 * @return whether the target address is a contract
 */