rpc, smartcontract: move contract metadata to smartcontract package

This commit is contained in:
Anna Shaleva 2020-04-29 13:45:01 +03:00
parent 40e153030d
commit 861aca1547
3 changed files with 8 additions and 10 deletions

View file

@ -505,11 +505,11 @@ func testInvokeScript(ctx *cli.Context) error {
// ProjectConfig contains project metadata.
type ProjectConfig struct {
Version uint
Contract request.ContractDetails `yaml:"project"`
Contract smartcontract.ContractDetails `yaml:"project"`
}
func parseContractDetails() request.ContractDetails {
details := request.ContractDetails{}
func parseContractDetails() smartcontract.ContractDetails {
details := smartcontract.ContractDetails{}
reader := bufio.NewReader(os.Stdin)
fmt.Print("Author: ")

View file

@ -78,7 +78,7 @@ func AddInputsAndUnspentsToTx(tx *transaction.Transaction, addr string, assetID
// DetailsToSCProperties extract the fields needed from ContractDetails
// and converts them to smartcontract.PropertyState.
func DetailsToSCProperties(contract *ContractDetails) smartcontract.PropertyState {
func DetailsToSCProperties(contract *smartcontract.ContractDetails) smartcontract.PropertyState {
var props smartcontract.PropertyState
if contract.HasStorage {
props |= smartcontract.HasStorage
@ -94,7 +94,7 @@ func DetailsToSCProperties(contract *ContractDetails) smartcontract.PropertyStat
// CreateDeploymentScript returns a script that deploys given smart contract
// with its metadata.
func CreateDeploymentScript(avm []byte, contract *ContractDetails) ([]byte, error) {
func CreateDeploymentScript(avm []byte, contract *smartcontract.ContractDetails) ([]byte, error) {
script := io.NewBufBinWriter()
emit.Bytes(script.BinWriter, []byte(contract.Description))
emit.Bytes(script.BinWriter, []byte(contract.Email))

View file

@ -1,6 +1,4 @@
package request
import "github.com/nspcc-dev/neo-go/pkg/smartcontract"
package smartcontract
// ContractDetails contains contract metadata.
type ContractDetails struct {
@ -12,6 +10,6 @@ type ContractDetails struct {
HasStorage bool
HasDynamicInvocation bool
IsPayable bool
ReturnType smartcontract.ParamType
Parameters []smartcontract.ParamType
ReturnType ParamType
Parameters []ParamType
}