Documentation ¶
Index ¶
- Constants
- Variables
- func EstimateFeeJuels(callbackGasLimit uint32, maxGasPriceWei, weiPerUnitLink *big.Int) (*big.Int, error)
- func EstimateFeeWei(callbackGasLimit uint32, maxGasPriceWei *big.Int) (*big.Int, error)
- func New(cfg vrfcommon.Config, feeCfg vrfcommon.FeeConfig, l logger.Logger, ...) job.ServiceCtx
- func ToV2Commitments(commitments []RequestCommitment) []vrf_coordinator_v2.VRFCoordinatorV2RequestCommitment
- func ToV2PlusCommitments(commitments []RequestCommitment) ...
- func ToV2PlusProofs(proofs []VRFProof) []vrf_coordinator_v2plus_interface.IVRFCoordinatorV2PlusInternalProof
- func ToV2Proofs(proofs []VRFProof) []vrf_coordinator_v2.VRFProof
- type Config
- type CoordinatorV2_X
- type RandomWordsFulfilled
- type RandomWordsFulfilledIterator
- type RandomWordsRequested
- type RandomWordsRequestedIterator
- type RequestCommitment
- func (r *RequestCommitment) BlockNum() uint64
- func (r *RequestCommitment) CallbackGasLimit() uint32
- func (r *RequestCommitment) Get() any
- func (r *RequestCommitment) NativePayment() bool
- func (r *RequestCommitment) NumWords() uint32
- func (r *RequestCommitment) Sender() common.Address
- func (r *RequestCommitment) SubID() *big.Int
- type RevertedVRFTxn
- type Subscription
- type SubscriptionCreated
- type SubscriptionCreatedIterator
- type TxnReceiptDB
- type VRFProof
Constants ¶
View Source
const ( // GasAfterPaymentCalculation is the gas used after computing the payment GasAfterPaymentCalculation = 21000 + 100 + 5000 + 2*2100 + 20000 - 4800 + 6685 // Positive static costs of argument encoding etc. note that it varies by +/- x*12 for every x bytes of non-zero data in the proof. // BatchFulfillmentIterationGasCost is the cost of a single iteration of the batch coordinator's // loop. This is used to determine the gas allowance for a batch fulfillment call. BatchFulfillmentIterationGasCost = 52_000 )
View Source
const GasProofVerification uint32 = 200_000
GasProofVerification is an upper limit on the gas used for verifying the VRF proof on-chain. It can be used to estimate the amount of LINK or native needed to fulfill a request.
Variables ¶
View Source
var ReqScanTimeRangeInDB = "1 hour"
Functions ¶
func EstimateFeeJuels ¶
func EstimateFeeJuels(callbackGasLimit uint32, maxGasPriceWei, weiPerUnitLink *big.Int) (*big.Int, error)
EstimateFeeJuels estimates the amount of link needed to fulfill a request given the callback gas limit, the gas price, and the wei per unit link. An error is returned if the wei per unit link provided is zero.
func EstimateFeeWei ¶
EstimateFeeWei estimates the amount of wei needed to fulfill a request
func New ¶
func New( cfg vrfcommon.Config, feeCfg vrfcommon.FeeConfig, l logger.Logger, chain legacyevm.Chain, chainID *big.Int, q pg.Q, coordinator CoordinatorV2_X, batchCoordinator batch_vrf_coordinator_v2.BatchVRFCoordinatorV2Interface, vrfOwner vrf_owner.VRFOwnerInterface, aggregator *aggregator_v3_interface.AggregatorV3Interface, pipelineRunner pipeline.Runner, gethks keystore.Eth, job job.Job, reqAdded func(), inflightCache vrfcommon.InflightCache, fulfillmentDeduper *vrfcommon.LogDeduper, ) job.ServiceCtx
func ToV2Commitments ¶
func ToV2Commitments(commitments []RequestCommitment) []vrf_coordinator_v2.VRFCoordinatorV2RequestCommitment
func ToV2PlusCommitments ¶
func ToV2PlusCommitments(commitments []RequestCommitment) []vrf_coordinator_v2plus_interface.IVRFCoordinatorV2PlusInternalRequestCommitment
func ToV2PlusProofs ¶
func ToV2PlusProofs(proofs []VRFProof) []vrf_coordinator_v2plus_interface.IVRFCoordinatorV2PlusInternalProof
func ToV2Proofs ¶
func ToV2Proofs(proofs []VRFProof) []vrf_coordinator_v2.VRFProof
Types ¶
type Config ¶
type Config interface { MinimumRequestConfirmations() uint16 MaxGasLimit() uint32 GasAfterPaymentCalculation() uint32 StalenessSeconds() uint32 }
func NewV2Config ¶
func NewV2Config(config vrf_coordinator_v2.GetConfig) Config
func NewV2_5Config ¶ added in v2.6.0
func NewV2_5Config(config vrf_coordinator_v2_5.SConfig) Config
type CoordinatorV2_X ¶
type CoordinatorV2_X interface { Address() common.Address ParseRandomWordsRequested(log types.Log) (RandomWordsRequested, error) ParseRandomWordsFulfilled(log types.Log) (RandomWordsFulfilled, error) RequestRandomWords(opts *bind.TransactOpts, keyHash [32]byte, subID *big.Int, requestConfirmations uint16, callbackGasLimit uint32, numWords uint32, payInEth bool) (*types.Transaction, error) AddConsumer(opts *bind.TransactOpts, subID *big.Int, consumer common.Address) (*types.Transaction, error) CreateSubscription(opts *bind.TransactOpts) (*types.Transaction, error) GetSubscription(opts *bind.CallOpts, subID *big.Int) (Subscription, error) GetConfig(opts *bind.CallOpts) (Config, error) ParseLog(log types.Log) (generated.AbigenLog, error) OracleWithdraw(opts *bind.TransactOpts, recipient common.Address, amount *big.Int) (*types.Transaction, error) Withdraw(opts *bind.TransactOpts, recipient common.Address) (*types.Transaction, error) WithdrawNative(opts *bind.TransactOpts, recipient common.Address) (*types.Transaction, error) LogsWithTopics(keyHash common.Hash) map[common.Hash][][]log.Topic Version() vrfcommon.Version RegisterProvingKey(opts *bind.TransactOpts, oracle *common.Address, publicProvingKey [2]*big.Int, maxGasPrice *uint64) (*types.Transaction, error) FilterSubscriptionCreated(opts *bind.FilterOpts, subID []*big.Int) (SubscriptionCreatedIterator, error) FilterRandomWordsRequested(opts *bind.FilterOpts, keyHash [][32]byte, subID []*big.Int, sender []common.Address) (RandomWordsRequestedIterator, error) FilterRandomWordsFulfilled(opts *bind.FilterOpts, requestID []*big.Int, subID []*big.Int) (RandomWordsFulfilledIterator, error) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) RemoveConsumer(opts *bind.TransactOpts, subID *big.Int, consumer common.Address) (*types.Transaction, error) CancelSubscription(opts *bind.TransactOpts, subID *big.Int, to common.Address) (*types.Transaction, error) GetCommitment(opts *bind.CallOpts, requestID *big.Int) ([32]byte, error) Migrate(opts *bind.TransactOpts, subID *big.Int, newCoordinator common.Address) (*types.Transaction, error) FundSubscriptionWithNative(opts *bind.TransactOpts, subID *big.Int, amount *big.Int) (*types.Transaction, error) // RandomWordsRequestedTopic returns the log topic of the RandomWordsRequested log RandomWordsRequestedTopic() common.Hash // RandomWordsFulfilledTopic returns the log topic of the RandomWordsFulfilled log RandomWordsFulfilledTopic() common.Hash }
CoordinatorV2_X is an interface that allows us to use the same code for both the V2 and V2Plus coordinators.
func NewCoordinatorV2 ¶
func NewCoordinatorV2(c *vrf_coordinator_v2.VRFCoordinatorV2) CoordinatorV2_X
func NewCoordinatorV2_5 ¶ added in v2.6.0
func NewCoordinatorV2_5(c vrf_coordinator_v2_5.VRFCoordinatorV25Interface) CoordinatorV2_X
type RandomWordsFulfilled ¶
type RandomWordsFulfilled interface { RequestID() *big.Int Success() bool SubID() *big.Int Payment() *big.Int Raw() types.Log }
func NewV2RandomWordsFulfilled ¶
func NewV2RandomWordsFulfilled(event *vrf_coordinator_v2.VRFCoordinatorV2RandomWordsFulfilled) RandomWordsFulfilled
func NewV2_5RandomWordsFulfilled ¶ added in v2.6.0
func NewV2_5RandomWordsFulfilled(event *vrf_coordinator_v2_5.VRFCoordinatorV25RandomWordsFulfilled) RandomWordsFulfilled
type RandomWordsFulfilledIterator ¶
type RandomWordsFulfilledIterator interface { Next() bool Error() error Close() error Event() RandomWordsFulfilled }
func NewV2RandomWordsFulfilledIterator ¶
func NewV2RandomWordsFulfilledIterator(it *vrf_coordinator_v2.VRFCoordinatorV2RandomWordsFulfilledIterator) RandomWordsFulfilledIterator
func NewV2_5RandomWordsFulfilledIterator ¶ added in v2.6.0
func NewV2_5RandomWordsFulfilledIterator(it *vrf_coordinator_v2_5.VRFCoordinatorV25RandomWordsFulfilledIterator) RandomWordsFulfilledIterator
type RandomWordsRequested ¶
type RandomWordsRequested interface { Raw() types.Log NumWords() uint32 SubID() *big.Int MinimumRequestConfirmations() uint16 KeyHash() [32]byte RequestID() *big.Int PreSeed() *big.Int Sender() common.Address CallbackGasLimit() uint32 NativePayment() bool }
func NewV2RandomWordsRequested ¶
func NewV2RandomWordsRequested(event *vrf_coordinator_v2.VRFCoordinatorV2RandomWordsRequested) RandomWordsRequested
func NewV2_5RandomWordsRequested ¶ added in v2.6.0
func NewV2_5RandomWordsRequested(event *vrf_coordinator_v2_5.VRFCoordinatorV25RandomWordsRequested) RandomWordsRequested
type RandomWordsRequestedIterator ¶
type RandomWordsRequestedIterator interface { Next() bool Error() error Close() error Event() RandomWordsRequested }
func NewV2RandomWordsRequestedIterator ¶
func NewV2RandomWordsRequestedIterator(it *vrf_coordinator_v2.VRFCoordinatorV2RandomWordsRequestedIterator) RandomWordsRequestedIterator
func NewV2_5RandomWordsRequestedIterator ¶ added in v2.6.0
func NewV2_5RandomWordsRequestedIterator(it *vrf_coordinator_v2_5.VRFCoordinatorV25RandomWordsRequestedIterator) RandomWordsRequestedIterator
type RequestCommitment ¶
type RequestCommitment struct { VRFVersion vrfcommon.Version V2 vrf_coordinator_v2.VRFCoordinatorV2RequestCommitment V2Plus vrf_coordinator_v2plus_interface.IVRFCoordinatorV2PlusInternalRequestCommitment }
func NewRequestCommitment ¶
func NewRequestCommitment(val any) RequestCommitment
func (*RequestCommitment) BlockNum ¶
func (r *RequestCommitment) BlockNum() uint64
func (*RequestCommitment) CallbackGasLimit ¶
func (r *RequestCommitment) CallbackGasLimit() uint32
func (*RequestCommitment) Get ¶
func (r *RequestCommitment) Get() any
func (*RequestCommitment) NativePayment ¶
func (r *RequestCommitment) NativePayment() bool
func (*RequestCommitment) NumWords ¶
func (r *RequestCommitment) NumWords() uint32
func (*RequestCommitment) Sender ¶
func (r *RequestCommitment) Sender() common.Address
func (*RequestCommitment) SubID ¶
func (r *RequestCommitment) SubID() *big.Int
type RevertedVRFTxn ¶ added in v2.10.0
type RevertedVRFTxn struct { DBReceipt TxnReceiptDB IsBatchReq bool Proof vrf_coordinator_v2.VRFProof Commitment vrf_coordinator_v2.VRFCoordinatorV2RequestCommitment }
type Subscription ¶
type Subscription interface { Balance() *big.Int NativeBalance() *big.Int Owner() common.Address Consumers() []common.Address Version() vrfcommon.Version }
func NewV2Subscription ¶
func NewV2Subscription(event vrf_coordinator_v2.GetSubscription) Subscription
func NewV2_5Subscription ¶ added in v2.6.0
func NewV2_5Subscription(event vrf_coordinator_v2_5.GetSubscription) Subscription
type SubscriptionCreated ¶
func NewV2SubscriptionCreated ¶
func NewV2SubscriptionCreated(event *vrf_coordinator_v2.VRFCoordinatorV2SubscriptionCreated) SubscriptionCreated
func NewV2_5SubscriptionCreated ¶ added in v2.6.0
func NewV2_5SubscriptionCreated(event *vrf_coordinator_v2_5.VRFCoordinatorV25SubscriptionCreated) SubscriptionCreated
type SubscriptionCreatedIterator ¶
type SubscriptionCreatedIterator interface { Next() bool Error() error Close() error Event() SubscriptionCreated }
func NewV2SubscriptionCreatedIterator ¶
func NewV2SubscriptionCreatedIterator(it *vrf_coordinator_v2.VRFCoordinatorV2SubscriptionCreatedIterator) SubscriptionCreatedIterator
func NewV2_5SubscriptionCreatedIterator ¶ added in v2.6.0
func NewV2_5SubscriptionCreatedIterator(it *vrf_coordinator_v2_5.VRFCoordinatorV25SubscriptionCreatedIterator) SubscriptionCreatedIterator
type TxnReceiptDB ¶ added in v2.10.0
type TxnReceiptDB struct { TxHash common.Hash `db:"tx_hash"` EVMReceipt evmtypes.Receipt `db:"receipt"` FromAddress common.Address `db:"from_address"` ToAddress common.Address `db:"to_address"` EncodedPayload hexutil.Bytes `db:"encoded_payload"` GasLimit uint64 `db:"gas_limit"` SubID uint64 `db:"sub_id"` RequestID string `db:"request_id"` RequestTxHash string `db:"request_tx_hash"` ForceFulfillmentAttempt uint64 `db:"force_fulfillment_attempt"` }
func UniqueByReqID ¶ added in v2.10.0
func UniqueByReqID(revertedForceTxns []TxnReceiptDB, allForceTxns []TxnReceiptDB) (res []TxnReceiptDB)
type VRFProof ¶
type VRFProof struct { VRFVersion vrfcommon.Version V2 vrf_coordinator_v2.VRFProof V2Plus vrf_coordinator_v2plus_interface.IVRFCoordinatorV2PlusInternalProof }
func FromV2PlusProof ¶
func FromV2PlusProof(proof vrf_coordinator_v2plus_interface.IVRFCoordinatorV2PlusInternalProof) VRFProof
func FromV2Proof ¶
func FromV2Proof(proof vrf_coordinator_v2.VRFProof) VRFProof
Click to show internal directories.
Click to hide internal directories.