Documentation ¶
Index ¶
- Constants
- Variables
- func CheckFromAddressMaxGasPrices(jb job.Job, cfg Config) (err error)
- func CheckFromAddressesExist(jb job.Job, gethks keystore.Eth) (err error)
- func EstimateFeeJuels(callbackGasLimit uint32, maxGasPriceWei, weiPerUnitLink *big.Int) (*big.Int, error)
- func FromAddressMaxGasPricesAllEqual(jb job.Job, cfg Config) (allEqual bool)
- func GetStartingResponseCountsV1(q pg.Q, l logger.Logger, chainID uint64, evmFinalityDepth uint32) map[[32]byte]uint64
- func GetStartingResponseCountsV2(q pg.Q, l logger.Logger, chainID uint64, evmFinalityDepth uint32) map[string]uint64
- func MaybeSubtractReservedLink(q pg.Q, startBalance *big.Int, chainID, subID uint64) (*big.Int, error)
- func VRFRandomnessRequestLogTopic() common.Hash
- func ValidatedVRFSpec(tomlString string) (job.Job, error)
- type Config
- 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(jb job.Job) ([]job.ServiceCtx, error)
- type GethKeyStore
- type RandomnessRequestLog
- type RawRandomnessRequestLog
Constants ¶
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 )
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 needed to fulfill a request.
Variables ¶
var (
ErrKeyNotSet = errors.New("key not set")
)
Functions ¶
func CheckFromAddressMaxGasPrices ¶
CheckFromAddressMaxGasPrices checks if the provided gas price in the job spec gas lane parameter matches what is set for the provided from addresses. If they don't match, this is a configuration error. An error is returned with all the keys that do not match the provided gas lane price.
func CheckFromAddressesExist ¶
CheckFromAddressesExist returns an error if and only if one of the addresses in the VRF spec's fromAddresses field does not exist in the keystore.
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 FromAddressMaxGasPricesAllEqual ¶
FromAddressMaxGasPricesAllEqual returns true if and only if all the specified from addresses in the fromAddresses field of the VRF v2 job have the same key-specific max gas price.
func MaybeSubtractReservedLink ¶
func MaybeSubtractReservedLink(q pg.Q, startBalance *big.Int, chainID, subID uint64) (*big.Int, error)
MaybeSubtractReservedLink figures out how much LINK is reserved for other VRF requests that have not been fully confirmed yet on-chain, and subtracts that from the given startBalance, and returns that value if there are no errors.
func VRFRandomnessRequestLogTopic ¶
VRFRandomnessRequestLogTopic returns the signature of the RandomnessRequest log emitted by the VRFCoordinator contract
Types ¶
type Delegate ¶
type Delegate struct {
// contains filtered or unexported fields
}
func NewDelegate ¶
func (*Delegate) AfterJobCreated ¶
func (*Delegate) BeforeJobCreated ¶
func (*Delegate) BeforeJobDeleted ¶
func (*Delegate) ServicesForSpec ¶
ServicesForSpec satisfies the job.Delegate interface.
type GethKeyStore ¶
type RandomnessRequestLog ¶
type RandomnessRequestLog struct { KeyHash common.Hash Seed *big.Int // uint256 JobID common.Hash Sender common.Address Fee *assets.Link // uint256 RequestID common.Hash Raw RawRandomnessRequestLog }
RandomnessRequestLog contains the data for a RandomnessRequest log, represented as compatible golang types.
func ParseRandomnessRequestLog ¶
func ParseRandomnessRequestLog(log types.Log) (*RandomnessRequestLog, error)
ParseRandomnessRequestLog returns the RandomnessRequestLog corresponding to the raw logData
func RawRandomnessRequestLogToRandomnessRequestLog ¶
func RawRandomnessRequestLogToRandomnessRequestLog( l *RawRandomnessRequestLog) *RandomnessRequestLog
func (*RandomnessRequestLog) ComputedRequestID ¶
func (l *RandomnessRequestLog) ComputedRequestID() common.Hash
func (*RandomnessRequestLog) Equal ¶
func (l *RandomnessRequestLog) Equal(ol RandomnessRequestLog) bool
Equal(ol) is true iff l is the same log as ol, and both represent valid RandomnessRequest logs.
func (*RandomnessRequestLog) RawData ¶
func (l *RandomnessRequestLog) RawData() ([]byte, error)
RawData returns the raw bytes corresponding to l in a solidity log
This serialization does not include the JobID, because that's an indexed field.
type RawRandomnessRequestLog ¶
type RawRandomnessRequestLog solidity_vrf_coordinator_interface.VRFCoordinatorRandomnessRequest
RawRandomnessRequestLog is used to parse a RandomnessRequest log into types go-ethereum knows about.