forked from TrueCloudLab/frostfs-node
[#486] innerring: Add fee configuration
When notary disabled, inner ring should be able to configure extra fee for vote collections inside the contracts. Previously these values were hardcoded, however we might want to change them depending on a environment. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
c4f4381b13
commit
1f3bb33db8
2 changed files with 31 additions and 0 deletions
|
@ -117,4 +117,8 @@ func defaultConfiguration(cfg *viper.Viper) {
|
||||||
cfg.SetDefault("indexer.cache_timeout", 15*time.Second)
|
cfg.SetDefault("indexer.cache_timeout", 15*time.Second)
|
||||||
|
|
||||||
cfg.SetDefault("locode.db.path", "")
|
cfg.SetDefault("locode.db.path", "")
|
||||||
|
|
||||||
|
// extra fee values for working mode without notary contract
|
||||||
|
cfg.SetDefault("fee.main_chain", 5000_0000) // 0.5 Fixed8
|
||||||
|
cfg.SetDefault("fee.side_chain", 2_0000_0000) // 2.0 Fixed8
|
||||||
}
|
}
|
||||||
|
|
27
pkg/innerring/config/fee.go
Normal file
27
pkg/innerring/config/fee.go
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
package config
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FeeConfig is an instance that returns extra fee values for contract
|
||||||
|
// invocations without notary support.
|
||||||
|
type FeeConfig struct {
|
||||||
|
mainchain, sidechain fixedn.Fixed8
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewFeeConfig(v *viper.Viper) *FeeConfig {
|
||||||
|
return &FeeConfig{
|
||||||
|
mainchain: fixedn.Fixed8(v.GetInt64("fee.main_chain")),
|
||||||
|
sidechain: fixedn.Fixed8(v.GetInt64("fee.side_chain")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f FeeConfig) MainChainFee() fixedn.Fixed8 {
|
||||||
|
return f.mainchain
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f FeeConfig) SideChainFee() fixedn.Fixed8 {
|
||||||
|
return f.sidechain
|
||||||
|
}
|
Loading…
Reference in a new issue