parent
7121686571
commit
15a939b1da
7 changed files with 112 additions and 5 deletions
|
@ -2,6 +2,7 @@ package native
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/interop"
|
||||
"github.com/nspcc-dev/neo-go/pkg/io"
|
||||
|
@ -35,6 +36,17 @@ func (cs *Contracts) ByHash(h util.Uint160) interop.Contract {
|
|||
return nil
|
||||
}
|
||||
|
||||
// ByName returns native contract with the specified name.
|
||||
func (cs *Contracts) ByName(name string) interop.Contract {
|
||||
name = strings.ToLower(name)
|
||||
for _, ctr := range cs.Contracts {
|
||||
if strings.ToLower(ctr.Metadata().Name) == name {
|
||||
return ctr
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewContracts returns new set of native contracts with new GAS, NEO and Policy
|
||||
// contracts.
|
||||
func NewContracts() *Contracts {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue