// NewContractCreation creates a new transaction for deploying a new contract with
// the given properties.
164386
func NewContractCreation(nonce int64, amount *BigInt, gasLimit int64, gasPrice *BigInt, data []byte) *Transaction {
	return &Transaction{types.NewContractCreation(uint64(nonce), amount.bigint, uint64(gasLimit), gasPrice.bigint, common.CopyBytes(data))}
}
968428
func (c Client) New(params *stripe.TaxRateParams) (*stripe.TaxRate, error) {
	tr := &stripe.TaxRate{}
	err := c.B.Call(http.MethodPost, "/v1/tax_rates", c.Key, params, tr)
	return tr, err
}
1254974
func (t *MockTransactor) CreateTransaction(request fab.TransactionRequest) (*fab.Transaction, error) {
	response := &fab.Transaction{
		Proposal: &fab.TransactionProposal{
			Proposal: &pb.Proposal{},
		},
		Transaction: &pb.Transaction{},
	}
	return response, nil
}
901340
func NewConstraint() *constraint {
	return &constraint{
		Handler: admission.NewHandler(admission.Create, admission.Update),
	}
}
1204730
func (c *leases) Create(lease *v1beta1.Lease) (result *v1beta1.Lease, err error) {
	result = &v1beta1.Lease{}
	err = c.client.Post().
		Namespace(c.ns).
		Resource("leases").
		Body(lease).
		Do().
		Into(result)
	return
}
688309
func CreateIfExists(condKey, key string, value []byte, lease bool) error {
	err := Client().CreateIfExists(condKey, key, value, lease)
	Trace("CreateIfExists", err, logrus.Fields{fieldKey: key, fieldValue: string(value), fieldCondition: condKey, fieldAttachLease: lease})
	return err
}
1236992
func (c Client) New(params *stripe.ChargeParams) (*stripe.Charge, error) {
	charge := &stripe.Charge{}
	err := c.B.Call(http.MethodPost, "/v1/charges", c.Key, params, charge)
	return charge, err
}
45886
func NewProperty(Variable node.Node, Expr node.Node, PhpDocComment string) *Property {
	return &Property{
		FreeFloating:  nil,
		PhpDocComment: PhpDocComment,
		Variable:      Variable,
		Expr:          Expr,
	}
}
252797
func NewClient(createConnection Dialer, s Signer, signerCacheSize uint) *Client {
	return &Client{
		createConnection: createConnection,
		signRequest:      NewMemoizeSigner(s, signerCacheSize).Sign,
	}
}
345303
func setupExternalContracts(endpointGroup *contivModel.EndpointGroup, extContractsGrps []string) error {
	// Validate presence and register consumed external contracts
	tenant := endpointGroup.TenantName
	for _, contractsGrp := range extContractsGrps {
		contractsGrpKey := tenant + ":" + contractsGrp
		contractsGrpObj := contivModel.FindExtContractsGroup(contractsGrpKey)

		if contractsGrpObj == nil {
			errStr := fmt.Sprintf("External contracts group %s not found", contractsGrp)
			log.Errorf(errStr)
			return core.Errorf(errStr)
		}

		// Establish the necessary links.
		modeldb.AddLinkSet(&contractsGrpObj.LinkSets.EndpointGroups, endpointGroup)
		modeldb.AddLinkSet(&endpointGroup.LinkSets.ExtContractsGrps, contractsGrpObj)

		// Links made, write the policy set object.
		err := contractsGrpObj.Write()
		if err != nil {
			return err
		}
	}

	return nil
}
227264
func New(ctx context.Context, s storage.Store, c *ast.Compiler, txn storage.Transaction) (w *Watcher, err error) {
	w = create(ctx, s, c)
	w.trigger, err = s.Register(ctx, txn, storage.TriggerConfig{OnCommit: w.notify})
	return w, err
}
754132
func (evm *EVM) Create(caller ContractRef, code []byte, gas uint64, value *big.Int) (ret []byte, contractAddr common.Address, leftOverGas uint64, err error) {
	contractAddr = crypto.CreateAddress(caller.Address(), evm.StateDB.GetNonce(caller.Address()))
	return evm.create(caller, &codeAndHash{code: code}, gas, value, contractAddr)
}
136611
func deployContract(deploy *def.Deploy, do *def.DeployArgs, script *def.Playbook, client *def.Client, compilersResponse compilers.ResponseItem, libs map[string]string, logger *logging.Logger) (*payload.CallTx, error) {
	contract := compilersResponse.Contract
	contractName := compilersResponse.Objectname
	logger.InfoMsg("Saving Binary", "contract", contractName)
	err := contract.Save(script.BinPath, fmt.Sprintf("%s.bin", contractName))
	if err != nil {
		return nil, err
	}

	if deploy.Store != "" {
		dir := filepath.Dir(deploy.Store)
		file := filepath.Base(deploy.Store)

		err = contract.Save(dir, file)
		if err != nil {
			return nil, err
		}
	}

	err = contract.Link(libs)
	if err != nil {
		return nil, err
	}
	contractCode := contract.Evm.Bytecode.Object

	if deploy.Data != nil {
		_, callDataArray, err := util.PreProcessInputData(compilersResponse.Objectname, deploy.Data, do, script, client, true, logger)
		if err != nil {
			return nil, err
		}
		packedBytes, _, err := abi.EncodeFunctionCall(string(compilersResponse.Contract.Abi), "", logger, callDataArray...)
		if err != nil {
			return nil, err
		}
		callData := hex.EncodeToString(packedBytes)
		contractCode = contractCode + callData
	} else {
		// No constructor arguments were provided. Did the constructor want any?
		spec, err := abi.ReadAbiSpec(compilersResponse.Contract.Abi)
		if err != nil {
			return nil, err
		}

		if len(spec.Constructor.Inputs) > 0 {
			logger.InfoMsg("Constructor wants %d arguments but 0 provided", len(spec.Constructor.Inputs))
			return nil, fmt.Errorf("Constructor wants %d arguments but 0 provided", len(spec.Constructor.Inputs))
		}
	}

	return deployTx(client, deploy, compilersResponse.Objectname, contractCode, logger)
}
1362631
func (ac *APIController) TenantCreate(tenant *contivModel.Tenant) error {
	log.Infof("Received TenantCreate: %+v", tenant)

	if tenant.TenantName == "" {
		return core.Errorf("Invalid tenant name")
	}

	// Get the state driver
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return err
	}

	// Build tenant config
	tenantCfg := intent.ConfigTenant{
		Name:           tenant.TenantName,
		DefaultNetwork: tenant.DefaultNetwork,
	}

	// Create the tenant
	err = master.CreateTenant(stateDriver, &tenantCfg)
	if err != nil {
		log.Errorf("Error creating tenant {%+v}. Err: %v", tenant, err)
		return err
	}

	return nil
}
771993
func NewChainAsyncResult(tasks []*tasks.Signature, backend iface.Backend) *ChainAsyncResult {
	asyncResults := make([]*AsyncResult, len(tasks))
	for i, task := range tasks {
		asyncResults[i] = NewAsyncResult(task, backend)
	}
	return &ChainAsyncResult{
		asyncResults: asyncResults,
		backend:      backend,
	}
}
306660
func (c *consulClient) createIfExists(condKey, key string, value []byte, lease bool) error {
	// Consul does not support transactions which would allow to check for
	// the presence of a conditional key if the key is not the key being
	// manipulated
	//
	// Lock the conditional key to serialize all CreateIfExists() calls

	l, err := LockPath(context.Background(), condKey)
	if err != nil {
		return fmt.Errorf("unable to lock condKey for CreateIfExists: %s", err)
	}

	defer l.Unlock()

	// Create the key if it does not exist
	if _, err := c.CreateOnly(context.TODO(), key, value, lease); err != nil {
		return err
	}

	// Consul does not support transactions which would allow to check for
	// the presence of another key
	masterKey, err := c.Get(condKey)
	if err != nil || masterKey == nil {
		c.Delete(key)
		return fmt.Errorf("conditional key not present")
	}

	return nil
}
303033
func (c *Client) NewInitiator(opts *NewInitiatorOptions) (NewInitiatorResult, error) {
	req := xms.PostInitiatorsReq(*opts)
	res, err := c.api.PostInitiators(&req)
	if err != nil {
		return nil, err
	}

	nir := NewInitiatorResult(res)
	return nir, nil
}