diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index d04ba6a3c..6af176227 100644 --- a/cmd/neofs-ir/defaults.go +++ b/cmd/neofs-ir/defaults.go @@ -110,6 +110,7 @@ func defaultConfiguration(cfg *viper.Viper) { cfg.SetDefault("audit.por.pool_size", "10") cfg.SetDefault("settlement.basic_income_rate", 0) + cfg.SetDefault("settlement.audit_fee", 0) cfg.SetDefault("indexer.cache_timeout", 15*time.Second) diff --git a/pkg/innerring/config/config.go b/pkg/innerring/config/config.go index 61e8e24ce..f7c556cba 100644 --- a/pkg/innerring/config/config.go +++ b/pkg/innerring/config/config.go @@ -37,3 +37,12 @@ func (c *GlobalConfig) BasicIncomeRate() (uint64, error) { return c.nm.BasinIncomeRate() } + +func (c *GlobalConfig) AuditFee() (uint64, error) { + value := c.cfg.GetUint64("settlement.audit_fee") + if value != 0 { + return value, nil + } + + return c.nm.AuditFee() +} diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index bc6b99091..335571a0b 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -393,6 +393,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error nmSrc: nmClient, clientCache: clientCache, balanceClient: balClient, + cfg: globalConfig, } auditCalcDeps := &auditSettlementDeps{ @@ -402,7 +403,6 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error basicSettlementDeps := &basicIncomeSettlementDeps{ settlementDeps: settlementDeps, cnrClient: cnrClient, - cfg: globalConfig, } auditSettlementCalc := auditSettlement.NewCalculator( @@ -413,6 +413,7 @@ func New(ctx context.Context, log *zap.Logger, cfg *viper.Viper) (*Server, error SGStorage: auditCalcDeps, AccountStorage: auditCalcDeps, Exchanger: auditCalcDeps, + AuditFeeFetcher: auditCalcDeps, }, auditSettlement.WithLogger(server.log), ) diff --git a/pkg/innerring/settlement.go b/pkg/innerring/settlement.go index 4a27312ef..b60337878 100644 --- a/pkg/innerring/settlement.go +++ b/pkg/innerring/settlement.go @@ -28,6 +28,7 @@ import ( type globalConfig interface { BasicIncomeRate() (uint64, error) + AuditFee() (uint64, error) } type settlementDeps struct { @@ -42,6 +43,8 @@ type settlementDeps struct { clientCache *ClientCache balanceClient *balanceClient.Wrapper + + cfg globalConfig } type auditSettlementDeps struct { @@ -51,7 +54,6 @@ type auditSettlementDeps struct { type basicIncomeSettlementDeps struct { *settlementDeps cnrClient *containerClient.Wrapper - cfg globalConfig } type basicSettlementConstructor struct { @@ -227,6 +229,10 @@ func (a auditSettlementDeps) Transfer(sender, recipient *owner.ID, amount *big.I a.transfer(sender, recipient, amount, transferAuditDetails) } +func (a auditSettlementDeps) AuditFee() (uint64, error) { + return a.cfg.AuditFee() +} + func (b basicIncomeSettlementDeps) Transfer(sender, recipient *owner.ID, amount *big.Int) { b.transfer(sender, recipient, amount, basicIncomeAuditDetails) }