vrf

package
v1.8.1-beta0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 47 Imported by: 0

Documentation

Index

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 needed to fulfill a request.

Variables

View Source
var (
	ErrKeyNotSet = errors.New("key not set")
)

Functions

func EstimateFeeJuels added in v1.2.0

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 GetStartingResponseCountsV1 added in v1.1.0

func GetStartingResponseCountsV1(q pg.Q, l logger.Logger, chainID uint64, evmFinalityDepth uint32) map[[32]byte]uint64

func GetStartingResponseCountsV2 added in v1.0.0

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)

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 added in v1.1.0

func VRFRandomnessRequestLogTopic() common.Hash

VRFRandomnessRequestLogTopic returns the signature of the RandomnessRequest log emitted by the VRFCoordinator contract

func ValidatedVRFSpec added in v0.10.8

func ValidatedVRFSpec(tomlString string) (job.Job, error)

Types

type Config added in v0.10.8

type Config interface {
	EvmFinalityDepth() uint32
	EvmGasLimitDefault() uint32
	EvmGasLimitVRFJobType() *uint32
	KeySpecificMaxGasPriceWei(addr common.Address) *big.Int
	MinIncomingConfirmations() uint32
}

type Delegate added in v0.10.8

type Delegate struct {
	// contains filtered or unexported fields
}

func NewDelegate added in v0.10.8

func NewDelegate(
	db *sqlx.DB,
	ks keystore.Master,
	pr pipeline.Runner,
	porm pipeline.ORM,
	chainSet evm.ChainSet,
	lggr logger.Logger,
	cfg pg.LogConfig) *Delegate

func (*Delegate) AfterJobCreated added in v0.10.11

func (d *Delegate) AfterJobCreated(spec job.Job)

func (*Delegate) BeforeJobDeleted added in v0.10.11

func (d *Delegate) BeforeJobDeleted(spec job.Job)

func (*Delegate) JobType added in v0.10.8

func (d *Delegate) JobType() job.Type

func (*Delegate) ServicesForSpec added in v0.10.8

func (d *Delegate) ServicesForSpec(jb job.Job) ([]job.ServiceCtx, error)

ServicesForSpec satisfies the job.Delegate interface.

type GethKeyStore added in v0.10.8

type GethKeyStore interface {
	GetRoundRobinAddress(chainID *big.Int, addresses ...common.Address) (common.Address, error)
}

type RandomnessRequestLog added in v0.8.2

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 added in v0.8.2

func ParseRandomnessRequestLog(log types.Log) (*RandomnessRequestLog, error)

ParseRandomnessRequestLog returns the RandomnessRequestLog corresponding to the raw logData

func RawRandomnessRequestLogToRandomnessRequestLog added in v0.8.2

func RawRandomnessRequestLogToRandomnessRequestLog(
	l *RawRandomnessRequestLog) *RandomnessRequestLog

func (*RandomnessRequestLog) ComputedRequestID added in v1.1.0

func (l *RandomnessRequestLog) ComputedRequestID() common.Hash

func (*RandomnessRequestLog) Equal added in v0.8.2

Equal(ol) is true iff l is the same log as ol, and both represent valid RandomnessRequest logs.

func (*RandomnessRequestLog) RawData added in v0.8.2

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 added in v0.8.2

RawRandomnessRequestLog is used to parse a RandomnessRequest log into types go-ethereum knows about.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL