MCPcopy Create free account
hub / github.com/DNAProject/DNA / DeployContract

Function DeployContract

cmd/utils/gas.go:578–612  ·  view source on GitHub ↗
(
	gasPrice,
	gasLimit uint64,
	signer *account.Account,
	vmtype payload.VmType,
	code,
	cname,
	cversion,
	cauthor,
	cemail,
	cdesc string)

Source from the content-addressed store, hash-verified

576}
577
578func DeployContract(
579 gasPrice,
580 gasLimit uint64,
581 signer *account.Account,
582 vmtype payload.VmType,
583 code,
584 cname,
585 cversion,
586 cauthor,
587 cemail,
588 cdesc string) (string, error) {
589
590 c, err := hex.DecodeString(code)
591 if err != nil {
592 return "", fmt.Errorf("hex.DecodeString error:%s", err)
593 }
594 mutable, err := NewDeployCodeTransaction(gasPrice, gasLimit, c, vmtype, cname, cversion, cauthor, cemail, cdesc)
595 if err != nil {
596 return "", err
597 }
598
599 err = SignTransaction(signer, mutable)
600 if err != nil {
601 return "", err
602 }
603 tx, err := mutable.IntoImmutable()
604 if err != nil {
605 return "", fmt.Errorf("convert to immutable transation error:%v", err)
606 }
607 txHash, err := SendRawTransaction(tx)
608 if err != nil {
609 return "", fmt.Errorf("SendRawTransaction error:%s", err)
610 }
611 return txHash, nil
612}
613
614func PrepareDeployContract(
615 vmtype payload.VmType,

Callers 1

deployContractFunction · 0.92

Calls 5

NewDeployCodeTransactionFunction · 0.85
SignTransactionFunction · 0.85
ErrorfMethod · 0.80
IntoImmutableMethod · 0.80
SendRawTransactionFunction · 0.70

Tested by

no test coverage detected