From fd16b5701fe0dbdae7bdfe16d6d9c0b566505053 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Wed, 21 Apr 2021 15:25:44 +0300 Subject: [PATCH] [#486] morph/client: Add more global config getters Signed-off-by: Alex Vanin --- pkg/morph/client/netmap/wrapper/config.go | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pkg/morph/client/netmap/wrapper/config.go b/pkg/morph/client/netmap/wrapper/config.go index 8cedd5f56..12298fa26 100644 --- a/pkg/morph/client/netmap/wrapper/config.go +++ b/pkg/morph/client/netmap/wrapper/config.go @@ -12,6 +12,8 @@ const ( epochDurationConfig = "EpochDuration" containerFeeConfig = "ContainerFee" etIterationsConfig = "EigenTrustIterations" + irCandidateFeeConfig = "InnerRingCandidateFee" + withdrawFeeConfig = "WithdrawFee" ) // MaxObjectSize receives max object size configuration @@ -79,6 +81,28 @@ func (w *Wrapper) EigenTrustIterations() (uint64, error) { return iterations, nil } +// InnerRingCandidateFee returns global configuration value of fee payed by +// node to be in inner ring candidates list. +func (w *Wrapper) InnerRingCandidateFee() (uint64, error) { + fee, err := w.readUInt64Config(irCandidateFeeConfig) + if err != nil { + return 0, errors.Wrapf(err, "(%T) could not get inner ring candidate fee", w) + } + + return fee, nil +} + +// WithdrawFee returns global configuration value of fee payed by user to +// withdraw assets from NeoFS contract. +func (w *Wrapper) WithdrawFee() (uint64, error) { + fee, err := w.readUInt64Config(withdrawFeeConfig) + if err != nil { + return 0, errors.Wrapf(err, "(%T) could not get withdraw fee", w) + } + + return fee, nil +} + func (w *Wrapper) readUInt64Config(key string) (uint64, error) { args := netmap.ConfigArgs{} args.SetKey([]byte(key))