[#404] innerring: Enable notary support in morph client

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-02-20 13:44:51 +03:00 committed by Alex Vanin
parent 779a495625
commit ccaf4f5d55
3 changed files with 52 additions and 0 deletions

View file

@ -88,6 +88,7 @@ type (
balance util.Uint160 // in morph
container util.Uint160 // in morph
audit util.Uint160 // in morph
proxy util.Uint160 // in morph
alphabet alphabetContracts // in morph
}
@ -236,6 +237,14 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error
return nil, err
}
err = server.morphClient.EnableNotarySupport(
server.contracts.proxy,
server.contracts.netmap,
)
if err != nil {
return nil, err
}
if cfg.GetBool("without_mainnet") {
// This works as long as event Listener starts listening loop once,
// otherwise Server.Start will run two similar routines.
@ -569,6 +578,7 @@ func parseContracts(cfg *viper.Viper) (*contracts, error) {
balanceContractStr := cfg.GetString("contracts.balance")
containerContractStr := cfg.GetString("contracts.container")
auditContractStr := cfg.GetString("contracts.audit")
proxyContractStr := cfg.GetString("contracts.proxy")
result.netmap, err = util.Uint160DecodeStringLE(netmapContractStr)
if err != nil {
@ -595,6 +605,11 @@ func parseContracts(cfg *viper.Viper) (*contracts, error) {
return nil, errors.Wrap(err, "ir: can't read audit script-hash")
}
result.proxy, err = util.Uint160DecodeStringLE(proxyContractStr)
if err != nil {
return nil, errors.Wrap(err, "ir: can't read proxy script-hash")
}
result.alphabet, err = parseAlphabetContracts(cfg)
if err != nil {
return nil, err