rpc, smartcontract: move contract metadata to smartcontract package
This commit is contained in:
parent
8f417c8e8b
commit
87b0e76a8c
3 changed files with 8 additions and 10 deletions
|
@ -505,11 +505,11 @@ func testInvokeScript(ctx *cli.Context) error {
|
||||||
// ProjectConfig contains project metadata.
|
// ProjectConfig contains project metadata.
|
||||||
type ProjectConfig struct {
|
type ProjectConfig struct {
|
||||||
Version uint
|
Version uint
|
||||||
Contract request.ContractDetails `yaml:"project"`
|
Contract smartcontract.ContractDetails `yaml:"project"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseContractDetails() request.ContractDetails {
|
func parseContractDetails() smartcontract.ContractDetails {
|
||||||
details := request.ContractDetails{}
|
details := smartcontract.ContractDetails{}
|
||||||
reader := bufio.NewReader(os.Stdin)
|
reader := bufio.NewReader(os.Stdin)
|
||||||
|
|
||||||
fmt.Print("Author: ")
|
fmt.Print("Author: ")
|
||||||
|
|
|
@ -78,7 +78,7 @@ func AddInputsAndUnspentsToTx(tx *transaction.Transaction, addr string, assetID
|
||||||
|
|
||||||
// DetailsToSCProperties extract the fields needed from ContractDetails
|
// DetailsToSCProperties extract the fields needed from ContractDetails
|
||||||
// and converts them to smartcontract.PropertyState.
|
// and converts them to smartcontract.PropertyState.
|
||||||
func DetailsToSCProperties(contract *ContractDetails) smartcontract.PropertyState {
|
func DetailsToSCProperties(contract *smartcontract.ContractDetails) smartcontract.PropertyState {
|
||||||
var props smartcontract.PropertyState
|
var props smartcontract.PropertyState
|
||||||
if contract.HasStorage {
|
if contract.HasStorage {
|
||||||
props |= smartcontract.HasStorage
|
props |= smartcontract.HasStorage
|
||||||
|
@ -94,7 +94,7 @@ func DetailsToSCProperties(contract *ContractDetails) smartcontract.PropertyStat
|
||||||
|
|
||||||
// CreateDeploymentScript returns a script that deploys given smart contract
|
// CreateDeploymentScript returns a script that deploys given smart contract
|
||||||
// with its metadata.
|
// with its metadata.
|
||||||
func CreateDeploymentScript(avm []byte, contract *ContractDetails) ([]byte, error) {
|
func CreateDeploymentScript(avm []byte, contract *smartcontract.ContractDetails) ([]byte, error) {
|
||||||
script := io.NewBufBinWriter()
|
script := io.NewBufBinWriter()
|
||||||
emit.Bytes(script.BinWriter, []byte(contract.Description))
|
emit.Bytes(script.BinWriter, []byte(contract.Description))
|
||||||
emit.Bytes(script.BinWriter, []byte(contract.Email))
|
emit.Bytes(script.BinWriter, []byte(contract.Email))
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
package request
|
package smartcontract
|
||||||
|
|
||||||
import "github.com/nspcc-dev/neo-go/pkg/smartcontract"
|
|
||||||
|
|
||||||
// ContractDetails contains contract metadata.
|
// ContractDetails contains contract metadata.
|
||||||
type ContractDetails struct {
|
type ContractDetails struct {
|
||||||
|
@ -12,6 +10,6 @@ type ContractDetails struct {
|
||||||
HasStorage bool
|
HasStorage bool
|
||||||
HasDynamicInvocation bool
|
HasDynamicInvocation bool
|
||||||
IsPayable bool
|
IsPayable bool
|
||||||
ReturnType smartcontract.ParamType
|
ReturnType ParamType
|
||||||
Parameters []smartcontract.ParamType
|
Parameters []ParamType
|
||||||
}
|
}
|
Loading…
Reference in a new issue