Skip to content

Commit

Permalink
cmd: Use different hardcoded redeemGas when connected to an Arbitrum …
Browse files Browse the repository at this point in the history
…network
  • Loading branch information
leszko committed Feb 10, 2022
1 parent cddc3ff commit ec2280d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions cmd/livepeer/livepeer.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ var (
// The maximum blocks for the block watcher to retain
blockWatcherRetentionLimit = 20

// Estimate of the gas required to redeem a PM ticket
redeemGas = 350000
// Estimate of the gas required to redeem a PM ticket on L1 Ethereum
redeemGasL1 = 350000
// Estimate of the gas required to redeem a PM ticket on L2 Arbitrum
redeemGasL2 = 1200000
// The multiplier on the transaction cost to use for PM ticket faceValue
txCostMultiplier = 100

Expand Down Expand Up @@ -210,20 +212,24 @@ func main() {
type NetworkConfig struct {
ethController string
minGasPrice int64
redeemGas int
}

ctx := context.Background()

configOptions := map[string]*NetworkConfig{
"rinkeby": {
ethController: "0x9a9827455911a858E55f07911904fACC0D66027E",
redeemGas: redeemGasL1,
},
"arbitrum-one-rinkeby": {
ethController: "0x9ceC649179e2C7Ab91688271bcD09fb707b3E574",
redeemGas: redeemGasL2,
},
"mainnet": {
ethController: "0xf96d54e490317c557a967abfa5d6e33006be69b3",
minGasPrice: int64(params.GWei),
redeemGas: redeemGasL1,
},
}

Expand All @@ -246,6 +252,7 @@ func main() {
}

// Setting config options based on specified network
var redeemGas int
if netw, ok := configOptions[*network]; ok {
if *ethController == "" {
*ethController = netw.ethController
Expand All @@ -255,8 +262,11 @@ func main() {
*minGasPrice = netw.minGasPrice
}

redeemGas = netw.redeemGas

glog.Infof("***Livepeer is running on the %v network: %v***", *network, *ethController)
} else {
redeemGas = redeemGasL1
glog.Infof("***Livepeer is running on the %v network***", *network)
}

Expand Down

0 comments on commit ec2280d

Please sign in to comment.