-
Notifications
You must be signed in to change notification settings - Fork 77
/
management.go
57 lines (47 loc) · 2.26 KB
/
management.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
Package management provides interface to ContractManagement native contract.
It allows to get/deploy/update contracts as well as get/set deployment fee.
*/
package management
import (
"github.com/nspcc-dev/neo-go/pkg/interop"
"github.com/nspcc-dev/neo-go/pkg/interop/contract"
)
// Hash represents Management contract hash.
const Hash = "\xfd\xa3\xfa\x43\x46\xea\x53\x2a\x25\x8f\xc4\x97\xdd\xad\xdb\x64\x37\xc9\xfd\xff"
// Deploy represents `deploy` method of Management native contract.
func Deploy(script, manifest []byte) *Contract {
return contract.Call(interop.Hash160(Hash), "deploy",
contract.States|contract.AllowNotify, script, manifest).(*Contract)
}
// DeployWithData represents `deploy` method of Management native contract.
func DeployWithData(script, manifest []byte, data interface{}) *Contract {
return contract.Call(interop.Hash160(Hash), "deploy",
contract.States|contract.AllowNotify, script, manifest, data).(*Contract)
}
// Destroy represents `destroy` method of Management native contract.
func Destroy() {
contract.Call(interop.Hash160(Hash), "destroy", contract.States|contract.AllowNotify)
}
// GetContract represents `getContract` method of Management native contract.
func GetContract(addr interop.Hash160) *Contract {
return contract.Call(interop.Hash160(Hash), "getContract", contract.ReadStates, addr).(*Contract)
}
// GetMinimumDeploymentFee represents `getMinimumDeploymentFee` method of Management native contract.
func GetMinimumDeploymentFee() int {
return contract.Call(interop.Hash160(Hash), "getMinimumDeploymentFee", contract.ReadStates).(int)
}
// SetMinimumDeploymentFee represents `setMinimumDeploymentFee` method of Management native contract.
func SetMinimumDeploymentFee(value int) {
contract.Call(interop.Hash160(Hash), "setMinimumDeploymentFee", contract.States, value)
}
// Update represents `update` method of Management native contract.
func Update(script, manifest []byte) {
contract.Call(interop.Hash160(Hash), "update",
contract.States|contract.AllowNotify, script, manifest)
}
// UpdateWithData represents `update` method of Management native contract.
func UpdateWithData(script, manifest []byte, data interface{}) {
contract.Call(interop.Hash160(Hash), "update",
contract.States|contract.AllowNotify, script, manifest, data)
}