// NewBoundContract creates a low level contract interface through which calls
// and transactions may be made through.
6344
func NewBoundContract(address common.Address, abi abi.ABI, caller ContractCaller, transactor ContractTransactor, filterer ContractFilterer) *BoundContract {
	return &BoundContract{
		address:    address,
		abi:        abi,
		caller:     caller,
		transactor: transactor,
		filterer:   filterer,
	}
}
973194
func NewConstFetch(Constant node.Node) *ConstFetch {
	return &ConstFetch{
		FreeFloating: nil,
		Constant:     Constant,
	}
}
626560
func NewContact(chatID int64, phoneNumber, firstName string) ContactConfig {
	return ContactConfig{
		BaseChat: BaseChat{
			ChatID: chatID,
		},
		PhoneNumber: phoneNumber,
		FirstName:   firstName,
	}
}
268023
func (b *boltArbitratorLog) FetchContractResolutions() (*ContractResolutions, error) {
	c := &ContractResolutions{}
	err := b.db.View(func(tx *bbolt.Tx) error {
		scopeBucket := tx.Bucket(b.scopeKey[:])
		if scopeBucket == nil {
			return errScopeBucketNoExist
		}

		resolutionBytes := scopeBucket.Get(resolutionsKey)
		if resolutionBytes == nil {
			return errNoResolutions
		}

		resReader := bytes.NewReader(resolutionBytes)

		_, err := io.ReadFull(resReader, c.CommitHash[:])
		if err != nil {
			return err
		}

		// First, we'll attempt to read out the commit resolution (if
		// it exists).
		var haveCommitRes bool
		err = binary.Read(resReader, endian, &haveCommitRes)
		if err != nil {
			return err
		}
		if haveCommitRes {
			c.CommitResolution = &lnwallet.CommitOutputResolution{}
			err = decodeCommitResolution(
				resReader, c.CommitResolution,
			)
			if err != nil {
				return err
			}
		}

		var (
			numIncoming uint32
			numOutgoing uint32
		)

		// Next, we'll read out he incoming and outgoing HTLC
		// resolutions.
		err = binary.Read(resReader, endian, &numIncoming)
		if err != nil {
			return err
		}
		c.HtlcResolutions.IncomingHTLCs = make([]lnwallet.IncomingHtlcResolution, numIncoming)
		for i := uint32(0); i < numIncoming; i++ {
			err := decodeIncomingResolution(
				resReader, &c.HtlcResolutions.IncomingHTLCs[i],
			)
			if err != nil {
				return err
			}
		}

		err = binary.Read(resReader, endian, &numOutgoing)
		if err != nil {
			return err
		}
		c.HtlcResolutions.OutgoingHTLCs = make([]lnwallet.OutgoingHtlcResolution, numOutgoing)
		for i := uint32(0); i < numOutgoing; i++ {
			err := decodeOutgoingResolution(
				resReader, &c.HtlcResolutions.OutgoingHTLCs[i],
			)
			if err != nil {
				return err
			}
		}

		return nil
	})
	if err != nil {
		return nil, err
	}

	return c, err
}
324493
func (e Event) ToContract() *contract.Event {
	event := contract.Event{
		ID:       e.ID,
		Pushed:   e.Pushed,
		Device:   e.Device,
		Created:  e.Created,
		Modified: e.Modified,
		Origin:   e.Origin,
	}

	for _, r := range e.Readings {
		event.Readings = append(event.Readings, r)
	}
	return &event
}
654825
func NewFormValidConstraint(fn formValidFunc, id ...FormElement) formValidConstraint {
	return formValidConstraint{fn: fn, id: id}
}
342875
func (b *SimulatedBackend) CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) {
	b.mu.Lock()
	defer b.mu.Unlock()

	if blockNumber != nil && blockNumber.Cmp(b.blockchain.CurrentBlock().Number()) != 0 {
		return nil, errBlockNumberUnsupported
	}
	state, err := b.blockchain.State()
	if err != nil {
		return nil, err
	}
	rval, _, _, err := b.callContract(ctx, call, b.blockchain.CurrentBlock(), state)
	return rval, err
}
537003
func NewAttachClient(conn io.ReadWriteCloser) AttachClient {
	return &attachClient{conn: conn, w: bufio.NewWriter(conn)}
}
816062
func (t *Transport) NewOutbound(chooser peer.Chooser) *Outbound {
	return &Outbound{
		once:      lifecycle.NewOnce(),
		transport: t,
		chooser:   chooser,
	}
}
1041493
func NewBoundingBox(input interface{}) (BoundingBox, error) {
	var (
		result, bbox2 BoundingBox
		err           error
		coordValue    float64
	)

	switch inputType := input.(type) {
	case []string:
		for _, coord := range inputType {
			if coordValue, err = strconv.ParseFloat(coord, 64); err == nil {
				result = append(result, coordValue)
			} else {
				return result, errors.New("Failed to parse bounding box: " + err.Error())
			}
		}
	case string:
		if inputType != "" {
			return NewBoundingBox(strings.Split(inputType, ","))
		}
	case []float64:
		switch len(inputType) {
		case 0, 1:
			// No op
		case 2:
			result = []float64{
				inputType[0],
				inputType[1],
				inputType[0],
				inputType[1]}
			// Drop extraneous coordinates like measurements that do not pertain to BBoxes
		default:
			result = []float64{
				inputType[0],
				inputType[1],
				inputType[2],
				inputType[0],
				inputType[1],
				inputType[2]}
		}
	case [][]float64:
		for _, curr := range inputType {
			if bbox2, err = NewBoundingBox(curr); err == nil {
				result = mergeBboxes(result, bbox2)
			} else {
				return result, err
			}
		}
	case [][][]float64:
		for _, curr := range inputType {
			if bbox2, err = NewBoundingBox(curr); err == nil {
				result = mergeBboxes(result, bbox2)
			} else {
				return result, err
			}
		}
	case [][][][]float64:
		for _, curr := range inputType {
			if bbox2, err = NewBoundingBox(curr); err == nil {
				result = mergeBboxes(result, bbox2)
			} else {
				return result, err
			}
		}
	case []BoundingBox:
		for _, curr := range inputType {
			result = mergeBboxes(result, curr)
		}
	}

	return result, result.Valid()
}
332335
func New(next http.Handler, extract utils.SourceExtractor, maxConnections int64, options ...ConnLimitOption) (*ConnLimiter, error) {
	if extract == nil {
		return nil, fmt.Errorf("Extract function can not be nil")
	}
	cl := &ConnLimiter{
		mutex:          &sync.Mutex{},
		extract:        extract,
		maxConnections: maxConnections,
		connections:    make(map[string]int64),
		next:           next,
		log:            log.StandardLogger(),
	}

	for _, o := range options {
		if err := o(cl); err != nil {
			return nil, err
		}
	}
	if cl.errHandler == nil {
		cl.errHandler = &ConnErrHandler{
			log: cl.log,
		}
	}
	return cl, nil
}
1166281
func NewHandleAt(ns netns.NsHandle, nlFamilies ...int) (*Handle, error) {
	return newHandle(ns, netns.None(), nlFamilies...)
}
1191600
func (b *boltArbitratorLog) InsertUnresolvedContracts(resolvers ...ContractResolver) error {
	return b.db.Batch(func(tx *bbolt.Tx) error {
		contractBucket, err := fetchContractWriteBucket(tx, b.scopeKey[:])
		if err != nil {
			return err
		}

		for _, resolver := range resolvers {
			err = b.writeResolver(contractBucket, resolver)
			if err != nil {
				return err
			}
		}

		return nil
	})
}
401747
func (c *BoundContract) Transfer(opts *TransactOpts) (tx *Transaction, _ error) {
	rawTx, err := c.contract.Transfer(&opts.opts)
	if err != nil {
		return nil, err
	}
	return &Transaction{rawTx}, nil
}
775670
func NewConnHandler(conn io.ReadWriteCloser, handler Handler, signalHandler SignalHandler) (*Conn, error) {
	return NewConn(genericTransport{conn}, WithHandler(handler), WithSignalHandler(signalHandler))
}
959356
func (c *BoundContract) Transfer(opts *TransactOpts) (*types.Transaction, error) {
	return c.transact(opts, &c.address, nil)
}
901340
func NewConstraint() *constraint {
	return &constraint{
		Handler: admission.NewHandler(admission.Create, admission.Update),
	}
}