mirror of
https://codeberg.org/pluja/kycnot.me
synced 2025-01-05 20:30:52 -05:00
Add distinction between p2p networks and trading
This commit is contained in:
parent
cc79ae3362
commit
7994519e06
@ -2,5 +2,6 @@ package database
|
||||
|
||||
const (
|
||||
AttributeOpenSource = "l0p2hlenm8cm7jp"
|
||||
AttributeP2P = "5bcqjb2xzbel9g9"
|
||||
AttributeP2PNetwork = "lpkke4dygq0yoly"
|
||||
AttributeP2PTrading = "5bcqjb2xzbel9g9"
|
||||
)
|
||||
|
@ -19,7 +19,7 @@ func ComputeScore(s *database.Service) (int, string) {
|
||||
grade = 8
|
||||
summary += fmt.Sprintf("\n%-*s--> base score for KYC Level %d", 10, fmt.Sprintf("|| %v", grade), s.KycLevel)
|
||||
case 1:
|
||||
grade = 7
|
||||
grade = 6.5
|
||||
summary += fmt.Sprintf("\n%-*s--> base score for KYC Level %d", 10, fmt.Sprintf("|| %v", grade), s.KycLevel)
|
||||
case 2:
|
||||
grade = 6
|
||||
@ -36,10 +36,10 @@ func ComputeScore(s *database.Service) (int, string) {
|
||||
grade += 0.1
|
||||
summary += fmt.Sprintf("\n%-*s--> good attribute.", 10, "|| +0.1")
|
||||
case "warn":
|
||||
grade -= 0.25
|
||||
grade -= 0.3
|
||||
summary += fmt.Sprintf("\n%-*s--> warn attribute.", 10, "|| -0.25")
|
||||
case "bad":
|
||||
grade -= 0.65
|
||||
grade -= 0.7
|
||||
summary += fmt.Sprintf("\n%-*s--> bad attribute.", 10, "|| -0.65")
|
||||
}
|
||||
}
|
||||
@ -58,8 +58,9 @@ func ComputeScore(s *database.Service) (int, string) {
|
||||
}
|
||||
}
|
||||
|
||||
if trPenalty > 3 {
|
||||
trPenalty = 3
|
||||
// Tos reviews penalty can't be over 3 points
|
||||
if trPenalty < -3 {
|
||||
trPenalty = -3
|
||||
}
|
||||
|
||||
grade += float64(trPenalty)
|
||||
@ -80,11 +81,15 @@ func ComputeScore(s *database.Service) (int, string) {
|
||||
|
||||
// TODO: Manage bonuses
|
||||
// P2P/OpenSource Bonus
|
||||
isP2P := false
|
||||
isP2PNetwork := false
|
||||
isP2PTrading := false
|
||||
isOpenSource := false
|
||||
for _, attr := range s.Attributes {
|
||||
if attr == database.AttributeP2P {
|
||||
isP2P = true
|
||||
if attr == database.AttributeP2PNetwork {
|
||||
isP2PNetwork = true
|
||||
}
|
||||
if attr == database.AttributeP2PTrading {
|
||||
isP2PTrading = true
|
||||
}
|
||||
if attr == database.AttributeOpenSource {
|
||||
isOpenSource = true
|
||||
@ -97,6 +102,7 @@ func ComputeScore(s *database.Service) (int, string) {
|
||||
summary += fmt.Sprintf("\n%-*s--> has Onion links.", 10, "|| +0.5")
|
||||
}
|
||||
|
||||
// Verified services get a bonus only if score is < 7.5
|
||||
if s.Verified {
|
||||
if grade < 7.5 {
|
||||
grade += 0.5
|
||||
@ -104,16 +110,19 @@ func ComputeScore(s *database.Service) (int, string) {
|
||||
}
|
||||
}
|
||||
|
||||
if !isP2P && grade > 9.5 {
|
||||
grade = 9
|
||||
summary += fmt.Sprintf("\n%-*s--> Not P2P, score can't be 10.", 10, "|| ----")
|
||||
}
|
||||
|
||||
if isP2P {
|
||||
// P2P networks or trading have a bonus
|
||||
if isP2PNetwork || isP2PTrading {
|
||||
grade += 0.5
|
||||
summary += fmt.Sprintf("\n%-*s--> P2P bonus.", 10, "|| +0.5")
|
||||
summary += fmt.Sprintf("\n%-*s--> P2P network bonus.", 10, "|| +0.5")
|
||||
}
|
||||
|
||||
// Only P2P Networks can have a 10/10
|
||||
if !isP2PNetwork && grade > 9.5 {
|
||||
grade = 9
|
||||
summary += fmt.Sprintf("\n%-*s--> Not P2P network, score can't be 10.", 10, "|| ----")
|
||||
}
|
||||
|
||||
// Open source services have a bonus if score is < 7.5
|
||||
if isOpenSource && grade < 7.5 {
|
||||
grade += 0.25
|
||||
summary += fmt.Sprintf("\n%-*s--> Open Source bonus (if < 7.5).", 10, "|| +0.25")
|
||||
|
Loading…
Reference in New Issue
Block a user