[#465] morph/client: Add audit fee getter in netmap wrapper

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-04-07 13:48:46 +03:00 committed by Alex Vanin
parent df909984bd
commit e11b5bd32b

View file

@ -8,6 +8,7 @@ import (
const (
maxObjectSizeConfig = "MaxObjectSize"
basicIncomeRateConfig = "BasicIncomeRate"
auditFee = "AuditFee"
)
// MaxObjectSize receives max object size configuration
@ -32,6 +33,17 @@ func (w *Wrapper) BasinIncomeRate() (uint64, error) {
return rate, nil
}
// AuditFee returns audit fee configuration value from network
// config in netmap contract.
func (w *Wrapper) AuditFee() (uint64, error) {
fee, err := w.readUInt64Config(auditFee)
if err != nil {
return 0, errors.Wrapf(err, "(%T) could not get audit fee", w)
}
return fee, nil
}
func (w *Wrapper) readUInt64Config(key string) (uint64, error) {
args := netmap.ConfigArgs{}
args.SetKey([]byte(key))