Returns serializable statespace of the contract
        :param contract: The Contract on which the analysis should be done
        :return: The serialized state space
432763
def dump_statespace(self, contract: EVMContract = None) -> str:
        
        sym = SymExecWrapper(
            contract or self.contracts[0],
            self.address,
            self.strategy,
            dynloader=DynLoader(
                self.eth,
                storage_loading=self.onchain_storage_access,
                contract_loading=self.dynld,
            ),
            max_depth=self.max_depth,
            execution_timeout=self.execution_timeout,
            create_timeout=self.create_timeout,
            enable_iprof=self.enable_iprof,
        )

        return get_serializable_statespace(sym)
271088
def contract(s):
    
    if not s: return s

    tokens = s.split()
    old = tokens[0]
    count = [[1, old]]

    for t in tokens[1:]:
        if t == old:
            count[-1][0] += 1
        else:
            old = t
            count.append([1, t])

    return " ".join("%d*%s" % (c, t) for c, t in count)
304182
def compile_all(self):
        

        # Solidity input JSON
        solc_input = self.get_solc_input()

        # Compile the contracts
        real_path = os.path.realpath(self.contracts_dir)
        compilation_result = compile_standard(solc_input, allow_paths=real_path)

        # Create the output folder if it doesn't already exist
        os.makedirs(self.output_dir, exist_ok=True)

        # Write the contract ABI to output files
        compiled_contracts = compilation_result['contracts']
        for contract_file in compiled_contracts:
            for contract in compiled_contracts[contract_file]:
                contract_name = contract.split('.')[0]
                contract_data = compiled_contracts[contract_file][contract_name]

                contract_data_path = self.output_dir + '/{0}.json'.format(contract_name)
                with open(contract_data_path, "w+") as contract_data_file:
                    json.dump(contract_data, contract_data_file)
939685
private String getApiId(Contract contract) {
        return getApiId(contract.getApiOrgId(), contract.getApiId(), contract.getApiVersion());
    }
594647
def _detect(self):
        
        results = []
        for c in self.slither.contracts_derived:
            unusedVars = self.detect_unused(c)
            if unusedVars:
                info = ''
                for var in unusedVars:
                    info += "{}.{} ({}) is never used in {}\n".format(var.contract.name,
                                                                      var.name,
                                                                      var.source_mapping_str,
                                                                      c.name)


                json = self.generate_json_result(info)
                self.add_variables_to_json(unusedVars, json)
                results.append(json)

        return results
351323
def solidity_get_contract_key(all_contracts, filepath, contract_name):
    
    if contract_name in all_contracts:
        return contract_name
    else:
        if filepath is None:
            filename = '<stdin>'
        else:
            _, filename = os.path.split(filepath)
        contract_key = filename + ":" + contract_name
        return contract_key if contract_key in all_contracts else None
1236884
def as_dictionary(self):
        
        template = {
            'contractName': self.contract_name,
            'events': [e.as_dictionary() for e in self.agreement_events],
            'fulfillmentOrder': self.fulfillment_order,
            'conditionDependency': self.condition_dependency,
            'conditions': [cond.as_dictionary() for cond in self.conditions]
        }
        return {
            # 'type': self.DOCUMENT_TYPE,
            'name': self.name,
            'creator': self.creator,
            'serviceAgreementTemplate': template
        }
1306680
def validate_minimal_contract_factory_data(contract_data: Dict[str, str]) -> None:
    
    if not all(key in contract_data.keys() for key in ("abi", "deployment_bytecode")):
        raise InsufficientAssetsError(
            "Minimum required contract data to generate a deployable "
            "contract factory (abi & deployment_bytecode) not found."
        )
297308
def _format_contracts(what: str, obj: Any) -> List[str]:
    """"""
    if what in ['function', 'method', 'attribute']:
        if what == 'attribute':
            if not isinstance(obj, property):
                return []

            return _format_property_contracts(prop=obj)

        if what in ['function', 'method']:
            return _format_function_contracts(func=obj)

        raise NotImplementedError("Unhandled what: {}".format(what))

    elif what == 'class':
        invariants = getattr(obj, "__invariants__", [])  # type: List[icontract._Contract]
        assert isinstance(invariants, list)
        assert all(isinstance(inv, icontract._Contract) for inv in invariants)

        return _format_invariants(invariants=invariants)

    # Only properties, functions and classes have contracts.
    return []
387497
def deployment_type(
    *,
    contract_instance: str,
    contract_type: str,
    deployment_bytecode: Dict[str, Any] = None,
    runtime_bytecode: Dict[str, Any] = None,
    compiler: Dict[str, Any] = None,
) -> Manifest:
    
    return _deployment_type(
        contract_instance,
        contract_type,
        deployment_bytecode,
        runtime_bytecode,
        compiler,
    )
1345962
def get_by_contract(self, contract_hash):
        
        hash = contract_hash
        if isinstance(contract_hash, str) and len(contract_hash) == 40:
            hash = UInt160.ParseString(contract_hash)

        if not isinstance(hash, UInt160):
            raise Exception("Incorrect address format")

        contractlist_snapshot = self.db.prefixed_db(NotificationPrefix.PREFIX_CONTRACT).snapshot()
        results = []

        for val in contractlist_snapshot.iterator(prefix=bytes(hash.Data), include_key=False):
            if len(val) > 4:
                try:
                    event = SmartContractEvent.FromByteArray(val)
                    results.append(event)
                except Exception as e:
                    logger.error("could not parse event: %s %s" % (e, val))
        return results
1354383
def creates(self):
        ""
        if self.to in (b'', '\0' * 20):
            return mk_contract_address(self.sender, self.nonce)
1294530
def get_contract_events(
        chain: BlockChainService,
        abi: Dict,
        contract_address: Address,
        topics: Optional[List[str]],
        from_block: BlockSpecification,
        to_block: BlockSpecification,
) -> List[Dict]:
    
    verify_block_number(from_block, 'from_block')
    verify_block_number(to_block, 'to_block')
    events = chain.client.get_filter_events(
        contract_address,
        topics=topics,
        from_block=from_block,
        to_block=to_block,
    )

    result = []
    for event in events:
        decoded_event = dict(decode_event(abi, event))
        if event.get('blockNumber'):
            decoded_event['block_number'] = event['blockNumber']
            del decoded_event['blockNumber']
        result.append(decoded_event)
    return result
905344
def derived_contracts(self):
        '''
            
        '''
        candidates = self.slither.contracts
        return [c for c in candidates if self in c.inheritance]
972997
public OkCoinPositionResult getFuturesPosition(String symbol, FuturesContract contract)
      throws IOException {
    OkCoinPositionResult futuresPositionsCross =
        okCoin.getFuturesPositionsCross(apikey, symbol, contract.getName(), signatureCreator());

    return returnOrThrow(futuresPositionsCross);
  }
155745
def Serialize(self, writer):
        
        super(ContractState, self).Serialize(writer)

        self.Code.Serialize(writer)
        writer.WriteUInt8(self.ContractProperties)
        writer.WriteVarString(self.Name)
        writer.WriteVarString(self.CodeVersion)
        writer.WriteVarString(self.Author)
        writer.WriteVarString(self.Email)
        writer.WriteVarString(self.Description)
207778
def serialize(cls, conversation):
        
        return {
            'namespace': conversation.namespace,
            'units': sorted(conversation.units),
            'scope': conversation.scope,
        }