Documentation
¶
Overview ¶
Package eth client is the go client for the Livepeer Ethereum smart contract. Contracts here are generated.
Index ¶
- Constants
- Variables
- func FormatPerc(value *big.Int) string
- func FormatPercMinter(value *big.Int) string
- func FormatUnits(baseAmount *big.Int, name string) string
- func FromBaseAmount(v *big.Int, maxDecimals int) string
- func FromPerc(perc float64) *big.Int
- func FromPercOfUint256(perc float64) *big.Int
- func FromWei(amount *big.Int, to int) string
- func IsNullAddress(addr ethcommon.Address) bool
- func ToBaseAmount(v string, maxDecimals int) (*big.Int, error)
- func ToPerc(value *big.Int) float64
- func ToWei(amount string, from int) (*big.Int, error)
- type AccountManager
- type Backend
- type GasPriceMonitor
- func (gpm *GasPriceMonitor) GasPrice() *big.Int
- func (gpm *GasPriceMonitor) MaxGasPrice() *big.Int
- func (gpm *GasPriceMonitor) MinGasPrice() *big.Int
- func (gpm *GasPriceMonitor) SetMaxGasPrice(gp *big.Int)
- func (gpm *GasPriceMonitor) SetMinGasPrice(minGasPrice *big.Int)
- func (gpm *GasPriceMonitor) Start(ctx context.Context) (chan struct{}, error)
- func (gpm *GasPriceMonitor) Stop() error
- type GasPriceOracle
- type LivepeerEthClient
- type LivepeerEthClientConfig
- type MockClient
- func (m *MockClient) Account() accounts.Account
- func (m *MockClient) CancelUnlock() (*types.Transaction, error)
- func (m *MockClient) CheckTx(tx *types.Transaction) error
- func (m *MockClient) CurrentRound() (*big.Int, error)
- func (m *MockClient) CurrentRoundInitialized() (bool, error)
- func (m *MockClient) CurrentRoundLocked() (bool, error)
- func (m *MockClient) CurrentRoundStartBlock() (*big.Int, error)
- func (m *MockClient) FundDeposit(amount *big.Int) (*types.Transaction, error)
- func (m *MockClient) FundDepositAndReserve(depositAmount, reserveAmount *big.Int) (*types.Transaction, error)
- func (m *MockClient) GetDelegator(addr common.Address) (*lpTypes.Delegator, error)
- func (m *MockClient) GetSenderInfo(addr common.Address) (*pm.SenderInfo, error)
- func (m *MockClient) GetServiceURI(addr common.Address) (string, error)
- func (m *MockClient) GetTranscoder(addr common.Address) (*lpTypes.Transcoder, error)
- func (m *MockClient) GetTranscoderEarningsPoolForRound(address common.Address, round *big.Int) (*lpTypes.TokenPools, error)
- func (m *MockClient) GetTranscoderPoolMaxSize() (*big.Int, error)
- func (m *MockClient) InitializeRound() (*types.Transaction, error)
- func (m *MockClient) IsActiveTranscoder() (bool, error)
- func (m *MockClient) L1WithdrawFees() (*types.Transaction, error)
- func (m *MockClient) ReplaceTransaction(tx *types.Transaction, method string, gasPrice *big.Int) (*types.Transaction, error)
- func (m *MockClient) Reward() (*types.Transaction, error)
- func (m *MockClient) RoundLength() (*big.Int, error)
- func (m *MockClient) Senders(addr common.Address) (sender struct{ ... }, err error)
- func (m *MockClient) TranscoderPool() ([]*lpTypes.Transcoder, error)
- func (m *MockClient) Unlock() (*types.Transaction, error)
- func (m *MockClient) UnlockPeriod() (*big.Int, error)
- func (m *MockClient) Vote(pollAddr ethcommon.Address, choiceID *big.Int) (*types.Transaction, error)
- func (m *MockClient) Withdraw() (*types.Transaction, error)
- func (m *MockClient) WithdrawFees(addr ethcommon.Address, amount *big.Int) (*types.Transaction, error)
- type NonceManager
- type PriceData
- type PriceFeedEthClient
- type RemoteNonceReader
- type RewardService
- type RoundInitializer
- type StubClient
- func (e *StubClient) Account() accounts.Account
- func (e *StubClient) Backend() Backend
- func (e *StubClient) BalanceOf(addr common.Address) (*big.Int, error)
- func (e *StubClient) BlockHashForRound(round *big.Int) ([32]byte, error)
- func (e *StubClient) Bond(amount *big.Int, toAddr common.Address) (*types.Transaction, error)
- func (e *StubClient) CancelUnlock() (*types.Transaction, error)
- func (c *StubClient) CheckTx(tx *types.Transaction) error
- func (e *StubClient) ClaimEarnings(endRound *big.Int) (*types.Transaction, error)
- func (e *StubClient) ClaimableReserve(reserveHolder, claimant ethcommon.Address) (*big.Int, error)
- func (e *StubClient) ClaimedReserve(sender ethcommon.Address, claimant ethcommon.Address) (*big.Int, error)
- func (c *StubClient) ContractAddresses() map[string]common.Address
- func (e *StubClient) CurrentRound() (*big.Int, error)
- func (e *StubClient) CurrentRoundInitialized() (bool, error)
- func (e *StubClient) CurrentRoundLocked() (bool, error)
- func (e *StubClient) CurrentRoundStartBlock() (*big.Int, error)
- func (e *StubClient) FundDeposit(amount *big.Int) (*types.Transaction, error)
- func (e *StubClient) FundDepositAndReserve(depositAmount, reserveAmount *big.Int) (*types.Transaction, error)
- func (e *StubClient) FundReserve(amount *big.Int) (*types.Transaction, error)
- func (e *StubClient) GetDelegator(addr common.Address) (*lpTypes.Delegator, error)
- func (e *StubClient) GetDelegatorUnbondingLock(addr common.Address, unbondingLockId *big.Int) (*lpTypes.UnbondingLock, error)
- func (c *StubClient) GetGlobalTotalSupply() (*big.Int, error)
- func (e *StubClient) GetSenderInfo(addr ethcommon.Address) (*pm.SenderInfo, error)
- func (e *StubClient) GetServiceURI(addr common.Address) (string, error)
- func (e *StubClient) GetTotalBonded() (*big.Int, error)
- func (e *StubClient) GetTranscoder(addr common.Address) (*lpTypes.Transcoder, error)
- func (e *StubClient) GetTranscoderEarningsPoolForRound(addr common.Address, round *big.Int) (*lpTypes.TokenPools, error)
- func (c *StubClient) GetTranscoderPoolMaxSize() (*big.Int, error)
- func (e *StubClient) GetTranscoderPoolSize() (*big.Int, error)
- func (c *StubClient) Inflation() (*big.Int, error)
- func (c *StubClient) InflationChange() (*big.Int, error)
- func (e *StubClient) InitializeRound() (*types.Transaction, error)
- func (e *StubClient) IsActiveTranscoder() (bool, error)
- func (e *StubClient) IsUsedTicket(ticket *pm.Ticket) (bool, error)
- func (e *StubClient) L1WithdrawFees() (*types.Transaction, error)
- func (e *StubClient) LastInitializedRound() (*big.Int, error)
- func (c *StubClient) NextValidRequest(common.Address) (*big.Int, error)
- func (e *StubClient) Paused() (bool, error)
- func (e *StubClient) Rebond(*big.Int) (*types.Transaction, error)
- func (e *StubClient) RebondFromUnbonded(common.Address, *big.Int) (*types.Transaction, error)
- func (e *StubClient) RedeemWinningTicket(ticket *pm.Ticket, sig []byte, recipientRand *big.Int) (*types.Transaction, error)
- func (c *StubClient) ReplaceTransaction(tx *types.Transaction, method string, gasPrice *big.Int) (*types.Transaction, error)
- func (e *StubClient) Request() (*types.Transaction, error)
- func (e *StubClient) Reward() (*types.Transaction, error)
- func (c *StubClient) RoundLength() (*big.Int, error)
- func (c *StubClient) RoundLockAmount() (*big.Int, error)
- func (e *StubClient) Senders(addr ethcommon.Address) (sender struct{ ... }, err error)
- func (c *StubClient) SetGasInfo(uint64) error
- func (c *StubClient) SetMaxGasPrice(*big.Int) error
- func (e *StubClient) SetServiceURI(serviceURI string) (*types.Transaction, error)
- func (e *StubClient) Setup(password string, gasLimit uint64, gasPrice *big.Int) error
- func (c *StubClient) Sign(msg []byte) ([]byte, error)
- func (c *StubClient) SignTypedData(typedData apitypes.TypedData) ([]byte, error)
- func (c *StubClient) TargetBondingRate() (*big.Int, error)
- func (e *StubClient) TotalSupply() (*big.Int, error)
- func (e *StubClient) Transcoder(blockRewardCut, feeShare *big.Int) (*types.Transaction, error)
- func (e *StubClient) TranscoderPool() ([]*lpTypes.Transcoder, error)
- func (e *StubClient) Transfer(toAddr common.Address, amount *big.Int) (*types.Transaction, error)
- func (e *StubClient) Unbond(*big.Int) (*types.Transaction, error)
- func (c *StubClient) UnbondingPeriod() (uint64, error)
- func (e *StubClient) Unlock() (*types.Transaction, error)
- func (e *StubClient) UnlockPeriod() (*big.Int, error)
- func (c *StubClient) Vote(pollAddr ethcommon.Address, choiceID *big.Int) (*types.Transaction, error)
- func (e *StubClient) Withdraw() (*types.Transaction, error)
- func (e *StubClient) WithdrawFees(addr ethcommon.Address, amount *big.Int) (*types.Transaction, error)
- func (e *StubClient) WithdrawStake(*big.Int) (*types.Transaction, error)
- type TransactionManager
Constants ¶
const DefaultMaxDecimals = 18
Variables ¶
var ( ErrAccountNotFound = fmt.Errorf("ETH account not found") ErrLocked = fmt.Errorf("account locked") ErrPassphraseMismatch = fmt.Errorf("passphrases do not match") )
var ( ErrReplacingMinedTx = fmt.Errorf("trying to replace already mined tx") ErrCurrentRoundLocked = fmt.Errorf("current round locked") ErrMissingBackend = fmt.Errorf("missing Ethereum client backend") )
var ( ErrRewardServiceStarted = fmt.Errorf("reward service already started") ErrRewardServiceStopped = fmt.Errorf("reward service already stopped") )
var (
BlocksUntilFirstClaimDeadline = big.NewInt(200)
)
Functions ¶
func FormatPerc ¶ added in v0.3.3
func FormatPercMinter ¶ added in v0.5.11
func FromPercOfUint256 ¶ added in v0.5.0
func FromWei ¶ added in v0.5.15
FromWei converts a wei amount to another denomination e.g. FromWei(1e18, params.Ether) = 1
func IsNullAddress ¶
Types ¶
type AccountManager ¶ added in v0.3.3
type AccountManager interface {
Unlock(passphrase string) error
Lock() error
CreateTransactOpts(gasLimit uint64) (*bind.TransactOpts, error)
SignTx(tx *types.Transaction) (*types.Transaction, error)
Sign(msg []byte) ([]byte, error)
SignTypedData(typedData apitypes.TypedData) ([]byte, error)
Account() accounts.Account
}
func NewAccountManager ¶ added in v0.3.3
type Backend ¶ added in v0.5.0
type Backend interface {
ethereum.ChainStateReader
ethereum.TransactionReader
ethereum.TransactionSender
ethereum.ContractCaller
ethereum.PendingContractCaller
ethereum.PendingStateReader
ethereum.GasEstimator
ethereum.GasPricer
ethereum.LogFilterer
ethereum.ChainReader
ChainID(ctx context.Context) (*big.Int, error)
GasPriceMonitor() *GasPriceMonitor
SuggestGasTipCap(context.Context) (*big.Int, error)
}
func NewBackend ¶ added in v0.5.0
func NewBackend(client *ethclient.Client, signer types.Signer, gpm *GasPriceMonitor, tm *TransactionManager) Backend
type GasPriceMonitor ¶ added in v0.5.0
type GasPriceMonitor struct {
// contains filtered or unexported fields
}
GasPriceMonitor polls for gas price updates and updates its own view of the current gas price that can be used by others
func NewGasPriceMonitor ¶ added in v0.5.0
func NewGasPriceMonitor(gpo GasPriceOracle, pollingInterval time.Duration, minGasPrice *big.Int, maxGasPrice *big.Int) *GasPriceMonitor
NewGasPriceMonitor returns a GasPriceMonitor
func (*GasPriceMonitor) GasPrice ¶ added in v0.5.0
func (gpm *GasPriceMonitor) GasPrice() *big.Int
GasPrice returns the current gas price
func (*GasPriceMonitor) MaxGasPrice ¶ added in v0.5.19
func (gpm *GasPriceMonitor) MaxGasPrice() *big.Int
func (*GasPriceMonitor) MinGasPrice ¶ added in v0.5.19
func (gpm *GasPriceMonitor) MinGasPrice() *big.Int
func (*GasPriceMonitor) SetMaxGasPrice ¶ added in v0.5.19
func (gpm *GasPriceMonitor) SetMaxGasPrice(gp *big.Int)
func (*GasPriceMonitor) SetMinGasPrice ¶ added in v0.5.19
func (gpm *GasPriceMonitor) SetMinGasPrice(minGasPrice *big.Int)
func (*GasPriceMonitor) Start ¶ added in v0.5.0
func (gpm *GasPriceMonitor) Start(ctx context.Context) (chan struct{}, error)
Start starts polling for gas price updates and returns a channel to receive notifications of gas price changes
func (*GasPriceMonitor) Stop ¶ added in v0.5.0
func (gpm *GasPriceMonitor) Stop() error
Stop stops polling for gas price updates
type GasPriceOracle ¶ added in v0.5.0
GasPriceOracle defines methods for fetching a suggested gas price for submitting transactions
type LivepeerEthClient ¶
type LivepeerEthClient interface {
Account() accounts.Account
Backend() Backend
// Rounds
InitializeRound() (*types.Transaction, error)
CurrentRound() (*big.Int, error)
LastInitializedRound() (*big.Int, error)
BlockHashForRound(round *big.Int) ([32]byte, error)
CurrentRoundInitialized() (bool, error)
CurrentRoundLocked() (bool, error)
CurrentRoundStartBlock() (*big.Int, error)
// Token
Transfer(toAddr ethcommon.Address, amount *big.Int) (*types.Transaction, error)
Request() (*types.Transaction, error)
NextValidRequest(addr ethcommon.Address) (*big.Int, error)
BalanceOf(ethcommon.Address) (*big.Int, error)
TotalSupply() (*big.Int, error)
// Service Registry
SetServiceURI(serviceURI string) (*types.Transaction, error)
GetServiceURI(addr ethcommon.Address) (string, error)
// Staking
Transcoder(blockRewardCut, feeShare *big.Int) (*types.Transaction, error)
Reward() (*types.Transaction, error)
Bond(amount *big.Int, toAddr ethcommon.Address) (*types.Transaction, error)
Rebond(unbondingLockID *big.Int) (*types.Transaction, error)
RebondFromUnbonded(toAddr ethcommon.Address, unbondingLockID *big.Int) (*types.Transaction, error)
Unbond(amount *big.Int) (*types.Transaction, error)
WithdrawStake(unbondingLockID *big.Int) (*types.Transaction, error)
WithdrawFees(addr ethcommon.Address, amount *big.Int) (*types.Transaction, error)
// for L1 contracts backwards-compatibility
L1WithdrawFees() (*types.Transaction, error)
ClaimEarnings(endRound *big.Int) (*types.Transaction, error)
GetTranscoder(addr ethcommon.Address) (*lpTypes.Transcoder, error)
GetDelegator(addr ethcommon.Address) (*lpTypes.Delegator, error)
GetDelegatorUnbondingLock(addr ethcommon.Address, unbondingLockId *big.Int) (*lpTypes.UnbondingLock, error)
GetTranscoderEarningsPoolForRound(addr ethcommon.Address, round *big.Int) (*lpTypes.TokenPools, error)
TranscoderPool() ([]*lpTypes.Transcoder, error)
IsActiveTranscoder() (bool, error)
GetTotalBonded() (*big.Int, error)
GetTranscoderPoolSize() (*big.Int, error)
// TicketBroker
FundDepositAndReserve(depositAmount, penaltyEscrowAmount *big.Int) (*types.Transaction, error)
FundDeposit(amount *big.Int) (*types.Transaction, error)
FundReserve(amount *big.Int) (*types.Transaction, error)
Unlock() (*types.Transaction, error)
CancelUnlock() (*types.Transaction, error)
Withdraw() (*types.Transaction, error)
RedeemWinningTicket(ticket *pm.Ticket, sig []byte, recipientRand *big.Int) (*types.Transaction, error)
IsUsedTicket(ticket *pm.Ticket) (bool, error)
GetSenderInfo(addr ethcommon.Address) (*pm.SenderInfo, error)
UnlockPeriod() (*big.Int, error)
ClaimedReserve(reserveHolder ethcommon.Address, claimant ethcommon.Address) (*big.Int, error)
// Parameters
GetTranscoderPoolMaxSize() (*big.Int, error)
RoundLength() (*big.Int, error)
RoundLockAmount() (*big.Int, error)
UnbondingPeriod() (uint64, error)
Inflation() (*big.Int, error)
InflationChange() (*big.Int, error)
TargetBondingRate() (*big.Int, error)
GetGlobalTotalSupply() (*big.Int, error)
Paused() (bool, error)
// Governance
Vote(ethcommon.Address, *big.Int) (*types.Transaction, error)
// Helpers
ContractAddresses() map[string]ethcommon.Address
CheckTx(*types.Transaction) error
Sign([]byte) ([]byte, error)
SignTypedData(apitypes.TypedData) ([]byte, error)
SetGasInfo(uint64) error
SetMaxGasPrice(*big.Int) error
}
func NewClient ¶
func NewClient(cfg LivepeerEthClientConfig) (LivepeerEthClient, error)
type LivepeerEthClientConfig ¶ added in v0.5.19
type LivepeerEthClientConfig struct {
AccountManager AccountManager
GasPriceMonitor *GasPriceMonitor
EthClient *ethclient.Client
TransactionManager *TransactionManager
Signer types.Signer
ControllerAddr ethcommon.Address
CheckTxTimeout time.Duration
}
type MockClient ¶ added in v0.5.0
type MockClient struct {
mock.Mock
// Embed StubClient to call its methods with MockClient
// as the receiver so that MockClient implements the LivepeerETHClient
// interface
*StubClient
}
func (*MockClient) Account ¶ added in v0.5.0
func (m *MockClient) Account() accounts.Account
func (*MockClient) CancelUnlock ¶ added in v0.5.0
func (m *MockClient) CancelUnlock() (*types.Transaction, error)
func (*MockClient) CheckTx ¶ added in v0.5.0
func (m *MockClient) CheckTx(tx *types.Transaction) error
func (*MockClient) CurrentRound ¶ added in v0.5.0
func (m *MockClient) CurrentRound() (*big.Int, error)
CurrentRound returns the current round number
func (*MockClient) CurrentRoundInitialized ¶ added in v0.5.0
func (m *MockClient) CurrentRoundInitialized() (bool, error)
CurrentRoundInitialized returns whether the current round is initialized
func (*MockClient) CurrentRoundLocked ¶ added in v0.5.30
func (m *MockClient) CurrentRoundLocked() (bool, error)
CurrentRoundLocked returns whether the current round is locked
func (*MockClient) CurrentRoundStartBlock ¶ added in v0.5.0
func (m *MockClient) CurrentRoundStartBlock() (*big.Int, error)
CurrentRoundStartBlock returns the block number that the current round started in
func (*MockClient) FundDeposit ¶ added in v0.5.0
func (m *MockClient) FundDeposit(amount *big.Int) (*types.Transaction, error)
func (*MockClient) FundDepositAndReserve ¶ added in v0.5.0
func (m *MockClient) FundDepositAndReserve(depositAmount, reserveAmount *big.Int) (*types.Transaction, error)
func (*MockClient) GetDelegator ¶ added in v0.5.30
func (*MockClient) GetSenderInfo ¶ added in v0.5.0
func (m *MockClient) GetSenderInfo(addr common.Address) (*pm.SenderInfo, error)
func (*MockClient) GetServiceURI ¶ added in v0.5.30
func (m *MockClient) GetServiceURI(addr common.Address) (string, error)
func (*MockClient) GetTranscoder ¶ added in v0.5.13
func (m *MockClient) GetTranscoder(addr common.Address) (*lpTypes.Transcoder, error)
func (*MockClient) GetTranscoderEarningsPoolForRound ¶ added in v0.5.13
func (m *MockClient) GetTranscoderEarningsPoolForRound(address common.Address, round *big.Int) (*lpTypes.TokenPools, error)
func (*MockClient) GetTranscoderPoolMaxSize ¶ added in v0.5.0
func (m *MockClient) GetTranscoderPoolMaxSize() (*big.Int, error)
GetTranscoderPoolMaxSize returns the max size of the active set
func (*MockClient) InitializeRound ¶ added in v0.5.0
func (m *MockClient) InitializeRound() (*types.Transaction, error)
InitializeRound submits a round initialization transaction
func (*MockClient) IsActiveTranscoder ¶ added in v0.5.13
func (m *MockClient) IsActiveTranscoder() (bool, error)
func (*MockClient) L1WithdrawFees ¶ added in v0.5.26
func (m *MockClient) L1WithdrawFees() (*types.Transaction, error)
for L1 contracts backwards-compatibility
func (*MockClient) ReplaceTransaction ¶ added in v0.5.13
func (m *MockClient) ReplaceTransaction(tx *types.Transaction, method string, gasPrice *big.Int) (*types.Transaction, error)
func (*MockClient) Reward ¶ added in v0.5.13
func (m *MockClient) Reward() (*types.Transaction, error)
func (*MockClient) RoundLength ¶ added in v0.5.13
func (m *MockClient) RoundLength() (*big.Int, error)
func (*MockClient) TranscoderPool ¶ added in v0.5.1
func (m *MockClient) TranscoderPool() ([]*lpTypes.Transcoder, error)
TranscoderPool returns a list of registered transcoders
func (*MockClient) Unlock ¶ added in v0.5.0
func (m *MockClient) Unlock() (*types.Transaction, error)
func (*MockClient) UnlockPeriod ¶ added in v0.5.0
func (m *MockClient) UnlockPeriod() (*big.Int, error)
func (*MockClient) Vote ¶ added in v0.5.8
func (m *MockClient) Vote(pollAddr ethcommon.Address, choiceID *big.Int) (*types.Transaction, error)
func (*MockClient) Withdraw ¶ added in v0.5.0
func (m *MockClient) Withdraw() (*types.Transaction, error)
func (*MockClient) WithdrawFees ¶ added in v0.5.26
func (m *MockClient) WithdrawFees(addr ethcommon.Address, amount *big.Int) (*types.Transaction, error)
type NonceManager ¶ added in v0.5.0
type NonceManager struct {
// contains filtered or unexported fields
}
NonceManager manages transaction nonces for multiple ETH addresses
func NewNonceManager ¶ added in v0.5.0
func NewNonceManager(remoteReader RemoteNonceReader) *NonceManager
NewNonceManager creates an instance of a NonceManager
func (*NonceManager) Lock ¶ added in v0.5.0
func (m *NonceManager) Lock(addr ethcommon.Address)
Lock locks the provided address. The caller should always call Lock before calling Next or Update
func (*NonceManager) Next ¶ added in v0.5.0
func (m *NonceManager) Next(addr ethcommon.Address) (uint64, error)
Next returns the next transaction nonce to be used for the provided address
func (*NonceManager) Unlock ¶ added in v0.5.0
func (m *NonceManager) Unlock(addr ethcommon.Address)
Unlock unlocks the provided address. The caller should always call Unlock after finishing calls to Next or Update
type PriceFeedEthClient ¶ added in v0.7.3
type PriceFeedEthClient interface {
Description() (string, error)
FetchPriceData() (PriceData, error)
}
PriceFeedEthClient is an interface for fetching price data from a Chainlink PriceFeed contract.
func NewPriceFeedEthClient ¶ added in v0.7.3
func NewPriceFeedEthClient(ethClient *ethclient.Client, priceFeedAddr string) (PriceFeedEthClient, error)
type RemoteNonceReader ¶ added in v0.5.0
type RemoteNonceReader interface {
PendingNonceAt(ctx context.Context, addr ethcommon.Address) (uint64, error)
}
RemoteNonceReader is an interface that describes an object capable of reading transaction nonces for ETH address from a remote source
type RewardService ¶ added in v0.5.13
type RewardService struct {
// contains filtered or unexported fields
}
func NewRewardService ¶ added in v0.5.13
func NewRewardService(client LivepeerEthClient, tw timeWatcher) *RewardService
func (*RewardService) IsWorking ¶ added in v0.5.13
func (s *RewardService) IsWorking() bool
func (*RewardService) Start ¶ added in v0.5.13
func (s *RewardService) Start(ctx context.Context) error
func (*RewardService) Stop ¶ added in v0.5.13
func (s *RewardService) Stop() error
type RoundInitializer ¶ added in v0.5.0
type RoundInitializer struct {
// contains filtered or unexported fields
}
RoundInitializer is a service that automatically initializes the current round. Each round is split into epochs with a length of epochL1Blocks. During each epoch a member of the upcoming active set is selected to initialize the round This selection process is purely a client side implementation that attempts to minimize on-chain transaction collisions, but collisions are still possible if initialization transactions are submitted by parties that are not using this selection process
func NewRoundInitializer ¶ added in v0.5.0
func NewRoundInitializer(client LivepeerEthClient, tw timeWatcher, maxDelay time.Duration) *RoundInitializer
NewRoundInitializer creates a RoundInitializer instance
func (*RoundInitializer) Start ¶ added in v0.5.0
func (r *RoundInitializer) Start() error
Start kicks off a loop that checks if the round should be initialized
func (*RoundInitializer) Stop ¶ added in v0.5.0
func (r *RoundInitializer) Stop()
Stop signals the polling loop to exit gracefully
type StubClient ¶
type StubClient struct {
SubLogsCh chan types.Log
TranscoderAddress common.Address
BlockNum *big.Int
BlockHashToReturn common.Hash
BlockHashForRoundMap map[int64]common.Hash
ProcessHistoricalUnbondError error
Orchestrators []*lpTypes.Transcoder
Round *big.Int
SenderInfo *pm.SenderInfo
PoolSize *big.Int
ClaimedAmount *big.Int
ClaimedReserveError error
Orch *lpTypes.Transcoder
Err error
CheckTxErr error
TotalStake *big.Int
TranscoderPoolError error
RoundLocked bool
RoundLockedErr error
Errors map[string]error
}
func (*StubClient) Account ¶
func (e *StubClient) Account() accounts.Account
func (*StubClient) Backend ¶
func (e *StubClient) Backend() Backend
func (*StubClient) BlockHashForRound ¶ added in v0.5.0
func (e *StubClient) BlockHashForRound(round *big.Int) ([32]byte, error)
func (*StubClient) Bond ¶
func (e *StubClient) Bond(amount *big.Int, toAddr common.Address) (*types.Transaction, error)
func (*StubClient) CancelUnlock ¶ added in v0.5.0
func (e *StubClient) CancelUnlock() (*types.Transaction, error)
func (*StubClient) CheckTx ¶ added in v0.3.3
func (c *StubClient) CheckTx(tx *types.Transaction) error
func (*StubClient) ClaimEarnings ¶ added in v0.3.3
func (e *StubClient) ClaimEarnings(endRound *big.Int) (*types.Transaction, error)
func (*StubClient) ClaimableReserve ¶ added in v0.5.0
func (*StubClient) ClaimedReserve ¶ added in v0.5.0
func (*StubClient) ContractAddresses ¶ added in v0.3.3
func (c *StubClient) ContractAddresses() map[string]common.Address
func (*StubClient) CurrentRound ¶ added in v0.3.3
func (e *StubClient) CurrentRound() (*big.Int, error)
func (*StubClient) CurrentRoundInitialized ¶
func (e *StubClient) CurrentRoundInitialized() (bool, error)
func (*StubClient) CurrentRoundLocked ¶ added in v0.3.3
func (e *StubClient) CurrentRoundLocked() (bool, error)
func (*StubClient) CurrentRoundStartBlock ¶ added in v0.5.0
func (e *StubClient) CurrentRoundStartBlock() (*big.Int, error)
func (*StubClient) FundDeposit ¶ added in v0.5.0
func (e *StubClient) FundDeposit(amount *big.Int) (*types.Transaction, error)
func (*StubClient) FundDepositAndReserve ¶ added in v0.5.0
func (e *StubClient) FundDepositAndReserve(depositAmount, reserveAmount *big.Int) (*types.Transaction, error)
TicketBroker
func (*StubClient) FundReserve ¶ added in v0.5.0
func (e *StubClient) FundReserve(amount *big.Int) (*types.Transaction, error)
func (*StubClient) GetDelegator ¶ added in v0.3.3
func (*StubClient) GetDelegatorUnbondingLock ¶ added in v0.3.3
func (e *StubClient) GetDelegatorUnbondingLock(addr common.Address, unbondingLockId *big.Int) (*lpTypes.UnbondingLock, error)
func (*StubClient) GetGlobalTotalSupply ¶ added in v0.5.29
func (c *StubClient) GetGlobalTotalSupply() (*big.Int, error)
func (*StubClient) GetSenderInfo ¶ added in v0.5.0
func (e *StubClient) GetSenderInfo(addr ethcommon.Address) (*pm.SenderInfo, error)
func (*StubClient) GetServiceURI ¶ added in v0.3.3
func (e *StubClient) GetServiceURI(addr common.Address) (string, error)
func (*StubClient) GetTotalBonded ¶ added in v0.3.3
func (e *StubClient) GetTotalBonded() (*big.Int, error)
func (*StubClient) GetTranscoder ¶ added in v0.3.3
func (e *StubClient) GetTranscoder(addr common.Address) (*lpTypes.Transcoder, error)
func (*StubClient) GetTranscoderEarningsPoolForRound ¶ added in v0.3.3
func (e *StubClient) GetTranscoderEarningsPoolForRound(addr common.Address, round *big.Int) (*lpTypes.TokenPools, error)
func (*StubClient) GetTranscoderPoolMaxSize ¶ added in v0.5.0
func (c *StubClient) GetTranscoderPoolMaxSize() (*big.Int, error)
Parameters
func (*StubClient) GetTranscoderPoolSize ¶ added in v0.5.0
func (e *StubClient) GetTranscoderPoolSize() (*big.Int, error)
func (*StubClient) InflationChange ¶ added in v0.3.3
func (c *StubClient) InflationChange() (*big.Int, error)
func (*StubClient) InitializeRound ¶
func (e *StubClient) InitializeRound() (*types.Transaction, error)
func (*StubClient) IsActiveTranscoder ¶
func (e *StubClient) IsActiveTranscoder() (bool, error)
func (*StubClient) IsUsedTicket ¶ added in v0.5.0
func (e *StubClient) IsUsedTicket(ticket *pm.Ticket) (bool, error)
func (*StubClient) L1WithdrawFees ¶ added in v0.5.26
func (e *StubClient) L1WithdrawFees() (*types.Transaction, error)
for L1 contracts backwards-compatibility
func (*StubClient) LastInitializedRound ¶ added in v0.3.3
func (e *StubClient) LastInitializedRound() (*big.Int, error)
func (*StubClient) NextValidRequest ¶ added in v0.5.2
Faucet
func (*StubClient) Paused ¶ added in v0.3.3
func (e *StubClient) Paused() (bool, error)
func (*StubClient) Rebond ¶ added in v0.3.3
func (e *StubClient) Rebond(*big.Int) (*types.Transaction, error)
func (*StubClient) RebondFromUnbonded ¶ added in v0.3.3
func (e *StubClient) RebondFromUnbonded(common.Address, *big.Int) (*types.Transaction, error)
func (*StubClient) RedeemWinningTicket ¶ added in v0.5.0
func (e *StubClient) RedeemWinningTicket(ticket *pm.Ticket, sig []byte, recipientRand *big.Int) (*types.Transaction, error)
func (*StubClient) ReplaceTransaction ¶ added in v0.3.3
func (c *StubClient) ReplaceTransaction(tx *types.Transaction, method string, gasPrice *big.Int) (*types.Transaction, error)
func (*StubClient) Request ¶ added in v0.3.3
func (e *StubClient) Request() (*types.Transaction, error)
func (*StubClient) Reward ¶
func (e *StubClient) Reward() (*types.Transaction, error)
func (*StubClient) RoundLength ¶ added in v0.3.3
func (c *StubClient) RoundLength() (*big.Int, error)
func (*StubClient) RoundLockAmount ¶ added in v0.3.3
func (c *StubClient) RoundLockAmount() (*big.Int, error)
func (*StubClient) SetGasInfo ¶ added in v0.3.3
func (c *StubClient) SetGasInfo(uint64) error
func (*StubClient) SetMaxGasPrice ¶ added in v0.5.28
func (c *StubClient) SetMaxGasPrice(*big.Int) error
func (*StubClient) SetServiceURI ¶ added in v0.3.3
func (e *StubClient) SetServiceURI(serviceURI string) (*types.Transaction, error)
func (*StubClient) SignTypedData ¶ added in v0.5.24
func (c *StubClient) SignTypedData(typedData apitypes.TypedData) ([]byte, error)
func (*StubClient) TargetBondingRate ¶ added in v0.3.3
func (c *StubClient) TargetBondingRate() (*big.Int, error)
func (*StubClient) TotalSupply ¶ added in v0.3.3
func (e *StubClient) TotalSupply() (*big.Int, error)
func (*StubClient) Transcoder ¶
func (e *StubClient) Transcoder(blockRewardCut, feeShare *big.Int) (*types.Transaction, error)
func (*StubClient) TranscoderPool ¶ added in v0.5.1
func (e *StubClient) TranscoderPool() ([]*lpTypes.Transcoder, error)
func (*StubClient) Transfer ¶
func (e *StubClient) Transfer(toAddr common.Address, amount *big.Int) (*types.Transaction, error)
func (*StubClient) Unbond ¶
func (e *StubClient) Unbond(*big.Int) (*types.Transaction, error)
func (*StubClient) UnbondingPeriod ¶ added in v0.3.3
func (c *StubClient) UnbondingPeriod() (uint64, error)
func (*StubClient) Unlock ¶ added in v0.5.0
func (e *StubClient) Unlock() (*types.Transaction, error)
func (*StubClient) UnlockPeriod ¶ added in v0.5.0
func (e *StubClient) UnlockPeriod() (*big.Int, error)
func (*StubClient) Vote ¶ added in v0.5.8
func (c *StubClient) Vote(pollAddr ethcommon.Address, choiceID *big.Int) (*types.Transaction, error)
Governance
func (*StubClient) Withdraw ¶ added in v0.3.3
func (e *StubClient) Withdraw() (*types.Transaction, error)
func (*StubClient) WithdrawFees ¶ added in v0.3.3
func (e *StubClient) WithdrawFees(addr ethcommon.Address, amount *big.Int) (*types.Transaction, error)
func (*StubClient) WithdrawStake ¶ added in v0.3.3
func (e *StubClient) WithdrawStake(*big.Int) (*types.Transaction, error)
type TransactionManager ¶ added in v0.5.19
type TransactionManager struct {
// contains filtered or unexported fields
}
func NewTransactionManager ¶ added in v0.5.19
func NewTransactionManager(eth transactionSenderReader, gpm *GasPriceMonitor, signer transactionSigner, txTimeout time.Duration, maxReplacements int) *TransactionManager
func (*TransactionManager) SendTransaction ¶ added in v0.5.19
func (tm *TransactionManager) SendTransaction(ctx context.Context, tx *types.Transaction) error
func (*TransactionManager) Start ¶ added in v0.5.19
func (tm *TransactionManager) Start()
func (*TransactionManager) Stop ¶ added in v0.5.19
func (tm *TransactionManager) Stop()
func (*TransactionManager) Subscribe ¶ added in v0.5.19
func (tm *TransactionManager) Subscribe(sink chan<- *transactionReceipt) event.Subscription