diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index c2017e5d..99f0477a 100644 --- a/cmd/neofs-ir/defaults.go +++ b/cmd/neofs-ir/defaults.go @@ -64,6 +64,14 @@ func defaultConfiguration(cfg *viper.Viper) { cfg.SetDefault("contracts.neofs", "") cfg.SetDefault("contracts.balance", "") cfg.SetDefault("contracts.container", "") + // alphabet contracts + cfg.SetDefault("contracts.alphabet.az", "") + cfg.SetDefault("contracts.alphabet.buky", "") + cfg.SetDefault("contracts.alphabet.vedi", "") + cfg.SetDefault("contracts.alphabet.glagoli", "") + cfg.SetDefault("contracts.alphabet.dobro", "") + cfg.SetDefault("contracts.alphabet.jest", "") + cfg.SetDefault("contracts.alphabet.zhivete", "") // gas native contract in LE cfg.SetDefault("contracts.gas", "668e0c1f9d7b70a99dd9e06eadd4c784d641afbc") diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index cb97edbb..4931d4ad 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -51,6 +51,8 @@ type ( reputation util.Uint160 // in morph neofsid util.Uint160 // in morph gas util.Uint160 // native contract in both chains + + alphabet [alphabetContractsN]util.Uint160 // in morph } chainParams struct { @@ -65,6 +67,8 @@ type ( const ( morphPrefix = "morph" mainnetPrefix = "mainnet" + + alphabetContractsN = 7 // az, buky, vedi, glagoli, dobro, jest, zhivete ) // Start runs all event providers. @@ -297,9 +301,30 @@ func parseContracts(cfg *viper.Viper) (*contracts, error) { return nil, errors.Wrap(err, "ir: can't read container script-hash") } + result.alphabet, err = parseAlphabetContracts(cfg) + if err != nil { + return nil, err + } + return result, nil } +func parseAlphabetContracts(cfg *viper.Viper) (res [7]util.Uint160, err error) { + // list of glagolic script letters that represent alphabet contracts + glagolic := []string{"az", "buky", "vedi", "glagoli", "dobro", "jest", "zhivete"} + + for i, letter := range glagolic { + contractStr := cfg.GetString("contracts.alphabet." + letter) + + res[i], err = util.Uint160DecodeStringLE(contractStr) + if err != nil { + return res, errors.Wrapf(err, "ir: can't read alphabet %s contract", letter) + } + } + + return res, nil +} + func initConfigFromBlockchain(s *Server, c *contracts, key *ecdsa.PublicKey) error { // get current epoch epoch, err := invoke.Epoch(s.morphClient, c.netmap)