Skip to content

Commit

Permalink
eth: update contract bindings
Browse files Browse the repository at this point in the history
- Introduces LivepeerETHTicketBroker
- Code cleanup: Remove job related code
  • Loading branch information
yondonfu committed Dec 27, 2018
1 parent 2afa993 commit 26435c2
Show file tree
Hide file tree
Showing 33 changed files with 3,032 additions and 5,906 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -18,3 +18,4 @@ eth/protocol

# Our compiled binary
livepeer
livepeer_cli
11 changes: 0 additions & 11 deletions cmd/livepeer/livepeer.go
Expand Up @@ -542,17 +542,6 @@ func setupOrchestrator(ctx context.Context, n *core.LivepeerNode, em eth.EventMo
rs := eventservices.NewRewardService(n.Eth)
n.EthServices["RewardService"] = rs

// Create job service to listen for new jobs and transcode if assigned to the job
js := eventservices.NewJobService(n)
n.EthServices["JobService"] = js

// Restart jobs as necessary
err = js.RestartTranscoder()
if err != nil {
glog.Errorf("Unable to restart orchestrator: %v", err)
// non-fatal, so continue
}

return nil
}

Expand Down
3 changes: 0 additions & 3 deletions cmd/livepeer_cli/livepeer_cli.go
Expand Up @@ -83,7 +83,6 @@ func (w *wizard) initializeOptions() []wizardOpt {
{desc: "Get node status", invoke: func() { w.stats(w.orchestrator) }},
{desc: "View protocol parameters", invoke: w.protocolStats},
{desc: "List registered orchestrators", invoke: func() { w.registeredOrchestratorStats() }},
{desc: "Print latest jobs", invoke: w.printLast5Jobs},
{desc: "Invoke \"initialize round\"", invoke: w.initializeRound},
{desc: "Invoke \"bond\"", invoke: w.bond},
{desc: "Invoke \"unbond\"", invoke: w.unbond},
Expand All @@ -95,8 +94,6 @@ func (w *wizard) initializeOptions() []wizardOpt {
{desc: "Invoke \"reward\"", invoke: w.callReward, orchestrator: true},
{desc: "Invoke multi-step \"become an orchestrator\"", invoke: w.activateOrchestrator, orchestrator: true},
{desc: "Set orchestrator config", invoke: w.setOrchestratorConfig, orchestrator: true},
{desc: "Invoke \"deposit\" (ETH)", invoke: w.deposit, notOrchestrator: true},
{desc: "Invoke \"withdraw deposit\" (ETH)", invoke: w.withdraw, notOrchestrator: true},
{desc: "Set broadcast config", invoke: w.setBroadcastConfig, notOrchestrator: true},
{desc: "Set Eth gas price", invoke: w.setGasPrice},
{desc: "Get test LPT", invoke: w.requestTokens, testnet: true},
Expand Down
21 changes: 0 additions & 21 deletions cmd/livepeer_cli/wizard_deposit.go
Expand Up @@ -3,7 +3,6 @@ package main
import (
"fmt"
"math/big"
"net/url"

"github.com/livepeer/go-livepeer/eth"
)
Expand All @@ -16,23 +15,3 @@ func str2eth(v string) string {
}
return eth.FormatUnits(i, "ETH")
}

func (w *wizard) deposit() {
fmt.Printf("Current deposit: %v\n", str2eth(w.getDeposit()))
fmt.Printf("Current balance: %v\n", str2eth(w.getEthBalance()))
fmt.Printf("Enter Deposit Amount in Wei - ")
amount := w.readBigInt()

val := url.Values{
"amount": {fmt.Sprintf("%v", amount.String())},
}

httpPostWithParams(fmt.Sprintf("http://%v:%v/deposit", w.host, w.httpPort), val)
}

func (w *wizard) withdraw() {
// We don't run str2eth here to facilitate copy-pasting
fmt.Printf("Current deposit in Wei: %v\n", w.getDeposit())

httpPost(fmt.Sprintf("http://%v:%v/withdrawDeposit", w.host, w.httpPort))
}
13 changes: 0 additions & 13 deletions cmd/livepeer_cli/wizard_jobs.go

This file was deleted.

18 changes: 0 additions & 18 deletions cmd/livepeer_cli/wizard_stats.go
Expand Up @@ -93,17 +93,9 @@ func (w *wizard) protocolStats() {
[]string{"RoundLength (Blocks)", params.RoundLength.String()},
[]string{"RoundLockAmount (%)", eth.FormatPerc(params.RoundLockAmount)},
[]string{"UnbondingPeriod (Rounds)", strconv.Itoa(int(params.UnbondingPeriod))},
[]string{"VerificationRate (1 / # of segments)", strconv.Itoa(int(params.VerificationRate))},
[]string{"VerificationPeriod (Blocks)", params.VerificationPeriod.String()},
[]string{"SlashingPeriod (Blocks)", params.SlashingPeriod.String()},
[]string{"FailedVerificationSlashAmount (%)", eth.FormatPerc(params.FailedVerificationSlashAmount)},
[]string{"MissedVerificationSlashAmount (%)", eth.FormatPerc(params.MissedVerificationSlashAmount)},
[]string{"DoubleClaimSegmentSlashAmount (%)", eth.FormatPerc(params.DoubleClaimSegmentSlashAmount)},
[]string{"FinderFee (%)", eth.FormatPerc(params.FinderFee)},
[]string{"Inflation (%)", eth.FormatPerc(params.Inflation)},
[]string{"InflationChange (%)", eth.FormatPerc(params.InflationChange)},
[]string{"TargetBondingRate (%)", eth.FormatPerc(params.TargetBondingRate)},
[]string{"VerificationCodeHash", params.VerificationCodeHash},
[]string{"Total Bonded", eth.FormatUnits(params.TotalBonded, "LPT")},
[]string{"Total Supply", eth.FormatUnits(params.TotalSupply, "LPT")},
[]string{"Current Participation Rate (%)", currentParticipationRate.String()},
Expand All @@ -129,7 +121,6 @@ func (w *wizard) broadcastStats() {

table := tablewriter.NewWriter(os.Stdout)
data := [][]string{
[]string{"Deposit", w.getDeposit()},
[]string{"Broadcast Price Per Segment in Wei", price.String()},
[]string{"Broadcast Transcoding Options", transcodingOptions},
}
Expand Down Expand Up @@ -197,7 +188,6 @@ func (w *wizard) orchestratorEventSubscriptions() {
data := [][]string{
[]string{"Watching for new rounds to initialize", strconv.FormatBool(subMap["RoundService"])},
[]string{"Watching for initialized rounds to call reward", strconv.FormatBool(subMap["RewardService"])},
[]string{"Watching for new jobs", strconv.FormatBool(subMap["JobService"])},
}

for _, v := range data {
Expand Down Expand Up @@ -325,14 +315,6 @@ func (w *wizard) getEthBalance() string {
return e
}

func (w *wizard) getDeposit() string {
e := httpGet(fmt.Sprintf("http://%v:%v/broadcasterDeposit", w.host, w.httpPort))
if e == "" {
e = "Unknown"
}
return e
}

func (w *wizard) getBroadcastConfig() (*big.Int, string) {
resp, err := http.Get(fmt.Sprintf("http://%v:%v/getBroadcastConfig", w.host, w.httpPort))
if err != nil {
Expand Down

0 comments on commit 26435c2

Please sign in to comment.