cli: make gas parameter to deployment add gas to the base price
That's how it was intended to behave originally. One thing questionable here is contract price (policy thing, basically) being moved to smartcontract package, but it's probably fine for NEO 2.0 (as it won't change) and we'll make something better for NEO 3.0.
This commit is contained in:
parent
695c4dd6ae
commit
bbd802681e
4 changed files with 46 additions and 26 deletions
|
@ -80,17 +80,10 @@ func AddInputsAndUnspentsToTx(tx *transaction.Transaction, addr string, assetID
|
|||
return nil
|
||||
}
|
||||
|
||||
// CreateDeploymentScript returns a script that deploys given smart contract
|
||||
// with its metadata.
|
||||
func CreateDeploymentScript(avm []byte, contract *ContractDetails) ([]byte, error) {
|
||||
// DetailsToSCProperties extract the fields needed from ContractDetails
|
||||
// and converts them to smartcontract.PropertyState.
|
||||
func DetailsToSCProperties(contract *ContractDetails) smartcontract.PropertyState {
|
||||
var props smartcontract.PropertyState
|
||||
|
||||
script := io.NewBufBinWriter()
|
||||
emit.Bytes(script.BinWriter, []byte(contract.Description))
|
||||
emit.Bytes(script.BinWriter, []byte(contract.Email))
|
||||
emit.Bytes(script.BinWriter, []byte(contract.Author))
|
||||
emit.Bytes(script.BinWriter, []byte(contract.Version))
|
||||
emit.Bytes(script.BinWriter, []byte(contract.ProjectName))
|
||||
if contract.HasStorage {
|
||||
props |= smartcontract.HasStorage
|
||||
}
|
||||
|
@ -100,7 +93,19 @@ func CreateDeploymentScript(avm []byte, contract *ContractDetails) ([]byte, erro
|
|||
if contract.IsPayable {
|
||||
props |= smartcontract.IsPayable
|
||||
}
|
||||
emit.Int(script.BinWriter, int64(props))
|
||||
return props
|
||||
}
|
||||
|
||||
// CreateDeploymentScript returns a script that deploys given smart contract
|
||||
// with its metadata.
|
||||
func CreateDeploymentScript(avm []byte, contract *ContractDetails) ([]byte, error) {
|
||||
script := io.NewBufBinWriter()
|
||||
emit.Bytes(script.BinWriter, []byte(contract.Description))
|
||||
emit.Bytes(script.BinWriter, []byte(contract.Email))
|
||||
emit.Bytes(script.BinWriter, []byte(contract.Author))
|
||||
emit.Bytes(script.BinWriter, []byte(contract.Version))
|
||||
emit.Bytes(script.BinWriter, []byte(contract.ProjectName))
|
||||
emit.Int(script.BinWriter, int64(DetailsToSCProperties(contract)))
|
||||
emit.Int(script.BinWriter, int64(contract.ReturnType))
|
||||
params := make([]byte, len(contract.Parameters))
|
||||
for k := range contract.Parameters {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue