diff --git a/pkg/innerring/alphabet.go b/pkg/innerring/alphabet.go index 20341303c4..9d12136fb6 100644 --- a/pkg/innerring/alphabet.go +++ b/pkg/innerring/alphabet.go @@ -1,5 +1,7 @@ package innerring +import "github.com/nspcc-dev/neo-go/pkg/util" + type glagoliticLetter int8 const ( @@ -139,3 +141,33 @@ func (l glagoliticLetter) configString() string { return "izhitsa" } } + +type alphabetContracts map[glagoliticLetter]util.Uint160 + +func newAlphabetContracts() alphabetContracts { + return make(map[glagoliticLetter]util.Uint160, lastLetterNum) +} + +func (a alphabetContracts) GetByIndex(ind int) (util.Uint160, bool) { + if ind < 0 || ind >= int(lastLetterNum) { + return util.Uint160{}, false + } + + contract, ok := a[glagoliticLetter(ind)] + + return contract, ok +} + +func (a alphabetContracts) indexOutOfRange(ind int) bool { + return ind < 0 && ind >= len(a) +} + +func (a alphabetContracts) iterate(f func(glagoliticLetter, util.Uint160)) { + for letter, contract := range a { + f(letter, contract) + } +} + +func (a *alphabetContracts) set(l glagoliticLetter, h util.Uint160) { + (*a)[l] = h +}