Documentation ¶
Index ¶
- Constants
- Variables
- func CalcPositioningConstant(upkeepID *big.Big, registryAddress ethkey.EIP55Address) (int32, error)
- func LeastSignificant32(num *big.Int) uint64
- func ParseUpkeepId(upkeepIdStr string) (*big.Int, bool)
- func ValidatedKeeperSpec(tomlString string) (job.Job, error)
- type Delegate
- func (d *Delegate) AfterJobCreated(spec job.Job)
- func (d *Delegate) BeforeJobCreated(spec job.Job)
- func (d *Delegate) BeforeJobDeleted(spec job.Job)
- func (d *Delegate) JobType() job.Type
- func (d *Delegate) OnDeleteJob(spec job.Job, q pg.Queryer) error
- func (d *Delegate) ServicesForSpec(spec job.Job) (services []job.ServiceCtx, err error)
- type KeeperIndexMap
- type ORM
- func (korm ORM) AllUpkeepIDsForRegistry(regID int64) (upkeeps []big.Big, err error)
- func (korm ORM) BatchDeleteUpkeepsForJob(jobID int32, upkeepIDs []big.Big) (int64, error)
- func (korm ORM) EligibleUpkeepsForRegistry(registryAddress ethkey.EIP55Address, blockNumber int64, gracePeriod int64, ...) (upkeeps []UpkeepRegistration, err error)
- func (korm ORM) Q() pg.Q
- func (korm ORM) Registries() ([]Registry, error)
- func (korm ORM) RegistryByContractAddress(registryAddress ethkey.EIP55Address) (Registry, error)
- func (korm ORM) RegistryForJob(jobID int32) (Registry, error)
- func (korm ORM) SetLastRunInfoForUpkeepOnJob(jobID int32, upkeepID *big.Big, height int64, fromAddress ethkey.EIP55Address, ...) (int64, error)
- func (korm ORM) UpdateUpkeepLastKeeperIndex(jobID int32, upkeepID *big.Big, fromAddress ethkey.EIP55Address) error
- func (korm ORM) UpsertRegistry(registry *Registry) error
- func (korm ORM) UpsertUpkeep(registration *UpkeepRegistration) error
- type Registry
- type RegistryConfig
- type RegistryGasChecker
- type RegistrySynchronizer
- type RegistrySynchronizerOptions
- type RegistryVersion
- type RegistryWrapper
- func (rw *RegistryWrapper) AddFunds(opts *bind.TransactOpts, id *big.Int, amount *big.Int) (*types.Transaction, error)
- func (rw *RegistryWrapper) CancelUpkeep(opts *bind.TransactOpts, id *big.Int) (*types.Transaction, error)
- func (rw *RegistryWrapper) GetActiveUpkeepIDs(opts *bind.CallOpts) ([]*big.Int, error)
- func (rw *RegistryWrapper) GetCancelledUpkeepIDFromLog(broadcast log.Broadcast) (*big.Int, error)
- func (rw *RegistryWrapper) GetConfig(opts *bind.CallOpts) (*RegistryConfig, error)
- func (rw *RegistryWrapper) GetIDFromGasLimitSetLog(broadcast log.Broadcast) (*big.Int, error)
- func (rw *RegistryWrapper) GetLogListenerOpts(minIncomingConfirmations uint32, upkeepPerformedFilter [][]log.Topic) (*log.ListenerOpts, error)
- func (rw *RegistryWrapper) GetUpkeep(opts *bind.CallOpts, id *big.Int) (*UpkeepConfig, error)
- func (rw *RegistryWrapper) GetUpkeepIdFromMigratedLog(broadcast log.Broadcast) (*big.Int, error)
- func (rw *RegistryWrapper) GetUpkeepIdFromReceivedLog(broadcast log.Broadcast) (*big.Int, error)
- func (rw *RegistryWrapper) GetUpkeepIdFromRegistrationLog(broadcast log.Broadcast) (*big.Int, error)
- func (rw *RegistryWrapper) GetUpkeepIdFromUpkeepPausedLog(broadcast log.Broadcast) (*big.Int, error)
- func (rw *RegistryWrapper) GetUpkeepIdFromUpkeepUnpausedLog(broadcast log.Broadcast) (*big.Int, error)
- func (rw *RegistryWrapper) ParseUpkeepCheckDataUpdatedLog(broadcast log.Broadcast) (*UpkeepCheckDataUpdatedLog, error)
- func (rw *RegistryWrapper) ParseUpkeepPerformedLog(broadcast log.Broadcast) (*UpkeepPerformedLog, error)
- func (rw *RegistryWrapper) PerformUpkeep(opts *bind.TransactOpts, id *big.Int, performData []byte) (*types.Transaction, error)
- func (rw *RegistryWrapper) RegisterUpkeep(opts *bind.TransactOpts, target common.Address, gasLimit uint32, ...) (*types.Transaction, error)
- func (rw *RegistryWrapper) SetKeepers(opts *bind.TransactOpts, keepers []common.Address, payees []common.Address) (*types.Transaction, error)
- type UpkeepCheckDataUpdatedLog
- type UpkeepConfig
- type UpkeepExecuter
- type UpkeepExecuterConfig
- type UpkeepIdentifier
- type UpkeepPerformedLog
- type UpkeepRegistration
Constants ¶
const ( ZeroPrefix = "0x" UpkeepPrefix = "UPx" )
const ActiveUpkeepIDBatchSize int64 = 10000
Variables ¶
var (
ErrContractCallFailure = errors.New("failure in calling contract")
)
var Registry1_1ABI = types.MustGetABI(keeper_registry_wrapper1_1.KeeperRegistryABI)
var Registry1_2ABI = types.MustGetABI(keeper_registry_wrapper1_2.KeeperRegistryABI)
var Registry1_3ABI = types.MustGetABI(keeper_registry_wrapper1_3.KeeperRegistryABI)
Functions ¶
func CalcPositioningConstant ¶
CalcPositioningConstant calculates a positioning constant. The positioning constant is fixed because upkeepID and registryAddress are immutable
func LeastSignificant32 ¶
LeastSignificant32 returns the least significant 32 bits of the input as a big int
func ParseUpkeepId ¶
ParseUpkeepId parses the upkeep id input string to a big int pointer. It can handle the following 4 formats: 1. decimal format like 123471239047239047243709... 2. hex format like AbC13D354eFF... 3. 0x-prefixed hex like 0xAbC13D354eFF... 4. Upkeep-prefixed hex like UPxAbC13D354eFF...
Types ¶
type Delegate ¶
type Delegate struct {
// contains filtered or unexported fields
}
func NewDelegate ¶
func NewDelegate( db *sqlx.DB, jrm job.ORM, pr pipeline.Runner, logger logger.Logger, legacyChains legacyevm.LegacyChainContainer, mailMon *mailbox.Monitor, ) *Delegate
NewDelegate is the constructor of Delegate
func (*Delegate) AfterJobCreated ¶
func (*Delegate) BeforeJobCreated ¶
func (*Delegate) BeforeJobDeleted ¶
func (*Delegate) ServicesForSpec ¶
ServicesForSpec satisfies the job.Delegate interface.
type KeeperIndexMap ¶
type KeeperIndexMap map[ethkey.EIP55Address]int32
func (*KeeperIndexMap) Scan ¶
func (k *KeeperIndexMap) Scan(val interface{}) error
type ORM ¶
type ORM struct {
// contains filtered or unexported fields
}
ORM implements ORM layer using PostgreSQL
func (ORM) AllUpkeepIDsForRegistry ¶
func (ORM) BatchDeleteUpkeepsForJob ¶
BatchDeleteUpkeepsForJob deletes all upkeeps by the given IDs for the job with the given ID
func (ORM) EligibleUpkeepsForRegistry ¶
func (korm ORM) EligibleUpkeepsForRegistry(registryAddress ethkey.EIP55Address, blockNumber int64, gracePeriod int64, binaryHash string) (upkeeps []UpkeepRegistration, err error)
EligibleUpkeepsForRegistry fetches eligible upkeeps for processing The query checks the following conditions - checks the registry address is correct and the registry has some keepers associated -- is it my turn AND my keeper was not the last perform for this upkeep OR my keeper was the last before BUT it is past the grace period -- OR is it my buddy's turn AND they were the last keeper to do the perform for this upkeep DEV: note we cast upkeep_id and binaryHash as 32 bits, even though both are 256 bit numbers when performing XOR. This is enough information to distribute the upkeeps over the keepers so long as num keepers < 4294967296
func (ORM) Registries ¶
Registries returns all registries
func (ORM) RegistryByContractAddress ¶
func (korm ORM) RegistryByContractAddress(registryAddress ethkey.EIP55Address) (Registry, error)
RegistryByContractAddress returns a single registry based on provided address
func (ORM) RegistryForJob ¶
RegistryForJob returns a specific registry for a job with the given ID
func (ORM) SetLastRunInfoForUpkeepOnJob ¶
func (korm ORM) SetLastRunInfoForUpkeepOnJob(jobID int32, upkeepID *big.Big, height int64, fromAddress ethkey.EIP55Address, qopts ...pg.QOpt) (int64, error)
SetLastRunInfoForUpkeepOnJob sets the last run block height and the associated keeper index only if the new block height is greater than the previous.
func (ORM) UpdateUpkeepLastKeeperIndex ¶
func (korm ORM) UpdateUpkeepLastKeeperIndex(jobID int32, upkeepID *big.Big, fromAddress ethkey.EIP55Address) error
UpdateUpkeepLastKeeperIndex updates the last keeper index for an upkeep
func (ORM) UpsertRegistry ¶
UpsertRegistry upserts registry by the given input
func (ORM) UpsertUpkeep ¶
func (korm ORM) UpsertUpkeep(registration *UpkeepRegistration) error
UpsertUpkeep upserts upkeep by the given input
type Registry ¶
type Registry struct { ID int64 BlockCountPerTurn int32 CheckGas uint32 ContractAddress ethkey.EIP55Address FromAddress ethkey.EIP55Address JobID int32 KeeperIndex int32 NumKeepers int32 KeeperIndexMap KeeperIndexMap }
type RegistryConfig ¶
type RegistryGasChecker ¶
type RegistrySynchronizer ¶
type RegistrySynchronizer struct { services.StateMachine // contains filtered or unexported fields }
func NewRegistrySynchronizer ¶
func NewRegistrySynchronizer(opts RegistrySynchronizerOptions) *RegistrySynchronizer
NewRegistrySynchronizer is the constructor of RegistrySynchronizer
func (*RegistrySynchronizer) Close ¶
func (rs *RegistrySynchronizer) Close() error
func (*RegistrySynchronizer) HandleLog ¶
func (rs *RegistrySynchronizer) HandleLog(broadcast log.Broadcast)
func (*RegistrySynchronizer) JobID ¶
func (rs *RegistrySynchronizer) JobID() int32
type RegistrySynchronizerOptions ¶
type RegistrySynchronizerOptions struct { Job job.Job RegistryWrapper RegistryWrapper ORM ORM JRM job.ORM LogBroadcaster log.Broadcaster MailMon *mailbox.Monitor SyncInterval time.Duration MinIncomingConfirmations uint32 Logger logger.Logger SyncUpkeepQueueSize uint32 EffectiveKeeperAddress common.Address }
type RegistryVersion ¶
type RegistryVersion int32
const ( RegistryVersion_1_0 RegistryVersion = iota RegistryVersion_1_1 RegistryVersion_1_2 RegistryVersion_1_3 RegistryVersion_2_0 RegistryVersion_2_1 )
func (RegistryVersion) String ¶
func (rv RegistryVersion) String() string
type RegistryWrapper ¶
type RegistryWrapper struct { Address ethkey.EIP55Address Version RegistryVersion // contains filtered or unexported fields }
RegistryWrapper implements a layer on top of different versions of registry wrappers to provide a unified layer to rest of the codebase
func NewRegistryWrapper ¶
func NewRegistryWrapper(address ethkey.EIP55Address, evmClient evmclient.Client) (*RegistryWrapper, error)
func (*RegistryWrapper) AddFunds ¶
func (rw *RegistryWrapper) AddFunds(opts *bind.TransactOpts, id *big.Int, amount *big.Int) (*types.Transaction, error)
func (*RegistryWrapper) CancelUpkeep ¶
func (rw *RegistryWrapper) CancelUpkeep(opts *bind.TransactOpts, id *big.Int) (*types.Transaction, error)
func (*RegistryWrapper) GetActiveUpkeepIDs ¶
func (*RegistryWrapper) GetCancelledUpkeepIDFromLog ¶
func (*RegistryWrapper) GetConfig ¶
func (rw *RegistryWrapper) GetConfig(opts *bind.CallOpts) (*RegistryConfig, error)
func (*RegistryWrapper) GetIDFromGasLimitSetLog ¶
func (*RegistryWrapper) GetLogListenerOpts ¶
func (rw *RegistryWrapper) GetLogListenerOpts(minIncomingConfirmations uint32, upkeepPerformedFilter [][]log.Topic) (*log.ListenerOpts, error)
func (*RegistryWrapper) GetUpkeep ¶
func (rw *RegistryWrapper) GetUpkeep(opts *bind.CallOpts, id *big.Int) (*UpkeepConfig, error)
func (*RegistryWrapper) GetUpkeepIdFromMigratedLog ¶
func (*RegistryWrapper) GetUpkeepIdFromReceivedLog ¶
func (*RegistryWrapper) GetUpkeepIdFromRegistrationLog ¶
func (*RegistryWrapper) GetUpkeepIdFromUpkeepPausedLog ¶
func (*RegistryWrapper) GetUpkeepIdFromUpkeepUnpausedLog ¶
func (*RegistryWrapper) ParseUpkeepCheckDataUpdatedLog ¶
func (rw *RegistryWrapper) ParseUpkeepCheckDataUpdatedLog(broadcast log.Broadcast) (*UpkeepCheckDataUpdatedLog, error)
func (*RegistryWrapper) ParseUpkeepPerformedLog ¶
func (rw *RegistryWrapper) ParseUpkeepPerformedLog(broadcast log.Broadcast) (*UpkeepPerformedLog, error)
func (*RegistryWrapper) PerformUpkeep ¶
func (rw *RegistryWrapper) PerformUpkeep(opts *bind.TransactOpts, id *big.Int, performData []byte) (*types.Transaction, error)
func (*RegistryWrapper) RegisterUpkeep ¶
func (rw *RegistryWrapper) RegisterUpkeep(opts *bind.TransactOpts, target common.Address, gasLimit uint32, admin common.Address, checkData []byte) (*types.Transaction, error)
func (*RegistryWrapper) SetKeepers ¶
func (rw *RegistryWrapper) SetKeepers(opts *bind.TransactOpts, keepers []common.Address, payees []common.Address) (*types.Transaction, error)
type UpkeepConfig ¶
type UpkeepExecuter ¶
type UpkeepExecuter struct { services.StateMachine // contains filtered or unexported fields }
UpkeepExecuter implements the logic to communicate with KeeperRegistry
func NewUpkeepExecuter ¶
func NewUpkeepExecuter( job job.Job, orm ORM, pr pipeline.Runner, ethClient evmclient.Client, headBroadcaster httypes.HeadBroadcaster, gasEstimator gas.EvmFeeEstimator, logger logger.Logger, config UpkeepExecuterConfig, effectiveKeeperAddress common.Address, ) *UpkeepExecuter
NewUpkeepExecuter is the constructor of UpkeepExecuter
func (*UpkeepExecuter) Close ¶
func (ex *UpkeepExecuter) Close() error
Close stops and closes upkeep executer
func (*UpkeepExecuter) OnNewLongestChain ¶
func (ex *UpkeepExecuter) OnNewLongestChain(_ context.Context, head *evmtypes.Head)
OnNewLongestChain handles the given head of a new longest chain
type UpkeepExecuterConfig ¶ added in v2.3.0
type UpkeepIdentifier ¶
func NewUpkeepIdentifier ¶
func NewUpkeepIdentifier(i *big.Big) *UpkeepIdentifier
func (UpkeepIdentifier) String ¶
func (ui UpkeepIdentifier) String() string
String produces a hex encoded value, zero padded, prefixed with UpkeepPrefix
type UpkeepPerformedLog ¶
type UpkeepRegistration ¶
type UpkeepRegistration struct { ID int32 CheckData []byte ExecuteGas uint32 LastRunBlockHeight int64 RegistryID int64 Registry Registry UpkeepID *big.Big LastKeeperIndex null.Int64 PositioningConstant int32 }
func (UpkeepRegistration) PrettyID ¶
func (upkeep UpkeepRegistration) PrettyID() string