forked from TrueCloudLab/frostfs-node
Initial commit
Initial public review release v0.10.0
This commit is contained in:
commit
dadfd90dcd
276 changed files with 46331 additions and 0 deletions
59
modules/morph/reputation.go
Normal file
59
modules/morph/reputation.go
Normal file
|
@ -0,0 +1,59 @@
|
|||
package morph
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-node/lib/implementations"
|
||||
"github.com/nspcc-dev/neofs-node/lib/peers"
|
||||
"github.com/pkg/errors"
|
||||
"go.uber.org/dig"
|
||||
)
|
||||
|
||||
type reputationContractResult struct {
|
||||
dig.Out
|
||||
|
||||
ReputationContract implementations.MorphReputationContract
|
||||
}
|
||||
|
||||
const (
|
||||
reputationContractName = "reputation"
|
||||
|
||||
reputationContractPutOpt = "put_method"
|
||||
|
||||
reputationContractListOpt = "list_method"
|
||||
)
|
||||
|
||||
// ReputationContractPutOptPath returns the config path to put method of Reputation contract.
|
||||
func ReputationContractPutOptPath() string {
|
||||
return optPath(prefix, reputationContractName, reputationContractPutOpt)
|
||||
}
|
||||
|
||||
// ReputationContractListOptPath returns the config path to list method of Reputation contract.
|
||||
func ReputationContractListOptPath() string {
|
||||
return optPath(prefix, reputationContractName, reputationContractListOpt)
|
||||
}
|
||||
|
||||
func newReputationContract(p contractParams, ps peers.Store) (res reputationContractResult, err error) {
|
||||
cli, ok := p.MorphContracts[reputationContractName]
|
||||
if !ok {
|
||||
err = errors.Errorf("missing %s contract client", reputationContractName)
|
||||
return
|
||||
}
|
||||
|
||||
morphClient := implementations.MorphReputationContract{}
|
||||
morphClient.SetReputationContractClient(cli)
|
||||
morphClient.SetPublicKeyStore(ps)
|
||||
|
||||
morphClient.SetPutMethodName(
|
||||
p.Viper.GetString(
|
||||
ReputationContractPutOptPath(),
|
||||
),
|
||||
)
|
||||
morphClient.SetListMethodName(
|
||||
p.Viper.GetString(
|
||||
ReputationContractListOptPath(),
|
||||
),
|
||||
)
|
||||
|
||||
res.ReputationContract = morphClient
|
||||
|
||||
return
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue