chainlinktest

package
v0.35.2 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package chainlinktest provides test doubles for Chainlinks's VRF.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Faucet

func Faucet(sim *ethtest.SimulatedBackend, extraBalances map[common.Address]*big.Int) error

Faucet increases the balances of the specified addresses by the respective amounts.

func FaucetTB

func FaucetTB(tb testing.TB, sim *ethtest.SimulatedBackend, extraBalances map[common.Address]*big.Int)

FaucetTB calls Faucet() and reports any errors on tb.Fatal().

func Fee

func Fee(requests int64) *big.Int

Fee returns the required fee, in LINK, for the specified number of requests for randomness.

Types

type Contracts

type Contracts struct {
	LinkToken, VRFCoordinator common.Address
}

Contracts carries addresses for Chainlink contracts.

func Addresses

func Addresses() Contracts

Addresses returns the addresses to which DeployAll deploys Chainlink test-double contracts.

type VRFCoordinator

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

A VRFCoordinator fulfils requests for randomness, listening for events emitted by the mocked contract. Fulmilment occurs in a new transaction, and the WaitFulfilled*() methods can be used to block until this occurs.

func DeployAll

func DeployAll(sim *ethtest.SimulatedBackend) (*VRFCoordinator, error)

DeployAll deploys all Chainlink test doubles to the backend and returns a VRFCoordinator responding to requests. To release resources, Close() must be called when the coordinator is no longer needed.

func DeployAllTB

func DeployAllTB(tb testing.TB, sim *ethtest.SimulatedBackend) *VRFCoordinator

DeployAllTB calls DeployAll(), reporting any errors on tb.Fatal. There is no need to call Close() on the returned coordinator as this is done by a tb.Cleanup() function.

func (*VRFCoordinator) Close

func (c *VRFCoordinator) Close() error

Close releases all coordinator resources. After the call returns, further requests for randomness will not be fulfilled. The first error that occurred while the coordinator was listening for requests, if one occurred, will be returned.

func (*VRFCoordinator) WaitFulfilled

func (c *VRFCoordinator) WaitFulfilled() error

WaitFulfilled blocks until the last request for randomness is fulfilled.

func (*VRFCoordinator) WaitFulfilledTB

func (c *VRFCoordinator) WaitFulfilledTB(tb testing.TB)

WaitFulfilledTB calls WaitFulfilled() and reports any errors on tb.Fatal.

Directories

Path Synopsis
Package chainlinktestabi is a generated package providing test doubles and real implementations of Chainlink contracts.
Package chainlinktestabi is a generated package providing test doubles and real implementations of Chainlink contracts.

Jump to

Keyboard shortcuts

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