Documentation
¶
Index ¶
- func Deploy(ic *interop.Context, _ *vm.VM) error
- func ModifyAccountVotes(acc *state.Account, d dao.DAO, value util.Fixed8) error
- type Contract
- type ContractMD
- type Contracts
- func (cs *Contracts) Add(c Contract)
- func (cs *Contracts) ByHash(h util.Uint160) Contract
- func (cs *Contracts) ByID(id uint32) Contract
- func (cs *Contracts) GetNativeInterop(ic *interop.Context) func(uint32) *vm.InteropFuncPrice
- func (cs *Contracts) SetGAS(g *GAS)
- func (cs *Contracts) SetNEO(n *NEO)
- type GAS
- func (c *GAS) Decimals(_ *interop.Context, _ []vm.StackItem) vm.StackItem
- func (g *GAS) Initialize(ic *interop.Context) error
- func (c *GAS) Metadata() *ContractMD
- func (c *GAS) Name(_ *interop.Context, _ []vm.StackItem) vm.StackItem
- func (g *GAS) OnPersist(ic *interop.Context) error
- func (c *GAS) Symbol(_ *interop.Context, _ []vm.StackItem) vm.StackItem
- func (c *GAS) Transfer(ic *interop.Context, args []vm.StackItem) vm.StackItem
- type Method
- type MethodAndPrice
- type NEO
- func (c *NEO) Decimals(_ *interop.Context, _ []vm.StackItem) vm.StackItem
- func (n *NEO) GetNextBlockValidatorsInternal(bc blockchainer.Blockchainer, d dao.DAO) ([]*keys.PublicKey, error)
- func (n *NEO) GetValidatorsInternal(bc blockchainer.Blockchainer, d dao.DAO) ([]*keys.PublicKey, error)
- func (n *NEO) Initialize(ic *interop.Context) error
- func (c *NEO) Metadata() *ContractMD
- func (c *NEO) Name(_ *interop.Context, _ []vm.StackItem) vm.StackItem
- func (n *NEO) OnPersist(ic *interop.Context) error
- func (c *NEO) Symbol(_ *interop.Context, _ []vm.StackItem) vm.StackItem
- func (c *NEO) Transfer(ic *interop.Context, args []vm.StackItem) vm.StackItem
- func (n *NEO) VoteInternal(ic *interop.Context, h util.Uint160, pubs keys.PublicKeys) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Contract ¶
type Contract interface {
Metadata() *ContractMD
OnPersist(*interop.Context) error
}
Contract is an interface for all native contracts.
type ContractMD ¶
type ContractMD struct {
Manifest manifest.Manifest
ServiceName string
ServiceID uint32
Script []byte
Hash util.Uint160
Methods map[string]MethodAndPrice
}
ContractMD represents native contract instance.
func NewContractMD ¶
func NewContractMD(name string) *ContractMD
NewContractMD returns Contract with the specified list of methods.
func (*ContractMD) AddEvent ¶
func (c *ContractMD) AddEvent(name string, ps ...manifest.Parameter)
AddEvent adds new event to a native contract.
func (*ContractMD) AddMethod ¶
func (c *ContractMD) AddMethod(md *MethodAndPrice, desc *manifest.Method, safe bool)
AddMethod adds new method to a native contract.
type Contracts ¶
Contracts is a set of registered native contracts.
func NewContracts ¶
func NewContracts() *Contracts
NewContracts returns new empty set of native contracts.
func (*Contracts) GetNativeInterop ¶
GetNativeInterop returns an interop getter for a given set of contracts.
type GAS ¶
type GAS struct {
NEO *NEO
// contains filtered or unexported fields
}
GAS represents GAS native contract.
func (*GAS) Initialize ¶
Initialize initializes GAS contract.
func (*GAS) Metadata ¶
func (c *GAS) Metadata() *ContractMD
type MethodAndPrice ¶
type MethodAndPrice struct {
Func Method
Price int64
RequiredFlags smartcontract.CallFlag
}
MethodAndPrice is a native-contract method descriptor.
type NEO ¶
type NEO struct {
GAS *GAS
// contains filtered or unexported fields
}
NEO represents NEO native contract.
func (*NEO) GetNextBlockValidatorsInternal ¶
func (n *NEO) GetNextBlockValidatorsInternal(bc blockchainer.Blockchainer, d dao.DAO) ([]*keys.PublicKey, error)
GetNextBlockValidatorsInternal returns next block validators.
func (*NEO) GetValidatorsInternal ¶
func (n *NEO) GetValidatorsInternal(bc blockchainer.Blockchainer, d dao.DAO) ([]*keys.PublicKey, error)
GetValidatorsInternal returns a list of current validators.
func (*NEO) Initialize ¶
Initialize initializes NEO contract.
func (*NEO) Metadata ¶
func (c *NEO) Metadata() *ContractMD
func (*NEO) VoteInternal ¶
VoteInternal votes from account h for validarors specified in pubs.