Documentation ¶
Index ¶
- Constants
- 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 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 Subscription
- type SubscriptionCreated
- type SubscriptionCreatedIterator
- 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 ¶
This section is empty.
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, 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 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
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) (*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
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
type RandomWordsFulfilledIterator ¶
type RandomWordsFulfilledIterator interface { Next() bool Error() error Close() error Event() RandomWordsFulfilled }
func NewV2RandomWordsFulfilledIterator ¶
func NewV2RandomWordsFulfilledIterator(it *vrf_coordinator_v2.VRFCoordinatorV2RandomWordsFulfilledIterator) 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
type RandomWordsRequestedIterator ¶
type RandomWordsRequestedIterator interface { Next() bool Error() error Close() error Event() RandomWordsRequested }
func NewV2RandomWordsRequestedIterator ¶
func NewV2RandomWordsRequestedIterator(it *vrf_coordinator_v2.VRFCoordinatorV2RandomWordsRequestedIterator) RandomWordsRequestedIterator
type RequestCommitment ¶
type RequestCommitment struct { VRFVersion vrfcommon.Version V2 vrf_coordinator_v2.VRFCoordinatorV2RequestCommitment }
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 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
type SubscriptionCreated ¶
func NewV2SubscriptionCreated ¶
func NewV2SubscriptionCreated(event *vrf_coordinator_v2.VRFCoordinatorV2SubscriptionCreated) SubscriptionCreated
type SubscriptionCreatedIterator ¶
type SubscriptionCreatedIterator interface { Next() bool Error() error Close() error Event() SubscriptionCreated }
func NewV2SubscriptionCreatedIterator ¶
func NewV2SubscriptionCreatedIterator(it *vrf_coordinator_v2.VRFCoordinatorV2SubscriptionCreatedIterator) SubscriptionCreatedIterator
type VRFProof ¶
type VRFProof struct { VRFVersion vrfcommon.Version V2 vrf_coordinator_v2.VRFProof }
func FromV2Proof ¶
func FromV2Proof(proof vrf_coordinator_v2.VRFProof) VRFProof
Click to show internal directories.
Click to hide internal directories.