Convert to a transfer/send/or low level call
        The funciton assume to receive a correct IR
        The checks must be done by the caller

        Additionally convert abi... to solidityfunction
554455
def convert_to_low_level(ir):
    
    if ir.function_name == 'transfer':
        assert len(ir.arguments) == 1
        ir = Transfer(ir.destination, ir.arguments[0])
        return ir
    elif ir.function_name == 'send':
        assert len(ir.arguments) == 1
        ir = Send(ir.destination, ir.arguments[0], ir.lvalue)
        ir.lvalue.set_type(ElementaryType('bool'))
        return ir
    elif ir.destination.name ==  'abi' and ir.function_name in ['encode',
                                                                'encodePacked',
                                                                'encodeWithSelector',
                                                                'encodeWithSignature',
                                                                'decode']:

        call = SolidityFunction('abi.{}()'.format(ir.function_name))
        new_ir = SolidityCall(call, ir.nbr_arguments, ir.lvalue, ir.type_call)
        new_ir.arguments = ir.arguments
        if isinstance(call.return_type, list) and len(call.return_type) == 1:
            new_ir.lvalue.set_type(call.return_type[0])
        else:
            new_ir.lvalue.set_type(call.return_type)
        return new_ir
    elif ir.function_name in ['call',
                              'delegatecall',
                              'callcode',
                              'staticcall']:
        new_ir = LowLevelCall(ir.destination,
                          ir.function_name,
                          ir.nbr_arguments,
                          ir.lvalue,
                          ir.type_call)
        new_ir.call_gas = ir.call_gas
        new_ir.call_value = ir.call_value
        new_ir.arguments = ir.arguments
        new_ir.lvalue.set_type(ElementaryType('bool'))
        return new_ir
    logger.error('Incorrect conversion to low level {}'.format(ir))
    exit(-1)
466213
def convert_money(amount, currency_from, currency_to):
    
    new_amount = base_convert_money(amount, currency_from, currency_to)
    return moneyed.Money(new_amount, currency_to)
656665
def create(converter_func: ConversionMethod, caught: Exception):
        
        msg = 'Caught TypeError while calling conversion function \'' + str(converter_func.__name__) + '\'. ' \
              'Note that the conversion function signature should be \'' + conversion_method_example_signature_str \
              + '\' (unpacked options mode - default) or ' + multioptions_conversion_method_example_signature_str \
              + ' (unpack_options = False).' \
              + 'Caught error message is : ' + caught.__class__.__name__ + ' : ' + str(caught)
        return CaughtTypeError(msg).with_traceback(caught.__traceback__)
871617
def transfer(sendContext, receiveContext, chunkSize):
    
    try:
        chunkSize = receiveContext.chunkSize
    except AttributeError:
        pass

    if sendContext is not None and receiveContext is not None:
        with receiveContext as writer:
            # Open reader after writer,
            # so any raised errors will abort write before writer closes.
            with sendContext as reader:
                checkBefore = None
                if hasattr(writer, 'skipChunk'):
                    checkBefore = hasattr(reader, 'checkSum')

                while True:
                    if checkBefore is True:
                        (size, checkSum) = reader.checkSum(chunkSize)

                        if writer.skipChunk(size, checkSum):
                            reader.seek(size, io.SEEK_CUR)
                            continue

                    data = reader.read(chunkSize)
                    if len(data) == 0:
                        break

                    if checkBefore is False:
                        checkSum = hashlib.md5(data).hexdigest()

                        if writer.skipChunk(len(data), checkSum, data):
                            continue

                    writer.write(data)
1224322
def send(self, sender, **kwargs):
        """"""
        if id(self) not in _alleged_receivers:
            return
        for func in _alleged_receivers[id(self)]:
            func(sender, **kwargs)
148003
async function requireTransferHelper(){
    // hex write helper already uploaded within current session ?
    // otherwise upload helper
    if (_isTransferWriteHelperUploaded !== true){
        let response = null;

        try{
            ({response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.command.transferWriteHelper));

        }catch(e){
            _logger.debug(e);
            throw new Error('cannot upload transfer helper function');
        }

        // get transfer encoding
        if (response == 'b'){
            _transferEncoding = 'base64'
        }else if (response == 'h'){
            _transferEncoding = 'hex'
        }else{
            throw new Error('unknown transfer encoding - ' + response);
        }

        // show encoding
        _logger.log('Transfer-Mode: ' + _transferEncoding);

        // set flag
        _isTransferWriteHelperUploaded = true;
    }
}
782773
def transfer_funds(self, to, amount, denom, msg):
        ''' 
        '''
        try:
            self.steem_instance().commit.transfer(to, 
                float(amount), denom, msg, self.mainaccount)
        except Exception as e:
            self.msg.error_message(e)
            return False
        else:
            return True
519759
def send(dest, msg, transactionid=None):
    
    transheader = ''

    if transactionid:
        transheader = 'transaction: %s\n' % transactionid

    return "SEND\ndestination: %s\n%s\n%s\x00\n" % (dest, transheader, msg)
864919
def transact(
            self,
            contract_method: ContractFunction,
    ):
        
        txhash = contract_method.transact(self.transaction)
        LOG.debug(f'Sending txHash={encode_hex(txhash)}')
        (receipt, _) = check_successful_tx(
            web3=self.web3,
            txid=txhash,
            timeout=self.wait,
        )
        return receipt
1037764
async function sendTransaction (tx, options = {}) {
  const { waitMined, verify } = R.merge(this.Chain.defaults, options)
  // Verify transaction before broadcast
  if (this.verifyTxBeforeSend || verify) {
    const { validation, tx: txObject, txType } = await this.unpackAndVerify(tx)
    if (validation.length) {
      throw Object.assign(Error('Transaction verification error'), {
        code: 'TX_VERIFICATION_ERROR',
        errorData: { validation, tx: txObject, txType },
        txHash: tx
      })
    }
  }

  try {
    const { txHash } = await this.api.postTransaction({ tx })
    return waitMined ? { ...(await this.poll(txHash, options)), rawTx: tx } : { hash: txHash, rawTx: tx }
  } catch (e) {
    throw Object.assign(
      (new Error(e.message)),
      {
        rawTx: tx,
        verifyTx: () => this.unpackAndVerify(tx)
      }
    )
  }
}
682332
def send(func, *args, **kwargs):
    '''
    
    '''
    kwargs = salt.utils.args.clean_kwargs(**kwargs)
    mine_func = kwargs.pop('mine_function', func)
    if mine_func not in __salt__:
        return False
    data = {}
    arg_data = salt.utils.args.arg_lookup(__salt__[mine_func])
    func_data = copy.deepcopy(kwargs)
    for ind, _ in enumerate(arg_data.get('args', [])):
        try:
            func_data[arg_data['args'][ind]] = args[ind]
        except IndexError:
            # Safe error, arg may be in kwargs
            pass
    f_call = salt.utils.args.format_call(
        __salt__[mine_func],
        func_data,
        expected_extra_kws=MINE_INTERNAL_KEYWORDS)
    for arg in args:
        if arg not in f_call['args']:
            f_call['args'].append(arg)
    try:
        if 'kwargs' in f_call:
            data[func] = __salt__[mine_func](*f_call['args'], **f_call['kwargs'])
        else:
            data[func] = __salt__[mine_func](*f_call['args'])
    except Exception as exc:
        log.error('Function %s in mine.send failed to execute: %s',
                  mine_func, exc)
        return False
    if __opts__['file_client'] == 'local':
        old = __salt__['data.get']('mine_cache')
        if isinstance(old, dict):
            old.update(data)
            data = old
        return __salt__['data.update']('mine_cache', data)
    load = {
            'cmd': '_mine',
            'data': data,
            'id': __opts__['id'],
    }
    return _mine_send(load, __opts__)
810818
def call(self, method, *args):
        

        payload = self.build_payload(method, args)
        logging.debug('* Client will send payload: {}'.format(payload))
        self.send(payload)

        res = self.receive()
        assert payload[2] == res['ref']
        return res['result'], res['error']
814543
function etherscanTransform(response: any, query?: Query = {}) {
  // TODO later: consider building some generalized response validators for
  // common services like etherscan, infura, jsonrpc, etc.
  if (
    typeof response !== 'object' ||
    !Object.hasOwnProperty.call(response, 'status')
  ) {
    throw new Error('Malformed response from Etherscan');
  }

  const { result, status } = response;

  if (status !== '1')
    throw new Error(`Erroneous response from Etherscan (status: ${status})`);

  let abi;
  try {
    abi = JSON.parse(result);
  } catch (error) {
    throw new Error(`Error parsing result from Etherscan: ${error.toString()}`);
  }

  const parsed = {
    abi,
    address: query.contractAddress,
    bytecode: '',
  };

  // Etherscan's API does not return a bytecode property, so we will employ a
  // custom getter (which throws an error) in order to make this clear.
  // $FlowFixMe: we don't want to assign a value
  Object.defineProperty(parsed, 'bytecode', {
    enumerable: false,
    configurable: false,
    get() {
      throw new Error('Etherscan does not currently provide contract bytecode');
    },
  });

  return parsed;
}
559310
private EConvResult convertInternal(byte[] in, Ptr inPtr, int inStop, byte[] out, Ptr outPtr, int outStop, int flags) {
        lastError.reset();

        EConvResult res;
        int len;

        if (numTranscoders == 0) {
            if (inBuf.bytes != null && inBuf.dataStart != inBuf.dataEnd) {
                if (outStop - outPtr.p < inBuf.dataEnd - inBuf.dataStart) {
                    len = outStop - outPtr.p;
                    System.arraycopy(inBuf.bytes, inBuf.dataStart, out, outPtr.p, len);
                    outPtr.p = outStop;
                    inBuf.dataStart += len;
                    return convertInternalResult(EConvResult.DestinationBufferFull, null);
                }
                len = inBuf.dataEnd - inBuf.dataStart;
                System.arraycopy(inBuf.bytes, inBuf.dataStart, out, outPtr.p, len);
                outPtr.p += len;
                inBuf.dataStart = inBuf.dataEnd = inBuf.bufStart;
                if ((flags & AFTER_OUTPUT) != 0) return convertInternalResult(EConvResult.AfterOutput, null);
            }

            if (outStop - outPtr.p < inStop - inPtr.p) {
                len = outStop - outPtr.p;
            } else {
                len = inStop - inPtr.p;
            }

            if (len > 0 && (flags & AFTER_OUTPUT) != 0) {
                out[outPtr.p++] = in[inPtr.p++];
                return convertInternalResult(EConvResult.AfterOutput, null);
            }

            System.arraycopy(in, inPtr.p, out, outPtr.p, len);
            outPtr.p += len;
            inPtr.p += len;

            if (inPtr.p != inStop) {
                res = EConvResult.DestinationBufferFull;
            } else if ((flags & PARTIAL_INPUT) != 0) {
                res = EConvResult.SourceBufferEmpty;
            } else {
                res = EConvResult.Finished;
            }
            return convertInternalResult(res, null);
        }

        boolean hasOutput = false;
        EConvElement elem = elements[numTranscoders - 1];
        if (elem.bytes != null) {
            int dataStart = elem.dataStart;
            int dataEnd = elem.dataEnd;
            byte[] data = elem.bytes;
            if (dataStart != dataEnd) {
                if (outStop - outPtr.p < dataEnd - dataStart) {
                    len = outStop - outPtr.p;
                    System.arraycopy(data, dataStart, out, outPtr.p, len);
                    outPtr.p = outStop;
                    elem.dataStart += len;
                    return convertInternalResult(EConvResult.DestinationBufferFull, null);
                }
                len = dataEnd - dataStart;
                System.arraycopy(data, dataStart, out, outPtr.p, len);
                outPtr.p += len;
                elem.dataStart = elem.dataEnd = elem.bufStart;
                hasOutput = true;
            }
        }

        Ptr resultPosition = new Ptr(0);
        if (inBuf != null && inBuf.dataStart != inBuf.dataEnd) {
            Ptr inDataStartPtr = new Ptr(inBuf.dataStart);
            res = transConv(inBuf.bytes, inDataStartPtr, inBuf.dataEnd, out, outPtr, outStop, (flags & ~AFTER_OUTPUT) | PARTIAL_INPUT, resultPosition);
            inBuf.dataStart = inDataStartPtr.p;
            if (!res.isSourceBufferEmpty()) return convertInternalResult(EConvResult.SourceBufferEmpty, resultPosition);
        }

        if (hasOutput && (flags & AFTER_OUTPUT) != 0 && inPtr.p != inStop) {
            inStop = inPtr.p;
            res = transConv(in, inPtr, inStop, out, outPtr, outStop, flags, resultPosition);
            if (res.isSourceBufferEmpty()) res = EConvResult.AfterOutput;
        } else if ((flags & AFTER_OUTPUT) != 0 || numTranscoders == 1) {
            res = transConv(in, inPtr, inStop, out, outPtr, outStop, flags, resultPosition);
        } else {
            flags |= AFTER_OUTPUT;
            do {
                res = transConv(in, inPtr, inStop, out, outPtr, outStop, flags, resultPosition);
            } while (res.isAfterOutput());
        }

        return convertInternalResult(res, resultPosition);
    }
211827
def _inbound(self, From, to, protocol, udp_source=None):
        
        # Verify stuff!

        self.verifyCertificateAllowed(to, From)
        return self.service.verifyHook(From, to, protocol
                                       ).addCallback(self._inboundimpl,
                                                     From,
                                                     to,
                                                     protocol,
                                                     udp_source).addErrback(
            lambda f: f.trap(KeyError) and dict(listeners=[]))
1086339
def receive_request(self, transaction):
        

        with transaction:

            transaction.separate_timer = self._start_separate_timer(transaction)

            self._blockLayer.receive_request(transaction)

            if transaction.block_transfer:
                self._stop_separate_timer(transaction.separate_timer)
                self._messageLayer.send_response(transaction)
                self.send_datagram(transaction.response)
                return

            self._observeLayer.receive_request(transaction)

            self._requestLayer.receive_request(transaction)

            if transaction.resource is not None and transaction.resource.changed:
                self.notify(transaction.resource)
                transaction.resource.changed = False
            elif transaction.resource is not None and transaction.resource.deleted:
                self.notify(transaction.resource)
                transaction.resource.deleted = False

            self._observeLayer.send_response(transaction)

            self._blockLayer.send_response(transaction)

            self._stop_separate_timer(transaction.separate_timer)

            self._messageLayer.send_response(transaction)

            if transaction.response is not None:
                if transaction.response.type == defines.Types["CON"]:
                    self._start_retransmission(transaction, transaction.response)
                self.send_datagram(transaction.response)
86113
def function( receiver ):
    
    if hasattr(receiver, '__call__'):
        # Reassign receiver to the actual method that will be called.
        if hasattr( receiver.__call__, im_func) or hasattr( receiver.__call__, im_code):
            receiver = receiver.__call__
    if hasattr( receiver, im_func ):
        # an instance-method...
        return receiver, getattr(getattr(receiver, im_func), func_code), 1
    elif not hasattr( receiver, func_code):
        raise ValueError('unknown reciever type %s %s'%(receiver, type(receiver)))
    return receiver, getattr(receiver,func_code), 0