( gasPrice, gasLimit uint64, signer *account.Account, vmtype payload.VmType, code, cname, cversion, cauthor, cemail, cdesc string)
| 576 | } |
| 577 | |
| 578 | func 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 | |
| 614 | func PrepareDeployContract( |
| 615 | vmtype payload.VmType, |
no test coverage detected