Skip to content

Commit

Permalink
cmd: use fee cut instead of fee share in the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
kyriediculous committed Apr 20, 2021
1 parent 3908252 commit ec9844d
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#### General

- \#1848 Use fee cut instead of fee share for user facing language in the CLI (@kyriediculous)

#### Broadcaster

#### Orchestrator
Expand Down
5 changes: 2 additions & 3 deletions cmd/livepeer_cli/wizard_bond.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,15 @@ func (w *wizard) registeredOrchestratorStats() map[int]common.Address {
fmt.Println("+------------------------+")

table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"ID", "Address", "Active", "Delegated Stake", "Reward Cut (%)", "Fee Share (%)", "Service URI", "Price Per Pixel"})

table.SetHeader([]string{"ID", "Address", "Active", "Delegated Stake", "Reward Cut (%)", "Fee Cut (%)", "Service URI", "Price Per Pixel"})
for _, t := range orchestrators {
table.Append([]string{
strconv.FormatInt(int64(nextId), 10),
t.Address.Hex(),
strconv.FormatBool(t.Active),
eth.FormatUnits(t.DelegatedStake, "LPT"),
eth.FormatPerc(t.RewardCut),
eth.FormatPerc(t.FeeShare),
feeShareToFeeCutString(t.FeeShare),
t.ServiceURI,
t.PricePerPixel.FloatString(3),
})
Expand Down
2 changes: 1 addition & 1 deletion cmd/livepeer_cli/wizard_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (w *wizard) orchestratorStats() {
{"Service URI", t.ServiceURI},
{"Delegated Stake", eth.FormatUnits(t.DelegatedStake, "LPT")},
{"Reward Cut (%)", eth.FormatPerc(t.RewardCut)},
{"Fee Share (%)", eth.FormatPerc(t.FeeShare)},
{"Fee Cut (%)", feeShareToFeeCutString(t.FeeShare)},
{"Last Reward Round", t.LastRewardRound.String()},
{"Base price per pixel", fmt.Sprintf("%v wei / %v pixels", priceInfo.Num(), priceInfo.Denom())},
}
Expand Down
19 changes: 15 additions & 4 deletions cmd/livepeer_cli/wizard_transcoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ import (

const defaultRPCPort = "8935"

const defaultRewardCut = float64(10)
const defaultFeeCut = float64(95)

const HUNDRED_PERCENT = float64(100)

func (w *wizard) isOrchestrator() bool {
isT := httpGet(fmt.Sprintf("http://%v:%v/IsOrchestrator", w.host, w.httpPort))
return isT == "true"
Expand All @@ -41,19 +46,21 @@ func (w *wizard) promptOrchestratorConfig() (float64, float64, int, int, string)

orch, _, err := w.getOrchestratorInfo()
if err != nil || orch == nil {
fmt.Println("unable to get current reward cut and fee share")
fmt.Println("unable to get current reward cut and fee cut")
blockRewardCut = 0
feeShare = 0
} else {
blockRewardCut = eth.ToPerc(orch.RewardCut)
feeShare = eth.ToPerc(orch.FeeShare)
}

fmt.Printf("Enter block reward cut percentage (current=%v default=10) - ", blockRewardCut)
feeCut := HUNDRED_PERCENT - feeShare

fmt.Printf("Enter block reward cut percentage (current=%v default=%v) - ", blockRewardCut, defaultRewardCut)
blockRewardCut = w.readDefaultFloat(blockRewardCut)

fmt.Printf("Enter fee share percentage (current=%v default=5) - ", feeShare)
feeShare = w.readDefaultFloat(feeShare)
fmt.Printf("Enter fee cut percentage (current=%v default=%v) - ", feeCut, defaultFeeCut)
feeCut = w.readDefaultFloat(feeCut)

fmt.Println("Enter a transcoding base price in wei per pixels")
fmt.Println("eg. 1 wei / 10 pixels = 0,1 wei per pixel")
Expand Down Expand Up @@ -268,3 +275,7 @@ func (w *wizard) showVoteChoices() {
}
wtr.Flush()
}

func feeShareToFeeCutString(feeShare *big.Int) string {
return eth.FormatPerc(new(big.Int).Sub(eth.FromPerc(HUNDRED_PERCENT), feeShare))
}

0 comments on commit ec9844d

Please sign in to comment.