[#770] node/config: Add proxy contract to config

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-08-24 15:59:28 +03:00 committed by Pavel Karpy
parent 13f1273e82
commit d77b2d1b76
5 changed files with 21 additions and 5 deletions

View file

@ -14,7 +14,7 @@ const (
// Netmap returns value of "netmap" config parameter
// from "contracts" section.
//
// Throws panic if value is not is not a 20-byte LE hex-encoded string.
// Throws panic if value is not a 20-byte LE hex-encoded string.
func Netmap(c *config.Config) util.Uint160 {
return contractAddress(c, "netmap")
}
@ -22,7 +22,7 @@ func Netmap(c *config.Config) util.Uint160 {
// Balance returns value of "balance" config parameter
// from "contracts" section.
//
// Throws panic if value is not is not a 20-byte LE hex-encoded string.
// Throws panic if value is not a 20-byte LE hex-encoded string.
func Balance(c *config.Config) util.Uint160 {
return contractAddress(c, "balance")
}
@ -30,7 +30,7 @@ func Balance(c *config.Config) util.Uint160 {
// Container returns value of "container" config parameter
// from "contracts" section.
//
// Throws panic if value is not is not a 20-byte LE hex-encoded string.
// Throws panic if value is not a 20-byte LE hex-encoded string.
func Container(c *config.Config) util.Uint160 {
return contractAddress(c, "container")
}
@ -38,11 +38,19 @@ func Container(c *config.Config) util.Uint160 {
// Reputation returns value of "reputation" config parameter
// from "contracts" section.
//
// Throws panic if value is not is not a 20-byte LE hex-encoded string.
// Throws panic if value is not a 20-byte LE hex-encoded string.
func Reputation(c *config.Config) util.Uint160 {
return contractAddress(c, "reputation")
}
// Proxy returns value of "proxy" config parameter
// from "contracts" section.
//
// Throws panic if value is not a 20-byte LE hex-encoded string.
func Proxy(c *config.Config) util.Uint160 {
return contractAddress(c, "proxy")
}
func contractAddress(c *config.Config, name string) util.Uint160 {
v := config.String(c.Sub(subsection), name)
if v == "" {